/* ── Dynamic Narrator — theatrical dark theme ─────────────────────── */
:root {
  --bg: #0e0c0a;
  --bg2: #151210;
  --card: #171310;
  --card2: #1d1814;
  --line: #2c241c;
  --text: #e9e0d0;
  --dim: #9a8d7a;
  --faint: #6b6152;
  --gold: #d4a24e;
  --gold-bright: #f0c470;
  --glow: rgba(212, 162, 78, .35);
  --ok: #7fb069;
  --bad: #c56b5a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(212,162,78,.07), transparent 60%),
    radial-gradient(900px 400px at 90% 110%, rgba(120,80,40,.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── header ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29,24,20,.9), rgba(23,19,16,.6));
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-size: 30px; filter: drop-shadow(0 0 12px var(--glow)); }
.brand h1 {
  font-family: var(--serif); font-size: 26px; font-weight: 600;
  margin: 0; letter-spacing: .04em;
  background: linear-gradient(90deg, var(--gold-bright), var(--gold) 60%, #a8792f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; font-size: 11.5px; color: var(--dim); letter-spacing: .12em; font-style: italic; font-family: var(--serif); }
.health { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: .06em; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; background: rgba(0,0,0,.25);
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: all .3s; }
.pill.ok i { background: var(--ok); box-shadow: 0 0 8px rgba(127,176,105,.8); }
.pill.bad i { background: var(--bad); box-shadow: 0 0 8px rgba(197,107,90,.8); }
.pill b { color: var(--text); font-weight: 600; }

/* ── layout ─────────────────────────────────────────────────────── */
main {
  flex: 1;
  width: min(1060px, 94vw);
  margin: 22px auto 18px;
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: 130px; /* room for the dock */
}
.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.card-head:not(.static) { cursor: pointer; user-select: none; }
.card-head h2 {
  font-family: var(--serif); font-size: 19px; font-weight: 600;
  margin: 0; color: var(--gold-bright); letter-spacing: .03em;
}
.card-head .hint { font-size: 11.5px; color: var(--faint); flex: 1; }
.card-head .chev { color: var(--faint); transition: transform .25s; }
.card.collapsed .chev { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card.collapsed .card-head { border-bottom: none; }
.card-body { padding: 16px 18px 18px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.field span em { text-transform: none; letter-spacing: 0; color: var(--faint); font-style: italic; }

textarea, input {
  background: #0f0d0b;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea:focus, input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,162,78,.12);
}
.script-input {
  width: 100%; border: none; border-radius: 0;
  font-family: var(--serif); font-size: 17px; line-height: 1.7;
  background: transparent; padding: 16px 18px;
  min-height: 150px;
}
.script-input:focus { box-shadow: none; }

.row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* ── buttons ────────────────────────────────────────────────────── */
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  letter-spacing: .05em;
  color: var(--text);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 18px;
  cursor: pointer;
  transition: all .18s;
}
.btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #3a2d18, #2a2012);
  border-color: #6d5426;
  color: var(--gold-bright);
}
.btn.primary:hover { box-shadow: 0 0 18px var(--glow); }
.btn.play {
  background: linear-gradient(180deg, #4a381c, #332712);
  border-color: var(--gold);
  color: var(--gold-bright);
  font-size: 14px; padding: 10px 22px;
}
.btn.play:hover { box-shadow: 0 0 22px var(--glow); }

.status { font-size: 12.5px; color: var(--dim); font-family: var(--mono); }
.status.err { color: var(--bad); }

/* ── script view ────────────────────────────────────────────────── */
.script-view {
  padding: 18px 20px 22px;
  display: flex; flex-direction: column; gap: 14px;
  max-height: 46vh;
  overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.empty { color: var(--faint); font-family: var(--serif); font-style: italic; font-size: 15px; text-align: center; padding: 18px 0; }
.frag {
  border-left: 2px solid transparent;
  padding: 8px 14px;
  border-radius: 0 10px 10px 0;
  transition: background .3s, border-color .3s;
  animation: fadein .45s ease both;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.frag .chip {
  display: inline-block;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  color: var(--gold);
  background: rgba(212,162,78,.08);
  border: 1px solid rgba(212,162,78,.25);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 5px;
}
.frag p {
  margin: 0;
  font-family: var(--serif); font-size: 17.5px; line-height: 1.65;
  color: var(--text);
}
.frag.active {
  background: linear-gradient(90deg, rgba(212,162,78,.14), rgba(212,162,78,.03));
  border-left-color: var(--gold);
  box-shadow: 0 0 24px rgba(212,162,78,.10);
}
.frag.active .chip {
  color: var(--gold-bright);
  background: rgba(212,162,78,.2);
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--glow);
}
.frag.done { opacity: .55; }

/* ── dock / narrator strip ──────────────────────────────────────── */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(21,18,16,.88), rgba(14,12,10,.97));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: 0 -12px 40px rgba(0,0,0,.5);
}
.strip-wrap { overflow: hidden; padding: 12px 0 4px; }
.strip {
  display: flex; gap: 10px;
  padding: 4px 22px;
  overflow-x: auto;
  scrollbar-width: none;
  width: max-content;
  min-width: 100%;
}
.strip::-webkit-scrollbar { display: none; }
.strip-empty { color: var(--faint); font-family: var(--serif); font-style: italic; font-size: 14px; padding: 8px 0; }
.strip-chip {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--dim);
  background: rgba(0,0,0,.3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  white-space: nowrap;
  animation: fadein .4s ease both;
  transition: all .25s;
}
.strip-chip .idx {
  font-size: 10px; color: var(--faint);
  border: 1px solid var(--line); border-radius: 50%;
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
}
.strip-chip.active {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: rgba(212,162,78,.14);
  box-shadow: 0 0 18px var(--glow);
  transform: translateY(-2px);
}
.strip-chip.active .idx { color: var(--gold-bright); border-color: var(--gold); }
.strip-chip.done { opacity: .5; }
.strip-chip.voiced::after {
  content: "●";
  font-size: 8px;
  color: var(--ok);
  margin-left: 2px;
}

.transport {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 22px 14px;
}
.progress {
  flex: 1; height: 3px; border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  box-shadow: 0 0 8px var(--glow);
  transition: width .4s;
}
