/* Name's the Game. Matchday Cartoon look: one flood colour per screen over a
   mown pitch, thick ink outlines, hard drop shadows, programme cards and a
   referee's stopwatch for a clock. Everything is sized in em off #app's
   font-size, which tracks phone width, and every screen is a fixed-height
   flex column: nothing ever scrolls. */

:root {
  --ink: #0f1f1a;
  --chalk: #fbf7e6;
  --yellow: #ffd21f;
  --hivis: #ff7a1a;
  --biro: #1746c7;
  --lime: #a4e53a;
  --red: #e5322d;
  --navy: #17306b;
  --display: 'Titan One', 'Archivo Black', 'Arial Black', Impact, sans-serif;
  --body: 'Nunito', 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --app-h: 100dvh;
  --app-top: 0px;
}

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--ink); }
body { font-family: var(--body); font-weight: 800; color: var(--chalk); -webkit-font-smoothing: antialiased; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; user-select: text; -webkit-user-select: text; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; }

/* ------------------------------------------------------------ shell */

#app {
  --bg: #1f8a4c; --bg2: #249653;
  position: fixed; left: 0; right: 0; top: var(--app-top); height: var(--app-h);
  max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden; overflow: clip;
  font-size: clamp(15px, 4.4vw, 19px);
  background: var(--bg); transition: background-color .35s;
  padding-top: env(safe-area-inset-top);
}
#app[data-phase='results'] { --bg: #0f2a22; --bg2: #14342a; }
#app[data-phase='final'] { --bg: #d9820b; --bg2: #e6900f; }

/* The pitch: mowing stripes in two tones of the flood colour, with faint chalk markings. */
.pitch { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: repeating-linear-gradient(180deg, var(--bg) 0 10%, var(--bg2) 10% 20%); }
.pitch i { position: absolute; border: .2em solid rgba(251, 247, 230, .17); }
.pitch .pitch-half { left: 0; right: 0; top: 50%; border-width: .2em 0 0; }
.pitch-circle { left: 50%; top: 50%; width: 9em; height: 9em; translate: -50% -50%; border-radius: 50%; }
.pitch .pitch-spot { left: 50%; top: 50%; width: .6em; height: .6em; translate: -50% -50%; border: 0; border-radius: 50%; background: rgba(251, 247, 230, .17); }
.pitch-box { left: 50%; width: 62%; height: 12%; translate: -50% 0; }
.pitch-box.top { top: -.2em; }
.pitch-box.bottom { bottom: -.2em; }
@keyframes spin { to { rotate: 360deg; } }

#bar { position: relative; z-index: 2; display: flex; align-items: center; gap: .6em; padding: .5em .8em 0; }
.bar-title { flex: 1; text-align: center; font-family: var(--display); font-size: 1.05em; letter-spacing: .01em; text-shadow: 0 .1em 0 var(--ink); }
.bar-btn { width: 2.5em; height: 2.5em; flex: none; display: grid; place-items: center; background: var(--chalk); color: var(--ink); border: .16em solid var(--ink); border-radius: .8em; box-shadow: 0 .2em 0 var(--ink); }
.bar-btn:active { translate: 0 .15em; box-shadow: 0 .05em 0 var(--ink); }
.bar-btn.ghost { visibility: hidden; }
.ic { display: inline-grid; width: 1.3em; height: 1.3em; flex: none; }
.ic svg { width: 100%; height: 100%; }

