/* ═══════════════════════════════════════════════════════════
   VozTTS v3 — Material Expressive 3 + Samsung-style sliders
   ═══════════════════════════════════════════════════════════ */

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

/* ─── Tokens ─── */
:root {
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --r-xs: 4px; --r-sm: 8px; --r-md: 16px; --r-lg: 24px; --r-xl: 28px; --r-full: 9999px;
    --r-expr: 24px 8px 24px 8px;
    --r-expr-lg: 32px 12px 32px 12px;
    --elev-1: 0 1px 3px 1px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.12);
    --elev-2: 0 2px 6px 2px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.12);
    --elev-3: 0 4px 8px 3px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.12);
    --ease: cubic-bezier(0.2, 0, 0, 1);
    --ease-emph: cubic-bezier(0.05, 0.7, 0.1, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-s: 200ms; --dur-m: 350ms; --dur-l: 500ms;
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
    --c-primary: #D0BCFF; --c-on-primary: #381E72;
    --c-primary-ctr: #4F378B; --c-on-primary-ctr: #EADDFF;
    --c-secondary: #CCC2DC; --c-secondary-ctr: #4A4458;
    --c-tertiary: #EFB8C8; --c-tertiary-ctr: #633B48;
    --c-error: #F2B8B5;
    --c-surf: #131016; --c-on-surf: #E6E0E9;
    --c-surf-var: #49454F; --c-on-surf-var: #CAC4D0;
    --c-surf-low: #1C1A21; --c-surf-ctr: #201E25;
    --c-surf-hi: #2B2930; --c-surf-top: #36343B;
    --c-outline: #938F99; --c-outline-var: #49454F;
    --c-inv-surf: #E6E0E9; --c-inv-on: #322F35;
    --grad: linear-gradient(135deg, var(--c-primary) 0%, color-mix(in srgb, var(--c-primary) 70%, white) 50%, var(--c-tertiary) 100%);
    --glow: radial-gradient(ellipse at 30% 0%, color-mix(in srgb, var(--c-primary) 15%, transparent) 0%, transparent 50%);
    --glass: rgba(32,30,37,0.8); --glass-b: rgba(147,143,153,0.18);
    --slider-track: #3A3740; --slider-fill: var(--c-primary); --slider-thumb: var(--c-primary);
}

[data-theme="light"] {
    --c-primary: #6750A4; --c-on-primary: #FFF;
    --c-primary-ctr: #EADDFF; --c-on-primary-ctr: #21005D;
    --c-secondary: #625B71; --c-secondary-ctr: #E8DEF8;
    --c-tertiary: #7D5260; --c-tertiary-ctr: #FFD8E4;
    --c-error: #B3261E;
    --c-surf: #FEF7FF; --c-on-surf: #1D1B20;
    --c-surf-var: #E7E0EC; --c-on-surf-var: #49454F;
    --c-surf-low: #F7F2FA; --c-surf-ctr: #F3EDF7;
    --c-surf-hi: #ECE6F0; --c-surf-top: #E6E0E9;
    --c-outline: #79747E; --c-outline-var: #CAC4D0;
    --c-inv-surf: #322F35; --c-inv-on: #F5EFF7;
    --grad: linear-gradient(135deg, var(--c-primary) 0%, color-mix(in srgb, var(--c-primary) 70%, white) 50%, var(--c-tertiary) 100%);
    --glow: radial-gradient(ellipse at 30% 0%, color-mix(in srgb, var(--c-primary) 8%, transparent) 0%, transparent 50%);
    --glass: rgba(243,237,247,0.85); --glass-b: rgba(121,116,126,0.12);
    --slider-track: #E0DBE7; --slider-fill: var(--c-primary); --slider-thumb: var(--c-primary);
    --elev-1: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.08);
    --elev-2: 0 2px 6px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.08);
    --elev-3: 0 4px 8px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.08);
}

