* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-dark: #050505;
    --bg-page: #0a0a0a;
    --glass-surface: rgba(20, 20, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --text-primary: #ededed;
    --text-secondary: #a1a1a1;
    --text-muted: #525252;
    --accent-blue: #60a5fa;
    --font-sans: 'Inter', sans-serif;
}
body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

main {
    flex: 1; 
    padding: 1.5rem 2rem 1.5rem 1rem;
    display: flex; 
    flex-direction: column; 
    gap: 1.5rem;
    margin-left: 40px;
    overflow-y: auto;
}
.controls {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex; flex-direction: column; gap: 1rem;
    backdrop-filter: blur(20px);
}
.control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.control-group { display: flex; flex-direction: column; gap: 0.5rem; }
.control-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}
.control-group select, .control-group input {
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-highlight);
    color: var(--text-primary);
    border-radius: 8px;
    outline: none;
}
.control-group select:focus, .control-group input:focus { border-color: var(--text-muted); }
.control-group select option { background: #1a1a1a; }
.control-group small { color: var(--text-muted); font-size: 0.7rem; margin-top: 0.25rem; }
textarea {
    font-family: inherit;
    font-size: 1rem;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    background: var(--glass-highlight);
    color: var(--text-primary);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}
textarea::placeholder { color: var(--text-muted); }
textarea:focus { border-color: var(--text-muted); }
.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }
button {
    font-family: inherit;
    background: var(--text-primary);
    color: var(--bg-dark);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
button:hover { transform: scale(1.02); box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); }
button:disabled { background: var(--glass-highlight); color: var(--text-muted); cursor: not-allowed; transform: none; box-shadow: none; }
button.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}
button.secondary:hover { background: var(--glass-highlight); transform: none; box-shadow: none; }
.result-area {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-height: 150px;
    justify-content: center;
    backdrop-filter: blur(20px);
}
.result-area audio { width: 100%; max-width: 500px; }
.empty-state { text-align: center; color: var(--text-muted); }
.empty-state h2 { font-size: 1.5rem; font-weight: 500; color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; color: var(--text-secondary); }
.loading { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.audio-controls { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.status { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.text-counter {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}
.text-counter span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.text-counter .count-value {
    color: var(--text-primary);
    font-weight: 500;
}
@media (max-width: 768px) {
    header { padding: 1rem; flex-wrap: wrap; gap: 1rem; }
    nav { width: 100%; overflow-x: auto; }
    main { padding: 1rem; }
}


/* Light Theme */
[data-theme="light"] {
    --bg-dark: #ffffff;
    --bg-page: #f5f5f5;
    --glass-surface: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-highlight: rgba(0, 0, 0, 0.03);
    --text-primary: #1a1a1a;
    --text-secondary: #525252;
    --text-muted: #a1a1a1;
    --accent-blue: #3b82f6;
}

[data-theme="light"] .controls {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .control-group select,
[data-theme="light"] .control-group input,
[data-theme="light"] textarea {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

[data-theme="light"] .control-group select option {
    background: #ffffff;
}

[data-theme="light"] button {
    background: #1a1a1a;
    color: #ffffff;
}

[data-theme="light"] button.secondary {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

[data-theme="light"] .result-area {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}
