/* Soulen — Mongolian emotional voice-over platform
   Dark studio UI, no build step (node/npm unavailable on this server). */

:root {
    --bg: #08080c;
    --bg-elev: #101017;
    --panel: #14141d;
    --panel-2: #191924;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);

    --text: #edeef5;
    --text-dim: #a4a5b8;
    --text-faint: #6f7085;

    --violet: #7c5cff;
    --violet-soft: rgba(124, 92, 255, .14);
    --cyan: #22d3ee;
    --pink: #f472b6;
    --green: #34d399;
    --amber: #fbbf24;
    --red: #fb7185;

    --grad: linear-gradient(135deg, #7c5cff 0%, #a855f7 45%, #22d3ee 100%);
    --grad-soft: linear-gradient(135deg, rgba(124, 92, 255, .22), rgba(34, 211, 238, .14));

    --r-sm: 8px;
    --r: 12px;
    --r-lg: 18px;
    --r-xl: 26px;

    --sidebar-w: 248px;
    --shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

/* The browser's own `[hidden] { display: none }` has the lowest priority of
   any rule, so every author class that sets `display` silently overrides it —
   `.btn`, `.alert`, `.tl-audio` and `.tl-analysis` all did. Elements marked
   hidden stayed on screen: a clickable "play the dub" button for cues with no
   dub, a permanent queue-worker warning, and empty audio players. Make the
   attribute authoritative. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

::selection { background: rgba(124, 92, 255, .4); }

/* Ambient glow behind everything */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(60rem 40rem at 12% -10%, rgba(124, 92, 255, .16), transparent 60%),
        radial-gradient(50rem 36rem at 92% 8%, rgba(34, 211, 238, .10), transparent 60%);
}

/* ---------- Typography helpers ---------- */

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.02em; font-weight: 650; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.grad-text {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Brand ---------- */

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--grad);
    display: grid; place-items: center;
    font-weight: 800; font-size: 15px; color: #0b0b12;
    box-shadow: 0 6px 20px rgba(124, 92, 255, .4);
    flex: none;
}
.brand-name { font-weight: 680; letter-spacing: -.02em; font-size: 17px; }

/* ---------- App shell ---------- */

.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    border-right: 1px solid var(--line);
    background: rgba(12, 12, 18, .72);
    backdrop-filter: blur(14px);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-faint);
    padding: 10px 10px 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.nav-item.active { background: var(--violet-soft); color: #fff; }
.nav-item.active .ico { opacity: 1; }
.ico { width: 17px; height: 17px; flex: none; opacity: .75; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

.credit-card {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px;
    background: var(--grad-soft);
}
.meter { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--grad); }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--panel);
}
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--grad); color: #0b0b12;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700; flex: none;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 62px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 0 26px;
    position: sticky; top: 0; z-index: 20;
    background: rgba(8, 8, 12, .78);
    backdrop-filter: blur(14px);
}
.content { padding: 28px 26px 60px; max-width: 1480px; width: 100%; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--panel-2);
    color: var(--text);
    font-size: 14px; font-weight: 550;
    cursor: pointer;
    transition: transform .12s, background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}
.btn:hover { background: #20202c; border-color: rgba(255, 255, 255, .22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
    background: var(--grad);
    border-color: transparent;
    color: #0a0a12;
    font-weight: 650;
    box-shadow: 0 8px 24px rgba(124, 92, 255, .32);
}
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(251, 113, 133, .35); color: var(--red); }
.btn-danger:hover { background: rgba(251, 113, 133, .12); }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Panels, cards ---------- */

.panel {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--panel);
    padding: 20px;
}
.panel-tight { padding: 14px; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 15px 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent);
}
.stat-label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-size: 26px; font-weight: 680; letter-spacing: -.03em; margin-top: 4px; }

/* Project card */
.project-card {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--panel);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .16s, border-color .16s, box-shadow .16s;
}
.project-card:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 92, 255, .4);
    box-shadow: var(--shadow);
}
.thumb {
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(70% 90% at 30% 20%, rgba(124, 92, 255, .35), transparent 70%),
        radial-gradient(60% 80% at 80% 80%, rgba(34, 211, 238, .25), transparent 70%),
        #0d0d14;
    display: grid; place-items: center;
    position: relative;
    border-bottom: 1px solid var(--line);
}
.thumb .play {
    width: 46px; height: 46px; border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    display: grid; place-items: center;
    backdrop-filter: blur(6px);
}
.thumb-badge {
    position: absolute; top: 10px; right: 10px;
}
.project-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Badges, pills ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 12px; font-weight: 550;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, .05);
    color: var(--text-dim);
}
.badge-draft { color: var(--text-dim); }
.badge-ready { color: var(--cyan); border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .1); }
.badge-generating { color: var(--amber); border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .1); }
.badge-done { color: var(--green); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .1); }
.badge-failed { color: var(--red); border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .1); }
.badge-accent { background: var(--violet-soft); color: #c4b5fd; border-color: rgba(124, 92, 255, .4); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13px; font-weight: 550; color: var(--text-dim); }
.hint { font-size: 12px; color: var(--text-faint); }

.input, .select, .textarea {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--text);
    padding: 11px 13px;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: rgba(124, 92, 255, .7);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .18);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a4a5b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 32px;
    cursor: pointer;
}
.input-error { border-color: rgba(251, 113, 133, .7); }
.error { color: var(--red); font-size: 13px; }

