/* Host stage: designed to read from across a room or on a stream. */
.stage-page { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.stage-bar { display: flex; align-items: center; gap: 20px; padding: 14px 24px; flex: none; }
.bar-actions { margin-left: auto; display: flex; gap: 10px; }
.mini-code {
  font-weight: 800; color: var(--ink-soft); padding: .3em .9em; border-radius: 999px; background: var(--bg-2);
  border: 2px solid var(--line); opacity: 0; transform: translateY(-10px); transition: .4s var(--spring);
}
.mini-code b { font-family: var(--f-display); color: var(--a); letter-spacing: .12em; font-size: 1.2em; }
body:not([data-phase="lobby"]) .mini-code { opacity: 1; transform: none; }

/* Restart / End game: only while a game is running */
.game-ctl { display: none; gap: 10px; margin-left: auto; }
body[data-phase="round"] .game-ctl, body[data-phase="reveal"] .game-ctl { display: flex; animation: popIn .4s var(--spring); }
.game-ctl .btn { --lift: 3px; font-size: .9rem; padding: .45em .95em; gap: .4em; }
body[data-phase="round"] .game-ctl + .bar-actions, body[data-phase="reveal"] .game-ctl + .bar-actions { margin-left: 0; }

.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(12,5,32,.6); opacity: 0; transition: opacity .25s; }
.modal[hidden] { display: none; }
.modal.open { opacity: 1; }
.modal-card { width: min(460px, 100%); padding: 26px 26px 24px; text-align: center; transform: scale(.8) rotate(-2deg); transition: transform .4s var(--spring); }
.modal.open .modal-card { transform: none; }
.modal-card h2 { font-size: 2rem; }
.modal-card p { color: var(--ink-soft); font-weight: 700; margin: 10px 0 22px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.rv-inner { position: absolute; inset: 0; }

#app { flex: 1; position: relative; min-height: 0; }
.screen {
  position: absolute; inset: 0; padding: 8px 32px 24px; display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: scale(.96) translateY(24px);
  transition: opacity .45s var(--ease), transform .6s var(--spring), visibility 0s .45s;
}
.screen.on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.screen.leaving { opacity: 0; transform: scale(1.04) translateY(-24px); }

/* ---------- Lobby ---------- */
.lobby-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; flex: none; }
.join-panel { padding: 22px 26px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto 1fr; column-gap: 24px; align-items: start; }
.join-panel > *:not(.qr-wrap) { grid-column: 1; }
.join-head { margin: 0; color: var(--ink-soft); font-weight: 800; font-size: clamp(.95rem, 1.4vw, 1.2rem); }
.join-url { margin: 2px 0 12px; font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 2.6vw, 2.2rem); color: var(--b); word-break: break-all; }
.big-code { display: flex; gap: 10px; margin-top: 8px; }
.big-code span {
  width: clamp(56px, 6.4vw, 92px); height: clamp(70px, 8vw, 112px); display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: clamp(2.6rem, 5.4vw, 4.6rem); color: var(--line);
  background: var(--a); border: 4px solid var(--line); border-radius: 18px; box-shadow: 0 7px 0 var(--line), inset 0 -6px 0 var(--a-deep);
  animation: codeDrop .8s var(--spring) both, codeIdle 3s ease-in-out infinite;
}
.big-code span:nth-child(2) { background: var(--b); box-shadow: 0 7px 0 var(--line), inset 0 -6px 0 var(--b-deep); animation-delay: .1s, -.7s; }
.big-code span:nth-child(3) { background: var(--pink); box-shadow: 0 7px 0 var(--line), inset 0 -6px 0 #d63d86; animation-delay: .2s, -1.4s; }
.big-code span:nth-child(4) { background: var(--lime); box-shadow: 0 7px 0 var(--line), inset 0 -6px 0 #7fbf12; animation-delay: .3s, -2.1s; }
@keyframes codeDrop { 0% { opacity: 0; transform: translateY(-120px) rotate(-20deg); } 100% { opacity: 1; transform: none; } }
@keyframes codeIdle { 0%, 100% { translate: 0 0; rotate: -2deg; } 50% { translate: 0 -6px; rotate: 2deg; } }
.qr-wrap { grid-column: 2; grid-row: 1 / span 4; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 800; color: var(--ink-soft); }
.qr { background: #fff; padding: 10px; border-radius: 14px; border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line); transform: rotate(3deg); }
.qr img, .qr canvas { width: clamp(110px, 12vw, 170px) !important; height: auto !important; }

.lobby-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings { padding: 18px 22px; }
.settings-title { font-size: 1.3rem; margin-bottom: 10px; }
.set-row { display: flex; align-items: center; gap: 14px; margin: 10px 0; flex-wrap: wrap; }
.set-label { width: 92px; font-weight: 800; color: var(--ink-soft); }
.deck-pick { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.deck-pick button {
  --c: var(--a); cursor: pointer; padding: .35em .85em; border-radius: 999px; font-weight: 800; font-size: .95rem;
  background: var(--bg-3); border: 2px solid var(--line); color: var(--ink-soft);
  transition: transform .25s var(--spring), background .2s, color .2s;
}
.deck-pick button:hover { transform: translateY(-2px) rotate(-2deg); }
.deck-pick button.on { background: var(--c); color: var(--line); box-shadow: 0 3px 0 var(--line); transform: rotate(-2deg) scale(1.06); }
.seg { display: inline-flex; background: var(--bg-3); border: 2px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { cursor: pointer; border: 0; background: none; padding: .3em 1em; border-radius: 999px; font-weight: 800; color: var(--ink-soft); transition: background .2s, color .2s, transform .25s var(--spring); }
.seg button.on { background: var(--ink); color: var(--line); transform: scale(1.06); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; margin-top: 12px; padding-top: 12px; border-top: 2px dashed rgba(164,147,214,.3); }
.toggle-row small { display: block; color: var(--muted); font-weight: 700; }
.toggle-row input { position: absolute; opacity: 0; }
.switch { flex: none; width: 58px; height: 32px; border-radius: 999px; background: var(--bg-3); border: 3px solid var(--line); position: relative; transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 2px solid var(--line); transition: transform .35s var(--spring); }
.toggle-row input:checked + .switch { background: var(--pink); }
.toggle-row input:checked + .switch::after { transform: translateX(26px); }
.toggle-row input:focus-visible + .switch { outline: 3px solid var(--ink); outline-offset: 3px; }

.ad-slot {
  min-height: 90px; flex: 1; max-height: 120px; display: grid; place-items: center; border-radius: var(--r-sm);
  border: 2px dashed rgba(164,147,214,.35); color: var(--muted); font-weight: 800; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase;
}
.ad-slot.wide { flex: none; width: min(728px, 100%); margin: 18px auto 0; }

.lobby-floor { flex: 1; position: relative; min-height: 120px; margin-top: 10px; }
.lobby-floor .blob { position: absolute; transform: translate(-50%, -100%); }
.lobby-floor .blob.drop { animation: blobDrop .9s var(--spring) both; }
@keyframes blobDrop {
  0% { opacity: 0; transform: translate(-50%, -100%) translateY(-60vh) scale(.6, 1.3); }
  55% { opacity: 1; transform: translate(-50%, -100%) scale(1.25, .7); }
  75% { transform: translate(-50%, -100%) translateY(-24px) scale(.9, 1.1); }
  100% { transform: translate(-50%, -100%); }
}
.lobby-floor .blob.leave { animation: blobLeave .5s var(--ease) forwards; }
@keyframes blobLeave { to { opacity: 0; transform: translate(-50%, -100%) scale(0) rotate(30deg); } }
.floor-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); font-weight: 800; font-size: 1.2rem; transition: opacity .3s; }
.floor-empty.hide { opacity: 0; }
.dots { display: flex; gap: 8px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-12px); opacity: 1; } }

.lobby-footer { display: flex; align-items: center; gap: 14px; flex: none; flex-wrap: wrap; }
.count-pill, .custom-pill { font-weight: 800; padding: .45em 1em; border-radius: 999px; background: var(--bg-2); border: 2px solid var(--line); color: var(--ink-soft); }
.count-pill b, .custom-pill b { font-family: var(--f-display); font-size: 1.3em; color: var(--ink); }
.count-pill.bump { animation: popIn .4s var(--spring); }
.custom-pill { background: var(--pink); color: var(--line); }
.custom-pill b { color: var(--line); }
.lobby-footer #start-btn { margin-left: auto; }
.lobby-footer #start-btn:not([disabled]) { animation: ready 1.6s ease-in-out infinite; }
@keyframes ready { 0%, 100% { transform: none; } 50% { transform: translateY(-4px) rotate(-1.5deg) scale(1.03); } }

/* ---------- Round ---------- */
.round-top { display: flex; align-items: center; justify-content: space-between; }
.round-pill { font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; padding: .3em 1em; border-radius: 999px; background: var(--bg-2); border: 3px solid var(--line); }
.timer { position: relative; width: 84px; height: 84px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 7; }
.timer .t-bg { stroke: var(--bg-3); fill: var(--bg-2); }
.timer .t-fg { stroke: var(--b); stroke-linecap: round; stroke-dasharray: 169.6; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer span { position: relative; font-family: var(--f-display); font-weight: 700; font-size: 1.9rem; }
.timer.low .t-fg { stroke: var(--pink); }
.timer.low { animation: shake .5s ease-in-out infinite; }
.timer.off { visibility: hidden; }

.q-kicker { text-align: center; font-family: var(--f-display); font-weight: 700; font-size: clamp(1.8rem, 4vw, 3.4rem); color: var(--ink); margin-top: -6px; }
.q-kicker.in { animation: kickerIn .7s var(--spring) both; }
@keyframes kickerIn { 0% { opacity: 0; transform: scale(2.4) rotate(-6deg); } 100% { opacity: 1; transform: none; } }
.q-author { text-align: center; margin: 4px auto 0; font-weight: 800; color: var(--line); background: var(--pink); padding: .2em .9em; border-radius: 999px; border: 2px solid var(--line); width: max-content; animation: popIn .5s var(--spring) .4s both; }
.q-cards { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; padding: 18px 0; min-height: 0; }
.q-card {
  position: relative; height: 100%; max-height: 340px; padding: 30px 30px 26px; border-radius: var(--r-lg);
  border: 4px solid var(--line); box-shadow: 0 10px 0 var(--line); display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--line);
}
.q-card.a { background: var(--a); box-shadow: 0 10px 0 var(--line), inset 0 -10px 0 var(--a-deep); }
.q-card.b { background: var(--b); box-shadow: 0 10px 0 var(--line), inset 0 -10px 0 var(--b-deep); }
.q-card p { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.6rem, 3.3vw, 3rem); line-height: 1.12; }
.q-letter {
  position: absolute; top: -22px; left: 24px; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: 1.8rem; background: var(--ink); border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line);
  transform: rotate(-8deg);
}
.q-card.b .q-letter { left: auto; right: 24px; transform: rotate(8deg); }
.q-card.a.in { animation: slideA .75s var(--spring) both .25s; }
.q-card.b.in { animation: slideB .75s var(--spring) both .45s; }
@keyframes slideA { 0% { opacity: 0; transform: translateX(-70vw) rotate(-14deg); } 100% { opacity: 1; transform: rotate(-1.5deg); } }
@keyframes slideB { 0% { opacity: 0; transform: translateX(70vw) rotate(14deg); } 100% { opacity: 1; transform: rotate(1.5deg); } }
.q-card.a { transform: rotate(-1.5deg); } .q-card.b { transform: rotate(1.5deg); }
.q-or {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: 2.2rem; color: var(--line);
  background: var(--pink); border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line);
}
.q-or.in { animation: stamp .6s var(--spring) both .8s, orSpin 3.2s var(--spring) 1.6s infinite; }
@keyframes stamp { 0% { opacity: 0; transform: scale(3) rotate(-40deg); } 100% { opacity: 1; transform: none; } }
@keyframes orSpin { 0%, 70% { transform: rotate(0) scale(1); } 80% { transform: rotate(-20deg) scale(1.2); } 90% { transform: rotate(12deg) scale(.95); } 100% { transform: rotate(0); } }

