:root {
  --navy-950: #010308;
  --navy-900: #060a16;
  --navy-800: #0d1428;
  --navy-700: #1b2750;
  --line: rgba(255, 255, 255, 0.10);
  --ink: #f3f5fb;
  --ink-2: #aab3cc;
  --ink-3: #6c7695;
  --ball: #39ff14;
  --team-a: #39ff14;
  --team-b: #00e5ff;
  --danger: #ff6b5a;
  --ok: #3ddc97;
  --radius: 18px;
  --font-score: 'Bebas Neue', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --font-ui: 'Josefin Sans', 'Futura', 'Century Gothic', 'Avenir Next', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--navy-900); color: var(--ink); font-family: var(--font-ui); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.wordmark { display: block; height: auto; }
.eyebrow { letter-spacing: .28em; text-transform: uppercase; font-size: 12px; color: var(--ink-2); font-weight: 600; }

/* ============ Landing ============ */
.landing {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 40px; padding: 40px 16px calc(40px + env(safe-area-inset-bottom));
  background: radial-gradient(1200px 600px at 50% -10%, #1b2a62 0%, transparent 60%), var(--navy-900);
}
.landing .brand { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.landing .brand .mark { width: 96px; height: auto; }
.landing .brand .wordmark { width: min(360px, 80vw); }
.landing .brand .sub { font-family: var(--font-score); font-size: 28px; letter-spacing: .3em; color: var(--ball); padding-left: .3em; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 18px; width: 100%; max-width: 640px; }
.choice {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink);
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; transition: transform .15s, border-color .15s;
}
.choice:hover, .choice:focus-visible { transform: translateY(-2px); border-color: var(--ball); outline: none; }
.choice svg { width: 40px; height: 40px; color: var(--ball); }
.choice h2 { margin: 6px 0 0; font-family: var(--font-score); font-weight: 400; font-size: 34px; letter-spacing: .06em; }
.choice p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.45; }
.install-hint { color: var(--ink-3); font-size: 13px; text-align: center; max-width: 420px; line-height: 1.5; }
.install-btn { background: var(--ball); color: var(--navy-950); border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
@media (max-width: 560px) { .choices { grid-template-columns: 1fr; } }

/* ============ Display (TV / tablet) ============ */
.display { position: fixed; inset: 0; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; background: var(--navy-950); cursor: default; }
.display.hide-cursor { cursor: none; }
.d-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 1.6vh 2.4vw; gap: 2vw; }
.d-top .wordmark { height: 3.4vh; width: auto; }
.d-meta { font-size: 2.2vh; letter-spacing: .3em; color: var(--ink-2); text-transform: uppercase; white-space: nowrap; font-weight: 600; }
.d-meta b { color: var(--ink); font-weight: 700; }
.d-status { justify-self: end; display: flex; align-items: center; gap: 1vw; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: .6em; border: 1px solid var(--line); border-radius: 999px; padding: .5em 1em; font-size: 1.7vh; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); background: rgba(255,255,255,.03); cursor: pointer; }
.chip .dot { width: .7em; height: .7em; border-radius: 50%; background: var(--ink-3); }
.chip.ok .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.chip.warn .dot { background: #ffb547; }
.icon-btn { width: 4.6vh; height: 4.6vh; min-width: 34px; min-height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.03); cursor: pointer; color: var(--ink-2); }
.icon-btn svg { width: 50%; height: 50%; }

