/* ==========================================================================
   TtsPlus — Studio design system
   Two full themes (dark / light). Minimum font size across the whole app: 15px.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand ramp — coral → tangerine, with teal and violet as counterweights */
    --brand-1: #ff4d6d;
    --brand-2: #ff8a3d;
    --brand-3: #2dd4bf;
    --brand-4: #a06bff;

    --grad-hot: linear-gradient(120deg, var(--brand-1), var(--brand-2));
    --grad-cool: linear-gradient(120deg, var(--brand-4), var(--brand-3));
    --grad-full: linear-gradient(120deg, var(--brand-1) 0%, var(--brand-2) 34%, var(--brand-3) 68%, var(--brand-4) 100%);

    /* Type scale — nothing below 15px, anywhere */
    --fs-xs: 15px;
    --fs-sm: 15px;
    --fs-base: 16px;
    --fs-md: 17px;
    --fs-lg: 19px;
    --fs-xl: 23px;
    --fs-2xl: 29px;
    --fs-3xl: 36px;

    --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
    --font-ui: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 999px;

    --sidebar-w: 272px;
    --topbar-h: 65px;
    --gutter: clamp(18px, 2.4vw, 34px);

    --ease: cubic-bezier(.22, 1, .36, 1);
    --ease-soft: cubic-bezier(.4, 0, .2, 1);
}

/* ---- Dark (default) ---- */
:root,
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0a0812;
    --bg-2: #0f0c1b;
    --surface: rgba(24, 19, 40, .72);
    --surface-solid: #18132a;
    --surface-2: rgba(33, 26, 54, .68);
    --surface-3: rgba(255, 255, 255, .04);

    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .17);

    --text: #f6f2ff;
    --text-2: #cdc4e4;
    --muted: #a397c2;
    --faint: #7d7196;

    --field: rgba(11, 8, 20, .72);
    --field-hover: rgba(15, 11, 27, .9);

    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .3);
    --shadow: 0 22px 48px rgba(0, 0, 0, .48);
    --shadow-lg: 0 40px 90px rgba(0, 0, 0, .58);
    --glow: 0 0 0 1px rgba(255, 77, 109, .28), 0 16px 44px rgba(255, 77, 109, .22);

    --good: #34e0a1;
    --warn: #ffc457;
    --bad: #ff6b81;

    --aurora-1: rgba(255, 77, 109, .38);
    --aurora-2: rgba(160, 107, 255, .34);
    --aurora-3: rgba(45, 212, 191, .24);
    --grain-opacity: .04;
    --sheen: rgba(255, 255, 255, .16);
}

/* ---- Light ---- */
html[data-theme="light"] {
    color-scheme: light;

    --bg: #fbf7f3;
    --bg-2: #f4eee9;
    --surface: rgba(255, 255, 255, .82);
    --surface-solid: #ffffff;
    --surface-2: rgba(255, 255, 255, .66);
    --surface-3: rgba(28, 20, 40, .035);

    --line: rgba(38, 26, 56, .11);
    --line-strong: rgba(38, 26, 56, .2);

    --text: #1e1730;
    --text-2: #453a5c;
    --muted: #6c6180;
    --faint: #8b809e;

    --field: rgba(255, 255, 255, .9);
    --field-hover: #ffffff;

    --shadow-sm: 0 3px 10px rgba(70, 48, 105, .08);
    --shadow: 0 20px 44px rgba(70, 48, 105, .12);
    --shadow-lg: 0 34px 80px rgba(70, 48, 105, .16);
    --glow: 0 0 0 1px rgba(255, 77, 109, .3), 0 16px 40px rgba(255, 120, 90, .22);

    --brand-1: #e5325a;
    --brand-2: #f07021;
    --brand-3: #0fa697;
    --brand-4: #7d4dff;

    --good: #0f9d6e;
    --warn: #c07d0a;
    --bad: #d63c53;

    --aurora-1: rgba(255, 122, 90, .3);
    --aurora-2: rgba(150, 110, 255, .24);
    --aurora-3: rgba(45, 212, 191, .22);
    --grain-opacity: .028;
    --sheen: rgba(255, 255, 255, .75);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html {
    background: var(--bg);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(1100px 620px at 82% -12%, var(--aurora-1), transparent 62%),
        radial-gradient(900px 560px at 6% 108%, var(--aurora-2), transparent 60%),
        linear-gradient(168deg, var(--bg) 0%, var(--bg-2) 52%, var(--bg) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    transition: background-color .45s var(--ease-soft), color .3s var(--ease-soft);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
    margin: 0;
}

p { margin: 0; }

/* The UA default is `font-size: smaller`, which would drop nested labels below
   our 15px floor. Pin every small/sub/sup/code to the floor instead. */
small, sub, sup, code, kbd, figcaption { font-size: var(--fs-xs); }
sub, sup { line-height: 0; }

button, input, textarea, select {
    font-family: inherit;
    font-size: var(--fs-sm);
    color: inherit;
}

button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .42; }

a { color: inherit; text-decoration: none; }

::selection { background: rgba(255, 77, 109, .32); color: var(--text); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border: 3px solid transparent;
    background-clip: padding-box;
    border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; }

:focus-visible {
    outline: 2px solid var(--brand-1);
    outline-offset: 3px;
    border-radius: 6px;
}

.hidden { display: none !important; }
.dim { color: var(--muted); }

/* --------------------------------------------------------------------------
   3. Ambient background
   -------------------------------------------------------------------------- */
.aurora { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    will-change: transform;
}
.aurora-blob.b1 {
    width: 46vw; height: 46vw; max-width: 620px; max-height: 620px;
    background: var(--aurora-1); top: -14%; right: -10%;
    animation: drift-a 26s var(--ease-soft) infinite alternate;
}
.aurora-blob.b2 {
    width: 40vw; height: 40vw; max-width: 540px; max-height: 540px;
    background: var(--aurora-2); bottom: -18%; left: -8%;
    animation: drift-b 32s var(--ease-soft) infinite alternate;
}
.aurora-blob.b3 {
    width: 30vw; height: 30vw; max-width: 400px; max-height: 400px;
    background: var(--aurora-3); top: 44%; left: 46%;
    animation: drift-c 38s var(--ease-soft) infinite alternate;
}

@keyframes drift-a { to { transform: translate3d(-8%, 12%, 0) scale(1.14); } }
@keyframes drift-b { to { transform: translate3d(12%, -10%, 0) scale(1.1); } }
@keyframes drift-c { to { transform: translate3d(-16%, -14%, 0) scale(.86); } }

.grain {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   4. Shell + sidebar
   -------------------------------------------------------------------------- */
.shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.scrim {
    position: fixed; inset: 0; z-index: 39;
    background: rgba(6, 4, 12, .58);
    backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease-soft);
}
.scrim.on { opacity: 1; pointer-events: auto; }

.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 10px 10px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(26px) saturate(140%);
}

