/* Athleticle website: the main menu and the frame events play in.
   Same colours, fonts, cards and buttons as the events, so moving between them feels like one game.
   The menu is three pages (Daily, Practice, Records) with a tab bar fixed at the bottom, like a phone app.
   LAYOUT RULE: each page fits on one screen with no scrolling, on computers and phones.
   Short screens shrink things further (see the height rules near the end). */
:root{
  --blue:#2148D6; --blue-d:#142E9E; --navy:#0E1B4D; --orange:#FF7A1F; --orange-d:#D85A08;
  --yellow:#FFC93C; --off:#FFF7EA; --off-d:#EFE3CC; --red:#E5383B; --green:#1F9D5C; --sky:#4C86F0;
  --gold:#F4BE1E; --silver:#CBD3DE; --bronze:#D9884A; --ink2:#33406e; --muted:#5a6690;
  --pb-red:#C81E2B;      /* personal-best badges everywhere ("New PB!", "New practice best!") */
  --display:"Lilita One","Arial Rounded MT Bold","Trebuchet MS",system-ui,sans-serif;
  --body:"Nunito",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --gap:16px;            /* space between cards */
  --top-space:14px;      /* space above the header (plus the phone's status-bar inset) */
  --tabbar-h:68px;       /* tab bar height, not counting the phone's home-bar inset */
  color-scheme:light;
}
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%}
html{background:var(--navy)}
body{margin:0;font-family:var(--body);color:var(--navy);overflow:hidden;
  background:linear-gradient(180deg,var(--sky) 0%,#6A9CF4 55%,#86B2F8 100%);-webkit-tap-highlight-color:transparent}
button{font-family:var(--body);color:inherit;-webkit-tap-highlight-color:transparent}
button:focus-visible{outline:3px solid var(--yellow);outline-offset:3px}

/* ---- the event fills the screen while it's open ---- */
#stage{position:fixed;inset:0;z-index:20;background:var(--navy)}

/* ---- stadium behind the menu, with a dark tint so cards and text stand out ---- */
#backdrop{position:fixed;inset:0;z-index:0;overflow:hidden;pointer-events:none}
#backdrop::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(180deg,rgba(14,27,77,.62) 0%,rgba(14,27,77,.38) 35%,rgba(14,27,77,.42) 65%,rgba(14,27,77,.72) 100%)}

#loading{position:fixed;inset:0;display:grid;place-items:center;font-family:var(--display);font-size:28px;color:var(--off);
  text-shadow:0 3px 0 var(--navy);text-align:center;padding:20px}

/* ================= menu: header, one page, tab bar ================= */
#menu{position:relative;z-index:1;height:100vh;height:100dvh;max-width:1040px;margin:0 auto;overflow:hidden;
  padding-top:calc(var(--top-space) + env(safe-area-inset-top,0px));
  padding-bottom:calc(var(--tabbar-h) + var(--gap) + env(safe-area-inset-bottom,0px));
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));
  display:flex;flex-direction:column;gap:var(--gap)}

.top{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:none}
.brand{display:flex;flex-direction:column;line-height:1}
.brand b{font-family:var(--display);font-weight:400;font-size:32px;letter-spacing:.02em;color:var(--off);
  text-shadow:0 2px 0 var(--navy),2px 0 0 var(--navy),-2px 0 0 var(--navy),0 -2px 0 var(--navy),0 4px 0 var(--navy)}
.brand b i{font-style:normal;color:var(--yellow)}
.brand span{margin-top:6px;font-weight:900;font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--off);
  text-shadow:1px 0 0 var(--navy),-1px 0 0 var(--navy),0 1px 0 var(--navy),0 -1px 0 var(--navy)}
.tools{display:flex;gap:8px}
.icon-btn{width:40px;height:40px;border-radius:50%;border:3px solid var(--navy);background:var(--off);box-shadow:0 3px 0 var(--navy);
  display:grid;place-items:center;cursor:pointer;padding:0;color:var(--navy)}