/* ─── Custom Color Palettes (Vibrantes e Distintas) ─── */
[data-color="purple"][data-theme="dark"] { --c-primary: #B388FF; --c-on-primary: #12005E; --c-primary-ctr: #651FFF; }
[data-color="purple"][data-theme="light"] { --c-primary: #651FFF; --c-on-primary: #FFF; --c-primary-ctr: #EDE7F6; }

[data-color="blue"][data-theme="dark"] { --c-primary: #82B1FF; --c-on-primary: #002171; --c-primary-ctr: #2979FF; }
[data-color="blue"][data-theme="light"] { --c-primary: #2979FF; --c-on-primary: #FFF; --c-primary-ctr: #E3F2FD; }

[data-color="green"][data-theme="dark"] { --c-primary: #69F0AE; --c-on-primary: #003314; --c-primary-ctr: #00E676; }
[data-color="green"][data-theme="light"] { --c-primary: #00C853; --c-on-primary: #FFF; --c-primary-ctr: #E8F5E9; }

[data-color="orange"][data-theme="dark"] { --c-primary: #FFAB40; --c-on-primary: #5c2300; --c-primary-ctr: #FF9100; }
[data-color="orange"][data-theme="light"] { --c-primary: #FF6D00; --c-on-primary: #FFF; --c-primary-ctr: #FFF3E0; }

[data-color="pink"][data-theme="dark"] { --c-primary: #FF80AB; --c-on-primary: #560027; --c-primary-ctr: #F50057; }
[data-color="pink"][data-theme="light"] { --c-primary: #F50057; --c-on-primary: #FFF; --c-primary-ctr: #FCE4EC; }

[data-color="yellow"][data-theme="dark"] { --c-primary: #FFE57F; --c-on-primary: #332b00; --c-primary-ctr: #FFD600; }
[data-color="yellow"][data-theme="light"] { --c-primary: #FFAB00; --c-on-primary: #332b00; --c-primary-ctr: #FFF8E1; }

[data-color="red"][data-theme="dark"] { --c-primary: #FF8A80; --c-on-primary: #5c0000; --c-primary-ctr: #FF5252; }
[data-color="red"][data-theme="light"] { --c-primary: #D50000; --c-on-primary: #FFF; --c-primary-ctr: #FFEBEE; }

/* ═══ BASE ═══ */
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
* { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none; }
body {
    font-family: var(--font-body); background: var(--c-surf); color: var(--c-on-surf);
    min-height: 100vh; transition: background var(--dur-l) var(--ease), color var(--dur-m) var(--ease);
}
body::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0; height: 500px;
    background: var(--glow); pointer-events: none; z-index: 0;
}

/* ═══ BACKGROUND ANIMATED LIGHTS ═══ */
.bg-lights {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 0; overflow: hidden; pointer-events: none;
}
.light {
    position: absolute; border-radius: 50%; filter: blur(90px);
    opacity: 0.12; animation: floatLight 18s ease-in-out infinite alternate;
}
.light-1 { width: 40vw; height: 40vw; background: var(--c-primary); top: -10%; left: -10%; animation-delay: 0s; }
.light-2 { width: 50vw; height: 50vw; background: color-mix(in srgb, var(--c-primary) 60%, transparent); bottom: -20%; right: -10%; animation-delay: -5s; }
.light-3 { width: 30vw; height: 30vw; background: var(--c-primary-ctr); top: 30%; right: 15%; animation-delay: -10s; }
.light-4 { width: 35vw; height: 35vw; background: color-mix(in srgb, var(--c-primary) 40%, transparent); bottom: 15%; left: 10%; animation-delay: -7s; }

@keyframes floatLight {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(4vw, -6vh) scale(1.1); }
    66% { transform: translate(-5vw, 4vh) scale(0.9); }
    100% { transform: translate(3vw, 5vh) scale(1.05); }
}

.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; }

/* ═══ TOP BAR ═══ */
.top-app-bar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 24px; background: var(--glass);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-b);
}
/* ═══ LOADING ═══ */
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 1000; transition: opacity var(--dur-m) var(--ease);
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--c-surf-hi);
    border-top: 4px solid var(--c-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-text { font-size: 1.25rem; font-weight: 600; color: var(--c-on-surf); margin: 0; }
.loading-subtext { font-size: 0.9rem; color: var(--c-on-surf-var); margin: 8px 0 0 0; }
.progress-container {
    width: 80%; max-width: 300px; height: 8px; background: var(--c-surf-hi);
    border-radius: 4px; margin-top: 24px; overflow: hidden;
}
.progress-bar {
    height: 100%; width: 0%; background: var(--c-primary);
    transition: width 0.1s linear;
}
.top-app-bar__leading { display: flex; align-items: center; gap: 14px; }
.logo-mark {
    display: flex; align-items: center; justify-content: center;
    animation: logoFloat 4s ease-in-out infinite;
}
@keyframes logoFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-2px)} }
.logo-icon {
    font-size: 40px; font-variation-settings: 'FILL' 1, 'wght' 600;
    background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.top-app-bar__title h1 {
    font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
    letter-spacing: -0.02em; background: var(--grad);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.top-app-bar__subtitle { font-size: 0.72rem; color: var(--c-on-surf-var); }
.top-app-bar__actions { display: flex; align-items: center; gap: 8px; }
.status-chip {
    display: flex; align-items: center; gap: 6px; padding: 5px 12px;
    background: var(--c-surf-hi); border-radius: var(--r-full);
    font-size: 0.72rem; font-weight: 500; color: var(--c-on-surf-var); border: 1px solid var(--c-outline-var);
}
.status-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: #4CAF50; animation: pulse 2s ease-in-out infinite; }
.status-chip.loading .status-chip__dot { background: var(--c-primary); animation: pulse 0.7s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.85)} }


/* ═══ LAYOUT ═══ */
.app-layout {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 1fr 340px 340px; gap: 20px;
    max-width: 1900px; margin: 0 auto; padding: 20px 24px;
    align-content: start;
}
.col-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.col-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.col-history { display: flex; flex-direction: column; gap: 20px; min-width: 0; }


/* ═══ CARDS ═══ */
.card {
    border-radius: var(--r-xl); padding: 20px;
    transition: all var(--dur-m) var(--ease);
    animation: cardIn var(--dur-l) var(--ease-emph) both;
}
.card--elevated { 
    background: color-mix(in srgb, var(--c-surf-low) 88%, transparent); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--elev-1); 
}
.card--elevated:hover { box-shadow: var(--elev-2); }
.card--outlined { 
    background: color-mix(in srgb, var(--c-surf) 82%, transparent); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--c-outline-var); 
}
@keyframes cardIn { from{opacity:0;transform:translateY(14px) scale(.98)} }
.card__header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card__icon { color: var(--c-primary); font-size: 20px; font-variation-settings: 'FILL' 1, 'wght' 500; }
.card__title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; flex: 1; }


/* ═══ TEXT FIELD ═══ */
.text-field {
    width: 100%; min-height: 180px; padding: 16px;
    border: 2px solid var(--c-outline-var); border-radius: var(--r-lg);
    background: var(--c-surf-ctr); color: var(--c-on-surf);
    font-family: var(--font-body); font-size: 1rem; line-height: 1.65;
    resize: vertical; outline: none;
    transition: all var(--dur-m) var(--ease);
}
.text-field::placeholder { color: var(--c-outline); }
.text-field:focus { border-color: var(--c-primary); box-shadow: 0 0 0 2px rgba(208,188,255,0.18); }
.text-field:hover:not(:focus) { border-color: var(--c-on-surf); }
.text-counter { font-size: 0.72rem; color: var(--c-on-surf-var); font-variant-numeric: tabular-nums; margin-left: auto; }

.synth-toolbar { display: flex; align-items: center; gap: 8px; padding-top: 12px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }


/* ═══ BUTTONS ═══ */
.icon-button {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--c-on-surf-var);
    border-radius: var(--r-full); cursor: pointer; transition: all var(--dur-s) var(--ease);
}
.icon-button:hover { background: var(--c-surf-top); color: var(--c-on-surf); }
.icon-button:active { transform: scale(0.9); }
.icon-button--sm { width: 34px; height: 34px; }
.icon-button--sm .material-symbols-rounded { font-size: 20px; }

.chip-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border: 1px solid var(--c-outline-var);
    background: var(--c-surf-ctr); color: var(--c-on-surf-var);
    font-family: var(--font-body); font-size: 0.78rem; font-weight: 500;
    border-radius: var(--r-full); cursor: pointer;
    transition: all var(--dur-s) var(--ease);
}
.chip-btn .material-symbols-rounded { font-size: 17px; }
.chip-btn:hover { background: var(--c-surf-hi); color: var(--c-on-surf); border-color: var(--c-primary); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn--outline { background: transparent; }

.fab-extended {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 0 28px; height: 56px; border-radius: var(--r-full);
    background: var(--c-primary); color: var(--c-on-primary);
    font-weight: 600; font-size: 1rem; cursor: pointer; border: none;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--c-primary) 40%, transparent);
    transition: all var(--dur-m) var(--spring);
}
.fab-extended:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--c-primary) 65%, transparent);
}
.fab-extended:active { transform: translateY(0) scale(0.97); box-shadow: var(--elev-1); transition-duration: 100ms; }
.fab-extended:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.fab-extended__icon .material-symbols-rounded { font-size: 20px; font-variation-settings: 'FILL' 1, 'wght' 600; }
.fab-extended.generating { pointer-events: none; }
.fab-extended.generating .fab-extended__icon .material-symbols-rounded { animation: sp .5s ease-in-out infinite alternate; }
@keyframes sp { from{transform:scaleX(.85)} to{transform:scaleX(1.15)} }


