:root {
  color-scheme: dark;
  --bg: #0b0f1a;
  --panel: #151b2b;
  --line: #2a3350;
  --text: #f2f4fa;
  --muted: #9aa3bd;
  --coral: #ff6a4d;
  --green: #3ddc84;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
[hidden] { display: none !important; }

#app { min-height: 100%; display: flex; flex-direction: column; }
/* Prompter glass: the parts are flipped one by one (not #app), because a full-screen page and the
   fixed posing screen would otherwise ignore or double the flip. */
.flip .bar, .flip .setup, .flip .view { transform: scaleX(-1); }

.bar { display: flex; align-items: center; gap: 24px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: 0.01em; }
.tabs { display: flex; gap: 4px; }
.tab { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.tab[aria-current] { background: var(--panel); color: var(--text); }
.tab.soon { opacity: 0.6; cursor: default; }

/* Set-up */
.setup { width: min(560px, 100%); margin: 20px auto; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.setup h1 { margin: 0; font-size: 28px; }
.lead { margin: 0 0 8px; color: var(--muted); }
.field { display: grid; gap: 4px; font-weight: 600; min-width: 0; } /* a long camera name must not widen the page */
select, button { font: inherit; color: inherit; }
select { width: 100%; min-width: 0; padding: 7px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 5px; width: 18px; height: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button { cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 10px 16px; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
button.go { background: var(--coral); border-color: var(--coral); color: #1a0a06; font-weight: 800; padding: 12px 28px; }
.muted { color: var(--muted); }
.warn { color: var(--coral); }
#folder-name { flex: 1 1 240px; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.keys { color: var(--muted); }
kbd { font: 13px var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; }

/* Posing: everything sized from the screen, because it runs on the small prompter screen. */
.guide { position: fixed; inset: 0; background: #000; overflow: hidden; }
.view { position: absolute; inset: 0; display: grid; place-items: center; }
.stage { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; overflow: hidden; }
.stage.mirror { transform: scaleX(-1); }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ghost { position: absolute; pointer-events: none; opacity: 0.38; transition: opacity 200ms ease-out; }
.ghost.ring { opacity: 1; filter: url(#outline-off); }
.stage.match .ghost.ring { filter: url(#outline-on); }
.stage.no-ghost .ghost { opacity: 0; }
.zones { position: absolute; inset: 0; pointer-events: none; }
.zones div { position: absolute; border: 2px dashed rgb(255 255 255 / 0.35); border-radius: 12px; }
.zones span { position: absolute; bottom: 4px; left: 8px; font: 700 max(12px, 1.4vmin) var(--font); color: rgb(255 255 255 / 0.55); }
.stage.mirror .zones span { transform: scaleX(-1); }
.stage.no-zones .zones { display: none; }
.debug { position: absolute; inset: 0; width: 100%; height: 100%; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.fire { animation: flash 450ms ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

.hud { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; padding: 2vmin 3vmin; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 2vmin; }
.pose-name { font: 800 max(18px, 4vmin) var(--font); text-shadow: 0 2px 8px #000; }
.chips { display: flex; gap: 1vmin; }
.chips span { position: relative; font: 700 max(12px, 2.4vmin) var(--font); padding: 0.15em 0.6em 0.15em 1.5em; border-radius: 99px; background: rgb(0 0 0 / 0.55); color: var(--muted); border: 2px solid transparent; }
.chips span.ok { color: var(--green); border-color: var(--green); }
.chips span::before { content: '✓'; position: absolute; left: 0.5em; visibility: hidden; } /* in the padding: the row never shifts */
.chips span.ok::before { visibility: visible; }
.tip {
  margin: 0 auto; max-width: 92%; text-align: center; text-wrap: balance;
  font: 900 max(28px, 7.5vmin) / 1.1 var(--font);
  padding: 1.4vmin 3vmin; border-radius: 2vmin; background: rgb(0 0 0 / 0.62);
  text-shadow: 0 2px 10px #000;
}
.tip.match { color: var(--green); }
.tip.saved { color: #fff; background: rgb(31 157 85 / 0.85); }
.shots { position: absolute; right: 3vmin; bottom: 16vmin; display: flex; flex-direction: column; gap: 1vmin; }
.shots img { width: max(80px, 14vmin); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 1vmin; border: 2px solid var(--green); }
.numbers { position: absolute; left: 3vmin; top: 9vmin; margin: 0; font: 12px/1.4 ui-monospace, monospace; background: rgb(0 0 0 / 0.7); padding: 8px 10px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  .flash.fire { animation: none; }
  .ghost { transition: none; }
}