.icon-btn:active{transform:translateY(2px);box-shadow:0 1px 0 var(--navy)}
.icon-btn svg{width:20px;height:20px}

/* the current page: its cards are centred in the space between the header and the tab bar */
.page{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:var(--gap)}
/* Practice and Records keep a comfortable reading width; Daily uses the full width (see page 1 below) */
.page-practice,.page-records{width:100%;max-width:640px;margin:0 auto}

/* ---- tab bar, fixed at the bottom ---- */
.tabbar{position:fixed;z-index:30;left:0;right:0;bottom:0;display:flex;justify-content:center;gap:6px;
  padding:8px max(10px,env(safe-area-inset-left,0px)) calc(8px + env(safe-area-inset-bottom,0px)) max(10px,env(safe-area-inset-right,0px));
  background:rgba(14,27,77,.94);border-top:3px solid var(--navy);box-shadow:0 -4px 0 rgba(255,247,234,.12)}
.tab{flex:1;max-width:190px;height:calc(var(--tabbar-h) - 16px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  border:2.5px solid transparent;border-radius:14px;background:transparent;color:#C5D2FA;cursor:pointer;padding:0 4px;
  font-family:var(--display);font-size:14px;letter-spacing:.03em}
.tab svg{width:24px;height:24px}
.tab:hover{color:var(--off);background:rgba(255,247,234,.08)}
.tab.on{background:var(--yellow);color:var(--navy);border-color:var(--navy);box-shadow:0 3px 0 rgba(0,0,0,.35)}
.tab.on svg{transform:translateY(-1px)}

/* ---- cards: nearly solid, with the stadium softly blurred behind so text stays easy to read ---- */
.card{background:var(--off);border:3px solid var(--navy);border-radius:20px;box-shadow:0 6px 0 var(--navy);padding:16px 18px 18px;position:relative;min-width:0;flex:none}
#menu .card{background:rgba(255,247,234,.92);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){#menu .card{background:var(--off)}}
.eyebrow{font-weight:900;font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--orange-d)}
.card h2{font-family:var(--display);font-weight:400;margin:0;line-height:1;font-size:24px}
.sec-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0}
.sec-note{font-weight:800;font-size:11px;color:var(--muted);text-align:right;line-height:1.2}
.lede{margin:6px 0 0;font-weight:700;font-size:14px;line-height:1.4;color:var(--ink2)}
.btn{font-family:var(--display);font-size:19px;letter-spacing:.02em;padding:10px 14px;border:3px solid var(--navy);border-radius:13px;
  box-shadow:0 4px 0 var(--navy);cursor:pointer;background:var(--orange);color:var(--navy);width:100%}
.btn:active{transform:translateY(3px);box-shadow:0 1px 0 var(--navy)}
/* No yellow outline on the big buttons. Keyboard users still see which button is selected:
   a soft blue glow that follows the button's rounded shape. */
.btn:focus-visible{outline:none;box-shadow:0 4px 0 var(--navy),0 0 0 4px rgba(33,72,214,.45)}

/* ================= page 1: daily =================
   Computers and tablets (700 px wide and up): today's result is the big card (about two-thirds of the width),
   the global leaderboard a thinner column on the right. Phones: result big on top, compact leaderboard below.
   The score's size follows the screen (--score-size), so it's as large as the space allows. */
.page-daily{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);grid-template-rows:minmax(0,600px);align-content:center;gap:var(--gap)}
.page-daily .card{min-height:0;overflow:hidden}

