/* The Scoonies. Halloween night: deep purple sky, pumpkin orange, slime green, bone white, and a Baskin pink nod. */
:root {
  --night: #140b24; --night2: #221338; --panel: #2c1a47; --panel2: #3a2560; --line: #4f3678;
  --bone: #f3ead8; --dim: #b9a8d6; --mute: #8571a8;
  --pumpkin: #ff7a1a; --slime: #7ee04a; --pink: #ff4f9a; --violet: #a46cff; --gold: #ffd23f; --blood: #ff4d5e;
  --a0: #ff7a1a; --a1: #7ee04a; --a2: #a46cff; --a3: #ff4f9a;
  --px: "Pixelify Sans", ui-monospace, monospace; --tx: "Rubik", system-ui, sans-serif;
  --r: 14px; --gut: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent }
html, body { margin: 0; min-height: 100%; background: var(--night); color: var(--bone); font: 17px/1.4 var(--tx) }
body { overflow-x: hidden; min-height: 100dvh }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation }
button:disabled { opacity: .45; cursor: default }
input { font: inherit }
h1, h2, h3, .px { font-family: var(--px); font-weight: 700; letter-spacing: .5px; margin: 0 }

/* Sky */
#sky { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(1200px 600px at 80% -10%, #3b2266 0%, transparent 60%), radial-gradient(900px 500px at 0% 110%, #1f3a2a 0%, transparent 55%), var(--night) }
#sky::before { content: ""; position: absolute; inset: 0; opacity: .7;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent), radial-gradient(1px 1px at 33% 8%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 58% 22%, #fff 50%, transparent),
    radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent), radial-gradient(1px 1px at 88% 30%, #fff 50%, transparent), radial-gradient(1px 1px at 20% 40%, #fff 50%, transparent), radial-gradient(1px 1px at 45% 35%, #fff 50%, transparent) }
.moon { position: absolute; top: 28px; right: 7vw; width: 70px; height: 70px; border-radius: 50%; background: #fbeec2; box-shadow: 0 0 60px 10px #fbeec244; opacity: .85 }
.moon::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #e9d8a6; top: 20px; left: 16px; box-shadow: 22px 18px 0 -3px #e9d8a6 }
.fog { position: absolute; left: -20%; width: 140%; height: 220px; bottom: -60px; background: radial-gradient(closest-side, #9c86c933, transparent); animation: drift 26s linear infinite alternate }
.fog.f2 { bottom: -100px; animation-duration: 38s; animation-direction: alternate-reverse; opacity: .7 }
@keyframes drift { to { transform: translateX(12%) } }
@media (max-width: 700px) { .moon { top: auto; bottom: 14vh; right: -18px; width: 56px; height: 56px; opacity: .45 } }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50 }

#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) var(--gut) max(24px, env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column }
body.host #app { max-width: 1400px; padding: 28px 40px 120px }

/* Bits */
.title { font-family: var(--px); font-size: clamp(40px, 11vw, 64px); line-height: .95; color: var(--pumpkin); text-shadow: 3px 3px 0 #5a1f00, 0 0 24px #ff7a1a55 }
.title small { display: block; font-size: .33em; color: var(--slime); text-shadow: 2px 2px 0 #1d3a0a; margin-top: 8px; letter-spacing: 1px }
body.host .title { font-size: 96px }
.card { background: linear-gradient(180deg, var(--panel), var(--night2)); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: 0 6px 0 #0a0514 }
.stack > * + * { margin-top: 14px }
.row { display: flex; gap: 10px; align-items: center }
.grow { flex: 1 }
.dim { color: var(--dim) } .mute { color: var(--mute); font-size: 14px }
.btn { display: block; width: 100%; padding: 16px; border-radius: 12px; background: var(--pumpkin); color: #2a0f00; font-family: var(--px); font-size: 22px; font-weight: 700;
  box-shadow: 0 5px 0 #8a3a00; transition: transform .06s, box-shadow .06s }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #8a3a00 }
.btn.green { background: var(--slime); color: #0e2a02; box-shadow: 0 5px 0 #2f6a12 }
.btn.ghost { background: var(--panel2); color: var(--bone); box-shadow: 0 5px 0 #1a0d2e }
.btn.small { width: auto; display: inline-block; padding: 10px 16px; font-size: 17px }
.field { width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line); background: #0f0820; color: var(--bone); font-size: 20px; outline: none }
.field:focus { border-color: var(--pumpkin) }
.err { color: var(--blood); min-height: 1.2em; font-size: 15px }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--panel2); font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase }
.pill.hot { background: var(--pumpkin); color: #2a0f00 } .pill.gold { background: var(--gold); color: #3a2a00 } .pill.green { background: var(--slime); color: #0e2a02 }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 40px }
.iconbtn { padding: 8px 10px; border-radius: 10px; background: var(--panel2); font-size: 14px; color: var(--dim) }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(40px); opacity: 0; transition: .25s; background: var(--bone); color: var(--night); padding: 10px 16px; border-radius: 10px; font-weight: 700; z-index: 60; max-width: 90vw; text-align: center }
#toast.on { opacity: 1; transform: translateX(-50%) }

/* Sprites */
.spr { display: block; image-rendering: pixelated; filter: drop-shadow(0 3px 0 #0006) }
.bob { animation: bob 1.4s steps(2) infinite }
@keyframes bob { 50% { transform: translateY(-3px) } }
.sprites { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px }
.sprites button { padding: 8px 2px 6px; border-radius: 12px; background: #0f0820; border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--dim) }
.sprites button[aria-pressed=true] { border-color: var(--pumpkin); background: #2a1430; color: var(--bone) }

/* Question */
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap }
.qtext { font-family: var(--tx); font-weight: 800; font-size: 22px; line-height: 1.25; margin: 12px 0 }
body.host .qtext { font-size: 46px; margin: 18px 0 }
.qimg { width: 100%; max-height: 32vh; object-fit: contain; border-radius: 12px; background: #0f0820; border: 2px solid var(--line) }
body.host .qimg { max-height: 44vh }
.choices { display: grid; grid-template-columns: 1fr; gap: 10px }
.choices.two { grid-template-columns: 1fr 1fr }
body.host .choices { grid-template-columns: 1fr 1fr; gap: 16px }
.ch { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 14px; min-height: 64px; border-radius: 12px; text-align: left; font-weight: 700; font-size: 18px; color: #170a26; box-shadow: 0 5px 0 #0007; transition: transform .08s, opacity .25s, filter .25s }
.ch:active:not(:disabled) { transform: translateY(3px) }
.ch:disabled { opacity: 1 }
.ch.c0 { background: var(--a0) } .ch.c1 { background: var(--a1) } .ch.c2 { background: var(--a2) } .ch.c3 { background: var(--a3) }
.ch .ic { flex: none; width: 30px; height: 30px }
.ch.picked { outline: 4px solid var(--bone); outline-offset: 2px }
.ch.off { filter: grayscale(.85) brightness(.55) }
.ch.win { outline: 4px solid var(--gold); outline-offset: 2px; animation: pop .4s }
.ch .ct { position: absolute; right: 12px; font-family: var(--px); font-size: 20px }
body.host .ch { font-size: 30px; min-height: 110px; padding: 18px 24px }
body.host .ch .ic { width: 48px; height: 48px }
.tf .ch { justify-content: center; font-family: var(--px); font-size: 28px; min-height: 120px }
@keyframes pop { 40% { transform: scale(1.04) } }

/* Clock */
.clock { --p: 1; position: relative; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--pumpkin) calc(var(--p) * 360deg), #ffffff14 0); display: grid; place-items: center; flex: none }
.clock::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--night2) }
.clock b { position: relative; font-family: var(--px); font-size: 22px }
.clock.low { background: conic-gradient(var(--blood) calc(var(--p) * 360deg), #ffffff14 0) }
body.host .clock { width: 110px; height: 110px } body.host .clock b { font-size: 44px } body.host .clock::before { inset: 10px }
.bar { height: 10px; border-radius: 99px; background: #ffffff14; overflow: hidden } .bar i { display: block; height: 100%; background: var(--slime); transition: width .3s }

/* Number + order inputs */
.numread { font-family: var(--px); font-size: 56px; text-align: center; color: var(--gold); line-height: 1 }
input[type=range] { width: 100%; height: 44px; accent-color: var(--pumpkin) }
.nudge { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px }
.nudge button { padding: 12px 0; border-radius: 10px; background: var(--panel2); font-family: var(--px); font-size: 18px }
.order button.it { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 12px; background: var(--panel2); border: 2px solid var(--line); text-align: left; font-weight: 700; font-size: 17px; min-height: 58px }
.order button.it + button.it { margin-top: 8px }
.order .n { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-family: var(--px); font-size: 20px; background: #0f0820; color: var(--mute) }
.order .it.set { border-color: var(--slime) } .order .it.set .n { background: var(--slime); color: #0e2a02 }
.order .it.bad { border-color: var(--blood) }
body.host .order .it { font-size: 30px; min-height: 90px } body.host .order .n { width: 56px; height: 56px; font-size: 32px }

/* Reveal + board */
.verdict { text-align: center; padding: 18px 0 8px }
.verdict h2 { font-size: 52px; line-height: 1 }
.verdict.ok h2 { color: var(--slime); text-shadow: 3px 3px 0 #1d3a0a } .verdict.no h2 { color: var(--blood); text-shadow: 3px 3px 0 #4a0010 }
.verdict .pts { font-family: var(--px); font-size: 34px; color: var(--gold); margin-top: 8px }
.fact { background: #0f0820; border-left: 4px solid var(--slime); padding: 12px 14px; border-radius: 8px; color: var(--dim); font-size: 16px }
body.host .fact { font-size: 26px; padding: 18px 22px }
.lb { list-style: none; margin: 0; padding: 0; position: relative }
.lb li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); margin-bottom: 8px; transition: transform .6s cubic-bezier(.2, .9, .3, 1.1) }
.lb li.me { border-color: var(--pumpkin) }
.lb .rk { font-family: var(--px); font-size: 22px; width: 32px; text-align: center; color: var(--mute) }
.lb li:nth-child(1) .rk { color: var(--gold) }
.lb .nm { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.lb .sc { font-family: var(--px); font-size: 22px }
.lb .dl { font-family: var(--px); font-size: 16px; color: var(--slime); min-width: 56px; text-align: right }
.lb .mv { font-size: 12px; color: var(--slime) } .lb .mv.down { color: var(--blood) }
body.host .lb li { padding: 10px 18px; font-size: 28px } body.host .lb .sc { font-size: 34px } body.host .lb .rk { font-size: 32px; width: 48px } body.host .lb .dl { font-size: 26px; min-width: 100px }

/* Number reveal: everyone's pin on the line */
.line { position: relative; height: 120px; margin: 20px 10px 6px }
.line .axis { position: absolute; left: 0; right: 0; top: 70px; height: 4px; background: var(--line); border-radius: 2px }
.line .pin { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 700; transition: left .8s }
.line .ans { position: absolute; top: 58px; width: 4px; height: 28px; background: var(--gold); transform: translateX(-50%); box-shadow: 0 0 12px var(--gold) }
.line .ans b { position: absolute; top: 32px; left: 50%; transform: translateX(-50%); font-family: var(--px); font-size: 22px; color: var(--gold); white-space: nowrap }
.line .lo, .line .hi { position: absolute; top: 80px; font-size: 12px; color: var(--mute) } .line .hi { right: 0 }

/* Splash card between questions */
.splash { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #140b24ee; animation: fadeout .35s ease forwards; animation-delay: var(--hold, 2.8s) }
.splash .in { text-align: center; animation: slam .45s cubic-bezier(.2, 1.4, .4, 1) }
.splash .n { font-family: var(--px); color: var(--dim); font-size: 22px }
.splash h2 { font-size: clamp(40px, 12vw, 110px); color: var(--pumpkin); text-shadow: 4px 4px 0 #5a1f00 }
.splash .special { font-family: var(--px); font-size: clamp(26px, 7vw, 60px); color: var(--slime); margin-top: 6px; animation: flicker 1s steps(2) infinite }
@keyframes slam { from { transform: scale(2.2); opacity: 0 } }
@keyframes fadeout { to { opacity: 0; visibility: hidden } }
@keyframes flicker { 50% { opacity: .55 } }

/* Lobby crowd (host) */
.crowd { display: flex; flex-wrap: wrap; gap: 18px 26px; justify-content: center; align-items: flex-end; min-height: 160px }
.crowd .who { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; animation: walkin .6s cubic-bezier(.2, 1.3, .4, 1) }
.crowd .who.off { opacity: .35 }
@keyframes walkin { from { transform: translateY(30px) scale(.6); opacity: 0 } }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: max-content }
.qr img, .qr canvas { display: block; width: 220px !important; height: 220px !important; image-rendering: pixelated }
.joinurl { font-family: var(--px); font-size: 34px; color: var(--slime); word-break: break-all }
.hostgrid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start }
.answered { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end }
.answered .who { display: flex; flex-direction: column; align-items: center; font-size: 15px; font-weight: 700; color: var(--dim); transition: transform .3s }
.answered .who.done { color: var(--slime) } .answered .who.done .spr { animation: hop .4s }
.answered .who:not(.done) .spr { opacity: .35 }
@keyframes hop { 40% { transform: translateY(-12px) } }
.hostbar { position: fixed; right: 18px; bottom: 18px; display: flex; gap: 10px; z-index: 30 }
.hostbar .btn { width: auto; padding: 12px 22px; font-size: 20px }

/* Podium */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 18px 0 }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 30% }
.podium .block { width: 100%; border-radius: 10px 10px 0 0; display: grid; place-items: start center; padding-top: 10px; font-family: var(--px); font-size: 34px; color: #2a1700;
  background: repeating-linear-gradient(90deg, #7a4a1f 0 14px, #6a3f18 14px 16px); border: 3px solid #3a2208; position: relative }
.podium .block::before { content: ""; position: absolute; left: 0; right: 0; top: 28%; height: 8px; background: var(--gold); border-block: 2px solid #3a2208 }
.podium .p1 .block { height: 180px; color: var(--gold) } .podium .p2 .block { height: 130px } .podium .p3 .block { height: 95px }
.podium .nm { font-weight: 800; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap }
.podium .sc { font-family: var(--px); color: var(--gold) }
body.host .podium .step { width: 22% } body.host .podium .block { font-size: 52px } body.host .podium .p1 .block { height: 190px } body.host .podium .p2 .block { height: 140px } body.host .podium .p3 .block { height: 100px } body.host .podium .nm { font-size: 30px } body.host .podium .sc { font-size: 30px }
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px }
.award { background: #0f0820; border: 2px solid var(--line); border-radius: 12px; padding: 12px; text-align: center }
.award b { display: block; font-family: var(--px); color: var(--slime); font-size: 15px; letter-spacing: .5px }
.award span { font-weight: 800; font-size: 18px }
body.host .award span { font-size: 26px }

.wagers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.wagers button { padding: 16px 8px; border-radius: 12px; background: var(--panel2); border: 2px solid var(--line); font-family: var(--px); font-size: 22px; line-height: 1.1 }
.wagers button small { display: block; font-family: var(--tx); font-size: 14px; color: var(--dim); margin-top: 4px }
.wagers button[aria-pressed=true] { border-color: var(--gold); background: #3a2a10 }
.wagers button.all { border-color: var(--blood) }

.center { text-align: center } .big { font-size: 20px } .gap { flex: 1 }
.wait { text-align: center; margin: auto 0; padding: 30px 0 }
.wait .spr { margin: 0 auto 14px }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important } .splash { animation-delay: 1.4s !important } }
