/* ============================================================================
   THUMBNAIL IA — Design Direction: "PLAYHEAD STUDIO"  (Hard Rule #16 — NEW)
   ----------------------------------------------------------------------------
   Direction: a modern dark VIDEO-EDITOR / player-UI creator chrome.
   Palette / type / layout: near-black editor charcoal + graphite panels · one
     confident play/CTR red (#ff2e2e) + cool cyan scrubber (#22d3ee) · heavy
     CONDENSED grotesk display (Anton, self-hosted) + clean grotesk body + mono
     timecodes · a "playhead" timeline motif on dividers, subtle ticks.
   Signature element: every generated thumbnail renders inside a realistic
     VIDEO-PLAYER CARD (centre play-triangle, red progress/scrubber bar, duration
     badge, mock title + channel + views) — so the member sees the thumbnail exactly
     as it appears in a YouTube / feed. A play-button glyph brands the gate.
   Chrome-vs-artifact discipline: the app chrome is Playhead Studio; the generated
     thumbnail artifact itself is a real composited image (fal.ai scene + high-CTR
     canvas headline) exported at exact platform dimensions.
   ============================================================================ */

/* ---- self-hosted display font (OFL, no CDN — used in CSS + canvas overlay) ---- */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/anton-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/anton-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Surfaces */
  --bg:            #0e0f13;
  --bg-elev:       #16181f;
  --bg-card:       #1b1e27;
  --bg-input:      #12141a;
  --border:        #262a35;
  --border-strong: #3a4152;

  /* Text (WCAG AA on --bg) */
  --text:       #f2f4f8;
  --text-muted: #a6adbd;
  --text-dim:   #838aa3;

  /* Accents */
  --accent:      #ff2e2e;   /* play / CTR red */
  --accent-hov:  #ff5252;
  --accent-2:    #22d3ee;   /* cyan scrubber / secondary */
  --on-accent:   #ffffff;

  /* Status */
  --good: #34d399;
  --warn: #fbbf24;
  --bad:  #ff5063;

  /* Spacing (8px base) */
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px;
  --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  --glow-red:  0 0 0 1px rgba(255,46,46,.35), 0 12px 34px rgba(255,46,46,.22);

  /* Type */
  --font-display: 'Anton', 'Haettenschweiler', 'Arial Narrow', 'Oswald', sans-serif;
  --font-body: ui-sans-serif, -apple-system, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Editor "canvas" backdrop — faint timeline grid, NOT a purple blob. */
.bg-gradient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 82% -10%, rgba(255,46,46,.10), transparent 55%),
    radial-gradient(90% 80% at 8% 6%, rgba(34,211,238,.07), transparent 52%),
    linear-gradient(180deg, #101117 0%, var(--bg) 60%);
}
.bg-gradient::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.020) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.045) 0 2px, transparent 2px 320px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.5), transparent 30%);
  opacity: .6;
}

a { color: var(--accent-2); }

::selection { background: rgba(255,46,46,.32); color: #fff; }

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

/* ---------------- screens ---------------- */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ============================================================
   GATE SCREEN
   ============================================================ */
#gate-screen.active, #key-screen.active {
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-lg);
}

.gate-container, .key-container {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
/* top scrubber rail on the card */
.gate-container::before, .key-container::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent) 0 34%, var(--accent-2) 34% 40%, var(--border-strong) 40%);
}

.gate-header { text-align: center; margin-bottom: var(--space-lg); }

/* play-button glyph (gate brand-mark) */
.play-glyph {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #2a2e3a, #14161d);
  border: 1px solid var(--border-strong);
  box-shadow: var(--glow-red);
}
.play-glyph svg { width: 26px; height: 26px; transform: translateX(2px); }

.brand-mark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(38px, 8vw, 52px);
  line-height: .92;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--text);
}
.brand-mark .em { color: var(--accent); }

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 12px;
  line-height: 1.5;
}
.subtitle strong { color: var(--text); font-weight: 600; }