/* ═══ READER — Word Highlight ═══ */
.reader-card { animation-delay: 80ms; }
.reader-text {
    padding: 16px; border-radius: var(--r-lg);
    background: var(--c-surf-ctr); margin-bottom: 14px;
    font-size: 1.05rem; line-height: 1.8; max-height: 200px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--c-outline-var) transparent;
}
.reader-text .word {
    display: inline; border-radius: 4px; padding: 2px 2px; margin: 0 -2px;
    background-color: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.reader-text .word.active {
    background-color: var(--c-primary); color: var(--c-on-primary);
}
.reader-text .word.spoken { color: var(--c-primary); }


/* ═══ WAVEFORM & PLAYER ═══ */
.waveform-container {
    position: relative; height: 70px; background: var(--c-surf-ctr);
    border-radius: var(--r-md); overflow: hidden; cursor: pointer; margin-bottom: 14px;
}
.waveform-canvas { width: 100%; height: 100%; display: block; }
.waveform-progress {
    position: absolute; top: 0; left: 0; bottom: 0; width: 0%;
    background: rgba(208,188,255,0.12); border-right: 2px solid var(--c-primary);
    pointer-events: none; transition: width 50ms linear;
}

.player-controls { display: flex; align-items: center; gap: 12px; }
.player-btn {
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 50%; cursor: pointer;
    transition: all var(--dur-s) var(--spring);
}
.player-btn--play { background: var(--c-primary); color: var(--c-on-primary); box-shadow: var(--elev-2); }
.player-btn--play:hover { transform: scale(1.1); }
.player-btn--play:active { transform: scale(0.93); }
.player-btn--play .material-symbols-rounded { font-size: 26px; font-variation-settings: 'FILL' 1, 'wght' 600; }

.player-time { font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--c-on-surf-var); white-space: nowrap; }
.player-progress-bar {
    flex: 1; height: 28px; display: flex; align-items: center;
    position: relative; cursor: pointer;
}
.player-progress-bar__track { width: 100%; height: 4px; background: var(--c-surf-top); border-radius: 2px; position: absolute; }
.player-progress-bar__fill { height: 4px; background: var(--c-primary); border-radius: 2px; position: absolute; width: 0%; }
.player-progress-bar__thumb {
    width: 14px; height: 14px; background: var(--c-primary); border-radius: 50%;
    position: absolute; left: 0%; transform: translateX(-50%);
    box-shadow: var(--elev-1); opacity: 0; transition: opacity var(--dur-s) var(--ease);
}
.player-progress-bar:hover .player-progress-bar__thumb { opacity: 1; }

