:root {
  --bg: #14121c;
  --panel: #211e2e;
  --panel2: #2b2740;
  --ink: #f4f1ea;
  --dim: #a9a4bd;
  --accent: #ffd23f;
  --a: #ff8a3d;
  --b: #3ddcff;
  --bad: #ff5d73;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 19px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.loading { color: var(--dim); text-align: center; margin-top: 30vh; }

.brand { display: block; text-align: center; font-weight: 900; letter-spacing: 0.06em; font-size: 30px; color: var(--accent); text-decoration: none; margin: 6px 0 2px; }
.tag { text-align: center; color: var(--dim); margin: 0 0 18px; font-size: 17px; }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 12px; }
h2 { font-size: 22px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--b); }

.panel { background: var(--panel); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.panel.hi { outline: 3px solid var(--accent); }
.muted { color: var(--dim); }
.small { font-size: 15px; }
.center { text-align: center; }
.err { color: var(--bad); font-weight: 600; }
.errbox { background: #3a1822; border-radius: 12px; padding: 12px; color: #ffd0d6; font-size: 15px; word-break: break-word; margin: 0 0 12px; }

label { display: block; font-weight: 700; margin: 0 0 6px; }
input[type=text], input[type=password], textarea {
  width: 100%; font: inherit; font-size: 22px; color: var(--ink); background: var(--panel2);
  border: 2px solid #4a4466; border-radius: 12px; padding: 14px; outline: none; margin: 0 0 14px;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: none; min-height: 3.2em; }
.check { display: flex; align-items: center; gap: 12px; font-weight: 600; margin: 4px 0 14px; min-height: 48px; }
.check input { width: 28px; height: 28px; accent-color: var(--accent); }

.btn {
  display: block; width: 100%; min-height: 60px; font: inherit; font-size: 22px; font-weight: 800; text-align: center;
  border: 0; border-radius: 14px; padding: 14px 18px; background: var(--accent); color: #1b1600; text-decoration: none;
  cursor: pointer; margin: 0 0 12px; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; }
.btn.alt { background: var(--panel2); color: var(--ink); }
.btn.small { min-height: 48px; font-size: 18px; padding: 10px 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.vs { text-align: center; font-weight: 900; font-size: 24px; margin: 4px 0 16px; }
.vs .x { color: var(--dim); font-weight: 600; font-size: 18px; margin: 0 8px; }
.seatA { color: var(--a); }
.seatB { color: var(--b); }
.fillA { color: var(--a); font-weight: 800; }
.fillB { color: var(--b); font-weight: 800; }

.turn { font-size: 26px; font-weight: 900; text-align: center; margin: 0 0 8px; }
.premise { font-size: 22px; font-weight: 700; margin: 0 0 14px; }
.roundlabel { text-transform: uppercase; letter-spacing: 0.08em; font-size: 14px; color: var(--dim); font-weight: 800; margin: 0 0 6px; }
.stem { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.line { font-size: 20px; margin: 0 0 10px; }
.line .who { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); font-weight: 800; }
.count { text-align: right; font-size: 14px; color: var(--dim); margin: -10px 0 10px; }

.status { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin: 6px 0 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; animation: pulse 1.1s ease-in-out infinite; }
.status.done .dot { animation: none; background: #5be38a; }
.status.failed .dot { animation: none; background: var(--bad); }
.status.idle .dot { animation: none; background: #5d5878; }
@keyframes pulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }
.steps { display: flex; gap: 4px; margin: 8px 0 4px; }
.steps span { flex: 1; height: 6px; border-radius: 3px; background: #3d3856; }
.steps span.on { background: var(--accent); }

video { display: block; width: 100%; max-height: 72vh; background: #000; border-radius: 12px; margin: 8px 0 12px; object-fit: contain; }
.qr { display: block; width: 220px; height: 220px; margin: 6px auto 12px; background: #fff; border-radius: 10px; padding: 6px; }
.link { font-size: 15px; word-break: break-all; background: var(--panel2); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; color: var(--ink); }

/* TV */
body.tv { overflow: hidden; }
body.tv #app { max-width: none; padding: 0; height: 100vh; display: flex; flex-direction: column; }
.tv-stage { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; background: #000; }
.tv-stage video { height: 100%; max-height: none; width: auto; max-width: 100%; border-radius: 0; margin: 0; }
.tv-caption { min-height: 21vh; padding: 2vh 4vw; text-align: center; font-size: 3.2vh; line-height: 1.3; background: var(--bg); }
.tv-caption .premise { font-size: 2.6vh; color: var(--dim); font-weight: 600; margin: 0 0 0.8vh; }
.tv-caption .line { font-size: 3.4vh; margin: 0 0 0.6vh; }
.tv-caption .big { font-size: 5vh; font-weight: 900; color: var(--accent); }
.tv-qr { position: fixed; right: 2vw; top: 2vh; background: #fff; border-radius: 1vh; padding: 1vh; text-align: center; color: #111; font-weight: 800; font-size: 1.8vh; }
.tv-qr img { display: block; width: 16vh; height: 16vh; }
.tv-empty { color: var(--dim); font-size: 4vh; text-align: center; padding: 0 10vw; }