.court { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1.2vw; padding: 0 2.4vw; min-height: 0; }
.team {
  --c: var(--team-a);
  position: relative; border-radius: 3vh; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; align-items: center; justify-items: center;
  background:
    radial-gradient(80% 60% at 50% 55%, color-mix(in srgb, var(--c) 7%, transparent), transparent 70%),
    #000;
  border: 1px solid var(--line); padding: 3vh 2vw 2.6vh; min-height: 0; transition: border-color .3s, box-shadow .3s;
}
.team::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: .8vh; background: var(--c); opacity: .9; }
.team.serving { border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent), 0 0 6vh -2vh color-mix(in srgb, var(--c) 45%, transparent); }
.team-head { display: flex; flex-direction: column; align-items: center; gap: 1.4vh; max-width: 100%; }
.team-players { display: flex; gap: 1.2vh; flex-wrap: wrap; justify-content: center; }
.team-players:empty { display: none; }
.pl { display: inline-flex; align-items: center; gap: .7em; font-size: 2.6vh; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); padding: .55em 1em .45em; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); white-space: nowrap; }
.pl i { font-style: normal; font-size: .72em; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: .15em .35em .05em; }
.pl.on { color: var(--navy-950); background: var(--c); border-color: transparent; }
.pl.on i { color: var(--navy-950); border-color: rgba(10,15,34,.35); }
.team-name { font-family: var(--font-score); font-size: 6vh; letter-spacing: .08em; line-height: 1; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: .1em; }
.team { grid-template-rows: auto minmax(0, 1fr) auto !important; }
.team-score { width: 100%; height: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; color: var(--c); transition: transform .2s; padding: .4vh 0; }
.team-score .seg7 { height: min(50vh, 30vw); width: auto; max-width: 100%; }

/* Seven-segment LED */
.seg7 { display: block; overflow: visible; }
.seg7 .on { fill: currentColor; }
.seg7 .off { fill: currentColor; opacity: .07; }
.team-score .seg7 .on, .callout .seg7 .on { filter: drop-shadow(0 0 .9vh currentColor) drop-shadow(0 0 2.6vh color-mix(in srgb, currentColor 55%, transparent)); }
.team-score.bump { animation: bump .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 0% { transform: scale(1); filter: brightness(1); } 35% { transform: scale(1.05); filter: brightness(1.6); } 100% { transform: scale(1); filter: brightness(1); } }
.team-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 2vw; min-height: 6vh; }
.serve-tag { display: flex; align-items: center; gap: 1.2vh; font-size: 2.4vh; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; color: var(--c); opacity: 0; transition: opacity .3s; white-space: nowrap; }
.team.serving .serve-tag { opacity: 1; }
.serve-tag .ball { width: 4.4vh; height: 4.4vh; flex: none; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.serve-tag small { display: block; font-size: .78em; color: var(--ink-2); letter-spacing: .18em; margin-top: .3em; font-weight: 600; }
.pips { display: flex; gap: 1vh; }
.pip { width: 2.4vh; height: 2.4vh; border-radius: 50%; border: .3vh solid color-mix(in srgb, var(--c) 70%, transparent); }
.pip.on { background: var(--c); }

.d-bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 1.8vh 2.4vw 2.2vh; gap: 2vw; }
.callout { color: #f4fbff; padding: 1.3vh 3vh; border-radius: 1.6vh; background: #000; border: 1px solid var(--line); box-shadow: inset 0 0 3vh rgba(0,0,0,.9); }
.callout .seg7 { height: 6.4vh; width: auto; }
.d-left { display: flex; align-items: center; gap: 2vw; min-width: 0; }
.credit { display: flex; align-items: center; gap: 1.1vh; font-size: 1.9vh; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.credit img { height: 3.6vh; width: auto; }
.credit.dev { font-size: 12px; gap: 10px; }
.credit.dev img { height: 26px; }
.credit b { color: var(--ink-2); font-weight: 600; }
.history { display: flex; gap: 1vw; font-family: var(--font-score); font-size: 3vh; letter-spacing: .08em; color: var(--ink-2); }
.history span { padding: .2em .6em 0; border: 1px solid var(--line); border-radius: 1vh; }
.history span b { color: var(--ink); font-weight: 400; }
.keys { justify-self: end; font-size: 1.5vh; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; text-align: right; line-height: 1.6; }

/* Toast + overlays */
.toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none;
  font-family: var(--font-score); font-size: 11vh; letter-spacing: .1em; padding: .25em .8em .1em; border-radius: 3vh;
  background: var(--navy-950); color: var(--ball); border: .4vh solid currentColor; box-shadow: 0 3vh 8vh rgba(0,0,0,.6); white-space: nowrap; z-index: 5;
}
.toast.show { animation: toast 1.6s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.85); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

.overlay { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(5, 9, 22, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pair-card { display: grid; grid-template-columns: auto auto; gap: 5vw; align-items: center; padding: 5vh 5vw; border-radius: 4vh; background: var(--navy-900); border: 1px solid var(--line); max-width: 92vw; }
.qr-box { background: #fff; padding: 2.2vh; border-radius: 2.6vh; line-height: 0; }
.qr-box canvas, .qr-box img, .qr-box svg { width: min(46vh, 40vw); height: min(46vh, 40vw); display: block; image-rendering: pixelated; }
.pair-text { max-width: 40vw; display: flex; flex-direction: column; gap: 2.4vh; }
.pair-text h1 { font-family: var(--font-score); font-weight: 400; font-size: 8vh; letter-spacing: .06em; margin: 0; line-height: .95; }
.pair-text p { margin: 0; font-size: 2.4vh; color: var(--ink-2); line-height: 1.5; }
.code { font-family: var(--font-score); font-size: 9vh; letter-spacing: .3em; color: var(--ball); line-height: 1; padding-top: .1em; }
.url { font-size: 1.9vh; color: var(--ink-3); word-break: break-all; }
.pair-actions { display: flex; gap: 1.4vw; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink); border-radius: 999px; padding: 1.4vh 2.6vh; font-size: 2vh; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--ball); color: var(--navy-950); border-color: transparent; }
.btn:focus-visible { outline: 3px solid var(--ball); outline-offset: 3px; }

.mini-qr { position: absolute; right: 2.4vw; bottom: 11vh; z-index: 4; display: flex; align-items: center; gap: 1.2vw; padding: 1.2vh; padding-right: 2vw; border-radius: 2vh; background: var(--navy-900); border: 1px solid var(--line); }
.mini-qr .qr-box { padding: .8vh; border-radius: 1.2vh; }
.mini-qr .qr-box canvas, .mini-qr .qr-box img, .mini-qr .qr-box svg { width: 13vh; height: 13vh; }
.mini-qr .code { font-size: 4vh; }
.mini-qr .eyebrow { font-size: 1.5vh; }

.pair-status { font-size: 2.2vh; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-2); min-height: 1.2em; }
.pair-status.ok { color: var(--ok); }
.pair-status.bad { color: var(--danger); }
.overlay.denied { z-index: 12; background: rgba(30, 2, 6, .88); }
.overlay.denied h1 { color: var(--danger); font-size: 14vh; }
.overlay.denied .hint { font-size: 3vh; text-transform: none; letter-spacing: .04em; color: var(--ink); max-width: 70vw; line-height: 1.4; }
.winner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2vh; }
.winner .eyebrow { font-size: 2.4vh; color: var(--ball); }
.winner h1 { font-family: var(--font-score); font-weight: 400; font-size: 18vh; line-height: .9; margin: 0; letter-spacing: .04em; }
.winner .games { display: flex; gap: 2vw; font-family: var(--font-score); font-size: 6vh; color: var(--ink-2); }
.winner .hint { font-size: 2.2vh; color: var(--ink-3); letter-spacing: .14em; text-transform: uppercase; }