.phone-input { display: flex; align-items: stretch; }
.phone-prefix {
    display: flex; align-items: center; gap: 7px;
    padding: 0 13px;
    background: var(--panel-2);
    border: 1px solid var(--line-strong);
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: var(--text-dim);
    font-weight: 550;
    white-space: nowrap;
}
.phone-input .input {
    border-radius: 0 10px 10px 0;
    letter-spacing: .06em;
    font-size: 17px;
}

/* OTP boxes */
.otp-row { display: flex; gap: 10px; justify-content: center; }
.otp-box {
    width: 54px; height: 62px;
    text-align: center;
    font-size: 24px; font-weight: 650;
    background: var(--bg-elev);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, transform .1s;
}
.otp-box:focus {
    outline: none;
    border-color: rgba(124, 92, 255, .8);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .2);
    transform: translateY(-1px);
}
.otp-box.filled { border-color: rgba(124, 92, 255, .45); }

.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.checkbox input { margin-top: 3px; accent-color: var(--violet); width: 15px; height: 15px; flex: none; }

/* Upload dropzone */
.dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--r-lg);
    padding: 26px 20px;
    text-align: center;
    background: rgba(255, 255, 255, .02);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: rgba(124, 92, 255, .6); background: var(--violet-soft); }
.dropzone input[type=file] { display: none; }
.dz-icon {
    width: 42px; height: 42px; margin: 0 auto 10px;
    border-radius: 12px;
    background: var(--grad-soft);
    border: 1px solid var(--line);
    display: grid; place-items: center;
}
.dz-file { color: var(--cyan); font-weight: 550; }

