:root {
  --bg: #0E0F0C; --ink: #F4F4EE; --dim: #9A9C94; --lime: #D6FF3D; --red: #E5484D; --card: #1A1B17;
  --fs: 30px; --panel: 42vh;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }

/* login + list */
#login { display: grid; place-items: center; padding: 16px; }
.card { width: min(360px, 100%); background: var(--card); border-radius: 20px; padding: 24px; display: grid; gap: 12px; }
h1 { margin: 0 0 4px; font-size: 24px; }
input { font: inherit; padding: 14px; border-radius: 12px; border: 1px solid #33352E; background: #111210; color: var(--ink); }
.primary { background: var(--lime); color: #0E0F0C; font-weight: 700; padding: 14px; border-radius: 12px; }
.ghost { background: transparent; font-size: 22px; padding: 8px 12px; }
.err { color: var(--red); margin: 0; min-height: 1.2em; }
#list { overflow-y: auto; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
#list header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.item { display: block; width: 100%; text-align: left; background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 10px; }
.item b { display: block; font-size: 17px; margin-bottom: 4px; }
.item small { color: var(--dim); }
.tag { display: inline-block; background: #2A2C26; border-radius: 8px; padding: 1px 8px; margin-right: 6px; font-size: 12px; color: var(--ink); }

/* prompter */
#prompter { background: #000; overflow: hidden; touch-action: none; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#cam.landscape { object-fit: contain; }   /* a landscape stream is shown whole (no hidden zoom) */
#panel { position: absolute; left: 0; right: 0; top: 0; height: var(--panel); background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,.58)); padding-top: env(safe-area-inset-top); display: flex; flex-direction: column; }
#text { flex: 1; overflow-y: auto; padding: 14px 20px 40vh; font-size: var(--fs); line-height: 1.35; font-weight: 600; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#text p { margin: 0 0 .7em; }
#text p .n { font-size: .45em; color: var(--dim); margin-right: .4em; vertical-align: middle; font-weight: 700; }
#text p.cur { color: var(--lime); }
#text.line p { display: none; }
#text.line p.cur { display: block; }
#text.line p.next { display: block; opacity: .35; font-size: .7em; }
#grip { height: 26px; display: grid; place-items: center; touch-action: none; cursor: ns-resize; }
#grip span { width: 56px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.45); }

#lineNav { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--panel) + 10px); display: flex; align-items: center; gap: 14px; background: rgba(0,0,0,.55); border-radius: 30px; padding: 6px 10px; }
#lineCount { font-weight: 700; min-width: 64px; text-align: center; }
#recInfo { position: absolute; right: 14px; top: calc(var(--panel) + 12px); background: rgba(0,0,0,.6); border-radius: 20px; padding: 6px 12px; display: flex; gap: 8px; align-items: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
#recInfo.paused .dot { animation: none; background: var(--dim); }
@keyframes blink { 50% { opacity: .2; } }

#bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 8px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.round { width: 52px; height: 52px; border-radius: 50%; background: rgba(20,21,18,.8); font-size: 22px; display: grid; place-items: center; }
.round.small { width: 44px; height: 44px; font-size: 17px; }
.round.on { background: var(--lime); color: #0E0F0C; }
#modes { display: flex; background: rgba(20,21,18,.8); border-radius: 22px; padding: 3px; }
.seg { padding: 9px 12px; border-radius: 19px; font-size: 14px; font-weight: 700; color: var(--dim); background: transparent; }
.seg.on { background: var(--ink); color: #0E0F0C; }
.recBtn { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: transparent; display: grid; place-items: center; flex: none; }
.recBtn span { width: 54px; height: 54px; border-radius: 50%; background: var(--red); transition: all .15s; }
.recBtn.on span { width: 28px; height: 28px; border-radius: 7px; }
#review { position: absolute; left: 0; right: 0; bottom: 120px; display: flex; justify-content: center; gap: 14px; }
.pill { padding: 14px 22px; border-radius: 30px; background: rgba(20,21,18,.9); font-weight: 700; font-size: 17px; }
#speed { position: absolute; right: 14px; bottom: 110px; display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.55); border-radius: 26px; padding: 4px; }
#speedVal { min-width: 30px; text-align: center; font-weight: 700; }
#toast { position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); background: rgba(0,0,0,.8); border-radius: 14px; padding: 8px 14px; font-size: 14px; max-width: 90vw; text-align: center; opacity: 0; transition: opacity .25s; pointer-events: none; }
#toast.show { opacity: 1; }
#camSheet { position: absolute; left: 12px; right: 12px; bottom: 110px; background: rgba(14,15,12,.95); border-radius: 18px; padding: 14px; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
#camSheet p { margin: 2px 0; color: var(--dim); font-size: 14px; }
#camSheet .pill { text-align: left; font-size: 15px; padding: 11px 16px; }
#camSheet input[type=range] { width: 100%; accent-color: var(--lime); }
#bar { gap: 6px; }
#bar .round.small { width: 40px; height: 40px; font-size: 16px; }
/* 7 controls don't fit a 360 px phone in one row: the mode switch sits above the bar */
#bar { position: absolute; }
#modes { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 6px; }
#review { bottom: 170px; }
#speed { bottom: 160px; }
#camSheet { bottom: 160px; }
#toast { bottom: 230px; }