.voter-strip { flex: none; display: flex; align-items: flex-end; gap: 18px; padding-top: 8px; }
.voters { flex: 1; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; min-height: 80px; }
.voters .blob .tag { font-size: .75rem; }
.vote-status { font-weight: 800; color: var(--ink-soft); font-size: 1.2rem; white-space: nowrap; }
.vote-status b { font-family: var(--f-display); color: var(--ink); font-size: 1.4em; }

/* ---------- Reveal ---------- */
.reveal-head { display: flex; align-items: center; justify-content: center; gap: 14px; flex: none; flex-wrap: wrap; }
.mini-opt { font-family: var(--f-display); font-weight: 600; font-size: clamp(1rem, 1.7vw, 1.35rem); padding: .3em .9em; border-radius: 14px; border: 3px solid var(--line); color: var(--line); max-width: 42%; text-align: center; line-height: 1.2; }
.mini-opt.a { background: var(--a); } .mini-opt.b { background: var(--b); }
.mini-or { font-family: var(--f-display); font-weight: 700; color: var(--pink); }
.reveal-stage { flex: 1; position: relative; min-height: 0; }
.reveal-stage .blob { position: absolute; transform: translate(-50%, -100%); transition: left .9s var(--snap), top .9s var(--snap), transform .6s var(--spring); }
.reveal-stage .blob .tag { font-size: .78rem; }