.result-badges { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; }
.badge {
    font-size: 0.68rem; padding: 3px 8px; background: var(--c-surf-hi);
    border-radius: var(--r-full); color: var(--c-on-surf-var); font-weight: 500; white-space: nowrap;
}


/* ═══════════════════════════════════════════
   SAMSUNG-STYLE SLIDERS (pill, thick, mobile)
   ═══════════════════════════════════════════ */
.mobile-slider {
    position: relative;
    padding: 6px 0;
}
.mobile-slider input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 24px;
    border-radius: 12px; cursor: pointer; outline: none; margin: 0;
}
/* Track */
.mobile-slider input[type="range"]::-webkit-slider-runnable-track {
    -webkit-appearance: none; appearance: none;
    height: 24px; border-radius: 12px;
    background: transparent; border: none;
}
/* Thumb */
.mobile-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 24px; height: 24px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform var(--dur-s) var(--spring);
    position: relative; z-index: 2;
}
.mobile-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.mobile-slider input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.25);
}

/* Firefox */
.mobile-slider input[type="range"]::-moz-range-track {
    height: 24px; border-radius: 12px;
    background: transparent; border: none;
}
.mobile-slider input[type="range"]::-moz-range-thumb {
    width: 24px; height: 24px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer; transition: transform var(--dur-s) var(--spring);
}
.mobile-slider input[type="range"]::-moz-range-progress {
    height: 24px; border-radius: 12px 0 0 12px;
    background: transparent;
}


