@font-face { font-family:"Fraunces"; font-weight:600; font-style:normal; font-display:swap; src:url(fonts/fraunces-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family:"Fraunces"; font-weight:600; font-style:italic; font-display:swap; src:url(fonts/fraunces-latin-600-italic.woff2) format("woff2"); }
@font-face { font-family:"Fraunces"; font-weight:400; font-style:italic; font-display:swap; src:url(fonts/fraunces-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family:"Inter"; font-weight:400; font-display:swap; src:url(fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family:"Inter"; font-weight:500; font-display:swap; src:url(fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family:"Inter"; font-weight:600; font-display:swap; src:url(fonts/inter-latin-600-normal.woff2) format("woff2"); }

:root {
  --navy-1:#0b1530; --navy-2:#121f44; --navy-3:#182a56;
  --gold:#c9a961; --gold-soft:#e3c988; --gold-deep:#a3813f;
  --cream:#f3ecd9; --cream-mute:rgba(243,236,217,.72); --cream-dim:rgba(243,236,217,.5);
  --line:rgba(243,236,217,.14); --card:rgba(24,42,86,.55);
  --serif:"Fraunces", Georgia, serif; --sans:"Inter", -apple-system, system-ui, "Segoe UI", sans-serif;
  --gold-grad:linear-gradient(135deg, #e3c988 0%, #c9a961 45%, #a3813f 100%);
  --ease:cubic-bezier(.16,1,.3,1);
  --st:env(safe-area-inset-top,0px); --sb:env(safe-area-inset-bottom,0px);
  --sl:env(safe-area-inset-left,0px); --sr:env(safe-area-inset-right,0px);
  --band:42%; --op:.5;
}
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; height:100%; overflow:hidden; background:var(--navy-1); color:var(--cream); font-family:var(--sans); }
body { background:radial-gradient(1200px 700px at 15% -10%, rgba(201,169,97,.10), transparent 60%),
  linear-gradient(180deg, var(--navy-1), var(--navy-2)); }
button, input, textarea, select { font-family:inherit; color:inherit; }
button { cursor:pointer; border:none; background:none; }
.hidden { display:none !important; }

/* ---------- buttons ---------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:12px 20px; border-radius:999px;
  font-size:15px; font-weight:600; color:var(--cream); background:rgba(243,236,217,.06); border:1px solid var(--line);
  transition:transform .2s var(--ease), background .2s, border-color .2s; white-space:nowrap; }
.btn:hover { background:rgba(243,236,217,.1); border-color:rgba(243,236,217,.28); }
.btn:active { transform:scale(.97); }
.btn.gold { background:var(--gold-grad); color:var(--navy-1); border:none; box-shadow:0 8px 24px rgba(201,169,97,.25); }
.btn.gold:hover { filter:brightness(1.06); }
.btn.sm { padding:8px 14px; font-size:13px; }
.btn.danger { color:#fca5a5; }
.icon-btn { width:42px; height:42px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  background:rgba(243,236,217,.06); border:1px solid var(--line); font-size:18px; color:var(--cream); }
.icon-btn:hover { background:rgba(243,236,217,.12); }
.eyebrow { font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); font-weight:600; }
.eyebrow::before { content:"●"; font-size:7px; vertical-align:2px; margin-right:7px; }

.wordmark { font-family:var(--serif); font-weight:600; font-size:20px; color:var(--cream); letter-spacing:-.01em; white-space:nowrap; }
.wordmark b { color:var(--gold); font-weight:600; }
.wordmark small { font-family:var(--sans); font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); margin-left:10px; font-weight:600; vertical-align:3px; }

/* ---------- editor ---------- */
#editor { height:100%; display:flex; flex-direction:column; gap:14px; max-width:1100px; margin:0 auto;
  padding:calc(14px + var(--st)) calc(16px + var(--sr)) calc(14px + var(--sb)) calc(16px + var(--sl)); }
.topbar { display:flex; align-items:center; gap:10px; }
.topbar .sp { flex:1; }
.titlebar { display:flex; gap:10px; align-items:center; }
#scriptTitle { flex:1; min-width:0; background:transparent; border:none; border-bottom:1px solid var(--line); font-family:var(--serif);
  font-size:26px; font-weight:600; padding:6px 2px; color:var(--cream); }
#scriptTitle:focus { outline:none; border-color:var(--gold); }
.marks { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.marks .lbl { font-size:12px; color:var(--cream-dim); margin-right:2px; }
.chip { font-size:13px; padding:7px 12px; border-radius:999px; border:1px solid var(--line); background:rgba(243,236,217,.04); color:var(--cream-mute); }
.chip:hover { border-color:var(--gold); color:var(--cream); }
.chip.on { background:rgba(201,169,97,.18); border-color:var(--gold); color:var(--gold-soft); }
#script { flex:1; min-height:120px; width:100%; resize:none; background:rgba(11,21,48,.6); border:1px solid var(--line);
  border-radius:18px; padding:18px; font-size:17px; line-height:1.6; color:var(--cream); }
#script:focus { outline:none; border-color:rgba(201,169,97,.6); box-shadow:0 0 0 4px rgba(201,169,97,.12); }
#script::placeholder { color:var(--cream-dim); }
.statsrow { display:flex; gap:14px; flex-wrap:wrap; font-size:13px; color:var(--cream-mute); align-items:center; }
.statsrow b { color:var(--gold-soft); font-weight:600; }
.actions { display:flex; gap:10px; flex-wrap:wrap; }
.actions .btn { flex:1; min-width:160px; padding:15px 20px; font-size:16px; }

/* ---------- sheets / modals ---------- */
.overlay { position:fixed; inset:0; z-index:50; background:rgba(5,10,25,.6); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
  display:flex; align-items:flex-end; justify-content:center; animation:fade .25s; }
@media (min-width:760px) { .overlay { align-items:center; } }
@keyframes fade { from { opacity:0 } }
@keyframes up { from { transform:translateY(30px); opacity:0 } }
.sheet { width:100%; max-width:720px; max-height:88vh; overflow:auto; background:linear-gradient(180deg, var(--navy-3), var(--navy-2));
  border:1px solid var(--line); border-radius:24px 24px 0 0; padding:22px 20px calc(22px + var(--sb)); animation:up .35s var(--ease); }
@media (min-width:760px) { .sheet { border-radius:24px; } }
.sheet h2 { font-family:var(--serif); font-weight:600; font-size:26px; margin:6px 0 4px; }
.sheet h2 em { color:var(--gold); }
.sheet p.sub { margin:0 0 16px; color:var(--cream-mute); font-size:14px; line-height:1.5; }
.sheet-head { display:flex; align-items:flex-start; gap:10px; }
.sheet-head > div { flex:1; }
.list { display:flex; flex-direction:column; gap:10px; }
.item { display:flex; gap:12px; align-items:center; padding:14px; border-radius:16px; background:var(--card); border:1px solid var(--line); }
.item.active { border-color:var(--gold); }
.item .main { flex:1; min-width:0; cursor:pointer; }
.item .t { font-weight:600; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item .m { font-size:12px; color:var(--cream-dim); margin-top:3px; }
.item .ops { display:flex; gap:6px; }
.tpl-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); gap:10px; }
.tpl { text-align:left; padding:16px; border-radius:16px; background:var(--card); border:1px solid var(--line); color:var(--cream); }
.tpl:hover { border-color:var(--gold); transform:translateY(-2px); }
.tpl .k { font-size:11px; color:var(--gold); letter-spacing:.12em; text-transform:uppercase; font-weight:600; }
.tpl .t { font-family:var(--serif); font-size:18px; font-weight:600; margin:6px 0 4px; }
.tpl .d { font-size:13px; color:var(--cream-mute); line-height:1.45; }
.helpgrid { display:grid; grid-template-columns:auto 1fr; gap:8px 14px; font-size:14px; color:var(--cream-mute); }
.helpgrid kbd, .helpgrid code { font-family:var(--sans); font-size:12px; padding:3px 8px; border-radius:6px; background:rgba(243,236,217,.08);
  border:1px solid var(--line); color:var(--cream); white-space:nowrap; }
.sheet h3 { font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); margin:22px 0 10px; }