/* Radio cards (source mode picker) */
.option-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.option {
    position: relative;
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    padding: 14px;
    cursor: pointer;
    background: var(--bg-elev);
    transition: border-color .15s, background .15s, transform .12s;
    display: flex; flex-direction: column; gap: 5px;
}
.option:hover { border-color: rgba(255, 255, 255, .25); transform: translateY(-2px); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option input:checked ~ .option-title { color: #fff; }
.option:has(input:checked) {
    border-color: rgba(124, 92, 255, .75);
    background: var(--violet-soft);
    box-shadow: 0 0 0 1px rgba(124, 92, 255, .3);
}
.option-title { font-weight: 600; font-size: 14px; }
.option-desc { font-size: 12px; color: var(--text-faint); line-height: 1.5; }

/* ---------- Alerts ---------- */

.alert {
    border-radius: var(--r);
    padding: 11px 14px;
    font-size: 14px;
    border: 1px solid var(--line-strong);
    background: var(--panel-2);
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .1); color: #a7f3d0; }
.alert-error { border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .1); color: #fecdd3; }
.alert-info { border-color: rgba(34, 211, 238, .3); background: rgba(34, 211, 238, .08); color: #a5f3fc; }
.alert-warn { border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .1); color: #fde68a; }

/* ---------- Auth / landing ---------- */

.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-aside {
    padding: 44px;
    display: flex; flex-direction: column; justify-content: space-between;
    border-right: 1px solid var(--line);
    background:
        radial-gradient(42rem 30rem at 20% 20%, rgba(124, 92, 255, .22), transparent 65%),
        radial-gradient(38rem 26rem at 80% 85%, rgba(34, 211, 238, .14), transparent 65%);
}
.auth-main { padding: 44px; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 408px; }

.feature-list { display: flex; flex-direction: column; gap: 16px; margin-top: 30px; }
.feature { display: flex; gap: 13px; }
.feature-ico {
    width: 36px; height: 36px; flex: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    display: grid; place-items: center;
}

/* Fake waveform used as decoration */
.wave { display: flex; align-items: center; gap: 3px; height: 34px; }
.wave i {
    display: block; width: 3px; border-radius: 99px;
    background: var(--grad);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { height: 22%; opacity: .55; }
    50% { height: 100%; opacity: 1; }
}

/* ---------- Editor (project detail) ---------- */

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }

.cue-list { display: flex; flex-direction: column; gap: 10px; }
.cue {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--panel);
    padding: 13px 14px;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 14px;
    transition: border-color .15s;
}
.cue:hover { border-color: var(--line-strong); }
.cue.is-generated { border-left: 2px solid var(--green); }
.cue-time { font-size: 12px; color: var(--text-faint); display: flex; flex-direction: column; gap: 3px; }
.cue-pos { font-size: 11px; color: var(--violet); font-weight: 650; }
.cue-text { font-size: 15px; line-height: 1.6; }
.cue-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.cue-controls .select, .cue-controls .input { width: auto; min-width: 128px; padding: 7px 11px; font-size: 13px; }
.cue-controls .select { padding-right: 30px; }

.v4-preview {
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.65;
    color: #c4b5fd;
    background: rgba(124, 92, 255, .08);
    border: 1px solid rgba(124, 92, 255, .22);
    border-radius: 10px;
    padding: 9px 11px;
    white-space: pre-wrap;
}

.side-panel { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }

.video-frame {
    width: 100%;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: #000;
    aspect-ratio: 16 / 9;
    display: grid; place-items: center;
    overflow: hidden;
}
.video-frame video { width: 100%; height: 100%; display: block; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--text-faint); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
    font-size: 12px;
    padding: 4px 9px;
    border-radius: 7px;
    border: 1px solid var(--line-strong);
    background: var(--bg-elev);
    color: var(--text-dim);
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.tag-chip:hover { border-color: rgba(124, 92, 255, .6); color: #c4b5fd; background: var(--violet-soft); }

/* ---------- Empty state ---------- */

.empty { text-align: center; padding: 54px 24px; }
.empty-ico {
    width: 58px; height: 58px; margin: 0 auto 16px;
    border-radius: 16px;
    background: var(--grad-soft);
    border: 1px solid var(--line);
    display: grid; place-items: center;
}

/* ---------- Pagination ---------- */

.pagination-wrap { margin-top: 20px; }
.pagination-wrap nav { display: flex; justify-content: center; }
.pagination-wrap svg { width: 16px; height: 16px; }
.pagination-wrap a, .pagination-wrap span {
    color: var(--text-dim);
    font-size: 13px;
}

/* ---------- Mobile ---------- */

@media (max-width: 1100px) {
    .editor { grid-template-columns: minmax(0, 1fr); }
    .side-panel { position: static; }
}

@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { padding: 26px 18px; }
}

@media (max-width: 760px) {
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 60;
        transform: translateX(-100%);
        transition: transform .22s ease;
        background: #0c0c12;
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open::after {
        content: ''; position: fixed; inset: 0; z-index: 50;
        background: rgba(0, 0, 0, .6);
    }
    .content { padding: 20px 16px 48px; }
    .topbar { padding: 0 16px; }
    .cue { grid-template-columns: 1fr; }
    .otp-box { width: 46px; height: 55px; font-size: 21px; }
}

.nav-toggle { display: none; }
@media (max-width: 760px) { .nav-toggle { display: inline-flex; } }

/* ===================================================================
   Vertical timeline — the cue editor
   =================================================================== */

.timeline { position: relative; padding-left: 86px; }

/* The rail itself */
.timeline::before {
    content: '';
    position: absolute;
    left: 74px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(124, 92, 255, .55), rgba(34, 211, 238, .35) 70%, transparent);
}

.tl-item { position: relative; margin-bottom: 12px; }

/* Clock reading, parked to the left of the rail */
.tl-time {
    position: absolute;
    left: -86px;
    top: 14px;
    width: 62px;
    text-align: right;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-faint);
}
.tl-time strong { display: block; color: var(--text-dim); font-size: 13px; font-weight: 600; }

/* The node on the rail */
.tl-dot {
    position: absolute;
    left: -19px;
    top: 18px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--panel-2);
    border: 2px solid rgba(124, 92, 255, .7);
    z-index: 2;
    transition: background .18s, border-color .18s, box-shadow .18s;
}
.tl-item.is-generated .tl-dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, .16); }
.tl-item.is-working .tl-dot { background: var(--amber); border-color: var(--amber); animation: tl-pulse 1.1s ease-in-out infinite; }
.tl-item.is-failed .tl-dot { background: var(--red); border-color: var(--red); }

@keyframes tl-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .45); }
    50% { box-shadow: 0 0 0 7px rgba(251, 191, 36, 0); }
}

/* Gap between two cues */
.tl-gap {
    position: relative;
    height: 26px;
    margin: -4px 0 8px;
    display: flex;
    align-items: center;
}
.tl-gap span {
    font-size: 11px;
    color: var(--text-faint);
    background: var(--bg);
    padding: 0 7px;
    margin-left: -13px;
    border-radius: 99px;
    border: 1px solid var(--line);
}

/* Cue card */
.tl-card {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--panel);
    padding: 13px 15px;
    transition: border-color .16s, box-shadow .16s;
}
.tl-card:hover { border-color: var(--line-strong); }
.tl-item.is-generated .tl-card { border-left: 2px solid rgba(52, 211, 153, .6); }
.tl-item.is-failed .tl-card { border-left: 2px solid rgba(251, 113, 133, .6); }

.tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.tl-pos { font-size: 11px; font-weight: 700; color: var(--violet); letter-spacing: .04em; }
.tl-dur { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.tl-text {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    line-height: 1.6;
    padding: 6px 8px;
    margin: 0 -8px;
    resize: vertical;
    min-height: 0;
    transition: background .15s, border-color .15s;
}
.tl-text:hover { background: rgba(255, 255, 255, .03); }
.tl-text:focus {
    outline: none;
    background: var(--bg-elev);
    border-color: rgba(124, 92, 255, .6);
}

.tl-controls { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.tl-controls .select { width: auto; min-width: 118px; padding: 6px 28px 6px 10px; font-size: 12.5px; }

.tl-actions {
    display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
    margin-top: 11px; padding-top: 11px;
    border-top: 1px solid var(--line);
}

/* The v4 script box */
.tl-script {
    width: 100%;
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.65;
    color: #c9b8ff;
    background: rgba(124, 92, 255, .07);
    border: 1px solid rgba(124, 92, 255, .22);
    border-radius: 9px;
    padding: 9px 11px;
    font-family: inherit;
    resize: vertical;
    min-height: 0;
    transition: border-color .15s;
}
.tl-script:focus { outline: none; border-color: rgba(124, 92, 255, .7); background: rgba(124, 92, 255, .1); }
.tl-script::placeholder { color: rgba(201, 184, 255, .4); }

/* Gemini's read of the performance */
.tl-analysis {
    margin-top: 9px;
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg-elev);
    padding: 9px 11px;
    display: grid;
    gap: 4px;
}
.tl-analysis .k { color: var(--text-faint); min-width: 72px; display: inline-block; }

/* Inline audio players */
.tl-audio { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tl-audio audio { height: 32px; max-width: 260px; }
.tl-audio audio::-webkit-media-controls-panel { background: var(--panel-2); }

/* Recorder */
.rec-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--red);
    animation: rec-blink 1s steps(2, start) infinite;
}
@keyframes rec-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .25; } }

.btn-rec { border-color: rgba(251, 113, 133, .4); color: #fecdd3; }
.btn-rec:hover { background: rgba(251, 113, 133, .12); border-color: rgba(251, 113, 133, .6); }
.btn-rec.is-recording { background: rgba(251, 113, 133, .18); border-color: var(--red); color: #fff; }

/* Spinner for in-flight work */
.spin {
    width: 13px; height: 13px; flex: none;
    border: 2px solid rgba(255, 255, 255, .22);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sticky preview rail */
.tl-toolbar {
    position: sticky;
    top: 62px;
    z-index: 15;
    background: rgba(8, 8, 12, .9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 10px 13px;
    margin-bottom: 16px;
}

@media (max-width: 760px) {
    .timeline { padding-left: 30px; }
    .timeline::before { left: 18px; }
    .tl-time {
        position: static;
        width: auto;
        text-align: left;
        margin-bottom: 5px;
        display: flex;
        gap: 8px;
        align-items: baseline;
    }
    .tl-time strong { display: inline; }
    .tl-dot { left: -18px; top: 10px; }
}

/* Scene / dub playback buttons */
.btn-dub {
    border-color: rgba(34, 211, 238, .4);
    color: #a5f3fc;
}
.btn-dub:hover {
    background: rgba(34, 211, 238, .12);
    border-color: rgba(34, 211, 238, .65);
}
/* Re-uses the recording button's "live" treatment while playing */
.btn-dub.is-recording,
.btn-ghost.is-recording {
    background: rgba(34, 211, 238, .2);
    border-color: var(--cyan);
    color: #fff;
}

/* The cue currently sounding during a full preview */
.tl-item.is-cueing .tl-card {
    border-color: rgba(34, 211, 238, .75);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, .35), 0 8px 26px rgba(34, 211, 238, .12);
}
.tl-item.is-cueing .tl-dot {
    background: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 0 5px rgba(34, 211, 238, .18);
}

/* ---- Scene selection ---- */

.tl-pick { display: inline-flex; align-items: center; cursor: pointer; }
.tl-pick input {
    width: 15px; height: 15px;
    accent-color: var(--violet);
    cursor: pointer;
}

.tl-item.is-picked .tl-card {
    border-color: rgba(124, 92, 255, .65);
    background: linear-gradient(180deg, var(--violet-soft), var(--panel) 60%);
}
.tl-item.is-picked .tl-dot { background: var(--violet); border-color: var(--violet); }

.scene-bar {
    position: sticky;
    top: 132px;
    z-index: 14;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(124, 92, 255, .5);
    border-radius: var(--r);
    background: rgba(18, 16, 30, .94);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