.brand {
    display: flex; align-items: center; gap: 13px;
    padding: 5px 5px 5px;
    border-bottom: 1px solid var(--line);
}
.brand-mark {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    width: 42px; height: 42px;
    padding: 6px;
    border-radius: 13px;
    background: var(--grad-full);
    background-size: 220% 220%;
    box-shadow: var(--glow);
    animation: brand-shift 9s ease infinite;
    flex: none;
}
.brand-mark i {
    display: block;
    border-radius: 4px;
    background: rgba(255, 255, 255, .92);
}
.brand-mark i:nth-child(1) { animation: bar 2.4s var(--ease-soft) infinite; }
.brand-mark i:nth-child(2) { animation: bar 2.4s var(--ease-soft) .3s infinite; }
.brand-mark i:nth-child(3) { animation: bar 2.4s var(--ease-soft) .6s infinite; }
.brand-mark i:nth-child(4) { animation: bar 2.4s var(--ease-soft) .9s infinite; }
@keyframes bar { 0%, 100% { opacity: .55; transform: scaleY(.7); } 50% { opacity: 1; transform: scaleY(1); } }
@keyframes brand-shift { 0%, 100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }

.brand-mark.has-logo {
    display: block;
    padding: 0;
    background: none;
    box-shadow: none;
    animation: none;
    overflow: hidden;
    border-radius: 12px;
}
.brand-mark.has-logo img {
    display: block;
    width: 100%; height: 100%;
    object-fit: contain;
    object-position: center;
}

.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
}
.brand-copy small {
    font-size: var(--fs-xs);
    color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav { position: relative; display: flex; flex-direction: column; gap: 4px; }

.nav-glow {
    position: absolute;
    left: 0; width: 100%;
    height: 48px;
    border-radius: var(--r-md);
    background: linear-gradient(100deg, rgba(255, 77, 109, .18), rgba(160, 107, 255, .14));
    border: 1px solid rgba(255, 77, 109, .28);
    box-shadow: var(--shadow-sm);
    transition: transform .42s var(--ease), opacity .25s;
    opacity: 0;
    pointer-events: none;
}

.nav-item {
    position: relative;
    z-index: 1;
    display: flex; align-items: center; gap: 12px;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--r-md);
    font-size: 20px;
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    transition: color .22s var(--ease-soft), background .22s var(--ease-soft), transform .22s var(--ease);
}
.nav-item .nav-ico {
    display: grid; place-items: center;
    width: 28px; height: 28px;
    border-radius: 9px;
    background: var(--surface-3);
    font-size: var(--fs-sm);
    transition: .22s var(--ease-soft);
    flex: none;
}
.nav-item .nav-ico svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav-item:hover { color: var(--text); background: var(--surface-3); transform: translateX(2px); }
.nav-item.active { color: var(--text); }
.nav-item.active .nav-ico {
    background: var(--grad-hot);
    color: #fff;
    box-shadow: 0 6px 18px rgba(255, 77, 109, .35);
}

.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }

.theme-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--field);
}
.theme-switch button {
    height: 38px;
    border-radius: 10px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--muted);
    transition: .24s var(--ease-soft);
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active {
    color: #fff;
    background: var(--grad-hot);
    box-shadow: 0 6px 18px rgba(255, 77, 109, .3);
}
html[data-theme="light"] .theme-switch button.active { color: #fff; }

/* --------------------------------------------------------------------------
   5. Workspace + topbar
   -------------------------------------------------------------------------- */
.workspace { min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    height: 65px;
    padding: 5px 5px 5px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(24px) saturate(140%);
}

.crumb { display: flex; align-items: center; gap: 9px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.crumb i { font-style: normal; opacity: .5; }
.crumb strong {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--field);
    font-size: var(--fs-md);
    color: var(--text-2);
    transition: .2s var(--ease-soft);
}
.icon-btn:hover { background: var(--field-hover); border-color: var(--line-strong); }

.only-mobile { display: none; }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--field);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
    transition: transform .18s var(--ease), background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); background: var(--field-hover); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); }

.btn.tiny { height: 36px; padding: 0 12px; }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }

.btn.solid {
    border-color: transparent;
    background: var(--grad-hot);
    color: #fff;
    box-shadow: 0 8px 22px rgba(255, 77, 109, .3);
}
.btn.solid:hover:not(:disabled) {
    color: #fff;
    box-shadow: 0 12px 30px rgba(255, 77, 109, .42);
    filter: saturate(115%);
}

.btn kbd {
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-3);
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    color: var(--faint);
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
    display: inline-flex; align-items: center; gap: 7px;
    height: 32px; padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--muted);
}
.pill.accent {
    border-color: rgba(45, 212, 191, .32);
    background: rgba(45, 212, 191, .1);
    color: var(--brand-3);
}