.callout { flex: none; min-height: 64px; display: flex; justify-content: center; align-items: center; }
.callout .bubble {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 3vw, 2.4rem); color: var(--line);
  background: var(--ink); padding: .25em .9em; border-radius: 20px; border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line);
  animation: stamp .6s var(--spring) both;
}
.callout .bubble.pink { background: var(--pink); } .callout .bubble.lime { background: var(--lime); } .callout .bubble.a { background: var(--a); } .callout .bubble.b { background: var(--b); }
.reveal-actions { flex: none; display: flex; justify-content: center; padding-top: 10px; opacity: 0; transform: translateY(20px); transition: .5s var(--spring); pointer-events: none; }
.reveal-actions.show { opacity: 1; transform: none; pointer-events: auto; }

/* Style: run to your side */
.rv-zone { position: absolute; bottom: 4%; width: 44%; height: 78%; border-radius: 40px; border: 4px dashed rgba(255,255,255,.15); display: flex; flex-direction: column; align-items: center; padding-top: 2%; transition: background .5s, border-color .5s, transform .6s var(--spring); }
.rv-zone.a { left: 3%; } .rv-zone.b { right: 3%; }
.rv-zone.lit.a { background: rgba(255,178,31,.12); border-color: var(--a); }
.rv-zone.lit.b { background: rgba(46,230,208,.12); border-color: var(--b); }
.rv-zone.win { transform: scale(1.03); }
.rv-pct { font-family: var(--f-display); font-weight: 700; font-size: clamp(3rem, 8vw, 7rem); line-height: 1; opacity: 0; transform: scale(.3); transition: opacity .2s, transform .6s var(--spring); -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; }
.rv-zone.a .rv-pct { color: var(--a); } .rv-zone.b .rv-pct { color: var(--b); }
.rv-pct.show { opacity: 1; transform: none; }
.spotlight { position: absolute; width: 220px; height: 120%; bottom: 0; transform: translateX(-50%); background: linear-gradient(to bottom, rgba(255,247,236,0), rgba(255,247,236,.22)); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); pointer-events: none; animation: popIn .5s var(--spring); }