/* confirm */
.dialog { max-width:420px; border-radius:20px; margin:auto auto calc(20px + var(--sb)); }
.dialog .row { display:flex; gap:10px; justify-content:flex-end; margin-top:16px; flex-wrap:wrap; }

/* ---------- onboarding ---------- */
#onboard { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column;
  background:radial-gradient(900px 600px at 80% 0%, rgba(201,169,97,.16), transparent 60%), linear-gradient(180deg, var(--navy-1), var(--navy-3));
  padding:calc(20px + var(--st)) calc(22px + var(--sr)) calc(22px + var(--sb)) calc(22px + var(--sl)); }
#onboard .slides { flex:1; display:flex; align-items:center; justify-content:center; }
.slide { max-width:560px; display:none; animation:up .5s var(--ease); }
.slide.on { display:block; }
.slide h1 { font-family:var(--serif); font-weight:600; font-size:clamp(34px, 8vw, 54px); line-height:1.08; margin:14px 0 14px; letter-spacing:-.02em; }
.slide h1 em { color:var(--gold); font-style:italic; }
.slide p { color:var(--cream-mute); font-size:16px; line-height:1.6; margin:0 0 12px; }
.slide ul { padding:0; margin:18px 0 0; list-style:none; display:flex; flex-direction:column; gap:10px; }
.slide li { display:flex; gap:12px; font-size:15px; color:var(--cream); line-height:1.45; }
.slide li span { color:var(--gold); flex:none; }
.ob-foot { display:flex; align-items:center; gap:12px; }
.dots { display:flex; gap:7px; flex:1; }
.dots i { width:8px; height:8px; border-radius:99px; background:var(--line); transition:all .3s var(--ease); }
.dots i.on { width:26px; background:var(--gold); }