/* The big call-to-action — animated gradient sheen */
.cta {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px;
    width: 100%;
    min-height: 64px;
    padding: 5px 15px;
    border-radius: var(--r-md);
    background: var(--grad-full);
    background-size: 260% 260%;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(255, 77, 109, .32);
    animation: cta-flow 5s ease infinite;
    transition: transform 0.2s var(--ease), box-shadow .2s;
}
.cta b { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; letter-spacing: -.01em; }
.cta small { font-size: var(--fs-xs); opacity: .85; font-weight: 500; }
.cta:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 20px 44px rgba(255, 77, 109, .42); }
.cta:active:not(:disabled) { transform: translateY(0) scale(.99); }
.cta:disabled { animation: none; }

.cta-sheen {
    position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 32%, var(--sheen) 48%, transparent 64%);
    transform: translateX(-110%);
    pointer-events: none;
}
.cta:hover .cta-sheen { animation: sheen 1.05s var(--ease-soft); }
@keyframes sheen { to { transform: translateX(110%); } }
@keyframes cta-flow { 0%, 100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }

/* --------------------------------------------------------------------------
   7. Views, cards, headings
   -------------------------------------------------------------------------- */
.views { padding: 10px; padding-bottom: 500px; }

.view { display: none; }
.view.active { display: block; animation: view-in .42s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.card {
    position: relative;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    backdrop-filter: blur(18px) saturate(135%);
    box-shadow: var(--shadow);
    transition: border-color .25s var(--ease-soft), box-shadow .25s;
}

.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-bottom: 0;
    flex-wrap: wrap;
}
.card-head strong { font-family: var(--font-display); font-size: var(--fs-md); }
.card-head small { display: block; font-size: var(--fs-xs); }

.eyebrow {
    display: inline-block;
    margin-bottom: 0;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    background: var(--grad-hot);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.page-head h2 { font-size: var(--fs-2xl); margin-bottom: 1px; }
.page-head p { font-size: var(--fs-sm); color: var(--muted); max-width: 62ch; }

/* ---- Hero ---- */
.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
    padding: 2px 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--surface-2);
    backdrop-filter: blur(20px);
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background: var(--grad-full);
    background-size: 300% 300%;
    opacity: .09;
    animation: cta-flow 16s ease infinite;
    pointer-events: none;
}
.hero-copy { position: relative; }
.hero h1 {
    font-size: clamp(30px, 3.6vw, 50px);
    margin-bottom: 0;
}
.hero h1 em {
    font-style: normal;
    background: var(--grad-full);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: cta-flow 8s ease infinite;
}
.hero p { font-size: var(--fs-md); color: var(--muted); max-width: 100ch; }

.hero-visual { position: relative; display: grid; place-items: center; height: 100px; }

.orb { position: relative; width: 118px; height: 118px; display: grid; place-items: center; }
.orb-core {
    width: 62px; height: 62px;
    border-radius: 50%;
    background: var(--grad-full);
    background-size: 200% 200%;
    box-shadow: 0 0 44px rgba(255, 77, 109, .58);
    animation: cta-flow 7s ease infinite, breathe 4s var(--ease-soft) infinite;
}
.orb-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
}
.orb-ring.r1 { inset: -6px; animation: pulse-ring 3.4s var(--ease-soft) infinite; }
.orb-ring.r2 { inset: -24px; animation: pulse-ring 3.4s var(--ease-soft) .55s infinite; }
.orb-ring.r3 { inset: -42px; animation: pulse-ring 3.4s var(--ease-soft) 1.1s infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes pulse-ring { 0% { opacity: .7; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.25); } }

.hero-bars {
    position: absolute; bottom: 4px;
    display: flex; align-items: flex-end; gap: 4px; height: 42px;
}
.hero-bars i {
    display: block;
    width: 4px;
    border-radius: var(--r-pill);
    background: var(--grad-hot);
    opacity: .55;
    animation: eq 1.5s var(--ease-soft) infinite;
    animation-delay: calc(var(--i) * -.09s);
    height: 30%;
}
@keyframes eq { 0%, 100% { height: 16%; } 50% { height: 100%; } }

/* --------------------------------------------------------------------------
   8. TTS studio grid
   -------------------------------------------------------------------------- */
.studio-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, .95fr);
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
}

.editor-card { display: flex; flex-direction: column; gap: 10px; }
.controls-card { display: flex; flex-direction: column; gap: 10px; }

.segmented {
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    gap: 3px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--field);
}
.segmented button { flex: 0 0 auto; }
.segmented button {
    height: 34px; padding: 0 14px;
    border-radius: 7px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--muted);
    transition: .22s var(--ease-soft);
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
    color: #fff;
    background: var(--grad-hot);
    box-shadow: 0 5px 14px rgba(255, 77, 109, .3);
}

.cue-bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cue-bar.wrap { margin: 12px 0; }
.cue-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--faint);
    margin-right: 3px;
}
.cue-bar button {
    height: 34px; padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface-3);
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--text-2);
    transition: .2s var(--ease-soft);
}
.cue-bar button:hover {
    color: var(--text);
    border-color: rgba(255, 77, 109, .4);
    background: rgba(255, 77, 109, .1);
    transform: translateY(-1px);
}
.cue-bar .cue-add {
    border-style: dashed;
    color: var(--brand-3);
    border-color: rgba(45, 212, 191, .4);
}

.script {
    width: 100%;
    min-height: 435px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--field);
    font-size: var(--fs-md);
    line-height: 1.75;
    color: var(--text);
    resize: vertical;
    transition: border-color .22s, box-shadow .22s, background .22s;
}
.script.tall { min-height: 340px; }
.script.short { min-height: 130px; }
.script::placeholder { color: var(--faint); }
.script:focus {
    outline: none;
    border-color: rgba(255, 77, 109, .5);
    background: var(--field-hover);
    box-shadow: 0 0 0 4px rgba(255, 77, 109, .12);
}

.editor-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    flex-wrap: wrap;
}
.counters { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.counters b { color: var(--text); font-weight: 700; }
.editor-tools { display: flex; gap: 8px; }

/* ---- Fields ---- */
.field { display: flex; flex-direction: column; gap: 9px; }
.field-label,
label.stacked {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--faint);
}
label.stacked { display: flex; flex-direction: column; gap: 7px; }
label.stacked small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); }