.community-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(34,211,238,.09);
  border: 1px solid rgba(34,211,238,.28);
  border-radius: 999px;
}

.gate-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }

.form-group { display: flex; flex-direction: column; gap: 7px; text-align: left; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: .03em; text-transform: uppercase; }

input, textarea, select {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(34,211,238,.16);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a6adbd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
  cursor: pointer;
}

.btn-primary {
  font-family: var(--font-body);
  font-size: 15px; font-weight: 700;
  letter-spacing: .02em;
  color: var(--on-accent);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  cursor: pointer;
  transition: background .15s, transform .08s, box-shadow .15s;
  box-shadow: 0 8px 22px rgba(255,46,46,.28);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hov); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  font-family: var(--font-body);
  font-size: 15px; font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 13px 20px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-dim); }

.btn-danger {
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  color: var(--bad);
  background: rgba(255,80,99,.08);
  border: 1px solid rgba(255,80,99,.3);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(255,80,99,.14); }

.error-message {
  color: var(--bad); font-size: 14px; font-weight: 500;
  background: rgba(255,80,99,.08);
  border: 1px solid rgba(255,80,99,.28);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: left;
}

.gate-footer { margin-top: 22px; text-align: center; font-size: 14px; color: var(--text-muted); }
.gate-footer a { font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(34,211,238,.4); }
.gate-footer a:hover { color: #fff; }

/* ============================================================
   KEY SCREEN
   ============================================================ */
.key-container { max-width: 540px; text-align: center; }
.key-container h2 { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1; text-transform: uppercase; letter-spacing: .01em; margin-bottom: 10px; }
.key-inputs { display: flex; flex-direction: column; gap: 18px; margin: 24px 0; text-align: left; }
.key-input-group { display: flex; flex-direction: column; gap: 7px; }
.key-input-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.key-input-wrapper { display: flex; gap: 8px; }
.key-input-wrapper input { flex: 1; }
.key-toggle {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0 14px; cursor: pointer; white-space: nowrap;
}
.key-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.key-status { font-size: 12px; color: var(--text-dim); }
.key-status.saved { color: var(--good); }
.key-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.key-info { margin-top: 22px; text-align: left; border-top: 1px solid var(--border); padding-top: 16px; }
.key-info summary { cursor: pointer; font-weight: 600; color: var(--text-muted); font-size: 14px; list-style: none; }
.key-info summary::-webkit-details-marker { display: none; }
.key-info summary::before { content: '▸ '; color: var(--accent); }
.key-info[open] summary::before { content: '▾ '; }
.key-info-content { margin-top: 12px; font-size: 13.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 10px; }
.key-info-content code { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-2); background: rgba(34,211,238,.08); padding: 1px 6px; border-radius: 4px; }
.key-info-content strong { color: var(--text); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: rgba(14,15,19,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: 26px; text-transform: uppercase; letter-spacing: .02em; line-height: 1;
  display: flex; align-items: center; gap: 10px;
}
.app-title .dot-play {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); display: inline-grid; place-items: center;
  box-shadow: 0 4px 12px rgba(255,46,46,.4);
}
.app-title .dot-play svg { width: 12px; height: 12px; transform: translateX(1px); }
.app-title .em { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 6px; }
.btn-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover { color: var(--text); background: var(--bg-elev); border-color: var(--border); }

.app-main { max-width: 1360px; margin: 0 auto; padding: var(--space-lg) var(--space-lg) var(--space-2xl); }

/* studio grid */
.studio { display: grid; grid-template-columns: 384px 1fr; gap: 24px; align-items: start; }
.studio > * { min-width: 0; } /* COR-026: let the right column shrink; inner scrolls */