/* ---------- prompter ---------- */
#prompter { position:fixed; inset:0; display:none; background:#050a18; touch-action:none; z-index:10; }
#prompter.camera { background:#000; }
#stage { position:absolute; overflow:hidden; display:none; background:#000; }
#prompter.camera #stage { display:block; }
#cam { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
#cam.mirror { transform:scaleX(-1); }
#grid { position:absolute; inset:0; pointer-events:none; display:none;
  background:
    linear-gradient(to right, transparent calc(33.333% - .5px), rgba(255,255,255,.35) calc(33.333% - .5px), rgba(255,255,255,.35) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.35) calc(66.666% - .5px), rgba(255,255,255,.35) calc(66.666% + .5px), transparent calc(66.666% + .5px)),
    linear-gradient(to bottom, transparent calc(33.333% - .5px), rgba(255,255,255,.35) calc(33.333% - .5px), rgba(255,255,255,.35) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.35) calc(66.666% - .5px), rgba(255,255,255,.35) calc(66.666% + .5px), transparent calc(66.666% + .5px)); }
#safe { position:absolute; inset:0; pointer-events:none; display:none; }
#safe .z { position:absolute; background:repeating-linear-gradient(45deg, rgba(201,169,97,.16) 0 8px, rgba(201,169,97,.05) 8px 16px); }
#safe .z.t { left:0; right:0; top:0; height:14%; border-bottom:1px dashed var(--gold); }
#safe .z.b { left:0; right:0; bottom:0; height:22%; border-top:1px dashed var(--gold); }
#safe .z.r { right:0; top:14%; bottom:22%; width:15%; border-left:1px dashed var(--gold); }
#safe .lab { position:absolute; left:8px; bottom:calc(22% + 6px); font-size:10px; letter-spacing:.1em; text-transform:uppercase; color:var(--gold-soft); text-shadow:0 1px 2px #000; }
#wmPreview { position:absolute; pointer-events:none; opacity:.9; max-width:24%; display:none; }
#fmtTag { position:absolute; right:8px; top:8px; font-size:11px; padding:3px 8px; border-radius:6px; background:rgba(0,0,0,.5); color:var(--cream); pointer-events:none; }

#band { position:absolute; inset:0; overflow:hidden; }
#viewport { position:absolute; inset:0; overflow:hidden; }
#text { position:absolute; left:0; right:0; margin:0 auto; width:min(90%, 1300px); line-height:1.42; font-family:var(--sans); font-weight:600;
  color:var(--cream); will-change:transform; word-wrap:break-word; }
#text .ln { min-height:1.42em; }
#text em { font-style:normal; color:var(--gold-soft); }
#text .note { display:inline-block; font-family:var(--serif); font-style:italic; font-weight:400; font-size:.62em; color:var(--cream-dim);
  border-left:2px solid var(--gold-deep); padding:0 .5em; margin:0 .2em; line-height:1.3; vertical-align:middle; }
#text .pause { display:inline-block; font-size:.5em; letter-spacing:.12em; padding:.15em .7em; border:1.5px solid var(--gold); border-radius:999px;
  color:var(--gold); vertical-align:middle; margin:0 .3em; font-weight:600; }
