/* Quiet, near-black desktop-app look: off-white type at medium weight, hairline borders, pill buttons. */
@font-face { font-family: "Inter"; font-weight: 100 900; src: url("/fonts/Inter-Variable.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Geist Mono"; font-weight: 500; src: url("/fonts/GeistMono-Medium.woff2") format("woff2"); }

:root {
  --bg: #000; --side: #0a0a0a; --panel: #0f0f0f; --raised: #161616; --hover: #1c1c1c; --pill: #252525;
  --line: rgba(255, 255, 255, 0.07); --line-2: rgba(255, 255, 255, 0.12);
  --ink: #f1f1f1; --ink-2: rgba(255, 255, 255, 0.7); --ink-3: rgba(255, 255, 255, 0.42);
  --S: #ff5a5f; --A: #ff9f43; --B: #fecA57; --C: #c8e05c; --D: #7bd389; --ok: #7bd389; --warn: #ffb35c;
  --r: 12px;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font: 450 14px/1.5 "Inter", system-ui, sans-serif; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
::selection { background: rgba(255, 255, 255, 0.2); }

/* ---- buttons: pills ---- */
button { cursor: pointer; border: 0; background: var(--pill); color: var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 500; font-size: 14px;
  transition: background 0.12s, opacity 0.12s; white-space: nowrap; }
button:hover { background: #2f2f2f; }
button.primary { background: var(--ink); color: #020202; }
button.primary:hover { background: #fff; }
button.ghost { background: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--hover); color: var(--ink); }
button:disabled { opacity: 0.4; cursor: default; }
input, textarea, select { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; transition: border-color 0.12s; }
input:focus, textarea:focus, select:focus { border-color: var(--line-2); }
textarea { resize: vertical; }
label { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.mono { font-family: "Geist Mono", ui-monospace, monospace; font-weight: 500; letter-spacing: 0.02em; }
.muted { color: var(--ink-3); }

/* ---- app shell ---- */
#app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
#side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; background: var(--side); border-right: 1px solid var(--line); overflow: auto; }
.side-top { padding: 4px 8px 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.mark { width: 14px; height: 14px; border-radius: 4px; background: var(--ink); box-shadow: inset 0 0 0 3px var(--side), inset 0 0 0 7px var(--ink); }
.side-new { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-weight: 500; margin-bottom: 6px; }
.side-new span { color: var(--ink-3); font-size: 16px; line-height: 1; }
.side-new:hover, #side-nav a:hover, .recent:hover { background: var(--hover); }
#side-nav { display: flex; flex-direction: column; gap: 1px; }
#side-nav a { padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
#side-nav a.on { background: var(--raised); color: var(--ink); }
.side-label { padding: 18px 10px 6px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.recent { display: block; padding: 7px 10px; border-radius: 8px; }
.recent b { display: block; font-weight: 500; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ready { background: var(--ok); } .dot.processing, .dot.queued { background: var(--ink); animation: pulse 1.2s infinite; }
.dot.failed, .dot.needs-images { background: var(--warn); }
.side-foot { margin-top: auto; padding: 10px; display: flex; flex-direction: column; gap: 12px; font-size: 12px; color: var(--ink-3); }
.side-status { display: flex; gap: 8px; align-items: center; }
/* API credit gauge */
.gauge { font-size: 12px; color: var(--ink-3); }
.gauge-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gauge-row b { color: var(--ink); font-weight: 500; font-size: 13px; }
.gauge .bar-progress { margin-top: 6px; height: 5px; }
.gauge .bar-progress > i { background: var(--ok); }
.gauge.mid .bar-progress > i { background: var(--A); }
.gauge.high .bar-progress > i { background: var(--S); }
.gauge-note { margin-top: 6px; }
.phone-only { display: none; }

#pane { min-width: 0; }
#banner { margin: 18px 32px 0; padding: 12px 16px; border-radius: var(--r); background: #1a140c; border: 1px solid rgba(255, 179, 92, 0.25); color: #f3d2a8; font-size: 13px; }
#banner code { background: rgba(0, 0, 0, 0.4); padding: 1px 6px; border-radius: 4px; font-family: "Geist Mono", monospace; font-size: 12px; }
main { max-width: 1080px; margin: 0 auto; padding: 44px 32px 96px; }

/* ---- type ---- */
h1 { font-weight: 500; font-size: 30px; letter-spacing: -0.025em; line-height: 1.2; }
h1 .dim { color: var(--ink-3); }
h2 { font-weight: 500; font-size: 15px; letter-spacing: -0.012em; margin: 40px 0 12px; color: var(--ink); }
.kicker { color: var(--ink-3); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.pick { cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.card.pick:hover { background: var(--raised); border-color: var(--line-2); }
.card h3 { font-weight: 500; font-size: 15px; letter-spacing: -0.015em; line-height: 1.35; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--raised); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.tier { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 600; font-size: 12px; color: #111; flex: none; }
.watch-line { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.watch-line:first-of-type { border-top: 0; }
.watch-line .name { flex: 1; color: var(--ink-2); }

/* ---- today ---- */
.composer { margin-top: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 16px; display: flex; gap: 10px; align-items: flex-end; transition: border-color 0.12s; }
.composer:focus-within { border-color: var(--line-2); }
.composer textarea { border: 0; background: none; padding: 12px 0; min-height: 52px; font-size: 15px; resize: none; overflow: hidden; }
.composer button { margin-bottom: 4px; }
.idea { display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.idea .hook { font-weight: 500; font-size: 16px; letter-spacing: -0.02em; line-height: 1.3; }
.idea .angle { color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.idea.writing { border-color: var(--line-2); background: var(--raised); }
/* Progress while Claude writes: bar, current step + timer, recent steps. */
.progress { margin-top: 12px; }
.progress .bar-progress { margin-top: 0; height: 5px; }
.progress-now { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--ink); }
.progress-now span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-now .mono { color: var(--ink-3); flex: none; }
.progress-log { list-style: none; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.progress-log li { padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#own-progress { margin: 4px 4px 0; }
.skeleton { background: linear-gradient(90deg, var(--panel) 0%, var(--raised) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; min-height: 150px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---- script editor ---- */
.title-input { font-size: 30px; font-weight: 500; letter-spacing: -0.025em; border: 0; padding: 0; background: none; }
.editor .w { display: grid; grid-template-columns: 1fr 120px 84px; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.editor .w:first-child { border-top: 0; padding-top: 0; }
.editor .w textarea { grid-column: 1 / -1; min-height: 88px; }
.lines-editor { min-height: 380px; font-size: 16px; line-height: 1.7; }
details summary { cursor: pointer; color: var(--ink-3); font-size: 13px; }

/* ---- video page: activity on the left, preview on the right ---- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 36%); gap: 28px; align-items: start; margin-top: 24px; }
.preview { position: sticky; top: 24px; }
.preview video, .preview .placeholder { width: 100%; aspect-ratio: 9 / 16; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); display: block; }
.preview .placeholder { display: grid; place-items: center; color: var(--ink-3); font-size: 13px; text-align: center; padding: 20px; }
.thumb-preview { display: block; width: 50%; margin-top: 16px; border-radius: 12px; border: 1px solid var(--line); }
.steps { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px; }
.step { display: flex; gap: 10px; align-items: center; padding: 6px 0; color: var(--ink-3); font-size: 13px; }
.step i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; font-style: normal; font-size: 10px; }
.step.done { color: var(--ink-2); } .step.done i { border-color: var(--ok); background: var(--ok); color: #000; }
.step.running { color: var(--ink); } .step.running i { border-color: var(--ink); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.step.failed, .step.waiting { color: var(--warn); } .step.failed i, .step.waiting i { border-color: var(--warn); }
@keyframes spin { to { transform: rotate(360deg); } }
.drop { border: 1px dashed var(--line-2); border-radius: 16px; padding: 44px 24px; text-align: center; cursor: pointer; transition: background 0.12s, border-color 0.12s; background: var(--panel); }
.drop.over { border-color: var(--ink); background: var(--raised); }
.drop h3 { font-weight: 500; font-size: 17px; letter-spacing: -0.02em; }
.bar-progress { height: 4px; border-radius: 4px; background: var(--raised); overflow: hidden; margin-top: 16px; }
.bar-progress > i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.2s; }
pre.log { background: var(--side); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; height: 220px; overflow: auto; font: 500 11.5px/1.6 "Geist Mono", monospace; color: var(--ink-3); white-space: pre-wrap; overflow-wrap: anywhere; }
.fix-row { margin-top: 8px; flex-wrap: nowrap; }
.fix-row input { flex: 1; min-width: 0; }
.fix-row .x { padding: 6px 10px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--side); border: 1px solid var(--line); border-radius: 999px; margin-top: 6px; }
.seg button { padding: 6px 14px; background: transparent; color: var(--ink-3); font-size: 13px; }
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button.on { background: var(--ink); color: #020202; }
/* Look and feel controls */
.style-row { gap: 14px 22px; align-items: flex-start; margin-top: 8px; }
.seg.swatches button { padding: 6px 8px; }
.seg.swatches button i { display: block; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.seg.swatches button.on { background: var(--raised); box-shadow: inset 0 0 0 1.5px var(--ink); }
.maker-drop { display: block; padding: 32px 20px; }
.maker-drop.has { border-style: solid; border-color: var(--ink-3); }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13px; color: var(--ink-3); }
label.check input { width: auto; accent-color: #f1f1f1; }
.caption textarea { min-height: 300px; font-size: 13.5px; line-height: 1.6; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.thumb { background: var(--panel); border: 1px dashed var(--line-2); border-radius: 10px; aspect-ratio: 1; display: grid; place-items: center; text-align: center; padding: 6px; font-size: 11px; color: var(--ink-3); cursor: pointer; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.has { border-style: solid; border-color: var(--line); }
/* Videos in flight: bottom-right on desktop, a strip above the home bar on phones. */
#tray { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: flex; flex-direction: column; gap: 6px; width: 300px; }
.tray-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; background: rgba(22, 22, 22, 0.94); border: 1px solid var(--line-2);
  border-radius: 14px; backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.tray-row.done { border-color: rgba(123, 211, 137, 0.4); }
.tray-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tray-text b { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-text span { font-size: 12px; color: var(--ink-3); }
.tray-x { padding: 4px 9px; }
@media (max-width: 860px) { #tray { left: 10px; right: 10px; width: auto; bottom: calc(10px + env(safe-area-inset-bottom)); } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #020202; padding: 9px 16px; border-radius: 999px; font-weight: 500; z-index: 50; }

/* ---- teleprompter / recorder ---- */
#prompter { position: fixed; inset: 0; background: #000; z-index: 40; overflow: hidden; overflow: clip; }   /* clip: the long script can never scroll the layer itself */
#prompter-text { position: absolute; left: 50%; width: min(1100px, 88vw); transform: translateX(-50%); top: 0; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; text-align: center; will-change: transform; }
#prompter-text p { margin: 0 0 0.55em; color: rgba(255, 255, 255, 0.28); transition: color 0.2s; }
#prompter-text p.now { color: #fff; }
#prompter-text p.gap { height: 1.2em; }
#prompter-text p .tierword { color: var(--A); }
#prompter-guide { position: absolute; left: 0; right: 0; top: 22vh; height: 0; border-top: 1px solid rgba(255, 255, 255, 0.18); pointer-events: none; }
#prompter-hud { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 16px; align-items: center; padding: 8px 8px 8px 18px; background: rgba(22, 22, 22, 0.92);
  border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink-3); backdrop-filter: blur(12px); max-width: calc(100vw - 32px); flex-wrap: wrap; }
#prompter-hud label { display: flex; gap: 8px; align-items: center; color: var(--ink-3); }
#prompter-hud input[type="range"] { width: 110px; padding: 0; accent-color: #f1f1f1; background: none; border: 0; }
#prompter-hud select { width: auto; max-width: 200px; padding: 5px 10px; font-size: 12px; border-radius: 999px; background: var(--pill); border: 0; }
#rec-cam { position: absolute; right: 24px; bottom: 88px; width: 220px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: var(--panel); }
#rec-cam video { display: block; width: 100%; transform: scaleX(-1); }
#rec-badge { position: absolute; left: 10px; top: 10px; display: flex; gap: 7px; align-items: center; background: rgba(0, 0, 0, 0.6); padding: 3px 10px; border-radius: 999px; font: 500 12px "Geist Mono", monospace; }
#rec-badge i { width: 8px; height: 8px; border-radius: 50%; background: #ff3b3b; animation: pulse 1s infinite; }
#take { position: absolute; inset: 0; z-index: 3; background: #000; display: grid; place-content: center; padding: 30px; }
#take video { max-height: 70vh; max-width: 90vw; border-radius: 14px; background: var(--panel); }
#prompter-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28vh; font-weight: 600; letter-spacing: -0.04em; color: #fff; background: rgba(0, 0, 0, 0.55); }

/* ---- login ---- */
.login { max-width: 320px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 24px 16px; }
.login .brand { margin-bottom: 14px; font-size: 20px; }
.login button { padding: 11px 16px; }
#prompter { touch-action: none; }   /* drags scroll the words, not the page */

@media (max-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr); } .preview { position: static; max-width: 360px; } }
/* Phone: the sidebar becomes a top bar, everything else stacks. Insets keep clear of the notch and home bar. */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #side { position: sticky; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none;
    padding: calc(8px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); border-right: 0; border-bottom: 1px solid var(--line); }
  #side::-webkit-scrollbar { display: none; }
  .side-top { padding: 0 6px 0 4px; }
  .side-new, .side-label, #side-recent, .side-foot { display: none; }
  .phone-only { display: block; }
  #side-nav { flex-direction: row; }
  #side-nav a { padding: 7px 11px; white-space: nowrap; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .preview { max-width: none; }
  main { padding: 24px max(16px, env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  #banner { margin: 14px 16px 0; }
  h1, .title-input { font-size: 24px; }
  .editor .w { grid-template-columns: 1fr 88px 68px; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  #prompter-text { width: 92vw; }
  #prompter-hud { left: 8px; right: 8px; transform: none; max-width: none; bottom: calc(8px + env(safe-area-inset-bottom)); border-radius: 20px; padding: 10px 12px; gap: 8px 12px; justify-content: center; }
  #prompter-status { width: 100%; text-align: center; }
  #prompter-hud input[type="range"] { width: 76px; }
  #rec-devices { display: flex; gap: 6px; width: 100%; justify-content: center; }
  #prompter-hud select { max-width: 45%; }
  #rec-cam { width: 96px; right: 10px; bottom: calc(150px + env(safe-area-inset-bottom)); border-radius: 12px; }
  #take { padding: 16px; }
}
/* Bigger touch targets, and 16px inputs so iPhone Safari doesn't zoom in when you type. */
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px; }
  button { padding: 10px 18px; }
  .seg button { padding: 8px 14px; }
}
/* A file input styled as a pill button */
.ghost-btn .button { display: inline-block; cursor: pointer; border-radius: 999px; padding: 8px 16px; background: var(--pill); font-weight: 500; font-size: 14px; }
.ghost-btn .button:hover { background: #2f2f2f; }