/* ---- brief panel ---- */
.brief-panel {
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: sticky; top: 84px;
}
.panel-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: 21px; line-height: 1.15; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text);
}
.panel-kicker { font-size: 13px; line-height: 1.4; color: var(--text-dim); margin-top: 4px; margin-bottom: 18px; }
.panel-kicker span { color: var(--accent-2); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field > label { font-size: 12px; font-weight: 700; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea#f-tema { min-height: 74px; resize: vertical; line-height: 1.5; }

/* segmented control */
.seg { display: flex; gap: 6px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; }
.seg.seg-wrap { flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  background: transparent; border: none;
  border-radius: 7px; padding: 9px 10px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg.seg-wrap button { flex: 0 1 auto; }
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--on-accent); background: var(--accent); box-shadow: 0 3px 10px rgba(255,46,46,.3); }
.seg button.active.cy { background: var(--accent-2); color: #06222b; box-shadow: 0 3px 10px rgba(34,211,238,.28); }

/* playhead / timeline divider (signature) */
.panel-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 0 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim);
}
.panel-divider span { flex: 0 0 auto; }
.panel-divider::after {
  content: ''; flex: 1; height: 12px;
  background:
    repeating-linear-gradient(90deg, var(--border-strong) 0 1px, transparent 1px 11px);
  border-bottom: 2px solid var(--border);
  position: relative;
  mask-image: linear-gradient(90deg, #000 90%, transparent);
}

/* toggle */
.toggle-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; margin: 6px 0 16px; }
.toggle-row input { display: none; }
.toggle-track { flex: 0 0 auto; width: 42px; height: 24px; border-radius: 999px; background: var(--bg-input); border: 1px solid var(--border-strong); position: relative; transition: background .18s; margin-top: 2px; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-muted); transition: transform .18s, background .18s; }
.toggle-row input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-row input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); background: #fff; }
.toggle-label { font-size: 13.5px; color: var(--text); font-weight: 500; display: flex; flex-direction: column; gap: 2px; }
.toggle-label small { color: var(--text-dim); font-weight: 400; font-size: 12px; line-height: 1.4; }

.byok-note { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin: 14px 0; padding: 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-md); }
.byok-note strong { color: var(--accent-2); }

.img-warn {
  display: none;
  font-size: 13px; color: #fed7aa; line-height: 1.5;
  padding: 12px; margin-bottom: 14px;
  background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3); border-radius: var(--radius-md);
}
.img-warn strong { color: var(--warn); }

.btn-gen { width: 100%; margin-top: 4px; font-size: 15px; padding: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-gen svg { width: 18px; height: 18px; }

.gen-status { font-size: 13.5px; margin-top: 12px; min-height: 18px; color: var(--text-muted); }

.gen-progress { margin-top: 14px; }
.gp-bar { height: 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; position: relative; }
.gp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .35s ease; }
.gp-label { font-size: 12.5px; color: var(--text-muted); margin-top: 7px; font-family: var(--font-mono); }

/* ============================================================
   STAGE (right column) — thumbnails as player cards
   ============================================================ */
.stage { min-height: 60vh; }

.stage-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; min-height: 60vh; gap: 22px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 40px 28px; color: var(--text-muted);
}
.stage-empty p { max-width: 460px; font-size: 15px; line-height: 1.6; }
.stage-empty p strong { color: var(--text); }
/* empty-state mock player */
.empty-player {
  width: 260px; max-width: 80%; aspect-ratio: 16/9;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: radial-gradient(circle at 50% 45%, #23262f, #14161c);
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.empty-player::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent) 0 38%, var(--border) 38%);
}
.empty-player .ep-play {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,46,46,.92); display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(255,46,46,.4);
}
.empty-player .ep-play svg { width: 22px; height: 22px; transform: translateX(2px); }

/* deck action bar */
.deck-head { margin-bottom: 18px; }
.deck-slate { font-family: var(--font-mono); font-size: 12px; line-height: 1.3; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; }
.deck-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 3vw, 34px); text-transform: uppercase; line-height: 1.02; margin-top: 4px; }
.deck-concept { color: var(--text-muted); font-size: 14px; margin-top: 6px; max-width: 640px; }