#stage { position: relative; z-index: 1; flex: 1; min-height: 0; }
.screen { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: .7em; padding: .7em 1em calc(.9em + env(safe-area-inset-bottom)); }
.screen.enter { animation: enter .32s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes enter { from { opacity: 0; scale: .94; } }

.offline-pill { position: absolute; z-index: 5; top: calc(.5em + env(safe-area-inset-top)); left: 50%; translate: -50% -4em; background: var(--red); color: #fff; border: .15em solid var(--ink); border-radius: 99px; padding: .3em 1em; font-size: .85em; transition: translate .25s; }
#app.offline .offline-pill { translate: -50% 0; }

#toast { position: absolute; z-index: 30; left: 50%; bottom: calc(1.2em + env(safe-area-inset-bottom)); translate: -50% 6em; max-width: 88%; background: var(--ink); color: var(--chalk); border: .14em solid var(--chalk); border-radius: 1em; padding: .6em 1em; text-align: center; font-size: .92em; pointer-events: none; opacity: 0; }
#toast.show { animation: toast 3.2s both; }
@keyframes toast { 0%, 100% { translate: -50% 6em; opacity: 0; } 8%, 88% { translate: -50% 0; opacity: 1; } }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 2.8em; padding: .55em 1.2em;
  font-family: var(--display); font-size: 1em; line-height: 1.1; color: var(--ink); text-align: center;
  background: var(--yellow); border: .17em solid var(--ink); border-radius: 99px; box-shadow: 0 .26em 0 var(--ink);
  transition: translate .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { translate: 0 .2em; box-shadow: 0 .06em 0 var(--ink); }
.btn.big { font-size: 1.2em; min-height: 2.7em; }
.btn.small { font-size: .82em; min-height: 2.4em; padding: .4em .9em; }
.btn.alt { background: var(--chalk); }
.btn.quiet { background: transparent; color: var(--chalk); border-color: var(--chalk); box-shadow: none; }
.btn.danger { background: var(--red); color: #fff; }
.btn.good { background: var(--lime); }
.btn:disabled { opacity: .55; filter: saturate(.4); cursor: default; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after { content: ''; width: .9em; height: .9em; border: .18em solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.grow { flex: 1; }
.link { align-self: center; padding: .5em 1em; text-decoration: underline; text-underline-offset: .2em; font-size: .95em; }
.stack { display: flex; flex-direction: column; gap: .7em; }
.actions { display: flex; align-items: center; gap: .7em; }
.actions.centre { justify-content: center; min-height: 3.6em; }
.hint { font-size: .8em; opacity: .85; text-align: center; font-weight: 700; }
.waiting { text-align: center; font-family: var(--display); font-size: 1.05em; text-shadow: 0 .1em 0 var(--ink); }
.label { font-size: .78em; font-weight: 900; opacity: .85; }

.field {
  width: 100%; min-width: 0; height: 2.9em; padding: 0 1em;
  font-size: 1.05em; font-weight: 800; color: var(--ink); background: #fff;
  border: .17em solid var(--ink); border-radius: .9em; box-shadow: inset 0 .18em 0 rgba(15, 31, 26, .12);
}
.field::placeholder { color: rgba(15, 31, 26, .45); }
.field:focus { outline: none; border-color: var(--biro); box-shadow: 0 0 0 .18em var(--yellow); }

.step { width: 2.3em; height: 2.3em; flex: none; display: grid; place-items: center; font-family: var(--display); font-size: 1.05em; color: var(--ink); background: var(--chalk); border: .16em solid var(--ink); border-radius: 50%; box-shadow: 0 .18em 0 var(--ink); }
.step:active:not(:disabled) { translate: 0 .12em; box-shadow: 0 .04em 0 var(--ink); }
.step:disabled { opacity: .4; }
.step-val { min-width: 2.4em; text-align: center; font-family: var(--display); font-size: 1.15em; }

/* ------------------------------------------------------------ faces */

.av { display: inline-flex; flex-direction: column; align-items: center; gap: .1em; width: 2.6em; flex: none; }
.av-face { display: block; width: 100%; }
.av-face svg { display: block; width: 100%; height: auto; overflow: visible; }
.av-name { max-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85em; }
.av.lg { width: 4.2em; }
.av.xl { width: 6.5em; }
.av.off { opacity: .4; filter: grayscale(1); }


/* ------------------------------------------------------------ lobby */

.invite { display: flex; align-items: center; justify-content: space-between; gap: .8em; padding: .7em .9em; color: var(--ink); background: var(--chalk); border: .2em solid var(--ink); border-radius: 1.2em; box-shadow: 0 .35em 0 var(--ink); }
.invite-text { display: flex; flex-direction: column; align-items: flex-start; gap: .35em; min-width: 0; }
.invite.demo p { font-size: .9em; }
.code { display: flex; gap: .16em; font-family: var(--display); font-size: 2.3em; line-height: 1; }
.code span { display: grid; place-items: center; width: 1.05em; height: 1.25em; color: var(--ink); background: var(--yellow); border: .07em solid var(--ink); border-radius: .18em; }
.qr { width: 6.6em; height: 6.6em; flex: none; border: .16em solid var(--ink); border-radius: .5em; overflow: hidden; }
.qr svg { display: block; width: 100%; height: 100%; }

.crowd { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); align-content: center; justify-items: center; gap: .3em .2em; overflow: hidden; }
.seat { position: relative; width: 100%; max-width: 8em; animation: pop .35s cubic-bezier(.2, 1.6, .4, 1) both; }
.seat .av { width: 100%; }
.seat .av-face { width: 82%; }
.seat .av-name { max-width: 100%; font-size: .82em; text-shadow: 0 .1em 0 var(--ink); }
.seat.me .av-name { color: var(--yellow); }
@keyframes pop { from { scale: 0; } }
.badge { position: absolute; right: 2%; top: 14%; display: grid; place-items: center; width: 1.7em; height: 1.7em; color: var(--ink); background: var(--yellow); border: .13em solid var(--ink); border-radius: 50%; }
.badge .ic { width: 1em; height: 1em; }

.settings { display: flex; flex-wrap: wrap; justify-content: center; gap: .5em 1.2em; }
.stepper { display: flex; align-items: center; gap: .35em; }
.stepper .label { margin-right: .2em; }
.settings-read { font-size: .9em; opacity: .9; }
.toggle { display: flex; align-items: center; gap: .5em; font-size: .9em; }
.toggle input { width: 1.4em; height: 1.4em; accent-color: var(--yellow); }
.foot { display: flex; flex-direction: column; gap: .5em; }

/* ------------------------------------------------------------ overlays */

#overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; }
.scrim { position: absolute; inset: 0; background: rgba(15, 31, 26, .72); animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-height: 96%; display: flex; flex-direction: column; color: var(--ink); background: var(--chalk); border: .2em solid var(--ink); border-bottom: 0; border-radius: 1.6em 1.6em 0 0; animation: sheet .28s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes sheet { from { translate: 0 100%; } }
.sheet-body { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: .8em; padding: 1.3em 1.1em calc(1.1em + env(safe-area-inset-bottom)); }
.sheet-body h2 { font-size: 1.6em; padding-right: 1.8em; }
.sheet-body p { font-weight: 700; line-height: 1.35; }
.sheet .hint { text-align: left; opacity: .7; }
.sheet-x { position: absolute; right: .8em; top: .8em; z-index: 1; display: grid; place-items: center; width: 2.3em; height: 2.3em; background: #fff; border: .16em solid var(--ink); border-radius: 50%; }
.sheet .btn.quiet { color: var(--ink); border-color: var(--ink); }

.join-form { display: flex; align-items: center; gap: .9em; }
.face-pick { position: relative; flex: none; }
.face-pick .av { width: 5.6em; }
.face-pick .badge { right: -4%; top: auto; bottom: 0; }
.join-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .5em; }
.code-field { font-family: var(--display); font-size: 1.3em; letter-spacing: .25em; text-transform: uppercase; }
.error { min-height: 1.3em; font-size: .88em; color: var(--red); }
#app.kb .sheet .hint, #app.kb .sheet .error:empty { display: none; }

.scores { display: flex; flex-direction: column; gap: .35em; padding: 0; list-style: none; min-height: 0; }
.scores li { display: flex; align-items: center; gap: .5em; padding: .25em .7em; background: #fff; border: .14em solid var(--ink); border-radius: .9em; }
.scores li.me { background: var(--yellow); }
.scores .av { width: 2.1em; }
.rank { width: 1.2em; font-family: var(--display); text-align: center; }
.score-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-name small { opacity: .6; }
.score-wins { display: inline-flex; align-items: center; gap: .15em; min-width: 2em; font-size: .85em; }
.score-wins .ic { width: 1.1em; height: 1.1em; }
.score-pts { min-width: 1.6em; text-align: right; font-family: var(--display); font-size: 1.3em; }
.scores.dense { display: grid; grid-template-columns: 1fr 1fr; font-size: .78em; }
.scores.dense .score-wins, .scores.dense .score-cards { display: none; }

.rules { display: flex; flex-direction: column; gap: .5em; padding-left: 1.2em; font-size: .9em; font-weight: 700; line-height: 1.32; }
.rules li::marker { color: var(--biro); }


/* ------------------------------------------------------------ home */

.home { justify-content: center; align-items: stretch; gap: 1em; text-align: center; }
.logo { font-size: 1em; display: flex; flex-direction: column; align-items: center; gap: .1em; font-family: var(--display); font-weight: 400; line-height: 1; }
.logo-top { font-size: 2.5em; color: var(--chalk); -webkit-text-stroke: .22em var(--ink); paint-order: stroke fill; text-shadow: 0 .12em 0 var(--ink); rotate: -3deg; }
.logo-tiles { display: flex; gap: .12em; padding: 0 .3em; font-size: 3.4em; }
.tile { display: grid; place-items: center; width: 1.02em; height: 1.25em; color: var(--ink); background: var(--yellow); border: .07em solid var(--ink); border-radius: .2em; box-shadow: 0 .09em 0 var(--ink); rotate: calc((var(--i) - 2) * 3deg); animation: drop .5s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: calc(.25s + var(--i) * .11s); }
.tile:nth-child(even) { background: var(--chalk); translate: 0 .06em; }
.tile:last-child { width: .6em; background: var(--red); color: #fff; }
@keyframes drop { from { translate: 0 -3em; opacity: 0; rotate: -30deg; } }
.tagline { font-size: 1.05em; text-shadow: 0 .1em 0 var(--ink); text-wrap: balance; }
.home-crowd { display: flex; justify-content: center; align-items: flex-end; gap: .4em; min-height: 0; flex: 0 1 7em; }
.home-punter { animation: bob 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * -.8s); }
.home-punter .av { width: 5em; }
.home-punter:nth-child(2) .av { width: 6.2em; }
@keyframes bob { 50% { translate: 0 -.45em; rotate: 2deg; } }
.note { font-size: .8em; opacity: .9; text-wrap: balance; }

/* ------------------------------------------------------------ play */

.play { gap: .6em; }
.play-top { display: flex; align-items: center; gap: .8em; height: 5em; flex: none; }
.clock { position: relative; height: 100%; aspect-ratio: 100 / 104; flex: none; }
.clock svg { display: block; width: 100%; height: 100%; overflow: visible; }
.clock-num { position: absolute; inset: 14% 0 0; display: grid; place-items: center; font-family: var(--display); font-size: 1.5em; color: var(--ink); -webkit-text-stroke: .2em var(--chalk); paint-order: stroke fill; }
.clock.low { animation: wobble .5s ease-in-out infinite; }
.clock.low .clock-num { color: var(--red); }
@keyframes wobble { 25% { rotate: -6deg; } 75% { rotate: 6deg; } }
.play-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .25em; }
.direction { padding: .15em .7em; font-size: .78em; font-weight: 900; color: var(--ink); background: var(--chalk); border: .14em solid var(--ink); border-radius: 99px; }
.direction.back { background: var(--hivis); }
.chain { width: 100%; display: flex; flex-direction: column; font-size: .88em; line-height: 1.2; text-shadow: 0 .08em 0 var(--ink); }
.chain-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chain-name ~ .chain-name { opacity: .7; font-size: .9em; }
.chain-name ~ .chain-name ~ .chain-name { display: none; }

.play-mid { position: relative; flex: 1; min-height: 0; display: flex; }
/* Programme card: chalk, ink outline, pinstripe frame and a corner flag. */
.prog { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35em; padding: .8em 1em; overflow: hidden; text-align: center; color: var(--ink); background: var(--chalk); border: .22em solid var(--ink); border-radius: 1.4em; box-shadow: 0 .42em 0 var(--ink); }
.prog::before { content: ''; position: absolute; inset: .4em; border: .12em solid rgba(15, 31, 26, .18); border-radius: 1em; pointer-events: none; }
.prog::after { content: ''; position: absolute; right: -.22em; top: -.22em; width: 2.6em; height: 2.6em; background: var(--yellow); border: .22em solid var(--ink); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.card-who { display: flex; align-items: center; gap: .4em; padding: .1em .9em .1em .3em; font-family: var(--display); font-size: 1.05em; border: .15em solid var(--ink); border-radius: 99px; background: #fff; }
.card-who .av { width: 1.9em; }
.prog.mine .card-who { background: var(--hivis); }
.card-main { display: flex; flex-direction: column; align-items: center; gap: .5em; min-height: 0; }
.card-ask { font-size: 1.1em; }
.letter { display: grid; place-items: center; width: 1.25em; height: 1.25em; font-family: var(--display); font-size: min(7.5em, 17vh); line-height: 1; background: var(--yellow); border: .06em solid var(--ink); border-radius: .2em; box-shadow: 0 .08em 0 var(--ink); rotate: -4deg; }
.card-after { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .7em; font-size: .9em; opacity: .8; }

.flash { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5em; padding: 1em; text-align: center; color: var(--ink); background: var(--lime); border: .22em solid var(--ink); border-radius: 1.4em; box-shadow: 0 .42em 0 var(--ink); animation: pop .3s cubic-bezier(.2, 1.5, .4, 1) both; }
.flash.yellow { background: var(--chalk); }
.flash.red { background: var(--red); color: #fff; }
.flash-name { font-family: var(--display); font-size: 2em; line-height: 1.05; text-wrap: balance; overflow-wrap: anywhere; }
.flash-by { display: flex; align-items: center; gap: .4em; font-size: 1.05em; }
.flash-by .av { width: 2.2em; }
.flash-card { width: 5em; animation: slam .4s cubic-bezier(.2, 1.5, .4, 1) both; }
.flash-card svg { display: block; width: 100%; overflow: visible; }
.flash-title { font-family: var(--display); font-size: 1.6em; line-height: 1.1; text-wrap: balance; }
.flash-why { font-size: 1em; text-wrap: balance; overflow-wrap: anywhere; }
.sticker { padding: .2em .8em; font-size: .85em; font-weight: 900; color: var(--ink); background: var(--chalk); border: .14em solid var(--ink); border-radius: 99px; rotate: -2deg; }
.sticker.hot { background: var(--hivis); rotate: 2deg; }
@keyframes pop { from { scale: 0; } }
@keyframes slam { from { scale: 3; opacity: 0; } }

.form { display: flex; align-items: center; gap: .6em; }
.form .field { flex: 1; font-size: 1.15em; }
.form.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { translate: -.4em 0; } 40%, 80% { translate: .4em 0; } }
.status { min-height: 2.9em; display: grid; place-items: center; text-align: center; font-family: var(--display); font-size: 1.1em; text-shadow: 0 .1em 0 var(--ink); }

.var-box { display: flex; flex-direction: column; gap: .5em; padding: .7em .9em; color: var(--chalk); background: var(--navy); border: .2em solid var(--ink); border-radius: 1.2em; box-shadow: 0 .35em 0 var(--ink); animation: pop .3s cubic-bezier(.2, 1.5, .4, 1) both; }
.var-title { font-family: var(--display); font-size: 1.2em; color: var(--yellow); }
.var-claim { font-size: 1em; line-height: 1.25; overflow-wrap: anywhere; }
.var-claim b { font-family: var(--display); font-weight: 400; font-size: 1.15em; }
.var-wait { font-size: .9em; opacity: .9; }

.team { display: flex; justify-content: center; align-items: flex-end; gap: .3em; height: 3.3em; flex: none; }
.kit { position: relative; flex: 0 1 2.7em; min-width: 0; transition: translate .2s, opacity .2s; }
.kit .av { width: 100%; }
.kit.on { translate: 0 -.35em; filter: drop-shadow(0 0 .35em var(--yellow)); }
.kit.off { opacity: .4; filter: grayscale(1); }
.kit.me::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: -.3em; height: .2em; background: var(--hivis); border-radius: 99px; }
.pip { position: absolute; right: -.05em; top: .1em; width: .7em; height: .95em; background: var(--yellow); border: .11em solid var(--ink); border-radius: .14em; rotate: 10deg; }
.pip.red { background: var(--red); }

.splash { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); font-family: var(--display); transition: opacity .28s, scale .28s; }
.splash.out { opacity: 0; scale: 1.25; pointer-events: none; }
.splash-round { font-size: 4em; color: var(--yellow); -webkit-text-stroke: .16em var(--ink); paint-order: stroke fill; text-shadow: 0 .09em 0 var(--ink); rotate: -4deg; animation: slam .45s cubic-bezier(.2, 1.5, .4, 1) both; }
.splash-of { font-size: 1.5em; text-shadow: 0 .1em 0 var(--ink); animation: slam .45s .12s cubic-bezier(.2, 1.5, .4, 1) both; }

/* Keyboard open: drop the top bar and the team strip, lay the card out sideways. */
#app.kb[data-phase='play'] #bar, #app.kb .team, #app.kb .card-after, #app.kb .prog::before { display: none; }
#app.kb .play { gap: .45em; padding-top: .4em; padding-bottom: .5em; }
#app.kb .play-top { height: 3em; }
#app.kb .clock-num { font-size: 1em; }
#app.kb .chain { font-size: .8em; }
#app.kb .prog { flex-direction: row; gap: .8em; padding: .4em .8em; }
#app.kb .card-main { flex-direction: row; gap: .6em; }
#app.kb .card-ask { max-width: 7em; font-size: .85em; text-align: left; }
#app.kb .card-main { gap: .6em; }
#app.kb .letter { font-size: min(3em, 12vh); }
#app.kb .status { min-height: 2em; }

/* ------------------------------------------------------------ results and hand-outs */

.you-card { display: flex; align-items: center; gap: .9em; padding: .7em 1em; color: var(--ink); background: var(--lime); border: .2em solid var(--ink); border-radius: 1.2em; box-shadow: 0 .35em 0 var(--ink); rotate: -1deg; }
.you-card.is-drink { background: var(--yellow); }
.you-points { display: flex; flex-direction: column; align-items: center; font-family: var(--display); font-size: 2.1em; line-height: .95; }
.you-points small { font-family: var(--body); font-size: .34em; font-weight: 900; white-space: nowrap; }
.you-lines { flex: 1; display: flex; flex-direction: column; gap: .15em; font-size: 1.02em; line-height: 1.2; }
.winner-strip { display: flex; align-items: center; gap: .7em; min-height: 0; }
.winner-strip > div:last-child { flex: 1; min-width: 0; }
.winner-title { font-family: var(--display); font-size: 1.3em; line-height: 1.1; text-shadow: 0 .1em 0 var(--ink); }
.winner-line { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-size: .8em; line-height: 1.25; opacity: .95; }
.damage { flex: 0 1 auto; margin-bottom: auto; min-height: 0; display: flex; flex-direction: column; gap: .45em; overflow: hidden; padding: .7em .9em; background: rgba(0, 0, 0, .3); border: .15em solid var(--ink); border-radius: 1.1em; }
.damage h3 { font-size: 1.1em; color: var(--yellow); }
.dmg { display: flex; align-items: center; gap: .7em; }
.drink-ic { width: 1.9em; flex: none; }
.drink-ic svg { display: block; width: 100%; }
.dmg-body { flex: 1; min-width: 0; }
.dmg-label { font-size: .95em; }
.dmg-names { display: flex; flex-wrap: wrap; gap: .25em; margin-top: .15em; }
.name-chip { padding: .08em .6em; font-size: .82em; color: var(--ink); background: var(--chalk); border-radius: 99px; }
.name-chip.me { background: var(--hivis); }
.dry, .pending { font-size: .92em; opacity: .95; }
.pending { color: var(--yellow); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.handout { flex: 0 1 auto; margin-bottom: auto; min-height: 0; display: flex; flex-direction: column; gap: .5em; padding: .7em .9em; color: var(--ink); background: var(--chalk); border: .2em solid var(--ink); border-radius: 1.2em; box-shadow: 0 .35em 0 var(--ink); }
.handout h3 { font-size: 1.3em; }
.handout .hint { text-align: left; opacity: .8; }
.handout-rows { min-height: 0; display: flex; flex-direction: column; gap: .4em; overflow: hidden; padding: .2em 0; }
.handout-row { display: flex; align-items: center; gap: .5em; }
.handout-row .av { width: 2.2em; }
.handout-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handout .step { width: 2em; height: 2em; background: var(--yellow); }
.handout.dense .handout-rows { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .35em .8em; font-size: .8em; }
.handout.dense .handout-row { gap: .25em; min-width: 0; }
.handout.dense .av { display: none; }
.handout.dense .step { width: 1.9em; height: 1.9em; }
.handout.dense .step-val { min-width: 1.3em; }

/* ------------------------------------------------------------ final */

.final { text-align: center; color: var(--ink); }
.final-title { font-size: 2.1em; color: var(--chalk); -webkit-text-stroke: .16em var(--ink); paint-order: stroke fill; rotate: -2deg; text-wrap: balance; }
.final-sub { font-size: .95em; color: var(--chalk); text-shadow: 0 .08em 0 var(--ink); text-wrap: balance; }
.podium { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: .4em; padding: 0 .4em; }
.podium-step { display: flex; flex-direction: column; align-items: center; min-height: 0; animation: rise .6s cubic-bezier(.2, 1.3, .4, 1) both; }
.podium-step.step-1 { animation-delay: .5s; }
.podium-step.step-2 { animation-delay: .25s; }
@keyframes rise { from { translate: 0 120%; } }
.podium-step .av { width: min(4.6em, 100%); }
.podium-step.step-1 .av { width: min(5.8em, 100%); }
.podium-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9em; color: var(--chalk); text-shadow: 0 .1em 0 var(--ink); }
.podium-block { width: 100%; display: flex; flex-direction: column; align-items: center; padding-top: .3em; font-family: var(--display); background: var(--chalk); border: .2em solid var(--ink); border-bottom: 0; border-radius: .8em .8em 0 0; }
.podium-block b { font-size: 1.7em; font-weight: 400; line-height: 1; }
.podium-block small { font-family: var(--body); font-size: .7em; font-weight: 900; }
.step-1 .podium-block { height: 5.6em; background: var(--yellow); }
.step-2 .podium-block { height: 4.2em; }
.step-3 .podium-block { height: 3.1em; }
.final.tight .final-sub { display: none; }
.final.tight .final-title { font-size: 1.6em; }
.final.tight .podium-step .av, .final.tight .podium-step.step-1 .av { width: min(3.2em, 100%); }
.final.tight .step-1 .podium-block { height: 3.4em; }
.final.tight .step-2 .podium-block { height: 2.7em; }
.final.tight .step-3 .podium-block { height: 2.1em; }
.final.tight .podium-block small { display: none; }
.final.tight .podium-block b { font-size: 1.4em; }
.podium { overflow: hidden; }
.final-mid { flex: none; display: flex; flex-direction: column; text-align: left; color: var(--chalk); }
.final-mid .handout, .final-mid .damage { margin-bottom: 0; }
.award { display: flex; flex-direction: column; gap: .4em; color: var(--ink); }
.award-card { display: flex; align-items: center; gap: .7em; height: 5.4em; padding: .6em .9em; background: var(--chalk); border: .2em solid var(--ink); border-radius: 1.1em; box-shadow: 0 .3em 0 var(--ink); animation: enter .3s both; }
.award-text { flex: 1; min-width: 0; }
.award-title { font-family: var(--display); font-size: 1.2em; color: var(--biro); line-height: 1.1; }
.award-line { margin-top: .15em; font-size: .88em; }
.faces { display: flex; justify-content: center; }
.faces .av + .av { margin-left: -1em; }
.faces.sm .av { width: 2.8em; }
.dots { display: flex; justify-content: center; gap: .4em; }
.dots i { width: .6em; height: .6em; border: .12em solid var(--ink); border-radius: 50%; background: rgba(255, 255, 255, .35); }
.dots i.on { background: var(--yellow); }

.score-cards { display: inline-flex; align-items: center; gap: .25em; min-width: 1.9em; font-size: .85em; }
.score-cards .pip { position: static; display: inline-block; rotate: 8deg; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-height: 700px) {
  .rules { font-size: .8em; gap: .4em; }
}
@media (max-height: 620px) {
  #app { font-size: clamp(13.5px, 4vw, 16px); }
}