/* Portrait tablets: stack the two teams */
@media (orientation: portrait) {
  .court { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; gap: 1.2vh; }
  .team-score .seg7 { height: min(18vh, 50vw); }
  .team-name { font-size: 4.6vh; }
  .d-top { grid-template-columns: 1fr auto; }
  .d-meta { grid-column: 1 / -1; grid-row: 2; justify-self: center; font-size: 1.6vh; }
  .keys { display: none; }
  .d-bottom { grid-template-columns: 1fr; justify-items: center; gap: 1.2vh; }
  .pair-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .pair-text { max-width: 80vw; align-items: center; }
  .qr-box canvas, .qr-box img, .qr-box svg { width: min(40vh, 70vw); height: min(40vh, 70vw); }
  .d-bottom { justify-items: start; }
  .chip { font-size: 1.25vh; }
  .d-top .wordmark { height: 2.6vh; }
  .callout .seg7 { height: 4.4vh; }
  .d-left { flex-direction: column; align-items: flex-start; gap: .8vh; }
  .mini-qr { right: 2.4vw; bottom: 1.4vh; padding: .8vh 1.6vh .8vh .8vh; }
  .mini-qr .qr-box canvas, .mini-qr .qr-box img, .mini-qr .qr-box svg { width: 7.5vh; height: 7.5vh; }
  .mini-qr .code { font-size: 3vh; }
}

