:root {
    --primary-color: #0078ff;
    --primary-hover: #0066d4;
    --danger-color: #ff3b30;
    --danger-hover: #e6352a;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    
    --bg-primary: #101010;
    --bg-secondary: #1b1b1b;
    --bg-tertiary: #252525;
    --bg-input: #252525;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #6b7280;
    
    --border-color: #333333;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: var(--transition);
}

body.light-theme {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --bg-input: #ffffff;
    
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #888888;
    
    --border-color: #e0e0e0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: rotate(180deg);
}

.main-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

textarea {
    width: 100%;
    height: 140px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 14px;
    font-size: 1rem;
    color: var(--text-primary);
    resize: none;
    transition: var(--transition);
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 120, 255, 0.1);
}

textarea::placeholder {
    color: var(--text-muted);
}

.char-count {
    display: block;
    text-align: right;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 14px;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 120, 255, 0.1);
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.checkbox-label:hover {
    background: var(--bg-input);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.interval-group {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.interval-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.interval-input input[type="range"] {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    appearance: none;
}

.interval-input input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.interval-input input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.interval-input span#interval-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 30px;
}

.interval-input .unit {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0099ff);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #0088e6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 120, 255, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #ff5a50);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-hover), #ff4a40);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    color: var(--text-primary);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    font-size: 1.1rem;
}

.files-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.files-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.refresh-btn {
    padding: 8px;
    min-width: auto;
}

.files-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.files-list {
    max-height: 300px;
    overflow-y: auto;
}

.files-list::-webkit-scrollbar {
    width: 6px;
}

.files-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.files-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 0.9rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 10px;
    transition: var(--transition);
}

.file-item-favorite {
    border: 2px solid #fbbf24;
}

.file-item:hover {
    background: var(--bg-input);
}

.file-item-favorite:hover {
    border-color: #f59e0b;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name-container {
    margin-bottom: 4px;
}

.file-name-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 4px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.file-name-input:hover {
    background: var(--bg-input);
}

.file-name-input:focus {
    background: var(--bg-input);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-voice {
    padding: 2px 6px;
    background: var(--bg-input);
    border-radius: 4px;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.file-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--bg-input);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.file-btn:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.file-btn-play:hover {
    background: #10b981;
    color: white;
}

.file-btn-loop:hover {
    background: var(--primary-color);
    color: white;
}

.file-btn-favorite {
    font-size: 1.1rem;
}

.file-btn-favorite:hover {
    background: #fbbf24;
    color: white;
}

.file-btn-favorite.active {
    background: #fbbf24;
    color: white;
}

.file-btn-favorite.active:hover {
    background: #f59e0b;
}

.file-btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.logs-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.logs-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.logs-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-btn {
    padding: 8px;
    min-width: auto;
}

.logs-content {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 14px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.logs-content::-webkit-scrollbar {
    width: 6px;
}

.logs-content::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 3px;
}

.logs-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.logs-content p {
    margin: 4px 0;
}

.log-time {
    color: var(--text-muted);
    margin-right: 8px;
}

.log-info {
    color: var(--text-secondary);
}

.log-success {
    color: #10b981;
}

.log-error {
    color: var(--danger-color);
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .main-content {
        padding: 18px;
    }
    
    textarea {
        height: 120px;
        padding: 12px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        padding: 12px 16px;
    }
    
    .logs-content {
        max-height: 150px;
        font-size: 0.8rem;
    }
    
    .file-item {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .file-info {
        width: 100%;
        gap: 10px;
    }
    
    .file-icon {
        font-size: 1.2rem;
    }
    
    .file-name-input {
        font-size: 0.9rem;
    }
    
    .file-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.75rem;
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 6px;
    }
    
    .file-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 700px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 30px;
    }
    
    textarea {
        height: 180px;
    }
}