/* Style: tug of war */
.tug { position: absolute; inset: 0; overflow: hidden; }
.tug-mid { position: absolute; left: 50%; top: 10%; bottom: 6%; width: 0; border-left: 5px dashed var(--pink); }
.tug-mid::after { content: 'CENTER'; position: absolute; top: -6px; left: 50%; transform: translate(-50%, -100%); font-weight: 900; font-size: .8rem; letter-spacing: .15em; color: var(--pink); }
.tug-track { position: absolute; left: 0; right: 0; top: 0; bottom: 0; transition: transform 1.4s var(--spring); }
.tug-track.strain { animation: strain .28s ease-in-out infinite; }
@keyframes strain { 0%, 100% { transform: translateX(-10px); } 50% { transform: translateX(10px); } }
.tug-rope { position: absolute; left: -10%; right: -10%; top: 58%; height: 14px; border-radius: 8px; border: 3px solid var(--line); background: repeating-linear-gradient(60deg, #d9a26a 0 10px, #b07a45 10px 20px); }
.tug-knot { position: absolute; left: 50%; top: 58%; width: 34px; height: 34px; margin: -10px 0 0 -17px; border-radius: 50%; background: var(--pink); border: 3px solid var(--line); }
.tug-pct { position: absolute; top: 12%; font-family: var(--f-display); font-weight: 700; font-size: clamp(2.6rem, 7vw, 6rem); -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; opacity: 0; transform: scale(.3); transition: opacity .2s, transform .6s var(--spring); }
.tug-pct.a { left: 6%; color: var(--a); } .tug-pct.b { right: 6%; color: var(--b); }
.tug-pct.show { opacity: 1; transform: none; }
.reveal-stage .blob.pull .bob { animation: pull .35s ease-in-out infinite; }
@keyframes pull { 0%, 100% { transform: rotate(var(--lean, -10deg)) scale(1.05, .95); } 50% { transform: rotate(calc(var(--lean, -10deg) * 1.6)) scale(.97, 1.03); } }
.reveal-stage .blob.flop { transform: translate(-50%, -100%) rotate(var(--flop, 80deg)) translateY(10px) !important; }

/* Style: seesaw */
.see { position: absolute; inset: 0; }
.see-fulcrum { position: absolute; left: 50%; bottom: 6%; width: 120px; height: 110px; transform: translateX(-50%); }
.see-plank { position: absolute; left: 10%; right: 10%; bottom: calc(6% + 106px); height: 22px; border-radius: 12px; background: var(--ink); border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line); transform-origin: 50% 50%; transition: transform 1.6s cubic-bezier(.3, 1.7, .5, 1); }
.see-plank.wobble { animation: seeWobble .5s ease-in-out infinite; }
@keyframes seeWobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.see-pan { position: absolute; bottom: 100%; width: 40%; display: flex; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; gap: 0 2px; padding-bottom: 2px; }
.see-pan.a { left: 0; } .see-pan.b { right: 0; }
.see-pan .blob { position: relative; transform: none; left: auto; top: auto; animation: panDrop .7s var(--spring) both; }
@keyframes panDrop { 0% { opacity: 0; transform: translateY(-50vh) scale(.7, 1.3); } 70% { opacity: 1; transform: scale(1.2, .8); } 100% { transform: none; } }
.see-label { position: absolute; top: calc(100% + 14px); width: 40%; text-align: center; }
.see-label.a { left: 0; } .see-label.b { right: 0; }
.see-pct { font-family: var(--f-display); font-weight: 700; font-size: clamp(2.2rem, 5vw, 4.4rem); -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; opacity: 0; transform: scale(.3); display: inline-block; transition: opacity .2s, transform .6s var(--spring); }
.see-label.a .see-pct { color: var(--a); } .see-label.b .see-pct { color: var(--b); }
.see-pct.show { opacity: 1; transform: none; }

/* ---------- End ---------- */
.end-title { text-align: center; font-size: clamp(2.4rem, 5.5vw, 4.4rem); margin: 4px 0 18px; }
.end-title .ch { display: inline-block; animation: chIn .6s var(--spring) both; }
@keyframes chIn { 0% { opacity: 0; transform: translateY(60%) rotate(8deg) scale(.6); } 100% { opacity: 1; transform: none; } }
.awards { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; align-items: center; align-content: center; perspective: 1000px; min-height: 0; }
.award { flex: 0 1 calc(25% - 15px); min-width: 200px; padding: 20px 16px 22px; text-align: center; transform-style: preserve-3d; opacity: 0; transform: rotateY(-100deg) scale(.7); transition: opacity .3s, transform .9s var(--spring); }
.award.show { opacity: 1; transform: none; }
.award .a-title { font-family: var(--f-display); font-weight: 700; font-size: 1.55rem; color: var(--line); background: var(--c, var(--a)); border: 3px solid var(--line); border-radius: 14px; padding: .1em .5em; display: inline-block; transform: rotate(-3deg); box-shadow: 0 4px 0 var(--line); }
.award .a-blobs { display: flex; justify-content: center; gap: 6px; margin: 22px 0 30px; min-height: 90px; align-items: flex-end; }
.award .a-name { font-family: var(--f-display); font-weight: 700; font-size: 1.4rem; }
.award .a-why { color: var(--ink-soft); font-weight: 700; margin: 4px 0 0; }
.end-actions { flex: none; display: flex; justify-content: center; gap: 16px; padding-top: 16px; }

/* ---------- Slam overlay ---------- */
.slam { overflow: hidden; position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 40; }
.slam .slam-text {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(3rem, 11vw, 9rem); color: var(--a);
  -webkit-text-stroke: 6px var(--line); paint-order: stroke fill; text-shadow: 0 10px 0 var(--line);
  animation: slam 1.3s var(--spring) both;
}
@keyframes slam { 0% { opacity: 0; transform: scale(3) rotate(-12deg); } 25% { opacity: 1; transform: scale(1) rotate(-4deg); } 75% { opacity: 1; transform: scale(1.05) rotate(-4deg); } 100% { opacity: 0; transform: scale(.6) rotate(4deg) translateY(-40px); } }
.slam::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(27,16,54,.0), rgba(12,5,32,.7)); opacity: 0; transition: opacity .3s; }
.slam.on::before { opacity: 1; }