/* ═══ SETTINGS ═══ */
.settings-card { animation-delay: 80ms; }
.setting-group { margin-bottom: 14px; }
.setting-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.82rem; font-weight: 600; color: var(--c-on-surf);
}
.setting-label .material-symbols-rounded { font-size: 18px; color: var(--c-primary); font-variation-settings: 'FILL' 1; }
.setting-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.setting-hint { font-size: 0.7rem; color: var(--c-on-surf-var); margin-top: 4px; line-height: 1.3; }
.setting-divider { height: 1px; background: var(--c-outline-var); margin: 14px 0; opacity: 0.5; }

.range-value {
    font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--c-primary); min-width: 38px; text-align: right;
}

.setting-select {
    width: 100%; padding: 10px 36px 10px 12px;
    border: 1.5px solid var(--c-outline-var); border-radius: var(--r-md);
    background: var(--c-surf-ctr); color: var(--c-on-surf);
    font-family: var(--font-body); font-size: 0.85rem; cursor: pointer; outline: none;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23938F99'%3E%3Cpath d='M10 13.5 4 7.5h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    transition: border-color var(--dur-s) var(--ease);
}
.setting-select:focus { border-color: var(--c-primary); }

.format-toggle { display: flex; border-radius: var(--r-full); overflow: hidden; border: 1.5px solid var(--c-outline-var); }
.format-btn {
    flex: 1; padding: 8px 16px; border: none; background: transparent;
    color: var(--c-on-surf-var); font-family: var(--font-body); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: all var(--dur-s) var(--ease);
}
.format-btn.active { background: var(--c-primary); color: var(--c-on-primary); }
.format-btn:not(.active):hover { background: var(--c-surf-hi); }