/* ============ Remote (phone) ============ */
.remote { min-height: 100%; display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); gap: 12px; max-width: 560px; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.r-head .wordmark { height: 14px; width: auto; }
.r-status { white-space: nowrap; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: none; cursor: pointer; }
.r-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #ffb547; }
.r-status.ok .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.r-status.bad .dot { background: var(--danger); }

.r-board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--navy-800); border: 1px solid var(--line); }
.r-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r-side.right { align-items: flex-end; text-align: right; }
.r-side .n { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: flex; align-items: center; gap: 6px; }
.r-side .n i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.r-side .s { height: 50px; margin: 4px 0 2px; }
.r-side .s .seg7 { height: 100%; width: auto; }
.r-side .s .seg7 .on { filter: drop-shadow(0 0 4px currentColor); }
.r-side .g { font-size: 11px; color: var(--ink-3); letter-spacing: .14em; }
.r-call { text-align: center; }
.r-call .c { color: #f4fbff; display: flex; justify-content: center; }
.r-call .c .seg7 { height: 26px; width: auto; }
.r-call .x { font-size: 10px; letter-spacing: .16em; color: var(--ink-3); text-transform: uppercase; }

.rally-btns { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 260px; }
.rally {
  --c: var(--team-a);
  position: relative; border: 0; border-radius: 24px; cursor: pointer; padding: 18px 12px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 78%, #000 22%));
  color: #0a0f22; box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--c) 60%, transparent), inset 0 -4px 0 rgba(0,0,0,.18);
  transition: transform .08s;
}
.rally:active { transform: scale(.97); }
.rally:disabled { filter: grayscale(.8) brightness(.55); }
.rally .lbl { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; font-weight: 700; opacity: .7; }
.rally .nm { font-family: var(--font-score); font-size: clamp(28px, 9vw, 44px); line-height: .95; letter-spacing: .04em; word-break: break-word; }
.rally .mid { display: flex; flex-direction: column; align-items: center; }
.rally .who { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .75; margin-top: 6px; line-height: 1.5; }
.rally .who b { opacity: 1; }
.rally .what { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: rgba(10,15,34,.14); padding: 6px 10px; border-radius: 999px; }
.rally.is-serving::after { content: 'SERVING'; position: absolute; top: 44px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; letter-spacing: .2em; padding: 6px 12px 5px; border-radius: 999px; background: #0a0f22; color: var(--c); }

.r-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--navy-800); cursor: pointer; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; }
.tool svg { width: 22px; height: 22px; color: var(--ink); }
.tool:disabled { opacity: .35; }
.tool.accent { background: var(--ball); color: var(--navy-950); border-color: transparent; }
.tool.accent svg { color: var(--navy-950); }

.next-game small { font-family: var(--font-ui); font-size: 13px; letter-spacing: .16em; font-weight: 700; opacity: .7; }
.next-game { flex: 1; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 24px; padding: 18px; font-family: var(--font-score); font-size: 28px; letter-spacing: .1em; background: var(--ball); color: var(--navy-950); cursor: pointer; }

/* Sign-in gate */
.gate { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 14px; text-align: center; padding: 22px 18px; border-radius: 24px; border: 1px solid var(--line); background: var(--navy-800); }
.gate .mark { width: 64px; margin: 0 auto 4px; }
.gate h2 { margin: 0; font-family: var(--font-score); font-weight: 400; font-size: 34px; letter-spacing: .05em; }
.gate p { margin: 0; color: var(--ink-2); line-height: 1.5; font-size: 15px; }
.gate.bad h2 { color: var(--danger); }
.big-btn.google { display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #1f1f1f; letter-spacing: .04em; text-transform: none; font-size: 16px; }
.big-btn.google svg { width: 22px; height: 22px; }
.account { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--navy-800); }
.account img { width: 38px; height: 38px; border-radius: 50%; background: var(--navy-700); }
.account b { display: block; font-size: 14px; }
.account span { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* Join screen */
.join { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; text-align: center; padding: 20px 6px; }
.join .mark { width: 72px; margin: 0 auto; }
.join h1 { font-family: var(--font-score); font-weight: 400; font-size: 40px; margin: 0; letter-spacing: .06em; }
.join p { color: var(--ink-2); margin: 0; line-height: 1.5; font-size: 15px; }
.code-input { font-family: var(--font-score); font-size: 44px; letter-spacing: .32em; text-align: center; text-transform: uppercase; width: 100%; padding: 14px 10px 8px .32em; border-radius: 18px; border: 2px solid var(--line); background: var(--navy-800); color: var(--ball); outline: none; }
.code-input:focus { border-color: var(--ball); }
.big-btn { border: 0; border-radius: 18px; padding: 16px; font-size: 15px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; background: var(--ball); color: var(--navy-950); cursor: pointer; }
.big-btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; }