@media (max-width: 900px) {
  .stage-page { height: auto; min-height: 100vh; overflow-x: hidden; overflow-y: auto; }
  #app { min-height: calc(100vh - 80px); }
  .screen { position: relative; display: none; }
  .screen.on { display: flex; }
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-floor { min-height: 200px; }
  .q-cards { grid-template-columns: 1fr; }
  .q-or { margin: auto; }
  .reveal-stage { min-height: 420px; }
  .award { flex-basis: calc(50% - 10px); min-width: 0; }
}

/* ---------- Game picker ---------- */
.game-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.game-tile b, .game-tile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Deck stepper */
.deck-step { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ds-arrow {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: var(--bg-3); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); transition: transform .2s var(--spring);
}
.ds-arrow:hover { transform: translateY(-2px) scale(1.06); }
.ds-arrow:active { transform: translateY(3px); box-shadow: none; }
.ds-name {
  --c: var(--a); flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; color: var(--line); background: var(--c);
  padding: .3em .8em; border-radius: 999px; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line);
}
.ds-count { flex: none; font-weight: 800; font-size: .8rem; color: var(--muted); min-width: 2.6em; text-align: center; }
.game-tile {
  font: inherit; cursor: pointer; text-align: left; padding: .5em .75em .55em; border-radius: 14px;
  background: var(--bg-3); border: 3px solid var(--line); color: var(--ink);
  display: flex; flex-direction: column; gap: 2px; transition: transform .25s var(--spring), background .2s, color .2s;
}
.game-tile b { font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; line-height: 1.1; }
.game-tile small { font-weight: 800; font-size: .78rem; line-height: 1.2; color: var(--muted); }
.game-tile:not(.soon):hover { transform: translateY(-2px) rotate(-1.5deg); }
.game-tile.on { background: var(--c); color: var(--line); box-shadow: 0 4px 0 var(--line); transform: rotate(-1.5deg) scale(1.03); }
.game-tile.on small { color: var(--line); opacity: .75; }