#text .scene { font-size:.45em; letter-spacing:.16em; text-transform:uppercase; color:var(--gold); padding:.6em 0 .2em; border-bottom:1px solid rgba(201,169,97,.35); margin-bottom:.3em; }
#text.voice .w.read { opacity:.4; }
#text.voice .w.cur { text-decoration:underline; text-decoration-color:var(--gold); text-decoration-thickness:3px; text-underline-offset:.15em; }
#text.mirrored { transform-origin:center; }
#guide { position:absolute; left:0; right:0; top:35%; height:0; border-top:2px solid rgba(201,169,97,.55); pointer-events:none; }
#guide::before, #guide::after { content:""; position:absolute; top:-9px; border:8px solid transparent; }
#guide::before { left:6px; border-left-color:var(--gold); }
#guide::after { right:6px; border-right-color:var(--gold); }
#progress { position:absolute; top:0; left:0; height:3px; background:var(--gold-grad); width:0; z-index:3; }

#prompter.camera #band { top:var(--st); bottom:auto; height:var(--band); background:rgba(5,10,24,var(--op)); border-bottom:1px solid rgba(201,169,97,.25); z-index:2; }
#prompter.camera #guide { top:30%; }
#prompter.camera #text { width:min(92%, 1100px); text-shadow:0 1px 3px rgba(0,0,0,.6); }
#prompter.camera #progress { top:var(--st); }

/* top-right status pills */
#pills { position:absolute; right:calc(12px + var(--sr)); top:calc(12px + var(--st)); z-index:6; display:flex; gap:6px; pointer-events:none; }
#prompter.camera #pills { top:calc(var(--st) + var(--band) * 0 + 8px); }
.pill { font-size:11px; padding:4px 9px; border-radius:999px; background:rgba(5,10,24,.75); border:1px solid var(--line); color:var(--cream-mute); }
.pill.gold { color:var(--gold-soft); border-color:rgba(201,169,97,.5); }
.pill.live::before { content:"●"; color:#4ade80; margin-right:5px; }

/* prompter bottom bar (text mode) */
#pBar { position:absolute; left:50%; bottom:calc(16px + var(--sb)); transform:translateX(-50%); z-index:6; display:flex; gap:10px; align-items:center;
  padding:8px 10px; border-radius:999px; background:rgba(11,21,48,.85); border:1px solid var(--line); -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px);
  transition:opacity .4s; }
#pBar.fade, #help.fade { opacity:0; pointer-events:none; }
#pBar .speedmini { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--cream-mute); padding:0 6px; }
#pBar input[type=range] { width:110px; }
#playBtn { width:52px; height:52px; border-radius:50%; background:var(--gold-grad); color:var(--navy-1); font-size:20px; display:flex; align-items:center; justify-content:center; }
#help { position:absolute; left:calc(14px + var(--sl)); bottom:calc(20px + var(--sb)); z-index:5; font-size:11px; color:var(--cream-dim); line-height:1.7; transition:opacity .4s; }
@media (hover:none) { #help { display:none; } }
#prompter.camera #pBar, #prompter.camera #help { display:none; }

/* camera bar */
#camBar { position:absolute; left:0; right:0; bottom:0; z-index:6; display:none; justify-content:space-around; align-items:center;
  padding:14px calc(16px + var(--sr)) calc(16px + var(--sb)) calc(16px + var(--sl)); background:linear-gradient(transparent, rgba(0,0,0,.6)); }
#prompter.camera #camBar { display:flex; }
.round { width:52px; height:52px; border-radius:50%; font-size:20px; display:flex; align-items:center; justify-content:center; color:var(--cream);
  background:rgba(11,21,48,.7); border:1px solid var(--line); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px); position:relative; }
.round.on { background:var(--gold-grad); color:var(--navy-1); border:none; }
.round:disabled { opacity:.35; }
.round .badge { position:absolute; top:-4px; right:-4px; min-width:20px; height:20px; border-radius:10px; background:var(--gold); color:var(--navy-1);
  font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; padding:0 5px; }