/* Bottom sheet (settings) */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(3,6,16,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--navy-900); border-radius: 24px 24px 0 0; border: 1px solid var(--line); border-bottom: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; animation: up .22s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h2 { margin: 0; font-family: var(--font-score); font-weight: 400; font-size: 30px; letter-spacing: .08em; display: flex; justify-content: space-between; align-items: center; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .eyebrow { font-size: 11px; }
.text-in { font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--navy-800); color: var(--ink); text-transform: uppercase; letter-spacing: .06em; width: 100%; }
.team-edit { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.player-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.player-row.single { grid-template-columns: 1fr; }
.player-row .text-in { font-size: 15px; padding: 10px 12px; }
.mini-btn { justify-self: start; border: 1px solid var(--line); background: none; color: var(--ink-2); border-radius: 999px; padding: 7px 12px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; cursor: pointer; }
.swatches { display: flex; gap: 6px; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--navy-900) inset; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--navy-800); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 10px 4px; border-radius: 10px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--navy-950); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note { font-size: 12px; color: var(--ink-3); line-height: 1.5; margin: 0; }
.close-x { background: none; border: 0; color: var(--ink-2); font-size: 28px; cursor: pointer; line-height: 1; }

.flash { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--navy-950); padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; z-index: 30; opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap; }
.flash.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.brand-sm { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .2em; color: var(--ink); white-space: nowrap; }
.brand-sm img { height: 22px; width: auto; }
.brand-sm b { color: var(--ball); font-weight: 700; }