input[type="text"], input[type="number"], input[type="file"], input:not([type]), select, textarea {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--field);
    font-size: var(--fs-sm);
    color: var(--text);
    transition: border-color .2s, background .2s, box-shadow .2s;
}
textarea { height: auto; padding: 13px; }
input[type="file"] { padding: 10px 13px; height: auto; }
select {
    appearance: none;
    padding-right: 38px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(255, 77, 109, .5);
    background: var(--field-hover);
    box-shadow: 0 0 0 4px rgba(255, 77, 109, .12);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

/* ---- Voice picker ---- */
.voice-pick {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 2px 15px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--field);
    text-align: left;
    transition: .22s var(--ease-soft);
}
.voice-pick:hover {
    border-color: rgba(255, 77, 109, .4);
    background: var(--field-hover);
    transform: translateY(-1px);
}
.voice-pick-copy { flex: 1; min-width: 0; }
.voice-pick-copy strong {
    display: block;
    font-size: var(--fs-md);
    font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.voice-pick-copy small {
    display: block;
    font-size: var(--fs-xs);
    color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chev { color: var(--faint); font-size: var(--fs-lg); line-height: 1; }

.inline-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inline-actions .btn { padding: 0 8px; }

/* ---- Sliders ---- */
.sliders { display: grid; gap: 10px; }
.slider-row label {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-2);
}
.slider-row output {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--brand-1);
}

input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; padding: 0;
    border: 0; border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--brand-1), var(--brand-2)) no-repeat,
                var(--surface-3);
    background-size: var(--fill, 50%) 100%;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 19px; height: 19px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand-1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
    transition: transform .16s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type="range"]::-moz-range-thumb {
    width: 15px; height: 15px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand-1);
}
input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Advanced ---- */
.advanced {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-3);
    overflow: hidden;
}
.advanced summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 3px 16px;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-2);
    cursor: pointer;
    list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary i { font-style: normal; font-size: var(--fs-lg); transition: transform .28s var(--ease); }
.advanced[open] summary i { transform: rotate(180deg); }
.advanced[open] summary { border-bottom: 1px solid var(--line); }

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
    gap: 12px;
    padding: 16px;
}
.advanced-grid label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.advanced-grid input, .advanced-grid select { height: 42px; }

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    padding: 0 16px 16px;
}

/* ---- Switch ---- */
.switch { display: flex; align-items: center; gap: 11px; cursor: pointer; font-size: var(--fs-xs); color: var(--text-2); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    position: relative;
    width: 44px; height: 25px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    border: 1px solid var(--line);
    transition: .28s var(--ease);
    flex: none;
}
.switch .track::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 17px; height: 17px;
    border-radius: 50%;
    background: var(--faint);
    transition: .28s var(--ease);
}
.switch input:checked + .track { background: var(--grad-hot); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(19px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(255, 77, 109, .22); }
.switch-text { line-height: 1.35; }

/* --------------------------------------------------------------------------
   9. Output / player
   -------------------------------------------------------------------------- */
.output-card { display: flex; flex-direction: column; gap: 1px; }

.output-head { display: flex; align-items: center; gap: 14px; }
.output-icon {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    background: var(--grad-full);
    background-size: 260% 260%;
    color: #fff;
    font-size: var(--fs-lg);
    box-shadow: 0 10px 26px rgba(255, 77, 109, .28);
    flex: none;
    animation: cta-flow 5s ease infinite;
    transition: transform 0.2s var(--ease), box-shadow .2s;
}
.output-card:hover .output-icon { transform: scale(1.05); box-shadow: 0 14px 32px rgba(255, 77, 109, .38); }
.output-copy strong { display: block; font-family: var(--font-display); font-size: var(--fs-md); }
.output-copy small { display: block; font-size: var(--fs-xs); color: var(--muted); }

#waveform {
    width: 100%;
    height: 60px;
    border-radius: var(--r-md);
    background: var(--field);
    border: 1px solid var(--line);
}

.player { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.player .time {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--muted);
    min-width: 46px;
}
.player input[type="range"] { flex: 1; min-width: 130px; }

.play-main {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--grad-hot);
    color: #fff;
    font-size: var(--fs-md);
    box-shadow: 0 10px 26px rgba(255, 77, 109, .36);
    transition: transform .2s var(--ease), box-shadow .2s;
    flex: none;
}
.play-main:hover:not(:disabled) { transform: scale(1.06); box-shadow: 0 14px 34px rgba(255, 77, 109, .46); }
.play-main[data-state="playing"] { animation: pulse-btn 1.9s var(--ease-soft) infinite; }
@keyframes pulse-btn {
    0%, 100% { box-shadow: 0 10px 26px rgba(255, 77, 109, .36); }
    50% { box-shadow: 0 10px 26px rgba(255, 77, 109, .36), 0 0 0 12px rgba(255, 77, 109, .07); }
}

.alignment { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.time-chip {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface-3);
    font-size: var(--fs-xs);
    color: var(--text-2);
}

