:root {
  --bg: #0A0D12; --surface: #13161B; --surface2: #181D27; --line: #252B37;
  --text: #F5F5F6; --muted: #94969C; --brand: #6938EF; --brand2: #7A5AF8; --rec: #F04438;
  --fs: 44px; --guide: 28%;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: #FDA29B; }
.row { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; justify-content: center; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--surface2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: #373F50; }
button.primary { background: var(--brand); border-color: var(--brand); font-weight: 600; }
button.primary:hover { background: var(--brand2); }
button.ghost, .btn.ghost { background: transparent; }
button.danger { color: #FDA29B; }
input, textarea, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

.view { min-height: 100%; }
.center { display: flex; align-items: center; justify-content: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.narrow { width: min(420px, 92vw); }

.page { max-width: 820px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 48px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 8px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; }
.list li .grow { flex: 1; min-width: 0; }
.list li .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li button, .list li .btn { padding: 8px 12px; font-size: 14px; }
.list .empty { color: var(--muted); justify-content: center; }

.title-input { width: 100%; font-size: 20px; font-weight: 600; margin-bottom: 10px; }
#ed-text { width: 100%; height: calc(100vh - 220px); min-height: 300px; resize: vertical; font-size: 17px; line-height: 1.55; }

/* Prompter */
.prompter { position: fixed; inset: 0; overflow: hidden; background: #000; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.prompter.mirror-cam #cam { transform: scaleX(-1); }
.prompter.pip #cam { inset: auto 16px 104px auto; width: 26vw; max-width: 260px; height: auto; aspect-ratio: auto; opacity: 1;
  border-radius: 12px; border: 1px solid var(--line); z-index: 3; }
#scroller { position: absolute; inset: 0; overflow-y: scroll; scrollbar-width: none; z-index: 1;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.35)); touch-action: pan-y; }
#scroller::-webkit-scrollbar { display: none; }
.prompter.mirror-text #scroller { transform: scaleX(-1); }
#text { max-width: 1100px; margin: 0 auto; padding: 0 max(5vw, 20px); font-size: var(--fs); line-height: 1.38;
  font-weight: 600; letter-spacing: .005em; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
#text p { margin: 0 0 1.1em; }
#text .cue { font-size: .5em; font-weight: 500; font-style: italic; color: #BDB4FE; vertical-align: middle; letter-spacing: .02em; }
.prompter.no-cues #text .cue { display: none; }
#text .pad-top { height: var(--guide); } #text .pad-bot { height: 80vh; }
#guide { position: absolute; left: 0; right: 0; top: var(--guide); height: 0; z-index: 2; pointer-events: none;
  border-top: 2px solid rgba(122, 90, 248, .55); }
#guide::before { content: ""; position: absolute; left: 6px; top: -9px; border: 8px solid transparent; border-left: 12px solid var(--brand2); }

.hud { position: absolute; left: 0; right: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.hud.top { top: 0; padding-top: max(10px, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.7), transparent); }
.hud.bottom { bottom: 0; justify-content: center; padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.8)); flex-wrap: wrap; }
.hud .group { display: flex; align-items: center; gap: 4px; }
.hud .val { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.icon { background: rgba(24,29,39,.8); border-color: rgba(255,255,255,.12); min-width: 44px; height: 44px; padding: 0 12px; border-radius: 22px; }
.icon.wide { min-width: 64px; }
.status { flex: 1; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
#rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #555; }
.recording #rec-dot { background: var(--rec); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.meter { width: 80px; height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: #47CD89; transition: width .08s; }
.rec { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 0; display: grid; place-items: center; }
.rec span { width: 46px; height: 46px; border-radius: 50%; background: var(--rec); transition: all .2s; }
.recording .rec span { width: 24px; height: 24px; border-radius: 6px; }
.rec.off span { background: #777; }

.sheet { position: absolute; right: 12px; bottom: 96px; z-index: 5; width: min(340px, 92vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sheet .group { display: flex; gap: 6px; }
.sheet label { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.sheet label:has(input[type=checkbox]) { justify-content: flex-start; }
.sheet input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); }
.sheet select { padding: 6px 8px; }

#countdown { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; font-size: 28vmin; font-weight: 800; background: rgba(0,0,0,.35); }
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.7); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--brand2); transition: width .2s; }
.banner { position: absolute; left: 12px; right: 12px; top: 70px; z-index: 5; background: rgba(60,10,10,.9); padding: 10px 14px; border-radius: 10px; margin: 0; }
.player-box { width: min(1000px, 94vw); display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.player-box video { width: 100%; max-height: 80vh; background: #000; border-radius: 12px; }

@media (orientation: portrait) and (max-width: 700px) {
  :root { --guide: 22%; }
  .icon { min-width: 40px; height: 40px; padding: 0 10px; }
  .hud.bottom { gap: 8px; }
}
