/* Player / phone screen */
html, body { overscroll-behavior: none; }
body { min-height: 100dvh; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wordmark { font-size: 64px; line-height: .9; text-align: center; text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--robe); }
.wordmark span { color: var(--accent); display: block; }
main, section { padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }

/* ---------- join */
.join { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; max-width: 460px; margin: 0 auto; }
.join-logo { width: min(92vw, 420px); filter: drop-shadow(0 8px 20px #000a); animation: logoIn .9s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes logoIn { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
.join-form { width: 100%; display: grid; gap: 8px; }
.join-form label { font-weight: 800; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.join-form input {
  width: 100%; font: 800 24px var(--body); padding: 14px 16px; border-radius: 12px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink); box-shadow: 0 5px 0 var(--ink); outline: none; user-select: text; -webkit-user-select: text;
}
.join-form input:focus { box-shadow: 0 5px 0 var(--ink), 0 0 0 4px var(--accent); }
#code { text-transform: uppercase; letter-spacing: .4em; font-size: 34px; text-align: center; font-family: var(--display); }
#code::placeholder { letter-spacing: .4em; color: #0003; }
.err { min-height: 22px; color: var(--danger); font-weight: 700; text-align: center; }
.play-btn { font-size: 24px; padding: 16px; margin-top: 4px; }
.join-foot { font-size: 12px; color: var(--muted); text-align: center; }
.join-foot a { color: var(--accent); }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* ---------- reveal */
.reveal { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; background: radial-gradient(circle at 50% 40%, #2b2366, var(--bg-deep) 70%); z-index: 20; }
.slot { width: 220px; height: 220px; display: grid; place-items: center; }
.slot .avatar { --size: 220px; }
.slot.landed .avatar { animation: land .8s cubic-bezier(.2, 1.8, .4, 1) both; box-shadow: 0 0 0 4px var(--ink), 0 0 60px var(--ring); }
@keyframes land { 0% { transform: scale(1.4); } 100% { transform: none; } }
.reveal-name { font-size: 46px; color: var(--accent); text-shadow: 3px 3px 0 var(--ink); min-height: 1.2em; }
.reveal-sub { color: var(--muted); font-weight: 700; }

/* ---------- waiting */
.wait { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; max-width: 460px; margin: 0 auto; }
.wait-avatar .avatar { --size: 180px; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-12px) rotate(3deg); } }
.wait h2 { font-size: 40px; }
.wait-as { color: var(--accent); font-weight: 800; }
.wait-speech { margin-top: 10px; }
.dots i { font-style: normal; animation: dot 1.2s infinite; } .dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 50% { opacity: 0; } }
.wait-tip { color: var(--muted); font-size: 14px; }

/* ---------- play */
.play { min-height: 100dvh; display: flex; flex-direction: column; gap: 12px; max-width: 520px; margin: 0 auto; }
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me .avatar { --size: 54px; }
.me .who { min-width: 0; }
.me .nm { font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .av { font-size: 12px; color: var(--muted); }
.latest { display: flex; align-items: center; gap: 10px; }
.latest-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: right; width: 44px; }
.latest-ball { width: 72px; height: 72px; }
.latest-ball .ball { --size: 72px; }
.latest-ball .ball.drop { animation: ballIn .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes ballIn { from { transform: translateY(-80px) scale(.3) rotate(-360deg); opacity: 0; } }
.goal { font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.goal b { color: var(--accent); }
.status { margin-left: auto; font-weight: 800; color: var(--cosmic); }

.card-wrap { perspective: 900px; }
.card { background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; padding: 8px; box-shadow: 0 8px 0 var(--ink), 0 18px 40px #000a; animation: cardIn .8s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes cardIn { from { transform: rotateX(70deg) translateY(60px); opacity: 0; } }
.card-head { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 6px; }
.card-head span { font-family: var(--display); font-size: 34px; text-align: center; color: var(--ink); border-radius: 10px; line-height: 1.25; border: 3px solid var(--ink); }
.card-head .B { background: var(--ball-b); } .card-head .I { background: var(--ball-i); } .card-head .N { background: #e1e1d6; }
.card-head .G { background: var(--ball-g); } .card-head .O { background: var(--ball-o); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sq {
  position: relative; aspect-ratio: 1; border: 3px solid #17181733; border-radius: 10px; background: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: clamp(22px, 7.4vw, 34px); color: var(--ink);
  transition: transform .1s; overflow: visible; cursor: pointer;
}
.sq:active { transform: scale(.92); }
.sq.free { background: var(--robe); color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.sq.free svg { width: 50%; height: 50%; fill: var(--accent); }
.sq .daub {
  position: absolute; inset: 6%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff6 0 10%, transparent 30%), var(--dc, #b33aa6);
  opacity: .82; mix-blend-mode: multiply; transform: rotate(var(--rot, 0deg));
  animation: splat .35s cubic-bezier(.2, 1.8, .4, 1) both;
  clip-path: polygon(50% 0, 63% 8%, 78% 4%, 84% 18%, 98% 26%, 92% 42%, 100% 56%, 88% 68%, 92% 84%, 76% 88%, 66% 100%, 50% 92%, 34% 100%, 24% 88%, 8% 86%, 10% 70%, 0 56%, 8% 42%, 2% 26%, 16% 18%, 22% 4%, 37% 8%);
}
@keyframes splat { from { transform: scale(2) rotate(var(--rot, 0deg)); opacity: 0; } }
.sq.missed { color: #17181755; background: #e4e1d6; }
.sq.missed::after {
  content: ''; position: absolute; inset: 14%; pointer-events: none;
  background: linear-gradient(45deg, transparent 44%, var(--danger) 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, var(--danger) 44% 56%, transparent 56%);
}
.sq.win { animation: winCell .6s ease-in-out infinite alternate; }
@keyframes winCell { to { transform: scale(1.08); box-shadow: 0 0 22px var(--accent); } }

.recent-strip { display: flex; gap: 8px; justify-content: center; min-height: 42px; }
.recent-strip .ball { --size: 40px; }

.bingo-btn {
  margin-top: auto; width: 100%; font-family: var(--display); font-size: 54px; padding: 10px; border-radius: 22px;
  border: 4px solid var(--ink); color: var(--ink);
  background: linear-gradient(90deg, var(--ball-b), var(--ball-i), #f0f0e6, var(--ball-g), var(--ball-o), var(--ball-b));
  background-size: 200% 100%; animation: rainbow 5s linear infinite;
  box-shadow: 0 8px 0 var(--ink), 0 14px 30px #000a; transition: transform .1s, box-shadow .1s; text-shadow: 2px 2px 0 #fff8;
}
.bingo-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ink); }
.bingo-btn.ready { animation: rainbow 1.2s linear infinite, throb .6s ease-in-out infinite alternate; }
.bingo-btn:disabled { filter: grayscale(1) brightness(.6); animation: none; font-size: 32px; padding: 22px 10px; }
@keyframes rainbow { from { background-position: 0% 0; } to { background-position: -200% 0; } }
@keyframes throb { to { transform: scale(1.04); } }
.helper { font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- dunce corner */
.card-wrap { position: relative; }
.play.dunced .card { filter: grayscale(.85) brightness(.55); }
.dunce {
  position: absolute; inset: 8% 6% auto; z-index: 5; display: grid; justify-items: center; gap: 6px; text-align: center;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 20px; padding: 18px 16px 16px;
  box-shadow: 0 8px 0 var(--ink), 0 20px 40px #000c; animation: dunceIn .6s cubic-bezier(.2, 1.8, .4, 1) both;
}
.dunce.wobble { animation: shake .45s; }
@keyframes dunceIn { from { transform: scale(.2) rotate(-20deg); opacity: 0; } }
.dunce-avatar { position: relative; margin-top: 54px; }
.dunce-avatar .avatar { animation: sulk 2.4s ease-in-out infinite; }
@keyframes sulk { 50% { transform: rotate(-6deg) translateY(3px); } }
.dunce-cap { position: absolute; left: 50%; bottom: 62%; width: 96px; transform: translateX(-50%) rotate(-8deg); filter: drop-shadow(0 4px 6px #0007); animation: capBob 2.4s ease-in-out infinite; }
@keyframes capBob { 50% { transform: translateX(-50%) rotate(4deg); } }
.dunce-cap-css { position: absolute; left: 50%; bottom: 70%; transform: translateX(-50%); width: 0; height: 0; border-left: 40px solid transparent; border-right: 40px solid transparent; border-bottom: 96px solid var(--paper); filter: drop-shadow(0 0 0 var(--ink)); font: 0/0 a; }
.dunce-title { font-family: var(--display); font-size: 40px; color: var(--danger); text-shadow: 2px 2px 0 var(--ink); line-height: 1; }
.dunce-sub { font-weight: 700; }
.dunce-count { font-weight: 800; background: var(--ink); color: var(--accent); border-radius: 999px; padding: 6px 14px; }

/* ---------- prize */
.prize {
  display: grid; justify-items: center; gap: 6px; width: min(340px, 86vw); padding: 12px 12px 16px; border-radius: 18px; text-decoration: none;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 8px 0 var(--ink), 0 0 40px #d5ed5855;
  animation: prizeIn .8s .6s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes prizeIn { from { transform: translateY(60px) scale(.6) rotate(6deg); opacity: 0; } }
.prize img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; border: 3px solid var(--ink); }
.prize-label { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--robe); }
.prize-title { font-family: var(--display); font-size: 24px; line-height: 1.05; }
.prize-tag { font-size: 14px; font-weight: 700; color: #555; }
.prize-cta { margin-top: 4px; background: var(--accent); border: 3px solid var(--ink); border-radius: 12px; padding: 10px 18px; font-weight: 800; box-shadow: 0 4px 0 var(--ink); }
.result-inner { max-height: 100dvh; overflow-y: auto; }

/* ---------- result */
.result { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #100f14f2; text-align: center; }
.result-inner { display: grid; justify-items: center; gap: 16px; padding: 24px; }
.result-title { font-size: 72px; line-height: 1; color: var(--accent); text-shadow: 4px 4px 0 var(--ink), 8px 8px 0 var(--robe); animation: logoIn .8s cubic-bezier(.2, 1.6, .4, 1) both; }
.result .avatar { --size: 170px; animation: floaty 1.6s ease-in-out infinite; }
.result-text { font-size: 22px; font-weight: 800; }
.result-sub { color: var(--muted); }
.result.lost .result-title { color: var(--cosmic); font-size: 56px; }


.paused-banner { background: var(--accent); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; font-weight: 800; text-align: center; box-shadow: 0 4px 0 var(--ink); animation: throb .8s ease-in-out infinite alternate; }

/* ======================================================================
   Responsive: keep the whole card + BINGO button on screen.
   --chrome = vertical space used by everything that isn't the card.
   ====================================================================== */
.card-wrap { --chrome: 350px; width: min(100%, calc((100dvh - var(--chrome)) / 1.2)); align-self: center; }

/* Short phones (iPhone SE, small Androids) */
@media (max-height: 760px) and (orientation: portrait) {
  .play { gap: 8px; }
  .card-wrap { --chrome: 240px; }
  .me .avatar { --size: 44px !important; }
  .latest-ball, .latest-ball .ball { width: 56px; height: 56px; --size: 56px !important; }
  .card { padding: 6px; border-radius: 14px; }
  .card-head span { font-size: 24px; }
  .grid, .card-head { gap: 4px; }
  .recent-strip { min-height: 30px; }
  .recent-strip .ball { --size: 30px !important; }
  .bingo-btn { font-size: 40px; padding: 4px; border-radius: 16px; }
  .helper { display: none; }
  .result-title { font-size: 52px; }
  .result .avatar { --size: 110px !important; }
  .result-inner { gap: 10px; }
  .result-text { font-size: 18px; }
  .prize img { aspect-ratio: 16 / 8; }
  .prize-title { font-size: 20px; }
  .slot, .slot .avatar { width: 170px; height: 170px; --size: 170px !important; }
  .wait-avatar .avatar { --size: 130px !important; }
}

/* Phones on their side: card on the right, everything else on the left */
@media (orientation: landscape) and (max-height: 540px) {
  .play { max-width: none; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-rows: min-content; column-gap: 20px; row-gap: 8px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
  .play > :not(.card-wrap) { grid-column: 1; }
  .card-wrap { grid-column: 2; grid-row: 1 / span 6; width: calc((100dvh - 24px) / 1.2); align-self: center; }
  .card-head span { font-size: 22px; }
  .sq { font-size: clamp(16px, 5.4vh, 26px); }
  .grid, .card-head { gap: 4px; }
  .bingo-btn { font-size: 40px; padding: 4px; align-self: end; }
  .helper { display: none; }
  .dunce { inset: 4% 4% auto; padding: 10px; }
  .dunce-avatar { margin-top: 40px; }
  .dunce-title { font-size: 28px; }

  .join { gap: 10px; max-width: 640px; }
  .join-logo { width: min(46vw, 300px); }
  .join-form { grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .join-form label[for=code] { grid-column: 1; grid-row: 1; }
  .join-form label[for=name] { grid-column: 2; grid-row: 1; }
  #code { grid-column: 1; grid-row: 2; font-size: 26px; padding: 8px; }
  #name { grid-column: 2; grid-row: 2; font-size: 20px; padding: 10px; }
  .err, .play-btn { grid-column: 1 / -1; }
  .play-btn { padding: 10px; font-size: 20px; }

  .reveal { flex-direction: row; flex-wrap: wrap; gap: 8px 28px; }
  .slot, .slot .avatar { width: 150px; height: 150px; --size: 150px !important; }
  .wait { gap: 8px; }
  .wait-avatar .avatar { --size: 100px !important; }
  .wait h2 { font-size: 30px; }

  .result-inner { grid-template-columns: auto auto; align-items: center; column-gap: 28px; text-align: left; }
  .result-title { grid-column: 1 / -1; justify-self: center; font-size: 48px; }
  .result .avatar { --size: 100px !important; }
  .result-text, .result-sub { grid-column: 1; }
  .prize { grid-column: 2; grid-row: 2 / span 3; width: min(320px, 44vw); }
  .prize img { aspect-ratio: 16 / 7; }
}

/* Very short screens / landscape: compact prize card so the button stays visible */
@media (max-height: 600px) {
  .prize img { aspect-ratio: 16 / 5; }
  .prize { padding: 8px 10px 10px; gap: 4px; }
  .prize-title { font-size: 18px; }
  .prize-cta { padding: 6px 14px; }
  .result-sub { display: none; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .prize img { display: none; }
  .result-title { font-size: 40px; }
}

/* Dunce card on small phones */
@media (max-height: 760px) and (orientation: portrait) {
  .dunce { inset: 2% 3% auto; padding: 10px 10px 12px; gap: 4px; border-width: 3px; }
  .dunce-avatar { margin-top: 38px; }
  .dunce-avatar .avatar { --size: 76px !important; }
  .dunce-cap { width: 66px; }
  .dunce-title { font-size: 28px; }
  .dunce-sub { font-size: 13px; }
  .dunce-count { padding: 4px 12px; font-size: 14px; }
}

/* ---------- sound toggle + prizes */
.goal-tools { margin-left: auto; display: flex; gap: 6px; }
.status:empty { display: none; }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; border: 2px solid var(--line); background: var(--surface); color: var(--paper); border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 12px; }
.chip-btn.on, .sound-toggle.on { border-color: var(--accent); color: var(--accent); }
#prizesBtn { border-color: var(--gold); color: var(--gold); }
.sound-big { display: inline-flex; align-items: center; gap: 10px; border: 3px solid var(--line); background: var(--surface); color: var(--paper); border-radius: 14px; padding: 12px 20px; font-weight: 800; font-size: 18px; }
.sound-big.on { border-color: var(--accent); color: var(--accent); }
.prize-url { font-size: 13px; font-weight: 800; color: var(--robe); text-decoration: underline; word-break: break-all; }
.prize-sheet { position: fixed; inset: 0; z-index: 50; background: #000a; display: grid; align-items: end; }
.prize-sheet-inner { background: var(--paper); color: var(--ink); border-radius: 22px 22px 0 0; border: 4px solid var(--ink); border-bottom: 0; padding: 16px 16px max(18px, env(safe-area-inset-bottom)); max-height: 80dvh; overflow-y: auto; width: min(560px, 100%); margin: 0 auto; animation: sheetUp .35s ease both; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.ps-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ps-head h2 { font-size: 30px; }
.ps-head .chip-btn { background: var(--ink); color: var(--paper); }
.prize-list { display: grid; gap: 10px; }
.prize-row { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 8px; box-shadow: 0 4px 0 var(--ink); }
.prize-row img { width: 84px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); }
.prize-row span { display: grid; flex: 1; min-width: 0; }
.prize-row b { font-size: 14px; }
.prize-row small { color: var(--robe); font-weight: 700; text-decoration: underline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prize-row i { font-style: normal; font-weight: 800; font-size: 20px; }
.ps-foot { margin-top: 10px; font-size: 12px; color: #555; text-align: center; }
@media (max-width: 360px) { .st-label { display: none; } .chip-btn { padding: 4px 8px; } }

.host-link { color: var(--accent); font-weight: 800; font-size: 14px; text-decoration: none; border-bottom: 2px solid currentColor; padding-bottom: 2px; }
.host-link:hover { color: var(--paper); }

.again-btn { font-size: 20px; padding: 12px 26px; background: var(--cosmic); }
@media (max-height: 600px) { .again-btn { font-size: 17px; padding: 8px 18px; } }
@media (orientation: landscape) and (max-height: 540px) { .again-btn { grid-column: 1; } }

/* Reserve room for the bottom-right Scroggygames.com link */
main, section { padding-bottom: max(52px, calc(env(safe-area-inset-bottom) + 44px)); }
.card-wrap { --chrome: 384px; }
@media (max-height: 760px) and (orientation: portrait) { .card-wrap { --chrome: 274px; } }
.home-link { font-size: 13px; padding: 5px 10px; }
.result { z-index: 30; }
.result ~ .home-link, .home-link { z-index: 45; }
@media (orientation: landscape) and (max-height: 540px) {
  .play { padding-bottom: 10px; }
  .play .bingo-btn { margin-bottom: 34px; }
}

/* Card sizing (measured: card height = 1.31 x width). --chrome = everything else on the play screen. */
.card-wrap { --chrome: 400px; width: min(100%, calc((100dvh - var(--chrome)) / 1.31)); }
@media (max-height: 760px) and (orientation: portrait) {
  .card-wrap { --chrome: 272px; }
  .bingo-btn { height: 64px; padding: 0; line-height: 1; }
  main, section { padding-bottom: max(42px, calc(env(safe-area-inset-bottom) + 36px)); }
}
@media (orientation: landscape) and (max-height: 540px) {
  .card-wrap { width: calc((100dvh - 62px) / 1.31); align-self: start; }
}
@media (max-height: 600px) and (orientation: portrait) {
  .card-wrap { --chrome: 300px; }
  .recent-strip { min-height: 26px; }
  .recent-strip .ball { --size: 26px !important; }
}

/* Numbers scale with the card itself, and columns may shrink below their text width */
.card { container-type: inline-size; }
.grid, .card-head { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sq { font-size: clamp(22px, 7.4vw, 34px); font-size: clamp(13px, 9.4cqi, 34px); }
.card-head span { font-size: clamp(18px, 9.6cqi, 34px); }
@media (max-height: 600px) and (orientation: portrait) {
  .recent-strip { display: none; }
  .card-wrap { --chrome: 266px; }
}

/* ---------- end-of-game vote */
.vote { width: min(360px, 90vw); display: grid; gap: 8px; background: var(--surface-2); border: 2px solid var(--cosmic); border-radius: 18px; padding: 12px; }
.vote-q { font-family: var(--display); font-size: 24px; color: var(--paper); }
.vote-q b { font-family: var(--body); font-size: 15px; color: var(--accent); margin-left: 6px; }
.vote-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vote-btn { display: grid; gap: 4px; justify-items: center; padding: 12px 8px; border-radius: 14px; border: 3px solid var(--ink); font-weight: 800; font-size: 16px; color: var(--ink); box-shadow: 0 5px 0 var(--ink); transition: transform .1s, box-shadow .1s, filter .2s; }
.vote-btn small { display: block; font-weight: 600; font-size: 11px; opacity: .75; }
.vote-btn em { font-style: normal; font-family: var(--display); font-size: 26px; line-height: 1; }
.vote-btn.restart { background: var(--accent); }
.vote-btn.blackout { background: var(--cosmic); }
.vote-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.vote-btn.picked { outline: 4px solid var(--paper); outline-offset: 2px; }
.vote-btn.picked span::before { content: '✓ '; }
.vote-btn:disabled { filter: grayscale(.4) brightness(.85); }
.vote-note { font-size: 12px; color: var(--muted); text-align: center; }
@media (max-height: 760px) { .vote-q { font-size: 20px; } .vote-btn { padding: 8px 6px; font-size: 14px; } .vote-btn em { font-size: 22px; } }
@media (orientation: landscape) and (max-height: 540px) { .vote { grid-column: 1 / -1; width: min(520px, 90vw); justify-self: center; } }

/* ---------- host a game (join screen) */
.host-cta { width: 100%; display: grid; justify-items: center; gap: 8px; }
.host-cta .or { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; width: 100%; }
.host-cta .or::before, .host-cta .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.host-btn { width: 100%; font-size: 20px; padding: 13px; border-width: 3px; border-color: var(--cosmic); color: var(--cosmic); text-decoration: none; }
.host-btn:hover { background: var(--cosmic); color: var(--ink); border-color: var(--ink); }
.host-hint { font-size: 12px; color: var(--muted); text-align: center; max-width: 320px; }
@media (orientation: landscape) and (max-height: 540px) { .host-cta { grid-template-columns: auto 1fr; align-items: center; } .host-cta .or, .host-hint { display: none; } }

/* While the vote is open the result screen gets compact so the vote is on screen */
.result:has(.vote:not([hidden])) .result-title { font-size: 48px; }
.result:has(.vote:not([hidden])) .avatar { --size: 96px !important; }
.result:has(.vote:not([hidden])) .result-inner { gap: 10px; }
.result:has(.vote:not([hidden])) .prize img { aspect-ratio: 16 / 6; }
.result:has(.vote:not([hidden])) .prize-title { font-size: 19px; }

/* ======================================================================
   Short real-world viewports (browser toolbars eat height): keep every
   button on the first screen.
   ====================================================================== */
@media (max-height: 700px) and (orientation: portrait) {
  .join { gap: 10px; justify-content: flex-start; padding-top: max(10px, env(safe-area-inset-top)); }
  .join-logo { width: min(70vw, 280px); }
  .join-form { gap: 4px; }
  .join-form label { margin-top: 2px; font-size: 11px; }
  .join-form input { padding: 9px 12px; font-size: 20px; }
  #code { font-size: 28px; }
  .err { min-height: 16px; font-size: 13px; }
  .play-btn { padding: 11px; font-size: 21px; }
  .host-cta { gap: 4px; }
  .host-btn { padding: 9px; font-size: 17px; }
  .host-hint, .join-foot { display: none; }
  /* winner: during a vote the prize card goes compact (the whole card is the link) */
  .result:has(.vote:not([hidden])) .prize img { display: none; }
  .result:has(.vote:not([hidden])) .result-title { font-size: 38px; }
  .result:has(.vote:not([hidden])) .avatar { --size: 72px !important; }
  .result:has(.vote:not([hidden])) .result-inner { gap: 7px; padding: 12px 16px; }
  .result:has(.vote:not([hidden])) .result-text { font-size: 16px; }
  .result:has(.vote:not([hidden])) .result-sub { display: none; }
}
@media (max-height: 480px) and (orientation: portrait) {
  .join-logo { width: min(56vw, 200px); }
  .join-form label { display: none; }
  .host-cta .or { display: none; }
}

/* Landscape phones: two-column join + result so nothing sits below the fold */
@media (orientation: landscape) and (max-height: 540px) {
  .join { justify-content: center; gap: 6px; }
  .join-logo { width: min(34vw, 30vh * 3, 240px); }
  .join-form label { display: none; }
  .join-form input, #code { padding: 7px 10px; font-size: 18px; }
  #code { font-size: 22px; }
  .err { min-height: 0; }
  .play-btn { padding: 8px; font-size: 18px; }
  .host-cta { grid-template-columns: 1fr; width: min(100%, 640px); }
  .host-btn { padding: 7px; font-size: 16px; }
  .join-foot { display: none; }

  .result-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-rows: min-content; align-items: start; column-gap: 20px; row-gap: 8px; max-width: 760px; width: 100%; }
  .result-title { grid-column: 1 / -1; font-size: 34px; }
  #resultAvatar { display: none; }
  .result-text { grid-column: 1; grid-row: 2; font-size: 15px; }
  .vote { grid-column: 1; grid-row: 3; width: 100%; padding: 8px; gap: 5px; }
  .vote-q { font-size: 18px; }
  .vote-btn { padding: 6px; font-size: 13px; }
  .vote-btn em { font-size: 20px; }
  .again-btn { grid-column: 1; }
  .prize { grid-column: 2; grid-row: 2 / span 3; width: 100%; }
  .result-sub { display: none; }
}
@media (max-height: 480px) and (orientation: portrait) {
  .result:has(.vote:not([hidden])) #resultAvatar { display: none; }
}

/* Safe centering: if the result is taller than the screen it starts at the top and scrolls,
   instead of being centered off the top edge. */
.result { place-items: normal; overflow-y: auto; }
.result-inner { margin: auto; max-height: none; padding-top: max(14px, env(safe-area-inset-top)); }