/* ---- Dismissible notice ---- */
.notice {
    display: flex; align-items: flex-start; gap: 13px;
    padding: 10px 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-left-width: 4px;
    border-left-color: #7f1d1d;
    border-radius: var(--r-md);
    background: linear-gradient(110deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 10px 28px rgba(185, 28, 28, .24);
    overflow: hidden;
    animation: view-in .4s var(--ease) both;
    transition: opacity .24s var(--ease-soft), transform .24s var(--ease-soft), margin .24s, height .24s, padding .24s;
}
.notice.closing { opacity: 0; transform: translateY(-6px); height: 0 !important; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.notice p { font-size: var(--fs-sm); color: #fff; line-height: 1.6; flex: 1; }
.notice p b { color: #fff; }
.notice-icon {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--grad-hot);
    color: #fff;
    font-size: var(--fs-md);
    flex: none;
}
.notice-close {
    width: 32px; height: 32px;
    border-radius: 9px;
    color: #fff;
    font-size: var(--fs-lg);
    line-height: 1;
    flex: none;
    transition: .2s;
}
.notice-close:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---- Character meters ---- */
.counters #charMeter.warn b, .counters #dialogueMeter.warn b { color: var(--warn); }
.counters #charMeter.over, .counters #dialogueMeter.over { color: var(--bad); }
.counters #charMeter.over b, .counters #dialogueMeter.over b { color: var(--bad); }

/* ---- Freshly finished render ---- */
.just-rendered { animation: landed 1.6s var(--ease-soft); }
@keyframes landed {
    0% { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 77, 109, .5); }
    40% { box-shadow: var(--shadow), 0 0 0 10px rgba(255, 77, 109, 0); }
    100% { box-shadow: var(--shadow); }
}

/* --------------------------------------------------------------------------
   10. Voice cards + grid
   -------------------------------------------------------------------------- */
.voice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.vcard {
    position: relative;
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
    animation: card-in .38s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 14ms);
    transition: transform .22s var(--ease), border-color .22s, box-shadow .22s;
    contain: content;
}
.vcard::before {
    content: '';
    position: absolute; right: -40px; top: -40px;
    width: 96px; height: 96px;
    border-radius: 50%;
    background: var(--brand-1);
    filter: blur(46px);
    opacity: .09;
    pointer-events: none;   /* keeps the favourite button clickable */
    transition: opacity .25s;
}
.vcard:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 77, 109, .34);
    box-shadow: var(--shadow);
}
.vcard:hover::before { opacity: .2; }
.vcard.is-selected { border-color: var(--brand-1); box-shadow: var(--glow); }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.vcard-top { display: flex; align-items: center; gap: 11px; padding-right: 34px; }

.vcard.no-fav .vcard-top { padding-right: 0; }

.vcard-id { min-width: 0; flex: 1; }
.vcard-id h4 {
    font-family: var(--font-ui);
    font-size: var(--fs-sm);
    font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vcard-id p {
    font-size: var(--fs-xs);
    color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.vcard-fav {
    position: absolute; top: 11px; right: 11px;
    z-index: 2;
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    font-size: var(--fs-md);
    line-height: 1;
    color: var(--faint);
    transition: .2s var(--ease-soft);
}
.vcard-fav:hover { background: var(--surface-3); color: var(--warn); transform: scale(1.12); }
.vcard-fav.on { color: var(--warn); }
.vcard-fav.on:hover { transform: scale(1.12) rotate(-8deg); }

.vcard-tags { display: flex; gap: 5px; flex-wrap: wrap; min-height: 28px; }
.vcard-tags span {
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--muted);
    max-width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vcard-tags .chip-lang {
    text-transform: uppercase;
    letter-spacing: .06em;
    border-color: rgba(45, 212, 191, .3);
    background: rgba(45, 212, 191, .1);
    color: var(--brand-3);
}
.vcard-tags .chip-gender {
    border-color: rgba(160, 107, 255, .3);
    background: rgba(160, 107, 255, .1);
    color: var(--brand-4);
}
.vcard-tags .chip-age {
    border-color: rgba(255, 138, 61, .3);
    background: rgba(255, 138, 61, .1);
    color: var(--brand-2);
}

.vcard-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: auto; }
.vcard-actions.single { grid-template-columns: 1fr; }
.vcard-actions button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-2);
    transition: .2s var(--ease-soft);
}
.vcard-actions button:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.vcard-actions .vcard-use {
    border-color: rgba(255, 77, 109, .28);
    background: rgba(255, 77, 109, .12);
    color: var(--brand-1);
}
.vcard-actions .vcard-use:hover { background: rgba(255, 77, 109, .2); color: var(--brand-1); }
.vcard-actions .vcard-preview[data-state="playing"] {
    border-color: transparent;
    background: var(--grad-hot);
    color: #fff;
}

/* The picker has no cover art, so its cards can sit a little tighter. */
.voice-grid.compact { gap: 11px; }
.voice-grid.compact .vcard { padding: 10px; }

/* Play / stop button internals */
.pi { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; line-height: 1; }
.pl { line-height: 1.2; }

/* Playing indicator bars */
.eqbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.eqbars i { width: 2px; height: 40%; background: currentColor; border-radius: 2px; animation: eq 1s var(--ease-soft) infinite; }
.eqbars i:nth-child(2) { animation-delay: -.35s; }
.eqbars i:nth-child(3) { animation-delay: -.7s; }

/* Skeleton loading */
.vcard.skeleton { pointer-events: none; animation: none; }
.vcard.skeleton .sk {
    border-radius: 7px;
    background: linear-gradient(100deg, var(--surface-3) 30%, var(--line) 50%, var(--surface-3) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.25s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 20px; }
.pagination button {
    min-width: 42px; height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--field);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-2);
    transition: .2s var(--ease-soft);
}
.pagination button:hover { border-color: var(--line-strong); color: var(--text); transform: translateY(-1px); }
.pagination button.active {
    border-color: transparent;
    background: var(--grad-hot);
    color: #fff;
    box-shadow: 0 7px 18px rgba(255, 77, 109, .3);
}
.pagination .gap { color: var(--faint); padding: 0 3px; font-size: var(--fs-xs); }

.tools-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px 190px auto;
    gap: 10px;
    align-items: center;
    padding: 14px;
    margin-bottom: 18px;
}

.search-field { position: relative; display: flex; align-items: center; }
.search-field > span {
    position: absolute; left: 14px;
    font-size: var(--fs-md);
    color: var(--faint);
    pointer-events: none;
}
.search-field input { padding-left: 42px; }

/* --------------------------------------------------------------------------
   11. Dialogue / design / STT
   -------------------------------------------------------------------------- */
.dialogue-layout,
.design-layout,
.transcribe-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
.design-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr); }
.transcribe-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }

.speaker-card { display: flex; flex-direction: column; gap: 14px; }
.speaker-list { display: grid; gap: 9px; }
.speaker-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-3);
    transition: .2s var(--ease-soft);
}
.speaker-item:hover { border-color: var(--line-strong); }
.speaker-index {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--grad-full);
    background-size: 260% 260%;
    color: #fff;
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 700;
    flex: none;
    animation: cta-flow 5s ease infinite;
    transition: transform 0.2s var(--ease), box-shadow .2s;
}
.speaker-item:hover .speaker-index { transform: scale(1.06); box-shadow: 0 8px 20px rgba(255, 77, 109, .3); }
.speaker-choose { flex: 1; min-width: 0; text-align: left; }
.speaker-choose strong { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.speaker-choose small { display: block; font-size: var(--fs-sm); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.speaker-remove {
    width: 32px; height: 32px;
    border-radius: 9px;
    color: var(--faint);
    font-size: var(--fs-md);
    transition: .2s;
}
.speaker-remove:hover { background: rgba(255, 107, 129, .14); color: var(--bad); }

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 14px 0 18px;
}
.mini-grid label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }

.candidates { display: grid; gap: 11px; min-height: 220px; }
.candidate {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-3);
    animation: card-in .4s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 70ms);
}
.candidate-num {
    display: grid; place-items: center;
    width: 46px; height: 46px;
    border-radius: 13px;
    background: var(--grad-full);
    background-size: 200% 200%;
    color: #fff;
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 700;
    animation: cta-flow 9s ease infinite;
}
.candidate-copy { min-width: 0; }
.candidate-copy strong { display: block; font-size: var(--fs-sm); }
.candidate-copy small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.candidate-actions { display: flex; gap: 7px; }
.candidate-play {
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--grad-hot);
    color: #fff;
    font-size: var(--fs-sm);
    box-shadow: 0 7px 18px rgba(255, 77, 109, .3);
    transition: transform .2s var(--ease);
}
.candidate-play:hover { transform: scale(1.08); }

.drop-zone {
    display: grid; place-items: center; gap: 5px;
    padding: 40px 22px;
    border: 2px dashed var(--line-strong);
    border-radius: var(--r-lg);
    background: var(--surface-3);
    text-align: center;
    cursor: pointer;
    transition: .25s var(--ease-soft);
}
.drop-zone:hover, .drop-zone.drag {
    border-color: var(--brand-1);
    background: rgba(255, 77, 109, .07);
    transform: translateY(-2px);
}
.drop-zone h3 { font-size: var(--fs-lg); }
.drop-zone p { font-size: var(--fs-sm); color: var(--muted); }
.drop-zone small { font-size: var(--fs-xs); color: var(--faint); }
.drop-orb {
    display: grid; place-items: center;
    width: 66px; height: 66px;
    margin-bottom: 8px;
    border-radius: 50%;
    background: var(--grad-cool);
    color: #fff;
    font-size: var(--fs-2xl);
    box-shadow: 0 12px 30px rgba(160, 107, 255, .32);
    animation: breathe 3.6s var(--ease-soft) infinite;
}

.file-chip {
    margin-top: 13px; padding: 11px 15px;
    border: 1px solid rgba(45, 212, 191, .34);
    border-radius: var(--r-sm);
    background: rgba(45, 212, 191, .1);
    font-size: var(--fs-xs);
    color: var(--brand-3);
    word-break: break-all;
}

.stt-options { display: grid; gap: 14px; margin: 16px 0 18px; }

.transcript {
    min-height: 190px;
    max-height: 340px;
    overflow: auto;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--field);
    font-size: var(--fs-md);
    line-height: 1.8;
    white-space: pre-wrap;
}
.transcript.empty { color: var(--faint); display: grid; place-items: center; text-align: center; }

.segments { display: grid; gap: 7px; max-height: 260px; overflow: auto; margin-top: 13px; }
.segment {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-xs);
}
.segment time { font-family: var(--font-mono); color: var(--brand-3); }