#recBtn { width:78px; height:78px; border-radius:50%; border:4px solid var(--cream); display:flex; align-items:center; justify-content:center; }
#recBtn span { width:60px; height:60px; border-radius:50%; background:#e5484d; transition:all .25s var(--ease); }
#recBtn.recording span { width:30px; height:30px; border-radius:8px; }
#timer { position:absolute; left:50%; transform:translateX(-50%); bottom:calc(112px + var(--sb)); z-index:6; background:rgba(229,72,77,.92);
  padding:5px 12px; border-radius:8px; font-size:15px; font-weight:600; font-variant-numeric:tabular-nums; display:none; }
#timer.show { display:block; }
#countdown { position:absolute; inset:0; display:none; align-items:center; justify-content:center; z-index:7; pointer-events:none;
  font-family:var(--serif); font-size:180px; font-weight:600; color:var(--cream); text-shadow:0 6px 40px rgba(0,0,0,.6); }
#toast { position:fixed; left:50%; top:calc(16px + var(--st)); transform:translateX(-50%); z-index:80; max-width:min(92vw,520px);
  background:rgba(11,21,48,.95); border:1px solid rgba(201,169,97,.5); color:var(--cream); padding:10px 16px; border-radius:14px; font-size:14px;
  line-height:1.4; box-shadow:0 10px 30px rgba(0,0,0,.4); display:none; text-align:center; }
#toast.show { display:block; animation:up .3s var(--ease); }

/* settings sheet */
.set { display:grid; grid-template-columns:110px 1fr auto; gap:12px; align-items:center; padding:10px 0; border-bottom:1px solid var(--line); font-size:14px; }
.set:last-child { border-bottom:none; }
.set > label:first-child, .set > span:first-child { color:var(--cream-mute); }
.set .v { min-width:44px; text-align:right; font-variant-numeric:tabular-nums; color:var(--gold-soft); font-size:13px; }
.set input[type=range] { width:100%; }
.seg { display:flex; flex-wrap:wrap; gap:6px; grid-column:2 / 4; }
.seg button { font-size:13px; padding:7px 12px; border-radius:999px; border:1px solid var(--line); color:var(--cream-mute); background:rgba(243,236,217,.04); }
.seg button.on { background:rgba(201,169,97,.2); border-color:var(--gold); color:var(--gold-soft); }
.switch { grid-column:2 / 4; justify-self:end; position:relative; width:48px; height:28px; }
.switch input { opacity:0; width:0; height:0; position:absolute; }
.switch i { position:absolute; inset:0; border-radius:99px; background:rgba(243,236,217,.15); transition:.2s; }
.switch i::after { content:""; position:absolute; width:22px; height:22px; border-radius:50%; left:3px; top:3px; background:var(--cream); transition:.25s var(--ease); }
.switch input:checked + i { background:var(--gold); }
.switch input:checked + i::after { transform:translateX(20px); background:var(--navy-1); }
.hint { grid-column:1 / 4; font-size:12px; color:var(--cream-dim); margin-top:-4px; line-height:1.45; }
input[type=range] { accent-color:var(--gold); }
select { background:rgba(243,236,217,.06); border:1px solid var(--line); border-radius:10px; padding:8px 10px; font-size:14px; grid-column:2 / 4; }
select option { background:var(--navy-2); }

/* review */
#review { position:fixed; inset:0; z-index:40; background:var(--navy-1); display:none; flex-direction:column; gap:12px;
  padding:calc(12px + var(--st)) calc(12px + var(--sr)) calc(14px + var(--sb)) calc(12px + var(--sl)); }
#review.show { display:flex; }
#review .head { display:flex; align-items:center; gap:10px; }
#review .head h2 { font-family:var(--serif); font-weight:600; font-size:22px; margin:0; flex:1; }
#reviewVid { flex:1; min-height:0; width:100%; object-fit:contain; background:#000; border-radius:16px; }
#takes { display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; }
.take { flex:none; padding:8px 14px; border-radius:12px; border:1px solid var(--line); background:var(--card); font-size:13px; color:var(--cream-mute); }
.take.on { border-color:var(--gold); color:var(--cream); background:rgba(201,169,97,.15); }
.take b { display:block; color:var(--cream); font-size:14px; }
#review .row { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
#review .info { text-align:center; font-size:12px; color:var(--cream-dim); }

/* mode-dependent settings */
body:not(.in-cam) #setSheet .cam-only { display:none; }
body.in-cam #setSheet .tx-only { display:none; }
#prompter.camera #pills { top:auto; right:auto; left:calc(12px + var(--sl)); bottom:calc(112px + var(--sb)); }