/* Color Selector */
.color-selector { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.color-btn {
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
    background-color: var(--btn-color); cursor: pointer;
    transition: transform 0.2s, border-color 0.2s; box-shadow: var(--elev-1);
}
.color-btn:hover { transform: scale(1.15); }
.color-btn.active { border-color: var(--c-on-surf); transform: scale(1.15); box-shadow: 0 0 0 2px var(--c-surf); }

.preset-bar { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.preset-select { flex: 1; }

.setting-actions { display: flex; gap: 8px; margin-top: 14px; }
.setting-actions .chip-btn { flex: 1; justify-content: center; }


/* ═══ HISTORY ═══ */
.history-card { animation-delay: 160ms; }
.history-list {
    display: flex; flex-direction: column; gap: 6px;
    max-height: calc(100vh - 200px); overflow-y: auto;
}
.history-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: var(--r-md);
    background: var(--c-surf-ctr); transition: all var(--dur-s) var(--ease);
    animation: histIn var(--dur-m) var(--ease-emph) both;
}
.history-item:hover { background: var(--c-surf-hi); }
@keyframes histIn { from{opacity:0;transform:translateX(-8px)} }
.history-item__play {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: var(--c-primary-ctr); color: var(--c-on-primary-ctr);
    border: none; border-radius: 50%; cursor: pointer; flex-shrink: 0;
    transition: all var(--dur-s) var(--spring);
}
.history-item__play:hover { transform: scale(1.1); background: var(--c-primary); color: var(--c-on-primary); }
.history-item__play .material-symbols-rounded { font-size: 18px; font-variation-settings: 'FILL' 1; }
.history-item__info { flex: 1; min-width: 0; }
.history-item__text {
    font-size: 0.8rem; color: var(--c-on-surf);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-item__meta { font-size: 0.68rem; color: var(--c-on-surf-var); display: flex; gap: 6px; margin-top: 1px; }
.history-item__actions { display: flex; gap: 2px; flex-shrink: 0; }

.history-empty {
    display: flex; flex-direction: column; align-items: center;
    padding: 32px 16px; text-align: center; color: var(--c-on-surf-var);
}
.history-empty__icon { font-size: 40px; margin-bottom: 8px; opacity: 0.35; }
.history-empty p { font-size: 0.82rem; }


/* ═══ LOADING & SNACKBAR ═══ */
.loading-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(8px);
    animation: fadeIn var(--dur-s) var(--ease);
}
.loading-overlay.hidden { display: none; }
@keyframes fadeIn { from{opacity:0} }
.loading-card {
    background: var(--c-surf-hi); border-radius: var(--r-xl); padding: 40px 56px;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
    box-shadow: var(--elev-3); animation: scaleIn var(--dur-m) var(--spring);
}
@keyframes scaleIn { from{opacity:0;transform:scale(.88)} }
.sound-wave-anim { display: flex; align-items: center; gap: 3.5px; height: 44px; }
.sound-wave-anim span {
    display: block; width: 4.5px; background: var(--c-primary); border-radius: 2.5px;
    animation: wBar 1s ease-in-out infinite;
}
.sound-wave-anim span:nth-child(1){height:12px;animation-delay:0s}
.sound-wave-anim span:nth-child(2){height:22px;animation-delay:.1s}
.sound-wave-anim span:nth-child(3){height:34px;animation-delay:.2s}
.sound-wave-anim span:nth-child(4){height:44px;animation-delay:.3s}
.sound-wave-anim span:nth-child(5){height:34px;animation-delay:.4s}
.sound-wave-anim span:nth-child(6){height:44px;animation-delay:.5s}
.sound-wave-anim span:nth-child(7){height:34px;animation-delay:.6s}
.sound-wave-anim span:nth-child(8){height:22px;animation-delay:.7s}
.sound-wave-anim span:nth-child(9){height:12px;animation-delay:.8s}
@keyframes wBar { 0%,100%{transform:scaleY(.4);opacity:.5} 50%{transform:scaleY(1);opacity:1} }
.loading-text { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.loading-subtext { font-size: 0.8rem; color: var(--c-on-surf-var); }

.snackbar {
    position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px; padding: 12px 22px;
    background: var(--c-inv-surf); color: var(--c-inv-on);
    border-radius: var(--r-md); box-shadow: var(--elev-3);
    z-index: 2000; font-size: 0.85rem; font-weight: 500;
    transition: bottom var(--dur-m) var(--spring); max-width: min(90vw, 440px);
}
.snackbar.visible { bottom: 20px; }
.snackbar__icon { font-size: 20px; font-variation-settings: 'FILL' 1; }
.snackbar.success .snackbar__icon { color: #66BB6A; }
.snackbar.error .snackbar__icon { color: var(--c-error); }
.snackbar.info .snackbar__icon { color: var(--c-primary); }

.hidden { display: none !important; }


/* ═══ RESPONSIVE ═══ */
@media (max-width: 1200px) {
    .app-layout { grid-template-columns: 1fr 340px; }
    .col-history { grid-column: 1 / -1; }
    .history-list { max-height: 400px; }
}
@media (max-width: 900px) {
    .app-layout { grid-template-columns: 1fr; padding: 16px 12px; }
    .col-history { grid-column: auto; }
}
@media (max-width: 600px) {
    .top-app-bar { padding: 8px 14px; }
    .top-app-bar__subtitle { display: none; }
    .card { padding: 16px; border-radius: var(--r-lg); }
    .fab-extended { width: 100%; justify-content: center; }
    .synth-toolbar { flex-direction: column-reverse; }
    .status-chip__label { display: none; }
}
@media (min-width: 1600px) {
    .app-layout { grid-template-columns: 1fr 360px 360px; gap: 24px; }
    .text-field { min-height: 240px; }
}