/* --------------------------------------------------------------------------
   12. Projects / history / empty
   -------------------------------------------------------------------------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card {
    display: flex; flex-direction: column; gap: 10px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    animation: card-in .38s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 30ms);
    transition: transform .22s var(--ease), border-color .22s, box-shadow .22s;
}
.project-card:hover { transform: translateY(-3px); border-color: rgba(160, 107, 255, .34); box-shadow: var(--shadow); }
.project-card strong { font-family: var(--font-display); font-size: var(--fs-md); }
.project-card p {
    font-size: var(--fs-xs); color: var(--muted); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.project-card footer {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: auto; padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: var(--fs-xs); color: var(--faint);
}

.history-list { display: grid; gap: 10px; }
.history-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    animation: card-in .34s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 24ms);
    transition: border-color .2s, transform .2s var(--ease);
}
.history-item:hover { border-color: var(--line-strong); transform: translateX(3px); }
.history-type {
    display: grid; place-items: center;
    width: 44px; height: 44px;
    border-radius: 13px;
    background: var(--surface-3);
    font-size: var(--fs-md);
    color: var(--brand-1);
}
.history-copy { min-width: 0; }
.history-copy strong { display: block; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-copy small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.history-meta { font-size: var(--fs-xs); color: var(--faint); white-space: nowrap; }
.history-actions { display: flex; gap: 7px; }
.history-actions a, .history-actions button {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-2);
    transition: .2s;
}
.history-actions a:hover, .history-actions button:hover { border-color: var(--line-strong); color: var(--text); }
.history-actions button[data-state="playing"] { background: var(--grad-hot); border-color: transparent; color: #fff; }
.history-actions .hist-delete {
    width: 36px;
    color: var(--faint);
    font-size: var(--fs-sm);
}
.history-actions .hist-delete:hover {
    border-color: rgba(255, 107, 129, .4);
    background: rgba(255, 107, 129, .12);
    color: var(--bad);
}
.history-item { transition: border-color .2s, transform .22s var(--ease), opacity .22s; }

.empty {
    display: grid; place-items: center; gap: 8px;
    padding: 56px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    text-align: center;
    color: var(--muted);
}
.empty > div:first-child { font-size: var(--fs-3xl); opacity: .4; }
.empty h3 { font-size: var(--fs-lg); color: var(--text); }
.empty p { font-size: var(--fs-sm); }

/* --------------------------------------------------------------------------
   13. Modals
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 90;
    display: grid; place-items: center;
    padding: 22px;
    background: rgba(6, 4, 12, .68);
    backdrop-filter: blur(14px);
    animation: fade .2s var(--ease-soft);
}
html[data-theme="light"] .modal-backdrop { background: rgba(50, 34, 70, .38); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
    width: min(620px, 96vw);
    max-height: 90vh;
    overflow: auto;
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    animation: modal-in .32s var(--ease) both;
}
.modal.wide { width: min(1180px, 97vw); }
.modal.narrow { width: min(440px, 96vw); }
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h3 { font-size: var(--fs-xl); }
.modal-close {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-xl);
    line-height: 1;
    color: var(--muted);
    flex: none;
    transition: .2s;
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); transform: rotate(90deg); }

.modal-tools {
    position: sticky; top: -24px; z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 10px;
    padding: 10px 0 14px;
    margin-bottom: 4px;
    background: var(--surface-solid);
}

.note { font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.note code { padding: 2px 6px; border-radius: 5px; background: var(--surface-3); color: var(--brand-4); font-family: var(--font-mono); font-size: var(--fs-xs); }

.stack-form { display: grid; gap: 15px; }
.consent { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.consent input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand-1); flex: none; }

.pron-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 9px;
    margin-bottom: 18px;
}

.rule-list { display: grid; gap: 7px; }
.rule-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) 78px 96px 40px;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-xs);
}
.rule-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-row button { color: var(--faint); font-size: var(--fs-md); transition: .2s; }
.rule-row button:hover { color: var(--bad); }

/* --------------------------------------------------------------------------
   14. Toasts / busy
   -------------------------------------------------------------------------- */
.toast-stack {
    position: fixed; right: 22px; bottom: 22px; z-index: 120;
    display: grid; gap: 10px;
    max-width: min(390px, calc(100vw - 44px));
}
.toast {
    position: relative;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 17px 14px 19px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    animation: toast-in .38s var(--ease) both;
    transition: opacity .25s, transform .25s var(--ease);
    overflow: hidden;
}
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--good); }
.toast.error::before { background: var(--bad); }
.toast.warning::before { background: var(--warn); }
.toast strong { display: block; font-size: var(--fs-sm); font-weight: 700; }
.toast p { font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; margin-top: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(26px) scale(.96); } to { opacity: 1; transform: none; } }

.busy {
    position: fixed; inset: 0; z-index: 140;
    display: grid; place-items: center;
    background: rgba(6, 4, 12, .74);
    backdrop-filter: blur(10px);
    animation: fade .2s;
}
html[data-theme="light"] .busy { background: rgba(50, 34, 70, .45); }
.busy-card {
    display: grid; place-items: center; gap: 6px;
    padding: 34px 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.busy-card strong { font-family: var(--font-display); font-size: var(--fs-lg); }
.busy-card span { font-size: var(--fs-xs); color: var(--muted); }
.busy-ring { display: flex; align-items: flex-end; gap: 6px; height: 46px; margin-bottom: 14px; }
.busy-ring i {
    display: block;
    width: 8px; height: 100%;
    border-radius: var(--r-pill);
    background: var(--grad-hot);
    animation: eq 1.05s var(--ease-soft) infinite;
}
.busy-ring i:nth-child(2) { animation-delay: -.35s; }
.busy-ring i:nth-child(3) { animation-delay: -.7s; }

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1400px) {
    .voice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1240px) {
    .studio-grid, .dialogue-layout, .design-layout, .transcribe-grid { grid-template-columns: minmax(0, 1fr); }
    .hero { grid-template-columns: minmax(0, 1fr); }
    .hero-visual { display: none; }
    .voice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tools-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1024px) {
    :root { --sidebar-w: 0px; }
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; top: 0; left: 0;
        width: 274px;
        transform: translateX(-104%);
        transition: transform .34s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: none; }
    .only-mobile { display: grid; }
    .top-actions .btn.ghost span { display: none; }
}
@media (max-width: 820px) {
    .voice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modal-tools { grid-template-columns: minmax(0, 1fr); position: static; }
    .history-item { grid-template-columns: 44px minmax(0, 1fr); }
    .history-meta { grid-column: 2; }
    .history-actions { grid-column: 2; }
    .rule-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; }
    .rule-row span:nth-child(3), .rule-row span:nth-child(4) { display: none; }
    .segment { grid-template-columns: minmax(0, 1fr); }
    .tools-bar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .voice-grid { grid-template-columns: minmax(0, 1fr); }
    .views { padding: 16px; padding-bottom: 60px; }
    .card { padding: 16px; }
    .hero { padding: 22px; }
    .top-actions .btn:not(.solid) { display: none; }
    .inline-actions { grid-template-columns: 1fr; }
    .toast-stack { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}

/* ==========================================================================
   16. Footer
   ========================================================================== */
.site-footer {
    position: relative;
    margin-top: 80px;
    padding: 0 var(--gutter) 5px;
    border-top: 1px solid var(--line);
    overflow: hidden;
}
.footer-glow {
    position: absolute; left: 50%; top: -160px;
    width: 720px; height: 320px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, var(--aurora-1), transparent 72%);
    opacity: .55;
    pointer-events: none;
}

.footer-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr);
    gap: 36px;
    padding: 15px 0 15px;
}

.footer-brand { display: flex; align-items: flex-start; gap: 14px; }
.footer-brand strong { display: block; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.02em; }
.footer-brand p { margin-top: 7px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.65; max-width: 42ch; }