/* Buy a pass */
.pkgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pkg { border: 1px solid var(--line); background: var(--navy-800); color: var(--ink); border-radius: 18px; padding: 16px 12px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.pkg b { font-family: var(--font-score); font-weight: 400; font-size: 30px; letter-spacing: .04em; color: var(--ball); }
.pkg span { font-size: 13px; color: var(--ink-2); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.pkg small { font-size: 12px; color: var(--ink-3); }
.pkg:active, .pkg:focus-visible { border-color: var(--ball); outline: none; }
#shopPay { display: flex; flex-direction: column; gap: 14px; }
#shopPay.hidden { display: none !important; }
.pay-sum { display: flex; justify-content: space-between; align-items: center; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; }
.pay-steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.pay-steps b { color: var(--ink); }
.pay-qr { background: #fff; border-radius: 18px; padding: 14px; align-self: center; line-height: 0; }
.pay-qr img { width: min(62vw, 260px); height: auto; }
.ref-input { font-size: 40px; letter-spacing: .4em; }
.done-h { font-family: var(--font-score); font-weight: 400; font-size: 30px; margin: 4px 0 8px; color: var(--ok); letter-spacing: .05em; }
.my-purchases { display: flex; flex-direction: column; gap: 6px; }
.my-purchases:empty { display: none; }
.purchase { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--navy-800); border: 1px solid var(--line); }
.purchase .st { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.st.pending { color: #ffb547; } .st.approved { color: var(--ok); } .st.rejected { color: var(--danger); }
.pending-note { font-size: 13px; color: #ffb547; line-height: 1.5; }

.disclaimer { margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px solid rgba(255,181,71,.35); background: rgba(255,181,71,.06); font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.disclaimer b { color: var(--ink); }
.disclaimer ul { margin: 6px 0 8px; padding-left: 18px; }
.disclaimer a, .note a, .support a { color: var(--ball); display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.agree input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--ball); }
.gate .support { margin-top: 2px; }
.overlay.denied .support-tv { font-size: 2.2vh; color: var(--ink-2); margin-top: 1vh; }

.legal{font-size:1.4vh;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-3)}.legal a{color:var(--ink-3);text-decoration:none}

.gate.offer { justify-content: flex-start; padding-top: 18px; }
.gate.offer h2 { color: var(--ball); }
.gate .pkgs .pkg { text-align: center; align-items: center; padding: 14px 8px; }
.gate .pkgs .pkg b { font-size: 26px; }

/* ===== Responsive fixes ===== */
.overlay { overflow-y: auto; padding: 2vh 0; }
.pair-text h1 { font-size: min(8vh, 4.6vw); }
.code { font-size: min(9vh, 7vw); }
@media (orientation: portrait) {
  .pair-card { padding: 3vh 5vw; gap: 2.4vh; margin: auto 0; }
  .qr-box canvas, .qr-box img, .qr-box svg { width: min(34vh, 62vw); height: min(34vh, 62vw); }
  .pair-text h1 { font-size: min(5vh, 8.5vw); }
  .pair-text p { font-size: min(2vh, 3.8vw); }
  .code { font-size: min(7vh, 10.5vw); letter-spacing: .22em; }
  .btn { font-size: min(1.8vh, 3.2vw); padding: 1.2vh 2.2vh; }
  .serve-tag { font-size: min(2.2vh, 3.4vw); }
  .serve-tag .ball { width: min(4vh, 6vw); height: min(4vh, 6vw); }
  .d-status { flex-wrap: wrap; justify-content: flex-end; gap: 1vh; }
  .winner h1 { font-size: min(14vh, 15vw); }
  .overlay.denied h1 { font-size: min(10vh, 12vw); }
  .toast { font-size: min(8vh, 10vw); }
}
@media (orientation: portrait) and (max-width: 600px) {
  #passChip { display: none !important; }
  .d-top { padding: 1.4vh 3vw; }
  .chip { font-size: 11px; }
  .team-name { font-size: min(4.2vh, 8vw); }
  .pl { font-size: min(2.2vh, 3.6vw); }
}
/* Short landscape screens (phones turned sideways) */
@media (orientation: landscape) and (max-height: 520px) {
  .d-top { padding: 1vh 2vw; }
  .team { padding: 1.5vh 1.5vw; }
  .team-name { font-size: 7vh; }
  .team-score .seg7 { height: min(46vh, 30vw); }
  .keys { display: none; }
  .pair-card { padding: 3vh 4vw; gap: 4vw; }
  .qr-box canvas, .qr-box img, .qr-box svg { width: min(60vh, 34vw); height: min(60vh, 34vw); }
  .pair-text { gap: 1.6vh; }
  .pair-text p { font-size: 3.4vh; }
  /* remote in landscape */
  .remote { max-width: none; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .rally-btns { min-height: 150px; }
  .rally { padding: 10px; }
  .rally .lbl { display: none; }
}
/* Remote: small phones */
@media (max-width: 380px) {
  .remote { padding-left: 10px; padding-right: 10px; gap: 10px; }
  .brand-sm { font-size: 11px; letter-spacing: .14em; }
  .r-status { font-size: 10px; padding: 6px 9px; }
  .r-side .s { height: 42px; }
  .tool { font-size: 9.5px; letter-spacing: .08em; }
  .account { grid-template-columns: auto 1fr; }
  .account > div:last-child { grid-column: 1 / -1; }
  .pkg b { font-size: 26px; }
}
/* Remote: tablets — keep controls a comfortable size */
@media (min-width: 700px) {
  .remote { max-width: 620px; }
  .rally-btns { max-height: 560px; }
}
.account > div:last-child { flex-wrap: wrap; }

/* Splash */
.splash { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh;
  background: radial-gradient(60% 50% at 50% 45%, #2a0f4a 0%, #0b0518 60%, #050209 100%); transition: opacity .6s ease; }
.splash img { width: min(62vmin, 520px); height: auto; image-rendering: pixelated; animation: splashIn .9s cubic-bezier(.2,1.3,.4,1) both; filter: drop-shadow(0 2vh 5vh rgba(0,0,0,.6)); }
.splash-bar { width: min(40vmin, 300px); height: 6px; border-radius: 6px; background: rgba(255,214,0,.18); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 0; background: #ffd600; border-radius: 6px; animation: splashBar 5s linear forwards; }
.splash.out { opacity: 0; pointer-events: none; }
@keyframes splashIn { from { opacity: 0; transform: scale(.85) translateY(2vh); } to { opacity: 1; transform: none; } }
@keyframes splashBar { to { width: 100%; } }

/* Device role chooser */
.chooser { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; padding: 4vh 4vw;
  background: radial-gradient(60% 50% at 50% 35%, #2a0f4a 0%, #0b0518 65%, #050209 100%); text-align: center; overflow-y: auto; }
.chooser.hidden { display: none; }

.chooser h1 { margin: 0; font-family: var(--font-score); font-weight: 400; letter-spacing: .08em; font-size: clamp(28px, 6vh, 64px); color: #fff; }
.chooser-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: clamp(12px, 2.4vw, 28px); width: 100%; justify-content: center; }
.chooser-opt { display: flex; flex-direction: column; align-items: center; gap: 1vh; padding: clamp(18px, 4vh, 40px) 16px; border-radius: 24px; cursor: pointer;
  border: 2px solid rgba(255,214,0,.25); background: rgba(255,255,255,.04); color: #fff; }
.chooser-opt svg { width: clamp(40px, 8vh, 80px); height: auto; color: #ffd600; }
.chooser-opt b { font-family: var(--font-score); font-weight: 400; font-size: clamp(26px, 5vh, 48px); letter-spacing: .06em; }
.chooser-opt span { font-size: clamp(12px, 1.8vh, 16px); color: #cbbfe0; letter-spacing: .06em; }
.chooser-opt.primary, .chooser-opt:focus-visible, .chooser-opt:hover { border-color: #ffd600; background: rgba(255,214,0,.1); outline: none; }
.chooser-count { margin: 0; color: #cbbfe0; font-size: clamp(12px, 1.8vh, 16px); letter-spacing: .08em; }
@media (max-width: 520px) { .chooser-opts { grid-template-columns: 1fr; } }
/* Remote: scanner */
.join-logo { width: 120px !important; image-rendering: pixelated; }
.scanner { position: relative; width: 100%; max-width: 360px; aspect-ratio: 1; margin: 0 auto; border-radius: 22px; overflow: hidden; background: #000; }
.scanner.hidden { display: none; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14%; border: 3px solid #ffd600; border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); animation: scanPulse 1.6s ease-in-out infinite; }
@keyframes scanPulse { 50% { border-color: #39ff14; } }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.brand-sm img { image-rendering: pixelated; }

/* Lobby: DinkyKong lifts the paddle off his shoulder, bounces the ball 3 times, puts it back — 4 s loop.
   Logo pixel units: 1u = logo width / 640. Pivot = his fist (520, 236). */
.dk-anim { --W: min(28vh, 42vw); --u: calc(var(--W) / 640); position: relative; width: var(--W); aspect-ratio: 640 / 613;
  margin: 7vh calc(var(--W) * .2) 0 0; }
.dk-logo, .dk-logo2 { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 2; }
.dk-logo { animation: dkRestLayer 4s infinite; }
.dk-logo2 { animation: dkActLayer 4s infinite; }
.dk-arm { position: absolute; left: calc(520 / 640 * 100%); top: calc(236 / 613 * 100%); width: 0; height: 0;
  transform: rotate(-160.34deg); animation: dkArm 4s infinite, dkActLayer 4s infinite; }
.dk-back { z-index: 1; } .dk-front { z-index: 3; }
.dk-head { position: absolute; left: 0; top: 0; width: calc(200 * var(--u)); height: calc(200 * var(--u)); image-rendering: pixelated;
  transform-origin: 0 0; transform: translate(calc(253.6 * var(--u)), calc(-100 * var(--u))) scaleY(1); animation: dkHead 4s infinite; }
.dk-handle { position: absolute; left: calc(-24 * var(--u)); top: calc(-10 * var(--u)); height: calc(20 * var(--u)); width: calc(298 * var(--u));
  background: repeating-linear-gradient(90deg, #9b5fd6 0 calc(10 * var(--u)), #6a2aa6 0 calc(16 * var(--u)));
  border: calc(4 * var(--u)) solid #180028; border-radius: calc(6 * var(--u)); box-sizing: border-box;
  box-shadow: inset calc(10 * var(--u)) 0 0 #f8c800; animation: dkHandle 4s infinite; }
.dk-ball { position: absolute; z-index: 4; width: calc(46 * var(--u)); height: calc(46 * var(--u));
  left: calc(672 * var(--u)); top: calc(156 * var(--u)); background: url(../icons/pixel-ball.svg) center / contain no-repeat;
  image-rendering: pixelated; transform-origin: 50% 100%; opacity: 0; animation: dkBall 4s infinite; }

@keyframes dkRestLayer { 0%, 9.9% { opacity: 1; } 10%, 79.9% { opacity: 0; } 80%, 100% { opacity: 1; } }
@keyframes dkActLayer  { 0%, 9.9% { opacity: 0; } 10%, 79.9% { opacity: 1; } 80%, 100% { opacity: 0; } }
/* swing: shoulder (-160°) → over the top → flat to the side (0°), taps on each bounce, then back */
@keyframes dkArm {
  0%, 10% { transform: rotate(-160.34deg); animation-timing-function: cubic-bezier(.45,0,.3,1); }
  22%   { transform: rotate(0deg); }
  24%   { transform: rotate(-4deg); } 26% { transform: rotate(0deg); }
  37%   { transform: rotate(-4deg); } 39% { transform: rotate(0deg); }
  50%   { transform: rotate(-4deg); } 52% { transform: rotate(0deg); }
  66%   { transform: rotate(0deg); animation-timing-function: cubic-bezier(.45,0,.3,1); }
  78%, 100% { transform: rotate(-160.34deg); }
}
/* paddle head slides in toward the fist and tilts flat (face up) while out front */
@keyframes dkHead {
  0%, 10% { transform: translate(calc(253.6 * var(--u)), calc(-100 * var(--u))) scaleY(1); animation-timing-function: cubic-bezier(.45,0,.3,1); }
  22%, 66% { transform: translate(calc(56 * var(--u)), calc(-62 * var(--u))) scale(1.3, .62); animation-timing-function: cubic-bezier(.45,0,.3,1); }
  78%, 100% { transform: translate(calc(253.6 * var(--u)), calc(-100 * var(--u))) scaleY(1); }
}
@keyframes dkHandle {
  0%, 10% { width: calc(298 * var(--u)); animation-timing-function: cubic-bezier(.45,0,.3,1); }
  22%, 66% { width: calc(100 * var(--u)); animation-timing-function: cubic-bezier(.45,0,.3,1); }
  78%, 100% { width: calc(298 * var(--u)); }
}
/* ball: appears on the flat paddle, 3 bounces with squash, settles, then is tucked away */
@keyframes dkBall {
  0%, 21% { opacity: 0; transform: translateY(0); }
  22% { opacity: 1; transform: translateY(0) scale(1); }
  24% { transform: translateY(0) scale(1.2, .8); animation-timing-function: cubic-bezier(.2,.7,.4,1); }
  30.5% { transform: translateY(-320%) scale(1); animation-timing-function: cubic-bezier(.6,0,.8,.3); }
  37% { transform: translateY(0) scale(1.2, .8); animation-timing-function: cubic-bezier(.2,.7,.4,1); }
  43.5% { transform: translateY(-320%) scale(1); animation-timing-function: cubic-bezier(.6,0,.8,.3); }
  50% { transform: translateY(0) scale(1.2, .8); animation-timing-function: cubic-bezier(.2,.7,.4,1); }
  56.5% { transform: translateY(-320%) scale(1); animation-timing-function: cubic-bezier(.6,0,.8,.3); }
  63% { transform: translateY(0) scale(1.1, .9); }
  64% { opacity: 1; transform: translateY(0) scale(1); }
  66%, 100% { opacity: 0; transform: translateY(0) scale(.6); }
}
@media (prefers-reduced-motion: reduce) { .dk-logo, .dk-logo2, .dk-arm, .dk-head, .dk-handle, .dk-ball { animation: none !important; } .dk-logo2, .dk-arm, .dk-ball { opacity: 0; } }
