/* Sceant It, the phone page. A premiere at night: marquee-bulb yellow, stage red and
   spotlight white on deep navy. Big type, huge thumb targets, calm while waiting. */

@font-face { font-family: 'Anton'; src: url('/static/fonts/Anton-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Geist'; src: url('/static/fonts/Geist-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --night: #0a1330;
  --night-2: #101c45;
  --night-3: #18275a;
  --line: rgba(246, 241, 228, 0.12);
  --bulb: #ffcc33;
  --bulb-deep: #b8860b;
  --red: #e8333c;
  --red-deep: #8f1a20;
  --white: #f6f1e4;
  --muted: #98a3c4;
  --dim: #66729a;
  --display: 'Anton', 'Impact', 'Arial Narrow', sans-serif;
  --body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 16px;
  --pad: 20px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--night); color: var(--white); }
body {
  font: 400 17px/1.4 var(--body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0.005em; margin: 0; line-height: 1.05; }
h1 { font-size: 44px; }
h2 { font-size: 32px; }
h3 { font-size: 22px; }
p { margin: 0; }
.calm { color: var(--muted); }
.small { font-size: 15px; }
.big { font-size: 22px; font-weight: 600; }
.err { color: #ff8a8f; min-height: 1.4em; font-weight: 500; }
.eyebrow { color: var(--bulb); font-weight: 600; font-size: 16px; }
video#wake { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; top: 0; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }
body.is-host #app { min-height: auto; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 24px var(--pad) 28px; }
.screen.center { justify-content: center; align-items: center; text-align: center; gap: 20px; min-height: 100dvh; }

/* the reconnecting strip */
#bar {
  position: sticky; top: 0; z-index: 20; background: var(--bulb); color: var(--night);
  text-align: center; font-weight: 600; padding: 8px 12px; font-size: 15px;
}
body.offline #app, body.offline #host { opacity: 0.55; pointer-events: none; }

/* the marquee: the name in bulbs' light, a row of bulbs round the edge */
.marquee {
  position: relative; display: inline-block; padding: 20px 28px 16px; border-radius: 14px;
  background: var(--red); color: var(--bulb);
  box-shadow: inset 0 -6px 0 var(--red-deep);
}
.marquee::before {
  content: ''; position: absolute; inset: 6px; border-radius: 9px; pointer-events: none;
  background:
    radial-gradient(circle, var(--bulb) 2.2px, transparent 2.8px) top left / 14px 7px space no-repeat,
    radial-gradient(circle, var(--bulb) 2.2px, transparent 2.8px) bottom left / 14px 7px space no-repeat;
  opacity: 0.9;
}
.marquee span { font-family: var(--display); font-size: 46px; line-height: 1; display: block; }
.marquee.small span { font-size: 28px; }

/* fields and buttons */
.field {
  width: 100%; background: var(--night-2); border: 2px solid var(--line); border-radius: 14px;
  padding: 16px 20px; font-size: 22px; font-weight: 600; color: var(--white); outline: none;
}
.field:focus { border-color: var(--bulb); }
.field.code { font-family: var(--display); font-size: 48px; text-align: center; letter-spacing: 0.2em; width: 220px; }
.lab { color: var(--muted); font-weight: 500; font-size: 15px; margin: 8px 0 -8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 12px 20px; border-radius: 14px; border: 0;
  background: var(--night-3); color: var(--white); font-weight: 600; font-size: 18px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
  transition: transform 80ms ease;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.big { min-height: 64px; font-size: 22px; font-family: var(--display); font-weight: 400; letter-spacing: 0.01em; }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn.yellow { background: var(--bulb); color: var(--night); box-shadow: inset 0 -5px 0 var(--bulb-deep); }
.btn.red { background: var(--red); color: var(--white); box-shadow: inset 0 -4px 0 var(--red-deep); }
.btn.ghost { background: transparent; border: 2px solid var(--line); box-shadow: none; }
.btn.nobody { background: var(--night); border: 2px solid var(--line); box-shadow: none; }
.link { background: none; border: 0; padding: 12px 8px; color: var(--bulb); font-weight: 600; font-size: 16px; text-decoration: underline; text-underline-offset: 4px; }
.link.quiet { color: var(--dim); text-decoration: none; font-weight: 500; }
.foot { margin-top: auto; text-align: center; padding-top: 8px; }

/* tokens */
.tok { width: 40px; height: 40px; flex: none; display: block; }
.tok.hero { width: 112px; height: 112px; }
.tok.mid { width: 80px; height: 80px; }
.tok.small { width: 36px; height: 36px; }
.tok.tiny { width: 22px; height: 22px; display: inline-block; vertical-align: -5px; margin-right: 8px; }

/* join */
.join { gap: 16px; }
.joinhead { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0 8px; }
.room { color: var(--muted); }
.room b { color: var(--white); font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: 0.08em; margin-left: 4px; }
.join form { display: flex; flex-direction: column; gap: 12px; }
.tokens { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tokbtn {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px 12px;
  background: var(--night-2); border: 2px solid transparent; border-radius: 14px; min-height: 92px;
}
.tokbtn .tok { width: 44px; height: 44px; }
.tokbtn span { font-size: 13px; color: var(--muted); font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tokbtn.sel { border-color: var(--bulb); background: var(--night-3); }
.tokbtn.sel span { color: var(--white); }
.tokbtn:disabled { opacity: 0.32; }

/* pin */
.pin { align-items: center; text-align: center; gap: 20px; }
.pin header { align-self: stretch; text-align: left; margin: -12px 0 0 -8px; }
.dots { display: flex; gap: 20px; justify-content: center; margin-top: 8px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--bulb); border-color: var(--bulb); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 330px; margin-top: auto; }
.key {
  min-height: 72px; border-radius: 16px; border: 0; background: var(--night-2);
  font-family: var(--display); font-size: 32px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3);
}
.key:active { background: var(--night-3); }
.key.soft { font-family: var(--body); font-size: 16px; font-weight: 600; color: var(--muted); }
.key.ok { font-family: var(--body); font-size: 17px; font-weight: 600; background: var(--bulb); color: var(--night); box-shadow: inset 0 -4px 0 var(--bulb-deep); }
.key.ok:disabled { opacity: 0.35; }

/* lobby and waiting: calm */
.me { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-top: 18px; }
.me h1 { margin-top: 8px; }
.where { font-size: 20px; font-weight: 600; }
.where span { color: var(--muted); font-weight: 500; }
.roster { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roster li { display: flex; align-items: center; gap: 12px; background: var(--night-2); border-radius: 12px; padding: 12px 12px; min-width: 0; }
.roster li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.roster li em { margin-left: auto; font-style: normal; color: var(--bulb); font-size: 13px; font-weight: 600; }
.roster .tok, .plist .tok { width: 28px; height: 28px; }
.away { opacity: 0.5; }

.track { position: relative; height: 22px; margin: 20px 8px 4px; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--night-3); }
.track b { position: absolute; top: 5px; width: 2px; height: 12px; background: var(--dim); }
.track i { position: absolute; top: 4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid var(--night); }
.track i.me { top: 0; width: 22px; height: 22px; margin-left: -11px; border-width: 3px; }
.now { margin-top: auto; display: flex; align-items: center; gap: 16px; background: var(--night-2); border-radius: var(--r); padding: 16px 20px; min-height: 76px; }
.now p { font-size: 19px; font-weight: 600; }
.calmscreen h2 { margin-top: 8px; }

/* the big moments */
.action { align-items: center; justify-content: center; text-align: center; gap: 24px; min-height: 100dvh; }
body.is-host .action { min-height: 62dvh; }
.mega {
  width: min(78vw, 340px); aspect-ratio: 1; border-radius: 50%; border: 0;
  font-family: var(--display); font-size: 92px; line-height: 1; color: var(--night);
  display: grid; place-items: center; user-select: none; -webkit-user-select: none;
  transition: transform 90ms ease, box-shadow 90ms ease;
}
body.is-host .mega { width: min(56vw, 240px); font-size: 68px; }
.mega.roll { background: var(--bulb); box-shadow: inset 0 -14px 0 var(--bulb-deep), 0 0 0 10px rgba(255, 204, 51, 0.12); border-radius: 36px; }
.mega.buzz { background: var(--red); color: var(--white); box-shadow: inset 0 -14px 0 var(--red-deep), 0 0 0 10px rgba(232, 51, 60, 0.14); }
.mega:active:not(:disabled), .mega.hit { transform: translateY(6px); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.3); }
.mega.buzz:disabled:not(.hit) { background: var(--night-3); color: var(--muted); box-shadow: inset 0 -14px 0 rgba(0,0,0,0.3); }
.mega.roll:disabled { opacity: 0.6; }
.place span { font-family: var(--display); font-size: 150px; line-height: 1; color: var(--bulb); }
.buzzed .place { margin: 8px 0; }

/* picking */
.pick { gap: 16px; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 16px;
  background: var(--night-2); border: 2px solid transparent; border-radius: 14px; text-align: left;
}
.row:active { border-color: var(--bulb); }
.row .nm { font-size: 19px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sp, .plist .sp { color: var(--muted); font-size: 15px; white-space: nowrap; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip {
  min-height: 64px; padding: 12px 12px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--night-2); font-weight: 600; font-size: 16px; line-height: 1.2;
}
.chip.sel { background: var(--bulb); color: var(--night); border-color: var(--bulb); }

/* game over */
.over { align-items: center; text-align: center; gap: 12px; }
.winner { font-size: 48px; color: var(--bulb); }
.stats { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
.stats th { color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 4px; text-align: right; }
.stats td { padding: 12px 4px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.stats td:first-child, .stats th:first-child { text-align: left; font-weight: 600; white-space: nowrap; }
.stats tr.win td { color: var(--bulb); }

/* the Host bar */
#host { padding: 8px var(--pad) 40px; display: flex; flex-direction: column; gap: 12px; border-top: 6px solid var(--red); background: var(--night); }
.hhead { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 2px; }
.hhead h2 { color: var(--red); font-size: 30px; }
.card { background: var(--night-2); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card .row { background: var(--night-3); }
.card .chip { background: var(--night-3); }
.card.pick h2 { font-size: 26px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; background: none; border: 0; padding: 0; text-align: left; }
.cardhead span { color: var(--bulb); font-weight: 600; font-size: 15px; }
.cardhead:disabled { cursor: default; opacity: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ask .prompt { font-size: 20px; font-weight: 600; }
.ask .answer { font-family: var(--display); font-size: 38px; color: var(--bulb); line-height: 1.05; }
.ask h3 { margin-top: 4px; }
.buzzes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.buzzes li { display: flex; align-items: center; background: var(--night-3); border-radius: 10px; padding: 8px 12px; font-weight: 600; }
.buzzes em { margin-left: auto; font-style: normal; color: var(--bulb); font-variant-numeric: tabular-nums; }
.fb { display: flex; flex-wrap: wrap; gap: 8px; }
.fb .btn { flex: 1 1 auto; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.plist li:first-child { border-top: 0; }
.plist .nm { flex: 1; font-weight: 600; min-width: 90px; }
.plist .nm em { font-style: normal; color: var(--dim); font-weight: 500; margin-left: 8px; font-size: 14px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--night); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { min-height: 46px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--bulb); color: var(--night); }
.lvl { min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--line); background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); }
.lvl.on { background: var(--bulb); border-color: var(--bulb); color: var(--night); }
.plist li { flex-wrap: nowrap; }
.plist .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.is-host .lobby .me { padding-top: 4px; }
body.is-host .lobby .tok.hero { width: 72px; height: 72px; }

.switch { display: flex; align-items: center; justify-content: space-between; min-height: 52px; font-weight: 600; position: relative; }
.switch input { position: absolute; opacity: 0; width: 60px; height: 34px; right: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { width: 56px; height: 32px; border-radius: 16px; background: var(--night-3); position: relative; transition: background 120ms; }
.switch i::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--muted); transition: transform 120ms, background 120ms; }
.switch input:checked + i { background: var(--bulb); }
.switch input:checked + i::after { transform: translateX(24px); background: var(--night); }
.switch input:focus-visible + i { outline: 2px solid var(--white); outline-offset: 2px; }

.sliders { display: flex; flex-direction: column; gap: 8px; }
.slider { display: grid; grid-template-columns: 1fr 52px; grid-template-rows: auto auto; align-items: center; column-gap: 12px; }
.slider label { font-size: 15px; font-weight: 500; grid-column: 1 / 3; }
.slider output { text-align: right; color: var(--bulb); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--night-3); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--night-3); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--bulb); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--bulb); margin-top: -11px; border: 0; }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--bulb); border: 0; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--white); color: var(--night); font-weight: 600; padding: 12px 20px; border-radius: 12px;
  max-width: calc(100vw - 40px); opacity: 0; pointer-events: none; transition: opacity 160ms, transform 160ms; z-index: 30;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.codeform { display: flex; flex-direction: column; align-items: center; gap: 16px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-height: 700px) { .tok.hero { width: 84px; height: 84px; } .mega { width: min(64vw, 280px); font-size: 76px; } }

/* the Host's own player area stays short so the Host bar is in reach */
body.is-host .wait { gap: 8px; padding-top: 14px; padding-bottom: 12px; }
body.is-host .wait .me { flex-direction: row; flex-wrap: wrap; text-align: left; justify-content: flex-start; align-items: center; gap: 4px 16px; padding-top: 0; }
body.is-host .wait .me .tok.hero { width: 56px; height: 56px; }
body.is-host .wait .me h1 { font-size: 32px; margin: 0; }
body.is-host .wait .me p { flex-basis: 100%; font-size: 15px; }
body.is-host .wait .track { margin-top: 8px; }
body.is-host .wait .now { margin-top: 4px; min-height: 0; padding: 12px 16px; }
body.is-host .wait .now p { font-size: 16px; }