.footer-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
.footer-col { display: flex; flex-direction: column; gap: 5px; }
.footer-col h4 {
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 3px;
}
.footer-col a {
    position: relative;
    width: fit-content;
    font-size: var(--fs-sm);
    color: var(--muted);
    transition: color .2s var(--ease-soft), transform .2s var(--ease);
}
.footer-col a::after {
    content: '';
    position: absolute; left: 0; bottom: -2px;
    width: 100%; height: 1px;
    background: var(--grad-hot);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .28s var(--ease);
}
.footer-col a:hover { color: var(--text); transform: translateX(2px); }
.footer-col a:hover::after { transform: scaleX(1); }

.footer-bar {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding-top: 0;
    border-top: 1px solid var(--line);
    font-size: var(--fs-xs);
    color: var(--faint);
    flex-wrap: wrap;
}
.footer-note { color: var(--muted); }

/* ==========================================================================
   17. Public information pages
   ========================================================================== */
.page-body { display: flex; flex-direction: column; min-height: 100vh; }

.page-top {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 20px;
    padding: 14px var(--gutter);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(24px) saturate(140%);
}
.page-top .brand { border-bottom: 0; padding: 0; }
.page-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.page-nav a { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); transition: color .2s; }
.page-nav a:hover { color: var(--text); }
.page-nav a.btn { color: #fff; }

.theme-switch.compact { grid-template-columns: 1fr 1fr; width: 92px; }
.theme-switch.compact button { padding: 0; }

.page-main { position: relative; z-index: 1; flex: 1; padding: 0 var(--gutter); }

.doc-hero { max-width: 1100px; margin: 0 auto; padding: 52px 0 30px; text-align: center; }
.doc-hero h1 { font-size: clamp(30px, 4.4vw, 50px); margin-bottom: 12px; }
.doc-updated { font-size: var(--fs-sm); color: var(--muted); }

.doc-layout {
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto 60px;
    align-items: start;
}

.doc-toc {
    position: sticky; top: 96px;
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.doc-toc h4 {
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 8px;
}
.doc-toc a {
    padding: 8px 11px;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    color: var(--muted);
    line-height: 1.4;
    transition: .2s var(--ease-soft);
}
.doc-toc a:hover { background: var(--surface-3); color: var(--text); }
.doc-toc a.active { background: rgba(255, 77, 109, .12); color: var(--brand-1); font-weight: 600; }

.doc-body { padding: 34px; }
.doc-section {
    padding-bottom: 26px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--line);
    animation: view-in .5s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 45ms);
}
.doc-section:last-of-type { border-bottom: 0; }
.doc-section h2 { font-size: var(--fs-xl); margin-bottom: 12px; }
.doc-section p { font-size: var(--fs-md); line-height: 1.8; color: var(--text-2); margin-bottom: 12px; }
.doc-section p:last-child { margin-bottom: 0; }
.doc-section ul { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.doc-section li { font-size: var(--fs-md); line-height: 1.75; color: var(--text-2); }
.doc-section a { color: var(--brand-1); font-weight: 600; }

.doc-cta {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    margin-top: 30px; padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: linear-gradient(100deg, rgba(255, 77, 109, .08), rgba(160, 107, 255, .06));
    flex-wrap: wrap;
}
.doc-cta strong { display: block; font-family: var(--font-display); font-size: var(--fs-md); }
.doc-cta span { display: block; font-size: var(--fs-xs); color: var(--muted); }

/* ---- Contact form ---- */
.support-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr);
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto 60px;
    align-items: start;
}
.support-card { padding: 28px; }
.support-aside { display: grid; gap: 14px; }
.support-aside .card { padding: 18px 20px; }
.support-aside h3 { font-size: var(--fs-md); margin-bottom: 7px; }
.support-aside p { font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; }
.support-aside a { color: var(--brand-1); font-weight: 600; }

.field-hint { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--faint); }
.field-hint.warn { color: var(--warn); }

/* Off-screen: bots fill it, people never see it. */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: auto;
    width: 1px; height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.captcha-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: end;
}
.captcha-image { position: relative; display: flex; align-items: center; gap: 8px; }
.captcha-image img {
    display: block;
    width: 190px; height: 64px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: #faf7f3;
}
.captcha-image button {
    width: 40px; height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-3);
    font-size: var(--fs-md);
    color: var(--muted);
    transition: .22s var(--ease);
}
.captcha-image button:hover { color: var(--text); transform: rotate(180deg); }

.flash {
    display: grid; gap: 3px;
    padding: 13px 17px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    background: var(--surface-3);
}
.flash.ok { border-left-color: var(--good); color: var(--good); }
.flash.bad { border-left-color: var(--bad); color: var(--bad); }
.flash a { color: inherit; text-decoration: underline; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ==========================================================================
   18. Responsive additions
   ========================================================================== */
@media (max-width: 1024px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); }
    .doc-toc { position: static; flex-direction: row; flex-wrap: wrap; }
    .doc-toc h4 { width: 100%; margin-bottom: 2px; }
    .support-layout { grid-template-columns: minmax(0, 1fr); }
    .footer-inner { grid-template-columns: minmax(0, 1fr); gap: 26px; }
}
@media (max-width: 700px) {
    .page-top { flex-wrap: wrap; gap: 12px; }
    .page-nav { width: 100%; margin-left: 0; justify-content: space-between; gap: 12px; }
    .page-nav a { font-size: var(--fs-xs); }
    .footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    .footer-bar { flex-direction: column; align-items: flex-start; gap: 6px; }
    .captcha-row { grid-template-columns: minmax(0, 1fr); }
    .captcha-image img { width: 100%; max-width: 240px; height: auto; }
    .doc-body { padding: 22px; }
    .support-card { padding: 20px; }
    .doc-cta { flex-direction: column; align-items: flex-start; }
    .doc-cta .btn { width: 100%; }
}
@media (max-width: 460px) {
    .footer-links { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