.daily{display:flex;flex-direction:column;gap:10px;--score-size:clamp(56px,min(16vh,11vw),150px)}
.streak{display:inline-flex;align-items:center;gap:4px;font-weight:900;font-size:12px;letter-spacing:.02em;white-space:nowrap;
  padding:3px 9px;border-radius:999px;background:#FFF1C9;border:2px solid var(--navy)}
.streak b{font-family:var(--display);font-weight:400;font-size:15px}
.d-main{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;text-align:center}
.d-main .ev{font-family:var(--display);font-size:calc(var(--score-size) * .38);line-height:1;color:var(--navy)}
.score{display:flex;align-items:baseline;justify-content:center;gap:6px;margin:2px 0 4px}
.score .v{font-family:var(--display);font-size:var(--score-size);line-height:.95;color:var(--blue);font-variant-numeric:tabular-nums;
  text-shadow:0 4px 0 rgba(14,27,77,.15)}
.score .u{font-family:var(--display);font-size:calc(var(--score-size) * .36);color:var(--blue)}
.score.none .v{color:var(--red)}
.badges{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.badges:empty{display:none}
.badge{display:inline-block;font-weight:900;font-size:12px;letter-spacing:.08em;text-transform:uppercase;padding:4px 11px;border-radius:999px;
  background:var(--yellow);border:2px solid var(--navy);white-space:nowrap}
.badge.wr{background:var(--red);color:#fff}
.badge.gold{background:var(--gold)}.badge.silver{background:var(--silver)}.badge.bronze{background:var(--bronze)}
/* "New PB!": the game's personal-best red, so it never looks like a gold medal. Same red as the events'
   "New daily best!" / "New practice best!". White text on it is easy to read (contrast about 5.7 : 1). */
.badge.pb-new{background:var(--pb-red);color:#fff}
.d-foot{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center}
.countdown{text-align:center;font-weight:800;font-size:11px;line-height:1.15;color:var(--muted)}
.countdown b{display:block;font-family:var(--display);font-weight:400;font-size:22px;letter-spacing:.02em;font-variant-numeric:tabular-nums;color:var(--navy)}

/* global leaderboard teaser: greyed placeholder rows under a "Coming soon" chip */
.board{display:flex;flex-direction:column;gap:8px}
.board-head{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.board h2{font-size:21px}
.ghost-rows{list-style:none;margin:2px 0 0;padding:0;display:grid;gap:6px;opacity:.55}
.ghost-rows li{display:grid;grid-template-columns:20px 1fr 34px;align-items:center;gap:8px;padding:6px 8px;border-radius:10px;border:2px dashed #C9BC9F}
.ghost-rows .rank{font-family:var(--display);font-size:15px;color:var(--muted);text-align:center}
.ghost-rows .bar{height:9px;border-radius:6px;background:var(--off-d)}
.ghost-rows .bar.sm{width:100%}

/* ================= page 2: practice ================= */
.practice{display:flex;flex-direction:column;gap:8px}
.plist{list-style:none;margin:4px 0 0;padding:0;display:grid;gap:8px}
.prow{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:12px;min-height:54px;
  padding:6px 10px 6px 12px;border-radius:13px;background:#fff;border:2px solid #E1D6BF;font:inherit;text-align:left}
button.prow{cursor:pointer;border-color:var(--navy);box-shadow:0 3px 0 var(--navy)}
button.prow:hover{background:#FFF9EC}
button.prow:active{transform:translateY(2px);box-shadow:0 1px 0 var(--navy)}
.prow.soon{background:transparent;border-style:dashed}
.prow.soon .soon-chip{grid-column:2 / -1;justify-self:end}
.prow.done{opacity:.75}
.left{display:flex;align-items:center;gap:6px;font-weight:900;font-size:11px;color:var(--muted);white-space:nowrap}
.pips{display:flex;gap:3px}
.pip{width:11px;height:11px;border-radius:50%;border:2px solid var(--navy);background:var(--orange)}
.pip.used{background:var(--off-d)}
.go{font-family:var(--display);font-size:16px;padding:5px 12px;border-radius:10px;border:2.5px solid var(--navy);background:var(--orange);white-space:nowrap}
.go.off{background:var(--off-d);border-color:#C9BC9F;color:var(--muted);font-size:14px}

/* ---- Slalom Skiing's "iced out" practice box ----
   Same size and layout as the other boxes. Frosty blue inside, a silver border dotted with tiny "diamonds",
   frost creeping in at the corners, a few twinkling sparkles and a slow shine that sweeps across every few seconds.
   The decorations sit behind the text (.ice-fx), so the event name and buttons stay easy to read. */
.prow.iced,button.prow.iced:hover{position:relative;overflow:hidden;isolation:isolate;border:3.5px solid transparent;
  background:
    linear-gradient(135deg,#DDF2FF 0%,#ADDBF7 38%,#D2EDFF 62%,#9CD1F2 100%) padding-box,
    radial-gradient(circle,#fff 0 1.1px,rgba(255,255,255,.5) 1.4px,transparent 2px) 0 0/6px 6px border-box,
    radial-gradient(circle,#fff 0 .8px,transparent 1.4px) 3px 3px/6px 6px border-box,
    linear-gradient(120deg,#F4F8FC 0%,#7F93AB 20%,#E9EFF6 42%,#6F849D 66%,#F4F8FC 85%,#8EA2B9 100%) border-box;
  box-shadow:0 0 0 1.5px var(--navy),0 3px 0 1.5px var(--navy),inset 0 0 0 1px rgba(255,255,255,.95),inset 0 0 14px rgba(255,255,255,.55),0 0 14px rgba(110,190,255,.6)}
button.prow.iced:hover{filter:brightness(1.04)}
button.prow.iced:active{box-shadow:0 0 0 1.5px var(--navy),0 1px 0 1.5px var(--navy),inset 0 0 0 1px rgba(255,255,255,.95),inset 0 0 14px rgba(255,255,255,.55),0 0 14px rgba(110,190,255,.6)}
/* the border is 1.5 px thicker than the other boxes', so the padding is 1.5 px less: same size on every screen */
.prow.iced{padding:4.5px 8.5px 4.5px 10.5px}
@media (max-width:599px){.prow.iced{padding:3.5px 6.5px 3.5px 8.5px}}
@media (max-height:620px){.prow.iced{padding-top:1.5px;padding-bottom:1.5px}}
.prow.iced > :not(.ice-fx){position:relative;z-index:1}
.ice-fx{position:absolute;inset:0;z-index:0;pointer-events:none;border-radius:inherit;overflow:hidden;
  /* the frozen texture: two fine layers of tiny ice crystals */
  background:
    radial-gradient(circle at 30% 40%,rgba(255,255,255,.8) 0 .8px,transparent 1.6px) 0 0/13px 11px,
    radial-gradient(circle at 70% 70%,rgba(255,255,255,.6) 0 .7px,transparent 1.4px) 3px 5px/19px 17px,
    repeating-linear-gradient(115deg,rgba(255,255,255,0) 0 22px,rgba(255,255,255,.22) 22px 23px,rgba(255,255,255,0) 23px 41px)}
/* frost creeping in from the four corners */
.ice-fx .frost{position:absolute;inset:0;
  background:
    radial-gradient(ellipse 44px 30px at 0 0,rgba(255,255,255,.95),rgba(255,255,255,.55) 45%,transparent 100%),
    radial-gradient(ellipse 34px 24px at 100% 0,rgba(255,255,255,.85),rgba(255,255,255,.4) 45%,transparent 100%),
    radial-gradient(ellipse 34px 24px at 0 100%,rgba(255,255,255,.85),rgba(255,255,255,.4) 45%,transparent 100%),
    radial-gradient(ellipse 44px 30px at 100% 100%,rgba(255,255,255,.95),rgba(255,255,255,.55) 45%,transparent 100%)}
/* the slow shine: sweeps across, then rests for a few seconds */
.ice-fx .shine{position:absolute;top:-30%;bottom:-30%;left:0;width:34%;transform:translateX(-160%) skewX(-20deg);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.75) 50%,transparent);animation:iceShine 5s ease-in-out infinite}
@keyframes iceShine{0%{transform:translateX(-160%) skewX(-20deg)}30%,100%{transform:translateX(420%) skewX(-20deg)}}
/* sparkles: small four-pointed stars that twinkle on and off, each at its own time */
.ice-fx .sp{position:absolute;width:12px;height:12px;background:#fff;opacity:0;
  clip-path:polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%);
  filter:drop-shadow(0 0 3px #fff);animation:iceTwinkle 3.2s ease-in-out infinite}
.ice-fx .sp:nth-of-type(1){left:4%;top:62%;animation-delay:.2s}
.ice-fx .sp:nth-of-type(2){left:27%;top:12%;animation-delay:1.4s;width:9px;height:9px}
.ice-fx .sp:nth-of-type(3){left:46%;top:68%;animation-delay:2.5s}
.ice-fx .sp:nth-of-type(4){left:61%;top:14%;animation-delay:.9s;width:9px;height:9px}
.ice-fx .sp:nth-of-type(5){left:74%;top:66%;animation-delay:2s}
.ice-fx .sp:nth-of-type(6){left:94%;top:28%;animation-delay:1.1s;width:9px;height:9px}
@keyframes iceTwinkle{0%,62%,100%{opacity:0;transform:scale(.3) rotate(0)}74%{opacity:1;transform:scale(1) rotate(45deg)}86%{opacity:0;transform:scale(.4) rotate(90deg)}}
@media (prefers-reduced-motion:reduce){.ice-fx .shine,.ice-fx .sp{animation:none}.ice-fx .sp{opacity:.7}}

/* shared: event name with its logo tile, "coming soon" chip */
.ev-name{display:flex;align-items:center;gap:10px;min-width:0}
.tile{flex:none;width:34px;height:34px;border-radius:10px;border:2.5px solid var(--navy);display:grid;place-items:center;
  font-family:var(--display);font-size:18px;color:var(--off);background:var(--c,var(--blue));text-shadow:0 2px 0 rgba(14,27,77,.5)}
/* the event's logo fills most of the tile (drawn in site/app.js) */
.tile .logo{width:88%;height:88%;display:block;overflow:visible}
.name{font-family:var(--display);font-size:19px;line-height:1.05;min-width:0;text-align:left}
.soon .tile{filter:grayscale(1);opacity:.45}
.soon .name{color:#7b84a6}
.soon-chip{font-weight:900;font-size:10px;letter-spacing:.08em;text-transform:uppercase;padding:3px 9px;border-radius:999px;
  background:var(--off-d);border:2px dashed #B9AC8E;color:var(--muted);white-space:nowrap}

/* ================= page 3: records ================= */
.records{display:flex;flex-direction:column;gap:10px}
.cabinet{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;align-items:end;
  padding:10px 8px 0;border:3px solid var(--navy);border-radius:14px;
  background:linear-gradient(180deg,#1E3DB8 0%,#2A4FD8 100%);box-shadow:inset 0 3px 0 rgba(255,255,255,.18),inset 0 -14px 0 #8A5A32,inset 0 -17px 0 var(--navy)}
.slot{display:flex;flex-direction:column;align-items:center;gap:4px;padding-bottom:22px;min-width:0}
.slot .lbl{font-weight:900;font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--off);text-align:center;line-height:1.1;white-space:nowrap}
.medal{--m:var(--gold);position:relative;width:54px;height:54px;margin-top:18px;border-radius:50%;border:3px solid var(--navy);
  background:radial-gradient(circle at 35% 30%,rgba(255,255,255,.65) 0 18%,transparent 40%),var(--m);
  display:grid;place-items:center;font-family:var(--display);font-size:23px;line-height:1;color:var(--navy);box-shadow:0 3px 0 var(--navy)}
.medal::before,.medal::after{content:"";position:absolute;top:-19px;width:12px;height:20px;border:2.5px solid var(--navy);border-bottom:0;background:var(--blue)}
.medal::before{left:10px;transform:skewX(18deg);background:var(--red)}
.medal::after{right:10px;transform:skewX(-18deg)}
.medal.wr{--m:var(--red);color:#fff;text-shadow:0 2px 0 var(--navy)}
.medal.wr::before,.medal.wr::after{background:var(--yellow)}
.medal.silver{--m:var(--silver)}.medal.bronze{--m:var(--bronze)}
.slot.zero .medal{filter:saturate(.25);opacity:.55}
.slot.zero .lbl{opacity:.7}

.pbs-card{display:flex;flex-direction:column;gap:8px}
.pbs{display:flex;flex-direction:column;gap:6px}
.pb-head,.pb-row{display:grid;grid-template-columns:minmax(0,1fr) 84px 84px;align-items:center;gap:8px}
.pb-head{padding:0 12px;font-weight:900;font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
.pb-head span:not(:first-child){text-align:right}
.pb-row{min-height:44px;padding:3px 12px;border-radius:12px;background:#fff;border:2px solid #E1D6BF}
.pb-row.soon{background:transparent;border-style:dashed}
.pb-row.soon .soon-chip{grid-column:2 / -1;justify-self:end}
.pb{text-align:right;font-family:var(--display);font-size:19px;line-height:1.1;font-variant-numeric:tabular-nums;white-space:nowrap}
.pb small{font-size:.65em}
.pb.empty{color:#B3A98F}

/* ================= pop-up card (how to play, share fallback) ================= */
.overlay{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:rgba(14,27,77,.55);
  padding:calc(12px + env(safe-area-inset-top,0px)) 12px calc(12px + env(safe-area-inset-bottom,0px))}
.overlay .card{width:100%;max-width:440px;max-height:100%;overflow:auto;padding:18px;animation:pop .28s cubic-bezier(.2,1.4,.4,1)}
@keyframes pop{from{transform:scale(.9);opacity:0}to{transform:none;opacity:1}}
.steps{list-style:none;margin:12px 0 0;padding:0;display:grid;gap:9px}
.steps li{display:grid;grid-template-columns:34px 1fr;gap:10px;align-items:start}
.num{width:34px;height:34px;border-radius:10px;border:3px solid var(--navy);display:grid;place-items:center;font-family:var(--display);font-size:18px;background:var(--yellow)}
.steps li:nth-child(2) .num{background:var(--orange)}
.steps li:nth-child(3) .num{background:var(--blue);color:var(--off)}
.steps li:nth-child(4) .num{background:var(--green);color:var(--off)}
.steps b{display:block;font-family:var(--display);font-weight:400;font-size:17px}
.steps p{margin:1px 0 0;font-size:13.5px;font-weight:700;line-height:1.4;color:var(--ink2)}
.btns{display:grid;gap:10px;margin-top:14px}
.share-text{width:100%;margin-top:10px;font:700 14px/1.4 var(--body);border:2px solid var(--navy);border-radius:10px;padding:8px;resize:none}

/* ================= daily page on phones: result big on top, compact leaderboard below ================= */
/* The compact leaderboard bar is for phones only; computers keep the thin column. */
.board-mini{display:none}
@media (max-width:699px){
  .page-daily{display:flex;flex-direction:column;justify-content:flex-start}
  .page-daily .daily{flex:1 1 auto;max-height:600px}
  .daily{--score-size:clamp(50px,min(13.5vh,22vw),100px);gap:8px}
  .page-daily .board{display:none}

  .board-mini{display:block;position:relative;flex:none}
  /* the bar: global position, your score, "Coming soon", and an arrow showing it opens */
  .board-bar{width:100%;display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:10px;
    padding:6px 10px 6px 12px;border:3px solid var(--navy);border-radius:14px;cursor:pointer;text-align:left;
    background:rgba(255,247,234,.94);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:0 4px 0 var(--navy);font:inherit;color:var(--navy)}
  .board-bar:active{transform:translateY(2px);box-shadow:0 2px 0 var(--navy)}
  .board-bar small{display:block;font-family:var(--body);font-weight:900;font-size:9px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);line-height:1.2}
  .bb-rank,.bb-score{font-family:var(--display);font-size:20px;line-height:1.05;font-variant-numeric:tabular-nums;white-space:nowrap;min-width:0}
  .bb-rank{color:var(--blue)}
  .bb-score{overflow:hidden;text-overflow:ellipsis}
  .bb-chev{width:12px;height:12px;border-right:3px solid var(--navy);border-top:3px solid var(--navy);transform:rotate(-45deg) translate(-2px,2px);transition:transform .2s}
  .board-mini.open .bb-chev{transform:rotate(135deg) translate(-2px,2px)}

  /* the full leaderboard opens upwards over the result card, so nothing below it moves */
  .board-sheet{position:absolute;left:0;right:0;bottom:calc(100% + 8px);z-index:5;display:flex;flex-direction:column;gap:6px;
    padding:12px 13px;border:3px solid var(--navy);border-radius:17px;background:var(--off);box-shadow:0 5px 0 var(--navy);
    animation:sheetUp .2s ease-out}
  @keyframes sheetUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
  .sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
  .sheet-head h2{font-size:19px}
  .sheet-note{margin:0;font-weight:700;font-size:12px;line-height:1.35;color:var(--ink2)}
  .sheet-rows{list-style:none;margin:2px 0 0;padding:0;display:grid;gap:5px}
  .sheet-rows li{display:grid;grid-template-columns:52px 1fr 40px;align-items:center;gap:8px;min-height:28px;padding:3px 9px;border-radius:9px;
    border:2px dashed #C9BC9F;opacity:.6}
  .sheet-rows .rank{font-family:var(--display);font-size:15px;color:var(--muted)}
  .sheet-rows .bar{height:9px;border-radius:6px;background:var(--off-d)}
  .sheet-rows .bar.sm{width:100%}
  .sheet-rows li.gap{display:block;border:0;min-height:0;padding:0;text-align:center;color:var(--muted);font-weight:900;line-height:1}
  .sheet-rows li.me{opacity:1;border:2.5px solid var(--navy);background:#FFF1C9;grid-template-columns:auto 1fr auto}
  .sheet-rows li.me .rank{color:var(--blue);font-size:16px}
  .sheet-rows .who{font-family:var(--display);font-size:16px}
  .sheet-rows .mine{font-family:var(--display);font-size:16px;font-variant-numeric:tabular-nums}
}
@media (max-width:359px){
  .board-bar{gap:7px;padding-left:9px}
  .bb-rank,.bb-score{font-size:17px}
  .board-bar .soon-chip{font-size:8px;padding:2px 5px}
}
@media (max-width:699px) and (max-height:620px){
  .board-bar{padding-top:4px;padding-bottom:4px}
  .bb-rank,.bb-score{font-size:17px}
  .sheet-rows li:nth-child(n+4):not(.gap):not(.me){display:none}
  .sheet-rows li{min-height:24px}
}

/* ================= phones (narrow) ================= */
@media (max-width:599px){
  :root{--gap:12px;--top-space:10px;--tabbar-h:62px}
  #menu{padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px))}
  .brand b{font-size:26px}
  .brand span{margin-top:4px;font-size:10px}
  .icon-btn{width:36px;height:36px}
  .icon-btn svg{width:18px;height:18px}
  .card{padding:12px 13px 14px;border-radius:17px;box-shadow:0 5px 0 var(--navy)}
  .card h2{font-size:21px}
  .lede{font-size:13px}
  .btn{font-size:18px;padding:8px 12px;border-radius:12px}
  .tab{font-size:13px}
  .tab svg{width:22px;height:22px}
  .prow{min-height:48px;gap:9px;padding:5px 8px 5px 10px}
  .left{flex-direction:column;gap:2px;font-size:10px}
  .go{font-size:14px;padding:4px 9px}
  .go.off{font-size:12px}
  .tile{width:30px;height:30px;font-size:16px;border-radius:9px}
  .name{font-size:17px}
  .medal{width:46px;height:46px;font-size:20px;margin-top:16px}
  .medal::before,.medal::after{top:-17px;width:10px;height:18px}
  .medal::before{left:8px}.medal::after{right:8px}
  .pb-head,.pb-row{grid-template-columns:minmax(0,1fr) 70px 70px;gap:6px}
  .pb-head{padding:0 10px}
  .pb-row{min-height:40px;padding:3px 10px}
  .pb{font-size:16px}
  .soon-chip{font-size:9px;padding:2px 7px}
}
@media (max-width:359px){
  .tile{display:none}
  .pb-head,.pb-row{grid-template-columns:minmax(0,1fr) 62px 62px}
  .name{font-size:15px}
  .pb{font-size:14px}
  .left .pips{display:none}
}

/* ================= short screens ================= */
@media (max-height:720px){
  :root{--gap:10px;--top-space:10px;--tabbar-h:60px}
  .card{padding-top:11px;padding-bottom:12px}
  .prow{min-height:44px}
  .pb-row{min-height:36px}
  .medal{width:44px;height:44px;font-size:19px;margin-top:15px}
  .medal::before,.medal::after{top:-16px;height:17px;width:10px}
  .slot{padding-bottom:20px}
  .ghost-rows li{padding:4px 10px}
}
@media (max-height:620px){
  :root{--gap:8px;--top-space:6px;--tabbar-h:54px}
  .brand span{display:none}
  .brand b{font-size:23px}
  .icon-btn{width:32px;height:32px}
  .card{padding:8px 12px 10px;border-radius:15px}
  .card h2{font-size:18px}
  .lede{font-size:12px;margin-top:3px}
  .d-main .eyebrow{display:none}
  .btn{font-size:16px;padding:6px 10px}
  .countdown b{font-size:17px}
  .badge{font-size:10px;padding:2px 8px}
  .ghost-rows{gap:4px}
  .tab{font-size:12px;gap:1px}
  .tab svg{width:20px;height:20px}
  .plist,.pbs{gap:5px}
  .prow{min-height:38px;padding-top:3px;padding-bottom:3px}
  .pb-row{min-height:31px}
  .medal{width:36px;height:36px;font-size:16px;margin-top:13px}
  .medal::before,.medal::after{top:-14px;height:15px;width:8px}
  .medal::before{left:6px}.medal::after{right:6px}
  .slot{padding-bottom:17px}
  .cabinet{padding-top:6px}
}
@media (max-height:520px){
  .lede{display:none}
  .prow{min-height:34px}
  .pb-row{min-height:28px}
}
@media (prefers-reduced-motion:reduce){.overlay .card{animation:none}}

/* ---- test panel (only in test mode; players never see it) ---- */
.test-panel{position:fixed;z-index:60;left:max(6px,env(safe-area-inset-left,0px));bottom:calc(6px + env(safe-area-inset-bottom,0px));
  display:flex;flex-direction:column;align-items:flex-start;gap:6px;font-family:var(--body)}
.menu-open .test-panel{bottom:calc(var(--tabbar-h) + 6px + env(safe-area-inset-bottom,0px))}
/* phones: up in the header row, left of the sound and help buttons, so it never covers the leaderboard bar */
@media (max-width:699px){
  .menu-open .test-panel{bottom:auto;left:auto;top:calc(var(--top-space) + 6px + env(safe-area-inset-top,0px));
    right:calc(max(12px,env(safe-area-inset-right,0px)) + 86px);flex-direction:column-reverse;align-items:flex-end}
}
.test-panel button{font-weight:800;font-size:11px;letter-spacing:.04em;cursor:pointer;white-space:nowrap;text-align:left;
  background:rgba(14,27,77,.85);color:var(--off);border:1.5px dashed rgba(255,247,234,.7);border-radius:8px;padding:5px 9px}
.test-panel button:hover{background:var(--navy)}
.test-panel .t-toggle[aria-expanded="true"]{background:var(--orange);color:var(--navy);border:1.5px solid var(--navy)}
.t-menu{display:flex;flex-direction:column;gap:4px;padding:8px;border-radius:12px;background:rgba(14,27,77,.92);border:2px solid var(--off);min-width:200px}
.t-menu button{width:100%;border-style:solid;border-color:rgba(255,247,234,.35)}
.t-info{font-size:11px;font-weight:700;line-height:1.4;color:#C5D2FA;padding:0 2px 4px}
.t-info b{color:var(--off)}