/* ---------- Called Out: round card ---------- */
.co-card { display: none; }
body[data-kind="co"] .q-cards { display: none; }
body[data-kind="co"] .co-card {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin: 18px auto; width: min(980px, 100%);
  max-height: 340px; padding: 30px 40px; border-radius: var(--r-lg); text-align: center; color: var(--line);
  background: var(--pink); border: 4px solid var(--line); box-shadow: 0 10px 0 var(--line), inset 0 -10px 0 #d63d86; transform: rotate(-1deg);
}
.co-card p { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.9rem, 4.2vw, 3.6rem); line-height: 1.1; }
.co-card.in { animation: coIn .8s var(--spring) both .25s; }
@keyframes coIn { 0% { opacity: 0; transform: translateY(60vh) rotate(12deg) scale(.7); } 100% { opacity: 1; transform: rotate(-1deg); } }

.mini-co { display: none; }
body[data-kind="co"] .reveal-head .mini-opt, body[data-kind="co"] .reveal-head .mini-or, body[data-kind="event"] .reveal-head .mini-opt, body[data-kind="event"] .reveal-head .mini-or { display: none; }
body[data-kind="co"] .mini-co, body[data-kind="event"] .mini-co {
  display: block; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.1rem, 2vw, 1.6rem); text-align: center;
  padding: .3em 1em; border-radius: 14px; border: 3px solid var(--line); background: var(--pink); color: var(--line); max-width: 80%; line-height: 1.2;
}

/* ---------- Called Out: lineup reveal ---------- */
.lineup { position: absolute; inset: 0; }
.lu-wall { position: absolute; inset: 3% 1% 0; border-radius: 28px 28px 0 0; background: rgba(255,255,255,.03); border: 3px solid rgba(164,147,214,.18); border-bottom: 0; overflow: hidden; }
.lu-wall i { position: absolute; left: 0; right: 0; border-top: 3px dashed rgba(164,147,214,.16); }
.lu-wall i:nth-child(1) { top: 20%; } .lu-wall i:nth-child(2) { top: 40%; } .lu-wall i:nth-child(3) { top: 60%; } .lu-wall i:nth-child(4) { top: 80%; }
.lu-row { position: absolute; left: 2%; right: 2%; top: 5%; bottom: 7%; display: flex; justify-content: center; align-items: flex-end; gap: 1%; }
.lu-col { position: relative; flex: 1 1 0; max-width: 190px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; animation: riseIn .6s var(--snap) both; transition: opacity .45s, filter .45s, transform .6s var(--spring); }
.reveal-stage .lineup .blob { position: relative; left: auto; top: auto; transform: none; transition: none; }
.lu-stack { display: flex; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; width: 100%; max-width: 140px; margin-bottom: -4px; }
.lu-stack .blob { margin: -3px -2px; animation: miniDrop .6s var(--spring) both; }
@keyframes miniDrop { 0% { opacity: 0; transform: translateY(-50vh) scale(.6, 1.4); } 70% { opacity: 1; transform: scale(1.25, .75); } 100% { transform: none; } }
.lu-count {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(1.8rem, 3.6vw, 3.2rem); line-height: 1; color: var(--ink);
  -webkit-text-stroke: 3px var(--line); paint-order: stroke fill; opacity: 0; transform: scale(.3); transition: opacity .2s, transform .45s var(--spring); margin-bottom: 4px;
}
.lu-count.show { opacity: 1; transform: none; }
.lu-count.bump { animation: popIn .35s var(--spring); }
.lu-col.top { transform: scale(1.08); z-index: 2; }
.lu-col.top .lu-count { color: var(--pink); }
.lu-col.top::before {
  content: ''; position: absolute; bottom: 0; left: 50%; width: 260%; height: 140%; transform: translateX(-50%); z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,247,236,0), rgba(255,247,236,.24)); clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%); animation: popIn .5s var(--spring);
}
.lu-col.dim { opacity: .45; filter: saturate(.5); transform: scale(.94); }
.lu-stamp {
  position: absolute; left: 50%; bottom: 6%; z-index: 3; white-space: nowrap; transform: translateX(-50%) rotate(-10deg);
  font-family: var(--f-display); font-weight: 700; font-size: clamp(1rem, 2vw, 1.7rem); text-transform: uppercase; letter-spacing: .06em;
  color: var(--pink); background: rgba(27,16,54,.88); border: 4px solid var(--pink); border-radius: 10px; padding: .05em .45em;
  animation: stampIn .5s var(--spring) both;
}
@keyframes stampIn { 0% { opacity: 0; transform: translateX(-50%) scale(3) rotate(-25deg); } 100% { opacity: 1; transform: translateX(-50%) rotate(-10deg); } }