.deck-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.act-btn {
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
  color: var(--text); background: var(--bg-elev);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  padding: 10px 16px; cursor: pointer; transition: border-color .15s, background .15s;
}
.act-btn:hover:not(:disabled) { border-color: var(--text-dim); background: var(--bg-card); }
.act-btn:disabled { opacity: .45; cursor: not-allowed; }
.act-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 18px rgba(255,46,46,.28); }
.act-btn.primary:hover:not(:disabled) { background: var(--accent-hov); }
.act-btn.copied { border-color: var(--good); color: var(--good); }

/* thumbnails grid */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.thumb-grid.portrait { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.thumb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* --- the realistic video-player mock (SIGNATURE) --- */
.player { padding: 12px 12px 0; }
.player-screen {
  position: relative; width: 100%;
  background: #05070c; border-radius: 10px; overflow: hidden;
  border: 1px solid #000;
}
.player-screen.a169 { aspect-ratio: 16 / 9; }
.player-screen.a916 { aspect-ratio: 9 / 16; max-width: 250px; margin: 0 auto; }
.player-screen.a11  { aspect-ratio: 1 / 1; }
.player-screen img.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* placeholder / loading / error inside the screen */
.player-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 18px; text-align: center;
  background: radial-gradient(circle at 50% 42%, #1c2029, #0b0d12);
  color: var(--text-muted);
}
.player-ph .ph-msg { font-size: 13px; font-family: var(--font-mono); letter-spacing: .02em; }
.player-ph.err { color: #fecaca; }
.player-ph.err .ph-ico { font-size: 26px; }
.ph-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.14); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.retry-mini {
  font-size: 12.5px; font-weight: 600; color: #fff;
  background: var(--accent); border: none; border-radius: 7px; padding: 7px 14px; cursor: pointer;
}
.retry-mini:hover { background: var(--accent-hov); }

/* play button overlay (only when a real thumb is present) */
.player-screen .play-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 62px; height: 62px; border-radius: 50%;
  background: rgba(20,10,10,.55); backdrop-filter: blur(2px);
  display: grid; place-items: center; pointer-events: none;
  border: 1.5px solid rgba(255,255,255,.25);
  transition: background .2s;
}
.player-screen .play-center svg { width: 24px; height: 24px; transform: translateX(2px); }
.thumb-card:hover .play-center { background: rgba(255,46,46,.9); }

/* duration badge */
.dur-badge {
  position: absolute; right: 8px; bottom: 12px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.82);
  padding: 1px 6px; border-radius: 4px; letter-spacing: .02em;
}
.player-screen.a916 .dur-badge { bottom: 14px; }

/* red scrubber bar at the very bottom of the screen */
.player-scrub {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(255,255,255,.22);
}
.player-scrub .scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 38%; background: var(--accent); }
.player-scrub .scrub-head { position: absolute; left: 38%; top: 50%; transform: translate(-50%,-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(0,0,0,.35); }

/* meta row: channel dot + title + views */
.player-meta { display: flex; gap: 10px; padding: 12px 4px 14px; }
.chan-dot { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #7a1420); display: grid; place-items: center; font-family: var(--font-display); font-size: 15px; color: #fff; }
.meta-text { min-width: 0; }
.vid-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }

/* per-thumb toolbar */
.thumb-tools { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 12px 14px; margin-top: auto; }
.tt-btn {
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  transition: color .15s, border-color .15s, background .15s;
}
.tt-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.tt-btn:disabled { opacity: .45; cursor: not-allowed; }
.tt-btn svg { width: 13px; height: 13px; }
.tt-btn.dl { color: var(--accent-2); border-color: rgba(34,211,238,.32); }
.tt-btn.dl:hover { background: rgba(34,211,238,.08); }

/* inline headline editor */
.txt-edit { display: none; padding: 0 12px 14px; }
.txt-edit.open { display: block; }
.txt-edit label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); display: block; margin: 6px 0 5px; }
.txt-edit input { font-size: 14px; padding: 9px 11px; }
.txt-edit .te-row { display: flex; gap: 8px; margin-top: 8px; }
.txt-edit .te-row .tt-btn { flex: 1; justify-content: center; }
.te-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }

/* tail (tips) */
.tail { margin-top: var(--space-xl); }
.tail-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.block-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); margin-bottom: 10px; }
.tips { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tips li { font-size: 14px; color: var(--text-muted); padding-left: 20px; position: relative; line-height: 1.5; }
.tips li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer { text-align: center; padding: 30px 22px; border-top: 1px solid var(--border); margin-top: 30px; color: var(--text-dim); font-size: 13px; }
.app-footer strong { color: var(--text-muted); }
.footer-links { margin-top: 8px; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent-2); }
.footer-sep { margin: 0 8px; color: var(--border-strong); }

/* ============================================================
   MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(6,7,10,.72); backdrop-filter: blur(4px); }
.modal-content { position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1; text-transform: uppercase; letter-spacing: .02em; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-primary { flex: 1; }
.modal-field { margin-bottom: 16px; }
.modal-field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 7px; }

/* ============================================================
   STATIC PAGES (about / privacy / data-deletion / 404)
   ============================================================ */
.doc { max-width: 820px; margin: 0 auto; padding: 48px 24px 72px; }
.doc-back { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: 30px; }
.doc-back:hover { color: var(--accent-2); }
.doc h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 6vw, 52px); text-transform: uppercase; line-height: 1; letter-spacing: .01em; margin-bottom: 8px; }
.doc h1 .em { color: var(--accent); }
.doc .lead { color: var(--text-muted); font-size: 17px; margin-bottom: 34px; line-height: 1.6; }
.doc h2 { font-size: 20px; font-weight: 700; margin: 34px 0 12px; color: var(--text); display: flex; align-items: center; gap: 10px; }
.doc h2 .num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.doc h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; color: var(--text); }
.doc p, .doc li { color: var(--text-muted); font-size: 15.5px; line-height: 1.7; }
.doc ul, .doc ol { margin: 12px 0 12px 22px; display: flex; flex-direction: column; gap: 7px; }
.doc strong { color: var(--text); }
.doc a { color: var(--accent-2); }
.doc code { font-family: var(--font-mono); font-size: 13px; color: var(--accent-2); background: rgba(34,211,238,.08); padding: 1px 6px; border-radius: 4px; }
.doc .card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; margin: 20px 0; }
.doc .steps { counter-reset: step; list-style: none; margin-left: 0; }
.doc .steps li { counter-increment: step; padding-left: 46px; position: relative; margin-bottom: 14px; }
.doc .steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; font-family: var(--font-display); font-size: 17px; display: grid; place-items: center; }
.doc .muted { color: var(--text-dim); font-size: 14px; }
.doc-hero-glyph { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #2a2e3a, #14161d); border: 1px solid var(--border-strong); display: grid; place-items: center; box-shadow: var(--glow-red); margin-bottom: 22px; }
.doc-hero-glyph svg { width: 26px; height: 26px; transform: translateX(2px); }

.err-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 16px; }
.err-code { font-family: var(--font-display); font-size: clamp(80px, 22vw, 160px); line-height: .88; color: var(--accent); }
.err-wrap p { color: var(--text-muted); font-size: 17px; }
.err-wrap a { display: inline-block; margin-top: 10px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 940px) {
  .studio { grid-template-columns: 1fr; gap: var(--space-lg); }
  .brief-panel { position: static; }
}
@media (max-width: 560px) {
  .app-main { padding: var(--space-md) var(--space-md) var(--space-xl); }
  .app-header { padding: 12px 14px; }
  .app-title { font-size: 22px; }
  .brief-panel { padding: var(--space-md); }
  .gate-container, .key-container { padding: 32px 20px 22px; }
  .thumb-grid, .thumb-grid.portrait { grid-template-columns: 1fr; gap: var(--space-md); }
  .field-row { grid-template-columns: 1fr; }
  .player-screen.a916 { max-width: 220px; }
  .seg button { padding: 11px 10px; min-height: 40px; }
  .deck-actions { gap: 8px; }
  .act-btn, .tt-btn { min-height: 40px; }
  .btn-icon { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