@media (max-width: 900px) {
  .game-pick { grid-template-columns: 1fr 1fr; }
}

/* Keep the lobby on one screen */
.settings { padding: 14px 18px; }
.set-row { margin: 7px 0; }
.toggle-row { margin-top: 8px; padding-top: 10px; }
@media (max-height: 800px) and (min-width: 901px) {
  .lobby-side .ad-slot { display: none; }
  .join-panel { padding: 16px 22px; }
  .big-code span { height: clamp(62px, 7vw, 96px); }
}

/* ---------- Sip Happens ---------- */
.sh-only { display: none !important; }
body[data-game="sip-happens"] .set-row.sh-only, body[data-game="sip-happens"] .toggle-row.sh-only { display: flex !important; }
body[data-game="sip-happens"] .not-sh { display: none !important; }
body[data-game="sip-happens"] .ad-slot { display: none !important; }
.sh-note { font-weight: 800; font-size: .8rem; color: var(--muted); }

.rule-pill {
  margin: 0 auto 0 14px; padding: .35em 1em; border-radius: 999px; font-weight: 800; font-size: 1rem;
  background: var(--sky); color: var(--line); border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); transform: rotate(-1.5deg);
  max-width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rule-pill[hidden] { display: none; }

.ev-card { display: none; }
body[data-kind="event"] .q-cards, body[data-kind="event"] .co-card { display: none; }
body[data-kind="event"] .ev-card {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin: 18px auto; width: min(940px, 100%);
  max-height: 320px; padding: 30px 40px; border-radius: var(--r-lg); text-align: center; color: var(--line);
  background: var(--sky); border: 4px solid var(--line); box-shadow: 0 10px 0 var(--line), inset 0 -10px 0 #3f66d6; transform: rotate(1deg);
}
.ev-card p { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.7rem, 3.8vw, 3.2rem); line-height: 1.12; }
.ev-card.in { animation: coIn .8s var(--spring) both .25s; }
body[data-kind="event"] .mini-co { background: var(--sky); }

/* Wild card reveal */
.rv-inner.wild { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 18px; padding-top: 6px; }
.wild-card {
  width: min(820px, 92%); padding: 22px 32px; border-radius: var(--r-lg); text-align: center; color: var(--line);
  background: var(--sky); border: 4px solid var(--line); box-shadow: 0 8px 0 var(--line), inset 0 -8px 0 #3f66d6;
  animation: wildIn .8s var(--spring) both; transform: rotate(-1deg);
}
.wild-card b { display: block; font-family: var(--f-display); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; margin-bottom: 8px; }
.wild-card p { margin: 0; font-weight: 800; font-size: clamp(1.1rem, 2vw, 1.5rem); line-height: 1.3; }
@keyframes wildIn { 0% { opacity: 0; transform: rotateY(90deg) scale(.7); } 100% { opacity: 1; transform: rotate(-1deg); } }
.wild-pair { display: flex; align-items: center; gap: 18px; animation: popIn .6s var(--spring) both .5s; }
.reveal-stage .wild-pair .blob, .reveal-stage .sip-board .blob { position: relative; left: auto; top: auto; transform: none; transition: none; }
.wild-link { width: 110px; height: 14px; border-radius: 999px; background: repeating-linear-gradient(90deg, var(--ink) 0 18px, transparent 18px 26px); position: relative; }
.wild-link.give { background: var(--pink); height: 10px; }
.wild-link.give::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); border: 14px solid transparent; border-left: 18px solid var(--pink); border-right: 0; }

/* Drink up board */
.sip-board {
  position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); width: min(620px, 94%); max-height: 96%; overflow: auto;
  padding: 16px 20px 14px; z-index: 5; animation: boardIn .6s var(--spring) both;
}
.rv-inner.wild .sip-board { position: relative; left: auto; bottom: auto; transform: none; animation-name: boardInStatic; }
@keyframes boardIn { 0% { opacity: 0; transform: translate(-50%, 40px) scale(.9); } 100% { opacity: 1; transform: translateX(-50%); } }
@keyframes boardInStatic { 0% { opacity: 0; transform: translateY(40px) scale(.9); } 100% { opacity: 1; transform: none; } }
.sb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.sb-head b { font-family: var(--f-display); font-size: 2rem; line-height: 1; }
.sb-head span { font-weight: 800; color: #5b4f7a; }
.sb-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.sb-row { display: flex; align-items: center; gap: 10px; animation: popIn .5s var(--spring) both; min-width: 0; }
.sb-name { flex: 1; min-width: 0; font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-name small { display: block; font-family: var(--f-body); font-size: .78rem; font-weight: 800; color: #5b4f7a; }
.sb-n { flex: none; font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; padding: .15em .7em; border-radius: 999px; background: var(--sky); border: 2px solid var(--line); }
.sb-n.dare { background: var(--a); }
.sb-none { margin: 4px 0; font-weight: 800; grid-column: 1 / -1; }
.sb-dare { margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: var(--a-soft); border: 2px dashed var(--line); font-weight: 800; }
.sb-dare.taken { background: var(--a); border-style: solid; }
.sb-dare.taken::before { content: 'Dare accepted! '; font-family: var(--f-display); }
.rv-inner.drinking:not(.wild) > :not(.sip-board) { opacity: .28; filter: saturate(.6); transition: opacity .5s, filter .5s; }
body[data-kind="event"] .reveal-head { display: none; }

/* ---------- Big screens: scale the whole stage up so it reads from the sofa ---------- */
/* js/host.js sets --z from the window size (designed at 1440x810, never scaled below 1) */
@media (min-width: 901px) {
  .stage-page { zoom: var(--z, 1); height: calc(100vh / var(--z, 1)); min-height: 0; }
}

/* ---------- Tablets and phones hosting ---------- */
@media (max-width: 900px) and (min-width: 600px) { .game-pick { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 599px) {
  .stage-bar { padding: 10px 14px; gap: 10px; }
  .screen { padding: 6px 14px 18px; }
  .join-panel { grid-template-columns: 1fr; padding: 16px 18px; }
  .qr-wrap { display: none; }
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .big-code span { flex: 1; width: auto; height: auto; aspect-ratio: 4 / 5; font-size: 11vw; max-width: 90px; }
  .deck-step { min-width: 0; }
  .game-pick { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .game-tile { padding-inline: 8px; }
  .game-tile b { font-size: .95rem; }
  .game-tile small { display: none; }
  .set-label { width: 74px; font-size: .9rem; }
  .ds-count { display: none; }
  .ds-name { font-size: 1rem; padding: .3em .5em; }
  .seg button { padding: .3em .8em; }
  .lobby-footer { gap: 10px; }
  .lobby-footer #start-btn { width: 100%; margin-left: 0; }
  .q-kicker { font-size: 1.6rem; }
  .round-pill { font-size: 1rem; }
  .timer { width: 64px; height: 64px; }
  .rule-pill { max-width: 40%; font-size: .8rem; }
  .game-ctl .btn { font-size: 0; padding: .45em; gap: 0; }
  .mini-code { font-size: .85rem; }
}
.callout .bubble { max-width: min(94vw, 1100px); white-space: normal; text-align: center; }
@media (max-width: 599px) {
  .stage-bar .logo > span { display: none; }
  #fullscreen { display: none; }
  .stage-bar .icon-btn { width: 40px; height: 40px; }
  .mini-code { padding: .25em .7em; white-space: nowrap; }
  .game-ctl { gap: 6px; }
  .voter-strip { flex-wrap: wrap; gap: 10px; }
  .voters { flex: 1 1 100%; flex-wrap: wrap; }
  .callout .bubble { font-size: 1.2rem; }
  .slam-text { font-size: 13vw !important; white-space: normal; text-align: center; }
}
