/* ZENBONI — interface */
:root{
  --navy:#04101f; --ink:#071a36; --blue:#003087; --gold:#ffb81c; --ice:#dff3ff; --cyan:#35d0ff; --red:#ff4d4f;
  --line:rgba(160,205,255,.18); --glass:rgba(5,16,34,.72);
  --disp:"Barlow Condensed","Avenir Next Condensed","Arial Narrow",Arial,sans-serif;
  --body:"Barlow","Helvetica Neue",Arial,sans-serif;
}
*{ box-sizing:border-box; }
html,body{ margin:0; height:100%; background:#02050a; color:#fff; overflow:hidden; font-family:var(--body); }
canvas#gl{ position:fixed; inset:0; width:100%; height:100%; display:block; }
.vignette{ position:fixed; inset:0; pointer-events:none; background:
  radial-gradient(ellipse at 50% 45%,transparent 55%,rgba(0,4,12,.55) 100%),
  linear-gradient(180deg,rgba(0,6,18,.55) 0,transparent 16%,transparent 78%,rgba(0,6,18,.6) 100%); }
.hide{ display:none !important; }
kbd{ font-family:var(--disp); font-weight:700; font-size:.82em; letter-spacing:.06em; color:#fff; background:rgba(255,255,255,.1);
  border:1px solid rgba(255,255,255,.28); border-bottom-width:2px; border-radius:4px; padding:1px 6px; margin:0 2px; text-transform:uppercase; }
.k{ font-family:var(--disp); font-weight:600; font-size:12px; letter-spacing:.24em; text-transform:uppercase; color:#8fb4dc; }

/* ---------- HUD ---------- */
#hud{ position:fixed; inset:0; pointer-events:none; user-select:none; animation:hudIn .5s ease both; }
@keyframes hudIn{ from{ opacity:0; transform:scale(1.03); } to{ opacity:1; transform:none; } }
.top{ position:absolute; top:18px; left:50%; transform:translateX(-50%); display:flex; align-items:flex-start; gap:10px; }
.plate{ min-width:210px; white-space:nowrap; padding:10px 22px 9px; background:var(--glass); border-top:2px solid var(--line); backdrop-filter:blur(8px);
  display:flex; flex-direction:column; margin-top:8px; }
.plate.left{ clip-path:polygon(0 0,100% 0,calc(100% - 16px) 100%,0 100%); border-left:3px solid var(--cyan); text-align:left; }
.plate.right{ clip-path:polygon(16px 0,100% 0,100% 100%,0 100%); border-right:3px solid var(--gold); text-align:right; }
.plate .v{ font-family:var(--disp); font-weight:700; font-size:38px; line-height:1; font-variant-numeric:tabular-nums; margin:2px 0; }
.plate .v.sm{ font-size:30px; text-transform:uppercase; letter-spacing:.04em; }
.plate .sub{ font-size:11px; color:#7f9bbd; letter-spacing:.08em; text-transform:uppercase; }
.plate .sub kbd{ font-size:10px; padding:0 4px; }
.objective{ width:400px; padding:10px 22px 14px; background:linear-gradient(180deg,rgba(7,26,54,.9),rgba(4,14,30,.82)); backdrop-filter:blur(8px);
  clip-path:polygon(0 0,100% 0,calc(100% - 20px) 100%,20px 100%); border-top:2px solid var(--gold); }
.obj-row{ display:flex; gap:14px; align-items:center; }
.badge{ width:54px; height:54px; flex:none; display:grid; place-items:center; font:italic 900 40px/1 var(--disp); color:var(--navy);
  background:linear-gradient(135deg,#fff,var(--cyan)); clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%); }
.obj-main{ flex:1; }
.obj-head{ display:flex; justify-content:space-between; align-items:center; }
.tag{ font-family:var(--disp); font-weight:700; font-size:12px; letter-spacing:.16em; text-transform:uppercase; color:var(--navy); background:var(--gold); padding:1px 8px; transform:skewX(-12deg); }
.obj-num{ font:italic 900 58px/.95 var(--disp); color:#fff; font-variant-numeric:tabular-nums; text-shadow:0 0 24px rgba(53,208,255,.55); }
.obj-num small{ font-size:26px; color:var(--cyan); margin-left:3px; }
.obj-bar{ position:relative; height:8px; margin-top:8px; background:rgba(255,255,255,.1); transform:skewX(-20deg); display:flex; }
.obj-bar i{ display:block; height:100%; transition:width .25s linear; }
#pBar{ background:linear-gradient(90deg,#1b8cff,var(--cyan),#fff); box-shadow:0 0 14px var(--cyan); }
#fBar{ background:var(--red); }
.obj-bar b{ position:absolute; top:-3px; width:2px; height:14px; background:rgba(255,255,255,.55); }

.cluster{ position:absolute; left:22px; bottom:22px; display:flex; align-items:center; gap:0; }
.speedo{ width:176px; height:176px; filter:drop-shadow(0 8px 22px rgba(0,0,0,.6)); }
.s-bg{ fill:rgba(4,14,30,.82); stroke:var(--line); stroke-width:1.5; }
.s-track{ fill:none; stroke:rgba(255,255,255,.1); stroke-width:10; }
.s-ticks{ fill:none; stroke:rgba(255,255,255,.5); stroke-width:16; }
.s-val{ fill:none; stroke:url(#sg); stroke-width:10; stroke-linecap:butt; filter:drop-shadow(0 0 6px rgba(53,208,255,.9)); transition:stroke-dasharray .12s linear; }
.speedo-txt{ position:absolute; left:0; top:50%; transform:translateY(-46%); width:176px; text-align:center; display:flex; flex-direction:column; align-items:center; }
.speedo-txt span{ font:italic 900 60px/.9 var(--disp); font-variant-numeric:tabular-nums; }
.speedo-txt small{ font:600 12px var(--disp); letter-spacing:.3em; color:#8fb4dc; margin-top:4px; }
.systems{ width:330px; margin-left:-18px; padding:14px 18px 14px 34px; background:var(--glass); backdrop-filter:blur(8px);
  clip-path:polygon(22px 0,100% 0,calc(100% - 16px) 100%,0 100%); border-top:2px solid var(--line); }
.sysrow{ display:grid; grid-template-columns:1fr auto; align-items:baseline; margin-bottom:9px; }
.sysrow .n{ font-family:var(--disp); font-size:13px; color:#9fb8d6; letter-spacing:.08em; text-transform:uppercase; }
.sysrow .n b{ font-size:22px; color:#fff; font-weight:700; }
.bar{ grid-column:1/-1; height:6px; background:rgba(255,255,255,.1); transform:skewX(-20deg); overflow:hidden; margin-top:3px; }
.bar i{ display:block; height:100%; width:0; transition:width .3s ease; }
.bar .water{ background:linear-gradient(90deg,#1b8cff,#7fe3ff); box-shadow:0 0 10px #35d0ff; }
.bar .snow{ background:linear-gradient(90deg,#aebccc,#fff); }
.bar .gold{ background:linear-gradient(90deg,#ff8a00,var(--gold)); }
.bar .red{ background:var(--red); }
.sysrow.low .n b{ color:var(--red); animation:blink .7s steps(2) infinite; }
.sysrow.low .water{ background:var(--red); box-shadow:0 0 10px var(--red); }
.chips{ display:flex; gap:6px; margin-top:12px; margin-right:14px; }
.chip{ flex:1; white-space:nowrap; display:flex; align-items:center; gap:5px; padding:6px 7px; font-family:var(--disp); font-weight:700; font-size:12px; letter-spacing:.05em; text-transform:uppercase;
  background:rgba(255,255,255,.06); border-left:3px solid rgba(255,255,255,.25); color:rgba(255,255,255,.6); transition:all .15s; }
.chip kbd{ font-size:10px; margin:0; padding:0 4px; }
.chip em{ margin-left:auto; font-style:normal; color:rgba(255,255,255,.45); }
.chip.on{ background:rgba(53,208,255,.16); border-left-color:var(--cyan); color:#fff; box-shadow:inset 0 0 18px rgba(53,208,255,.18); }
.chip.on em{ color:var(--cyan); }
.chip.warn{ background:rgba(255,77,79,.2); border-left-color:var(--red); color:#fff; animation:blink .5s steps(2) infinite; }
.chip.warn em{ color:var(--red); }
@keyframes blink{ 50%{ opacity:.45; } }

.scan{ position:absolute; right:22px; bottom:22px; padding:10px 14px 10px; background:var(--glass); backdrop-filter:blur(8px);
  border-top:2px solid var(--line); border-right:3px solid var(--gold); clip-path:polygon(18px 0,100% 0,100% 100%,0 100%); }
.scan-head{ display:flex; justify-content:space-between; align-items:center; padding-left:14px; margin-bottom:6px; }
.live{ font:700 11px var(--disp); letter-spacing:.2em; text-transform:uppercase; color:var(--red); }
.live::before{ content:""; display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--red); margin-right:6px; animation:blink 1s steps(2) infinite; }
#map{ width:320px; height:136px; display:block; margin-left:8px; filter:drop-shadow(0 0 10px rgba(53,208,255,.25)); }
.legend{ display:flex; gap:14px; justify-content:flex-end; margin-top:6px; font:600 11px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:#9fb8d6; }
.legend span::before{ content:""; display:inline-block; width:9px; height:9px; margin-right:5px; background:var(--c); transform:skewX(-14deg); }

#warn{ position:absolute; left:50%; top:26%; transform:translateX(-50%) skewX(-10deg) scale(.9); padding:8px 26px; font:italic 800 22px var(--disp); letter-spacing:.1em; text-transform:uppercase;
  color:#fff; background:rgba(255,77,79,.88); border-left:5px solid #fff; opacity:0; transition:opacity .15s,transform .15s; white-space:nowrap; }
#warn.show{ opacity:1; transform:translateX(-50%) skewX(-10deg); animation:blink .8s steps(2) infinite; }
.hints{ position:absolute; left:50%; bottom:18px; transform:translateX(-50%); font:600 12px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:#9fb8d6; white-space:nowrap;
  background:rgba(4,14,30,.55); padding:6px 16px; clip-path:polygon(10px 0,100% 0,calc(100% - 10px) 100%,0 100%); }
.hints i{ display:inline-block; width:1px; height:10px; background:rgba(255,255,255,.25); margin:0 8px; }
#tip{ position:fixed; left:50%; top:158px; transform:translateX(-50%); padding:8px 22px; pointer-events:none; white-space:nowrap;
  font:700 18px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:var(--navy); background:var(--gold);
  clip-path:polygon(12px 0,100% 0,calc(100% - 12px) 100%,0 100%); opacity:0; transition:opacity .3s; }

/* ---------- Menu + results ---------- */
.screen{ position:fixed; inset:0; z-index:5; display:flex; align-items:center; justify-content:space-between; gap:40px; padding:7vh 6vw;
  background:linear-gradient(100deg,rgba(2,8,20,.94) 0,rgba(2,8,20,.72) 42%,rgba(2,8,20,.25) 70%,rgba(2,8,20,.6) 100%); animation:fade .6s ease both; }
@keyframes fade{ from{ opacity:0; } to{ opacity:1; } }
.bars::before,.bars::after{ content:""; position:fixed; left:0; right:0; height:6vh; background:#000; }
.bars::before{ top:0; border-bottom:1px solid rgba(255,184,28,.5); } .bars::after{ bottom:0; border-top:1px solid rgba(255,184,28,.5); }
.eyebrow{ font:600 14px var(--disp); letter-spacing:.42em; text-transform:uppercase; color:var(--gold); }
.eyebrow::before{ content:""; display:inline-block; width:34px; height:2px; background:var(--gold); vertical-align:middle; margin-right:12px; }
.menu{ max-width:520px; animation:slideIn .7s .1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slideIn{ from{ opacity:0; transform:translateX(-40px); } to{ opacity:1; transform:none; } }
.menu h1{ margin:10px 0 0; font:italic 900 clamp(84px,13vw,168px)/.8 var(--disp); letter-spacing:-.01em; text-transform:uppercase; text-shadow:0 10px 50px rgba(0,0,0,.7); }
.menu h1 span{ color:transparent; background:linear-gradient(180deg,#fff 10%,var(--cyan) 55%,#1b8cff); -webkit-background-clip:text; background-clip:text; filter:drop-shadow(0 0 26px rgba(53,208,255,.45)); padding-right:.1em; }
.tagline{ display:inline-block; margin-top:20px; padding:4px 14px; font:700 15px var(--disp); letter-spacing:.3em; text-transform:uppercase; color:var(--navy); background:var(--gold); transform:skewX(-12deg); }
.menu p{ font-size:17px; line-height:1.55; color:#c4d6ee; margin:20px 0 22px; max-width:440px; }
.menu-row{ display:flex; align-items:center; gap:14px; margin-bottom:18px; }
.menu-row label{ font:600 13px var(--disp); letter-spacing:.24em; text-transform:uppercase; color:#8fb4dc; }
select{ font:700 18px var(--disp); letter-spacing:.08em; text-transform:uppercase; padding:6px 12px; color:#fff; background:rgba(255,255,255,.08); border:1px solid var(--line); border-left:3px solid var(--gold); }
select option{ background:#071a36; }
button{ white-space:nowrap; display:inline-flex; align-items:center; gap:18px; cursor:pointer; border:0; padding:16px 22px 16px 34px; color:var(--navy); background:linear-gradient(180deg,#ffd257,var(--gold));
  font:italic 900 30px/1 var(--disp); letter-spacing:.08em; text-transform:uppercase; clip-path:polygon(16px 0,100% 0,calc(100% - 16px) 100%,0 100%);
  transition:transform .12s,filter .12s; filter:drop-shadow(0 8px 24px rgba(255,184,28,.35)); }
button:hover{ transform:translateX(6px); filter:drop-shadow(0 8px 30px rgba(255,184,28,.65)) brightness(1.08); }
button kbd{ color:var(--navy); border-color:rgba(4,16,31,.5); background:rgba(4,16,31,.12); font-style:normal; font-size:13px; }
.best{ margin-top:16px; font:600 14px var(--disp); letter-spacing:.22em; text-transform:uppercase; color:#8fb4dc; }
.best.pb{ color:var(--gold); }
.brief{ width:min(400px,34vw); padding:22px 24px; background:var(--glass); backdrop-filter:blur(10px); border-top:2px solid var(--gold);
  clip-path:polygon(0 0,100% 0,100% calc(100% - 22px),calc(100% - 22px) 100%,0 100%); animation:slideR .7s .25s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slideR{ from{ opacity:0; transform:translateX(40px); } to{ opacity:1; transform:none; } }
.brief-title{ font:700 13px var(--disp); letter-spacing:.34em; text-transform:uppercase; color:var(--gold); margin-bottom:14px; }
.step{ display:flex; gap:14px; padding:12px 0; border-top:1px solid var(--line); }
.step>b{ font:italic 900 34px/1 var(--disp); color:rgba(53,208,255,.55); }
.step h3{ margin:0 0 4px; font:700 20px var(--disp); letter-spacing:.1em; text-transform:uppercase; }
.step p{ margin:0; font-size:13.5px; line-height:1.5; color:#b9cde6; }
.controls{ display:flex; flex-wrap:wrap; gap:8px 14px; padding-top:14px; border-top:1px solid var(--line); font:600 12px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:#9fb8d6; }

#end{ justify-content:center; background:radial-gradient(ellipse at center,rgba(2,8,20,.7),rgba(2,8,20,.94)); }
.report{ display:flex; width:min(900px,94vw); background:linear-gradient(135deg,rgba(7,26,54,.96),rgba(3,10,24,.96)); border-top:3px solid var(--gold);
  clip-path:polygon(0 0,100% 0,100% calc(100% - 30px),calc(100% - 30px) 100%,0 100%); animation:pop .5s cubic-bezier(.2,.9,.2,1.1) both; }
@keyframes pop{ from{ opacity:0; transform:scale(.94) translateY(20px); } to{ opacity:1; transform:none; } }
.rep-left{ width:300px; flex:none; padding:30px 26px; display:flex; flex-direction:column; align-items:center; text-align:center; background:linear-gradient(180deg,rgba(53,208,255,.1),transparent); border-right:1px solid var(--line); }
.letter{ font:italic 900 220px/.9 var(--disp); margin-top:10px; color:transparent; background:linear-gradient(180deg,#fff,var(--cyan)); -webkit-background-clip:text; background-clip:text;
  filter:drop-shadow(0 0 40px rgba(53,208,255,.6)); padding:0 .12em; animation:stamp .5s .35s cubic-bezier(.2,1.4,.3,1) both; }
@keyframes stamp{ from{ opacity:0; transform:scale(2.4) rotate(-8deg); } to{ opacity:1; transform:none; } }
.letter.gS{ background-image:linear-gradient(180deg,#fff,var(--gold)); filter:drop-shadow(0 0 46px rgba(255,184,28,.8)); }
.letter.gC,.letter.gD{ background-image:linear-gradient(180deg,#dfe7f2,#7d8ea6); filter:none; }
.grade-name{ font:800 26px var(--disp); letter-spacing:.14em; text-transform:uppercase; }
.rep-right{ flex:1; padding:30px 34px 28px; }
.score-line{ display:flex; justify-content:space-between; align-items:flex-end; }
.score{ font:italic 900 76px/.85 var(--disp); font-variant-numeric:tabular-nums; }
.bonus{ text-align:right; font:600 13px var(--disp); letter-spacing:.16em; text-transform:uppercase; color:var(--gold); margin:6px 0 18px; }
.rstat{ display:grid; grid-template-columns:1fr auto; align-items:baseline; padding:9px 0; border-top:1px solid var(--line); }
.rstat .n{ font:700 26px var(--disp); font-variant-numeric:tabular-nums; }
.rstat .bar i{ transition:width 1.2s cubic-bezier(.2,.8,.2,1); }
.rep-foot{ display:flex; justify-content:space-between; align-items:center; margin-top:20px; }
.rep-foot .best{ margin:0; white-space:nowrap; }
.rep-foot button{ font-size:24px; padding:12px 18px 12px 28px; }

@media (max-width:1250px){ .hints{ display:none; } }
@media (max-width:1000px){
  .brief{ display:none; } .plate{ min-width:120px; padding:8px 14px; } .plate .v{ font-size:28px; } .objective{ width:300px; } .obj-num{ font-size:44px; }
  #map{ width:220px; height:94px; } .hints{ display:none; } .speedo,.speedo-txt{ width:140px; } .speedo{ height:140px; } .speedo-txt span{ font-size:46px; } .systems{ width:220px; }
  .rep-left{ width:200px; } .letter{ font-size:150px; }
}
@media (max-width:700px){ .plate{ display:none; } .report{ flex-direction:column; } .rep-left{ width:auto; border-right:0; } .scan .legend{ display:none; } }

.filebtn{ cursor:pointer; font:700 15px var(--disp); letter-spacing:.1em; text-transform:uppercase; padding:7px 14px; color:#fff; background:rgba(255,255,255,.08); border:1px solid var(--line); border-left:3px solid var(--cyan); }
.filebtn:hover{ background:rgba(53,208,255,.18); }
#logoClear{ font:600 12px var(--disp); letter-spacing:.16em; text-transform:uppercase; color:var(--red); }
.state{ font:600 12px var(--disp); letter-spacing:.16em; text-transform:uppercase; color:#8fb4dc; }
#fps{ position:fixed; left:10px; top:8px; z-index:6; font:600 12px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:#9fe8ff; background:rgba(4,14,30,.7); padding:3px 8px; pointer-events:none; }

/* ---------- Touch controls + phone layout ---------- */
.mini{ display:none; }
#touch{ position:fixed; inset:0; z-index:4; pointer-events:none; user-select:none; -webkit-user-select:none; touch-action:none; }
#touch>*{ pointer-events:auto; touch-action:none; }
#stick{ position:absolute; left:max(22px,env(safe-area-inset-left)); bottom:22px; width:150px; height:150px; border-radius:50%;
  background:radial-gradient(circle,rgba(53,208,255,.1),rgba(4,14,30,.55)); border:2px solid rgba(160,205,255,.4); backdrop-filter:blur(4px); }
#stick.live{ border-color:var(--cyan); box-shadow:0 0 24px rgba(53,208,255,.4); }
#knob{ position:absolute; left:50%; top:50%; width:66px; height:66px; margin:-33px 0 0 -33px; border-radius:50%; pointer-events:none;
  background:radial-gradient(circle at 35% 30%,#fff,var(--cyan) 55%,#1b6fd0); box-shadow:0 4px 14px rgba(0,0,0,.5); }
#stick span{ position:absolute; left:0; right:0; text-align:center; font:700 10px var(--disp); letter-spacing:.2em; color:rgba(255,255,255,.55); pointer-events:none; }
.s-up{ top:7px; } .s-dn{ bottom:7px; }
.tbtn{ all:unset; box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; cursor:pointer;
  width:92px; height:92px; border-radius:50%; color:#fff; background:rgba(4,14,30,.62); border:2px solid rgba(160,205,255,.45); backdrop-filter:blur(4px);
  font-family:var(--disp); text-transform:uppercase; -webkit-tap-highlight-color:transparent; }
.tbtn b{ font-weight:800; font-size:17px; letter-spacing:.1em; } .tbtn i{ font-style:normal; font-weight:700; font-size:12px; letter-spacing:.16em; color:#8fb4dc; }
.tbtn:active{ transform:scale(.94); }
.tbtn.on{ background:rgba(53,208,255,.28); border-color:var(--cyan); box-shadow:0 0 22px rgba(53,208,255,.5); } .tbtn.on i{ color:#fff; }
.tbtn.warn{ background:rgba(255,77,79,.4); border-color:var(--red); box-shadow:0 0 22px rgba(255,77,79,.5); }
.tbig{ position:absolute; right:max(22px,env(safe-area-inset-right)); bottom:22px; display:flex; gap:14px; align-items:flex-end; }
#tBlade{ margin-bottom:34px; }
.tsmall{ position:absolute; right:max(22px,env(safe-area-inset-right)); bottom:162px; display:flex; gap:8px; }
.tbtn.sm{ width:auto; height:34px; border-radius:17px; padding:0 14px; font-weight:700; font-size:12px; letter-spacing:.14em; }

body.touch .hints, body.touch .plate, body.touch .speedo, body.touch .speedo-txt, body.touch .chips, body.touch .legend, body.touch .scan-head{ display:none; }
body.touch .top{ top:6px; transform:translateX(-50%) scale(.72); transform-origin:top center; }
body.touch .mini{ display:flex; justify-content:space-between; font:700 15px var(--disp); letter-spacing:.12em; text-transform:uppercase; color:#cfe6ff; margin-top:2px; font-variant-numeric:tabular-nums; }
body.touch .cluster{ left:max(8px,env(safe-area-inset-left)); top:8px; bottom:auto; transform:scale(.72); transform-origin:top left; }
body.touch .systems{ margin-left:0; width:250px; padding:10px 22px 6px 26px; }
body.touch .scan{ right:max(8px,env(safe-area-inset-right)); top:8px; bottom:auto; padding:6px 8px; clip-path:none; }
body.touch #map{ width:170px; height:72px; margin:0; }
body.touch #warn{ top:30%; font-size:16px; }
body.touch #tip{ top:112px; font-size:14px; }
body.touch .screen{ overflow-y:auto; align-items:flex-start; padding:5vh 5vw; }
@media (max-height:520px){
  .menu h1{ font-size:64px; } .menu p{ display:none; } .tagline{ margin:10px 0 14px; font-size:12px; } .menu-row{ margin-bottom:10px; } .bars{ display:none; }
  button{ font-size:22px; padding:10px 16px 10px 24px; }
  .report{ flex-direction:row; } .rep-left{ width:170px; padding:14px; } .letter{ font-size:110px; } .grade-name{ font-size:18px; }
  .rep-right{ padding:14px 20px; } .score{ font-size:44px; } .bonus{ margin:2px 0 6px; } .rstat{ padding:4px 0; } .rstat .n{ font-size:18px; } .rep-foot{ margin-top:8px; }
  #stick{ width:130px; height:130px; } .tbtn{ width:80px; height:80px; } .tsmall{ bottom:140px; }
}
@media (max-width:760px){ body.touch .top{ transform:translateX(-50%) scale(.6); } body.touch .cluster{ transform:scale(.6); } body.touch #map{ width:130px; height:55px; } }
body.touch button kbd{ display:none; }
.menu-row label, .filebtn, .state{ white-space:nowrap; }

/* ---------- Pause button, pause menu, leaderboard ---------- */
.hudbtn{ all:unset; box-sizing:border-box; position:absolute; top:18px; right:22px; width:44px; height:44px; display:flex; align-items:center; justify-content:center; gap:6px; cursor:pointer; pointer-events:auto;
  background:var(--glass); border:1px solid var(--line); border-top:2px solid var(--gold); backdrop-filter:blur(8px); -webkit-tap-highlight-color:transparent; }
.hudbtn i{ display:block; width:5px; height:16px; background:#fff; }
.hudbtn:hover{ background:rgba(53,208,255,.22); }
body.touch .hudbtn{ display:none; }                       /* phones get a Pause button beside Cam / Finish instead */
button.ghost{ color:#fff; background:rgba(255,255,255,.08); border:1px solid var(--line); border-left:3px solid var(--cyan); clip-path:none; filter:none;
  font:700 18px var(--disp); font-style:normal; letter-spacing:.14em; padding:12px 20px; }
button.ghost:hover{ background:rgba(53,208,255,.18); transform:none; filter:none; }
button.small{ font-size:20px; padding:9px 16px 9px 22px; }
button.ghost.small{ font-size:15px; padding:9px 14px; }
button:disabled{ opacity:.5; cursor:default; }
.menu-btns{ display:flex; flex-wrap:wrap; align-items:center; gap:14px; }
select{ max-width:100%; }
.screen.overlay{ z-index:8; justify-content:center; background:radial-gradient(ellipse at center,rgba(2,8,20,.78),rgba(2,8,20,.95)); backdrop-filter:blur(3px); }
.panel{ width:min(420px,92vw); max-height:92vh; overflow-y:auto; padding:26px 30px 28px; display:flex; flex-direction:column; gap:10px; background:linear-gradient(135deg,rgba(7,26,54,.97),rgba(3,10,24,.97));
  border-top:3px solid var(--gold); animation:pop .35s cubic-bezier(.2,.9,.2,1.1) both; }
.panel.wide{ width:min(560px,94vw); }
.panel h2{ margin:2px 0 8px; font:italic 900 46px/.95 var(--disp); letter-spacing:.02em; text-transform:uppercase; }
.panel button{ justify-content:space-between; }
.panel button.ghost{ justify-content:center; }
.pstats{ display:flex; gap:18px; margin-bottom:8px; padding:10px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.pstats span{ display:flex; flex-direction:column; flex:1; } .pstats i{ font-style:normal; } .pstats b{ font:700 26px var(--disp); font-variant-numeric:tabular-nums; }
.lb-list{ list-style:none; margin:4px 0 10px; padding:0; min-height:120px; max-height:min(52vh,460px); overflow-y:auto; }
.lb-list li{ display:grid; grid-template-columns:38px 1fr auto auto; gap:12px; align-items:baseline; padding:7px 10px; border-top:1px solid var(--line); font:600 18px var(--disp); letter-spacing:.06em; }
.lb-list li b{ color:var(--cyan); font-weight:800; font-variant-numeric:tabular-nums; } .lb-list li:nth-child(-n+3) b{ color:var(--gold); }
.lb-list .nm{ text-transform:uppercase; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lb-list .tm{ font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:#8fb4dc; white-space:nowrap; max-width:150px; overflow:hidden; text-overflow:ellipsis; }
.lb-list .t{ font-weight:800; font-variant-numeric:tabular-nums; }
.lb-list li.me{ background:rgba(255,184,28,.16); box-shadow:inset 3px 0 0 var(--gold); }
.lb-list li.empty{ display:block; text-align:center; color:#8fb4dc; font-size:15px; letter-spacing:.14em; text-transform:uppercase; padding:38px 10px; }
.lb-entry{ margin-top:14px; padding:12px 14px; background:rgba(255,184,28,.1); border-left:3px solid var(--gold); }
.lb-head{ font:700 15px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:var(--gold); margin-bottom:8px; } .lb-head b{ color:#fff; }
#lbForm{ display:flex; gap:10px; align-items:center; }
#lbName, #lbTown{ flex:1; min-width:0; font:700 22px var(--disp); letter-spacing:.08em; text-transform:uppercase; padding:8px 12px; color:#fff; background:rgba(255,255,255,.08); border:1px solid var(--line); border-left:3px solid var(--gold); outline:none; border-radius:0; }
#lbName:focus, #lbTown:focus{ border-color:var(--cyan); }
#lbMsg{ margin-top:6px; min-height:14px; } #lbMsg.err{ color:var(--red); } #lbMsg.ok{ color:var(--gold); }
.foot-btns{ display:flex; align-items:center; gap:12px; }
body.touch .screen.overlay{ align-items:center; }
@media (max-height:520px){ .panel{ padding:14px 20px 16px; gap:7px; } .panel h2{ font-size:30px; margin-bottom:2px; } .panel button.ghost{ padding:8px 14px; font-size:15px; } .pstats{ padding:6px 0; margin-bottom:2px; } .pstats b{ font-size:20px; }
  .lb-list li{ padding:4px 8px; font-size:16px; } .lb-entry{ margin-top:6px; padding:8px 10px; } .rep-foot button.ghost{ font-size:13px; padding:7px 10px; } }

/* ---------- Portrait (phone held upright, or a tall narrow window) ---------- */
@media (orientation:portrait){
  .screen{ flex-direction:column; justify-content:flex-start; align-items:stretch; overflow-y:auto; padding:6vh 7vw 5vh; gap:22px;
    background:linear-gradient(180deg,rgba(2,8,20,.93) 0,rgba(2,8,20,.74) 55%,rgba(2,8,20,.5) 100%); }
  .screen.overlay, #end{ justify-content:center; align-items:center; }
  .bars{ display:none; } .brief{ display:none; }
  .menu{ max-width:none; } .menu h1{ font-size:clamp(72px,24vw,150px); } .menu p{ font-size:15px; margin:16px 0 18px; }
  .menu-row{ flex-wrap:wrap; gap:8px 12px; margin-bottom:14px; } .menu-row select{ flex:1; min-width:0; }
  .menu-btns button{ flex:1; justify-content:center; }
  .report{ flex-direction:column; width:100%; } .rep-left{ width:auto; flex-direction:row; justify-content:center; gap:18px; padding:14px 18px; border-right:0; border-bottom:1px solid var(--line); }
  .rep-left .eyebrow{ display:none; } .letter{ font-size:104px; margin:0; } .grade-name{ font-size:20px; }
  .rep-right{ padding:16px 20px 20px; } .score{ font-size:54px; } .bonus{ margin:4px 0 10px; } .rstat{ padding:6px 0; } .rstat .n{ font-size:20px; }
  .rep-foot{ flex-direction:column; align-items:stretch; gap:10px; margin-top:14px; } .foot-btns{ justify-content:space-between; } .rep-foot button{ font-size:20px; }
  /* HUD: ice quality across the top, gauges and rink scan side by side under it */
  .plate, .hints, .speedo, .speedo-txt, .chips, .legend, .scan-head{ display:none; }
  .top{ top:max(8px,env(safe-area-inset-top)); left:8px; right:8px; transform:none; display:block; }
  body.touch .top{ top:max(8px,env(safe-area-inset-top)); transform:none; }
  .objective{ width:auto; padding:8px 16px 10px; clip-path:none; } .obj-num{ font-size:44px; } .badge{ width:44px; height:44px; font-size:32px; }
  .mini{ display:flex; justify-content:space-between; font:700 15px var(--disp); letter-spacing:.12em; text-transform:uppercase; color:#cfe6ff; margin-top:2px; font-variant-numeric:tabular-nums; }
  .cluster, body.touch .cluster{ left:8px; top:calc(max(8px,env(safe-area-inset-top)) + 122px); bottom:auto; right:calc(50% + 4px); transform:none; }
  .systems, body.touch .systems{ width:100%; margin:0; padding:8px 12px 2px; clip-path:none; }
  .scan, body.touch .scan{ right:8px; left:calc(50% + 4px); top:calc(max(8px,env(safe-area-inset-top)) + 122px); bottom:auto; padding:6px; clip-path:none; border-right:0; }
  #map, body.touch #map{ width:100%; height:auto; aspect-ratio:400/170; margin:0; }
  .hudbtn{ top:auto; bottom:22px; right:22px; }
  #tip, body.touch #tip{ top:calc(max(8px,env(safe-area-inset-top)) + 206px); font-size:13px; letter-spacing:.08em; padding:6px 14px; white-space:normal; text-align:center; width:max-content; max-width:90vw; clip-path:none; }
  #warn, body.touch #warn{ top:38%; font-size:15px; white-space:normal; text-align:center; width:max-content; max-width:88vw; padding:6px 16px; }
  #stick{ width:136px; height:136px; bottom:max(26px,env(safe-area-inset-bottom)); }
  .tbig{ bottom:max(26px,env(safe-area-inset-bottom)); gap:10px; } .tbtn{ width:82px; height:82px; } #tBlade{ margin-bottom:30px; }
  .tsmall{ bottom:calc(max(26px,env(safe-area-inset-bottom)) + 136px); left:12px; right:12px; justify-content:space-between; gap:6px; } .tbtn.sm{ padding:0 11px; font-size:11px; }
  .panel h2{ font-size:38px; }
}

/* ---------- Fit fixes ---------- */
.rep-right{ min-width:0; } .rep-foot{ flex-wrap:wrap; gap:10px 14px; } .foot-btns{ margin-left:auto; }
.lb-head{ line-height:1.35; }
.menu-row{ margin-bottom:12px; } .menu p{ margin:16px 0 18px; }
@media (max-height:820px) and (orientation:landscape){ .menu h1{ font-size:clamp(64px,10vw,128px); } .tagline{ margin-top:14px; } .menu p{ font-size:15px; margin:12px 0 14px; } button.ghost{ padding:10px 16px; font-size:16px; } }
@media (orientation:portrait){ body.touch .screen{ align-items:stretch; padding:6vh 7vw 5vh; } body.touch .screen.overlay, body.touch #end{ align-items:center; } .foot-btns{ margin-left:0; } }
@media (orientation:portrait){
  .sysrow{ margin-bottom:6px; } .sysrow .k{ font-size:10px; letter-spacing:.12em; } .sysrow .n b{ font-size:18px; } .sysrow .n{ font-size:11px; }
  #tip, body.touch #tip{ top:calc(max(8px,env(safe-area-inset-top)) + 232px); }
  #warn, body.touch #warn{ top:44%; }
  .foot-btns{ flex-wrap:wrap; } .foot-btns button{ flex:1 1 auto; justify-content:center; } .rep-foot button kbd{ display:none; }
  #lbForm{ flex-wrap:wrap; } #lbName{ flex:1 1 150px; } #lbSubmit{ flex:1 1 auto; justify-content:center; }
}
@media (max-height:520px) and (orientation:landscape){ .tsmall{ gap:6px; } .tbtn.sm{ padding:0 10px; font-size:11px; height:30px; } }

/* ---------- Favourite star next to the team menu ---------- */
button.fav{ all:unset; box-sizing:border-box; flex:none; width:38px; height:38px; display:grid; place-items:center; cursor:pointer; font:22px/1 var(--body); color:#8fb4dc;
  background:rgba(255,255,255,.08); border:1px solid var(--line); -webkit-tap-highlight-color:transparent; transition:color .15s,background .15s; }
button.fav:hover{ color:#fff; background:rgba(255,184,28,.16); }
button.fav.on{ color:var(--gold); border-color:rgba(255,184,28,.55); }
button.fav:focus-visible{ outline:2px solid var(--cyan); outline-offset:2px; }
@media (orientation:portrait){ .menu-row select{ min-width:0; } }
.menu-row #team{ flex:0 1 auto; min-width:0; width:330px; max-width:100%; text-overflow:ellipsis; }   /* long names (e.g. Wilkes-Barre/Scranton) mustn't push the star off the menu */
@media (orientation:portrait){ .menu-row #team{ width:auto; flex:1 1 0; } }

/* ---------- Zenboni main menu ---------- */
#start{ justify-content:flex-start; background:linear-gradient(100deg,rgba(2,8,20,.9) 0,rgba(2,8,20,.62) 40%,rgba(2,8,20,.12) 72%,rgba(2,8,20,.35) 100%); }
.menu h1{ font:300 clamp(72px,10vw,140px)/.9 var(--body); font-style:normal; letter-spacing:.02em; text-transform:none; margin:0; }
.menu h1 span{ font-weight:600; }
.tagline{ background:none; color:#cfe6ff; transform:none; padding:0; margin:14px 0 26px; font:500 15px var(--disp); letter-spacing:.42em; }
.tagline::before{ content:""; display:inline-block; width:34px; height:1px; background:var(--cyan); vertical-align:middle; margin-right:12px; }
.menu-row #style, .menu-row #paint{ width:auto; flex:0 1 auto; }
.menu-row.small{ margin-top:6px; } .menu-row.small .filebtn{ font-size:12px; padding:5px 10px; border-left-width:2px; }
.credit{ display:flex; align-items:center; gap:12px; margin-top:22px; font:600 12px var(--disp); letter-spacing:.24em; text-transform:uppercase; color:#8fb4dc; }
.credit img{ height:34px; width:auto; display:block; filter:drop-shadow(0 3px 10px rgba(0,0,0,.6)); }   /* white-and-green logo on a transparent background */
/* ---------- How to play ---------- */
.howto .lede{ margin:0 0 6px; color:#c4d6ee; font-size:15px; line-height:1.5; }
.howto .steps{ display:flex; flex-direction:column; gap:6px; padding:8px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.howto .steps div{ display:flex; gap:12px; align-items:baseline; font-size:15px; color:#dbe8f7; }
.howto .steps b{ font:italic 900 22px/1 var(--disp); color:var(--cyan); width:16px; } .howto em{ font-style:normal; font-weight:600; color:#fff; }
.howto .keys{ display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; padding:6px 0; font:600 13px var(--disp); letter-spacing:.1em; text-transform:uppercase; color:#9fb8d6; }
.howto .keys.mob{ display:none; grid-template-columns:1fr; text-transform:none; letter-spacing:.02em; font:500 14px var(--body); color:#cfdcec; }
body.touch .howto .keys.desk{ display:none; } body.touch .howto .keys.mob{ display:grid; }
.ico{ display:inline-flex; align-items:center; justify-content:center; font:700 11px var(--disp); letter-spacing:.1em; text-transform:uppercase; font-style:normal; color:#fff; margin-right:4px; vertical-align:middle; }
.ico.stick{ width:24px; height:24px; border-radius:50%; border:2px solid rgba(160,205,255,.5); background:radial-gradient(circle,#fff 0 4px,var(--cyan) 5px 7px,transparent 8px); }
.ico.btn{ width:46px; height:24px; border-radius:12px; border:2px solid rgba(160,205,255,.5); }
.ico.pill{ height:20px; padding:0 8px; border-radius:10px; border:1px solid rgba(160,205,255,.5); }
.howto .note{ margin:4px 0 6px; font-size:13px; color:#8fb4dc; }
body.touch .howto button kbd{ display:none; }
@media (orientation:portrait){ .menu h1{ font-size:clamp(64px,20vw,120px); } .howto .keys{ grid-template-columns:1fr; } .credit{ margin-top:16px; } }
@media (max-height:520px){ .tagline{ margin:8px 0 12px; } .credit{ margin-top:10px; } .credit img{ height:30px; } .howto .lede{ font-size:13px; } .howto .steps div{ font-size:13px; } .howto .keys.mob{ font-size:12px; gap:4px; } }
.credit img{ height:40px; }
@media (orientation:portrait){ .tagline{ letter-spacing:.24em; font-size:13px; } .credit img{ height:34px; } }

/* ---------- Settings ---------- */
.set-row{ display:flex; flex-direction:column; gap:8px; padding:10px 0; border-top:1px solid var(--line); }
.seg{ display:flex; gap:8px; flex-wrap:wrap; }
.seg button.ghost{ flex:1; justify-content:center; opacity:.62; border-left-color:rgba(255,255,255,.25); }
.seg button.ghost.on{ opacity:1; background:rgba(53,208,255,.22); border-color:var(--cyan); border-left-color:var(--cyan); box-shadow:inset 0 0 18px rgba(53,208,255,.2); }
.set-note{ margin:0; font-size:13.5px; line-height:1.45; color:#b9cde6; }

/* ---------- Simplified main menu ---------- */
.menu-btns{ margin-top:6px; }
.menu-links{ display:flex; gap:22px; margin-top:16px; }
button.link{ all:unset; cursor:pointer; font:700 15px var(--disp); letter-spacing:.22em; text-transform:uppercase; color:#b9d2ee; padding:4px 0; border-bottom:2px solid rgba(160,205,255,.3); transition:color .12s,border-color .12s; }
button.link:hover, button.link:focus-visible{ color:#fff; border-bottom-color:var(--gold); }
.seg select{ flex:1; min-width:0; }
.seg .filebtn{ flex:0 1 auto; }
.seg #logoClear{ align-self:center; }
.panel .set-row .state{ min-height:0; }

/* ---------- Upload your own center-ice image (main menu) ---------- */
.menu-row.upl{ align-items:center; flex-wrap:wrap; }
.upbtn{ display:inline-flex; align-items:center; gap:10px; cursor:pointer; padding:8px 16px 8px 12px; font:700 14px var(--disp); letter-spacing:.12em; text-transform:uppercase; color:#fff;
  background:linear-gradient(90deg,rgba(53,208,255,.22),rgba(53,208,255,.08)); border:1px solid rgba(53,208,255,.55); border-radius:4px; transition:background .15s,transform .15s; white-space:nowrap; }
.upbtn:hover{ background:linear-gradient(90deg,rgba(53,208,255,.36),rgba(53,208,255,.14)); transform:translateY(-1px); }
.upbtn:focus-within{ outline:2px solid var(--cyan); outline-offset:2px; }
.upbtn .cam{ width:20px; height:15px; border:2px solid #fff; border-radius:3px; position:relative; flex:none; }
.upbtn .cam::before{ content:""; position:absolute; width:7px; height:7px; border:2px solid #fff; border-radius:50%; left:50%; top:50%; transform:translate(-50%,-50%); }
.upbtn .cam::after{ content:""; position:absolute; width:7px; height:3px; background:#fff; left:3px; top:-5px; border-radius:1px 1px 0 0; }
.thumb{ width:38px; height:38px; object-fit:contain; border-radius:50%; background:#f3f8fc; border:2px solid var(--cyan); padding:3px; box-shadow:0 4px 14px rgba(0,0,0,.35); }
.menu-row.upl #logoClear{ font:600 12px var(--disp); letter-spacing:.16em; text-transform:uppercase; color:var(--red); }
.up-note{ margin:-6px 0 12px; min-height:0; font-size:11px; }
.up-note:empty{ display:none; }
@media (orientation:portrait){ .upbtn{ flex:1 1 auto; justify-content:center; } }
.up-note{ white-space:normal; line-height:1.4; }

/* =====================================================================================
   BROADCAST SCORE BUG — the whole gameplay HUD is one unit, top centre, like a TV scoreboard
   ===================================================================================== */
#hud{ --bugH:58px; }
.bug{ position:absolute; left:50%; top:max(14px,env(safe-area-inset-top)); transform:translateX(-50%); width:max-content; max-width:calc(100vw - 16px); pointer-events:none;
  filter:drop-shadow(0 14px 28px rgba(0,0,0,.5)); animation:bugIn .6s cubic-bezier(.2,.9,.2,1) both; font-family:var(--disp); }
@keyframes bugIn{ from{ transform:translate(-50%,-120%); opacity:0; } to{ transform:translateX(-50%); opacity:1; } }
.bug-main{ display:flex; align-items:stretch; height:var(--bugH); background:linear-gradient(180deg,#16233b 0,#0b1424 48%,#070d19 100%); border-radius:8px 8px 0 0; overflow:hidden;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(0,0,0,.6); }
.bug-team{ --tc:#003087; --tc2:#ffb81c; position:relative; display:flex; align-items:center; gap:10px; padding:0 30px 0 14px; min-width:150px; color:#fff;
  background:linear-gradient(180deg,rgba(255,255,255,.22),rgba(255,255,255,0) 46%,rgba(0,0,0,.28)),var(--tc); clip-path:polygon(0 0,100% 0,calc(100% - 18px) 100%,0 100%);
  font:800 26px/1 var(--disp); letter-spacing:.06em; text-transform:uppercase; text-shadow:0 1px 2px rgba(0,0,0,.45); white-space:nowrap; }
.bug-team::after{ content:""; position:absolute; right:7px; top:0; bottom:0; width:6px; background:var(--tc2); transform:skewX(-17deg); box-shadow:0 0 0 1px rgba(0,0,0,.25); }
.bug-team.light{ color:#0b1424; text-shadow:none; }
.bug-team img{ height:40px; width:40px; object-fit:contain; filter:drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.bug-team img.hide{ display:none; }
.bug-cell{ display:flex; flex-direction:column; justify-content:center; padding:0 18px; border-right:1px solid rgba(255,255,255,.08); color:#fff; white-space:nowrap; }
.bug .lbl{ font:700 10px/1 var(--disp); letter-spacing:.24em; text-transform:uppercase; color:#8fa9cc; }
.bug .num{ font:800 34px/1 var(--disp); letter-spacing:.01em; font-variant-numeric:tabular-nums; margin-top:3px; }
.bug .num small{ font-size:17px; font-weight:700; color:#8fa9cc; margin-left:2px; }
.bug .num.sm{ font-size:28px; color:#eaf4ff; }
.bug-cell.score{ padding-left:14px; min-width:128px; } .bug-cell.score .num b{ font-weight:800; color:#fff; }
.bug-cell.clock{ min-width:112px; }
.bug-cell.grade{ flex-direction:row; align-items:center; gap:10px; background:linear-gradient(180deg,rgba(255,255,255,.06),rgba(255,255,255,0)); }
.bug .badge{ all:unset; display:grid; place-items:center; width:38px; height:38px; border-radius:6px; font:italic 900 28px/1 var(--disp); color:#0b1424; background:linear-gradient(180deg,#cfd8e4,#8e9bb0);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7),0 2px 6px rgba(0,0,0,.4); }
.bug .badge.gC{ background:linear-gradient(180deg,#b9e6ff,#5fb8ee); } .bug .badge.gB{ background:linear-gradient(180deg,#8ff0ff,#22c3f0); }
.bug .badge.gA{ background:linear-gradient(180deg,#ffe08a,#ffb81c); } .bug .badge.gS{ background:linear-gradient(180deg,#fff6c9,#ffcf3a); box-shadow:inset 0 1px 0 #fff,0 0 18px rgba(255,200,60,.8); }
.bug .badge.pop{ animation:gradePop .7s cubic-bezier(.2,.9,.2,1.2); }
@keyframes gradePop{ 0%{ transform:scale(1.7); filter:brightness(2.2); } 100%{ transform:none; filter:none; } }
.bug .tag{ all:unset; font:700 13px/1.1 var(--disp); letter-spacing:.14em; text-transform:uppercase; color:#cfe1f7; max-width:92px; white-space:normal; }
.bug-map{ display:flex; align-items:center; padding:6px 10px; background:#050a14; box-shadow:inset 1px 0 0 rgba(255,255,255,.06); }
.bug .bug-map #map, body.touch .bug .bug-map #map{ display:block; height:calc(var(--bugH) - 12px); width:auto; aspect-ratio:400/170; margin:0; border-radius:10px/12px; border:0; }
.bug-bar{ position:relative; height:5px; background:#02060d; overflow:hidden; }
.bug-bar i{ position:absolute; top:0; bottom:0; left:0; } .bug-bar #pBar{ background:linear-gradient(90deg,#1aa6e8,#5fe3ff); box-shadow:0 0 10px rgba(80,220,255,.9); transition:width .25s linear; }
.bug-bar #fBar{ left:auto; right:0; background:var(--red); opacity:.85; } .bug-bar b{ position:absolute; top:0; bottom:0; width:2px; background:rgba(255,255,255,.4); }
.bug-sub{ display:flex; align-items:center; gap:0; height:30px; padding:0 4px; background:linear-gradient(180deg,rgba(9,16,30,.94),rgba(5,10,20,.94)); border-radius:0 0 8px 8px;
  box-shadow:inset 0 -1px 0 rgba(255,255,255,.07); color:#dbe8f7; font:700 13px/1 var(--disp); letter-spacing:.12em; text-transform:uppercase; white-space:nowrap; }
.bug-sub>*{ display:flex; align-items:center; gap:7px; padding:0 12px; height:100%; border-right:1px solid rgba(255,255,255,.07); }
.bug-sub>*:last-child{ border-right:0; }
.bug-sub kbd{ font:700 10px var(--disp); padding:1px 5px; border-radius:3px; color:#0b1424; background:#aebdd2; letter-spacing:.06em; }
.bug-sub .st em{ font-style:normal; font-weight:800; min-width:34px; padding:3px 6px; border-radius:3px; text-align:center; color:#8fa9cc; background:rgba(255,255,255,.07); }
.bug-sub .st.on em{ color:#04101f; background:var(--cyan); box-shadow:0 0 10px rgba(53,208,255,.7); }
.bug-sub .st.warn em{ color:#fff; background:var(--red); animation:blink .5s steps(2) infinite; }
.bug-sub .meter .bar{ width:74px; height:6px; border-radius:3px; background:rgba(255,255,255,.1); overflow:hidden; }
.bug-sub .meter .bar i{ display:block; height:100%; border-radius:3px; } .bug-sub .bar .water{ background:linear-gradient(90deg,#1aa6e8,#5fe3ff); } .bug-sub .bar .snow{ background:linear-gradient(90deg,#c9d6e6,#fff); }
.bug-sub .meter b{ font-weight:800; font-variant-numeric:tabular-nums; min-width:26px; text-align:right; color:#fff; } .bug-sub .meter small{ font-size:10px; color:#8fa9cc; letter-spacing:.14em; }
.bug-sub .meter.low b{ color:var(--red); } .bug-sub .meter.low .water{ background:var(--red); }
.bug-sub .meter.cam b{ min-width:0; color:var(--gold); }
/* warnings drop out of the bottom of the bug, like a penalty banner */
#hud .bug #warn, body.touch #hud .bug #warn{ position:absolute; left:50%; top:100%; transform:translate(-50%,-100%); margin:0; padding:7px 22px; width:max-content; max-width:92vw; clip-path:none; border:0;
  font:800 15px/1.1 var(--disp); font-style:normal; letter-spacing:.14em; text-transform:uppercase; text-align:center; white-space:normal; color:#fff; background:linear-gradient(180deg,#ff5b5d,#c81e2a);
  border-radius:0 0 8px 8px; opacity:0; z-index:-1; transition:transform .25s ease,opacity .2s; animation:none; box-shadow:0 10px 24px rgba(200,30,42,.45); }
#hud .bug #warn.show, body.touch #hud .bug #warn.show{ opacity:1; transform:translate(-50%,2px); }
#tip#tip{ top:calc(max(14px,env(safe-area-inset-top)) + 138px); }
.hints kbd{ color:#0b1424; background:#aebdd2; border:0; }
/* narrower screens: drop the least important cells first */
@media (max-width:1040px){ .bug-sub .meter.cam, .bug-sub kbd{ display:none; } .bug-cell{ padding:0 12px; } .bug-team{ min-width:0; font-size:22px; } }
@media (max-width:860px){ #hud{ --bugH:46px; } .bug .num{ font-size:26px; } .bug .num.sm{ font-size:22px; } .bug .tag{ display:none; } .bug .badge{ width:30px; height:30px; font-size:22px; }
  .bug-team{ font-size:18px; padding:0 24px 0 10px; } .bug-team img{ width:30px; height:30px; } .bug-sub{ height:26px; font-size:11px; } .bug-sub>*{ padding:0 8px; gap:5px; } .bug-sub .meter .bar{ width:48px; }
  .bug-sub .meter.spd{ display:none; } #tip#tip{ top:calc(max(14px,env(safe-area-inset-top)) + 112px); } }
@media (max-height:520px) and (orientation:landscape){ .bug{ top:max(6px,env(safe-area-inset-top)); } #tip#tip{ top:96px; } }
@media (orientation:portrait){
  .bug{ left:8px; right:8px; width:auto; max-width:none; transform:none; animation-name:bugInP; } @keyframes bugInP{ from{ transform:translateY(-120%); opacity:0; } to{ transform:none; opacity:1; } }
  .bug-main{ flex-wrap:nowrap; } .bug-team{ flex:1 1 auto; min-width:0; overflow:hidden; } .bug-team span{ overflow:hidden; text-overflow:ellipsis; }
  .bug-cell.clock{ min-width:0; } .bug-cell.score{ min-width:0; } .bug-cell.grade{ padding:0 8px; } .bug-map{ display:none; }
  .bug-sub{ justify-content:space-between; } .bug-sub>*{ padding:0 6px; flex:1 1 auto; justify-content:center; } .bug-sub .meter .bar{ width:34px; } .bug-sub .lbl{ display:none; } .bug-sub .st span{ display:inline; }
  #tip#tip{ top:calc(max(14px,env(safe-area-inset-top)) + 108px); }
}
/* =====================================================================================
   UI POLISH — panels, buttons and menus share the score bug's finish
   ===================================================================================== */
.panel, .report{ border-radius:12px; border:1px solid rgba(160,205,255,.16); border-top:3px solid var(--gold); background:linear-gradient(160deg,rgba(18,32,58,.97),rgba(5,11,24,.98));
  box-shadow:0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.1); }
.report{ overflow:hidden; }
.screen.overlay{ backdrop-filter:blur(10px) saturate(1.1); -webkit-backdrop-filter:blur(10px) saturate(1.1); background:radial-gradient(ellipse at center,rgba(2,8,20,.62),rgba(2,8,20,.9)); }
.panel h2{ font:800 40px/1 var(--disp); font-style:normal; letter-spacing:.04em; }
.eyebrow{ letter-spacing:.34em; }
#go, #again, #pResume, #howtoGo, #setClose, #lbClose, #lbSubmit{ border-radius:8px; clip-path:none; transform:none; font-style:normal; font-weight:800; letter-spacing:.12em;
  background:linear-gradient(180deg,#ffd45e 0,#ffb81c 55%,#f09c00 100%); color:#0b1424; box-shadow:0 10px 26px rgba(255,170,0,.35), inset 0 1px 0 rgba(255,255,255,.7), inset 0 -2px 0 rgba(0,0,0,.15);
  transition:transform .15s ease, box-shadow .15s ease, filter .15s ease; }
#go:hover, #again:hover, #pResume:hover, #howtoGo:hover, #setClose:hover, #lbClose:hover, #lbSubmit:hover{ transform:translateY(-2px); filter:brightness(1.06); box-shadow:0 16px 34px rgba(255,170,0,.45), inset 0 1px 0 rgba(255,255,255,.8), inset 0 -2px 0 rgba(0,0,0,.15); }
#go:active, #again:active, #pResume:active, #howtoGo:active{ transform:translateY(1px); }
#go{ padding:14px 30px; font-size:30px; } #go span{ transform:none; }
button.ghost{ border-radius:8px; border:1px solid rgba(160,205,255,.28); border-left:1px solid rgba(160,205,255,.28); background:linear-gradient(180deg,rgba(255,255,255,.1),rgba(255,255,255,.03)); transition:background .15s, border-color .15s, transform .15s; }
button.ghost:hover{ background:linear-gradient(180deg,rgba(53,208,255,.24),rgba(53,208,255,.08)); border-color:rgba(53,208,255,.7); transform:translateY(-1px); }
select, #lbName, #lbTown{ border-radius:8px; border:1px solid rgba(160,205,255,.3); background-color:rgba(8,18,36,.72); backdrop-filter:blur(6px); transition:border-color .15s, box-shadow .15s; }
select:hover, select:focus, #lbName:focus, #lbTown:focus{ border-color:var(--cyan); box-shadow:0 0 0 3px rgba(53,208,255,.18); outline:none; }
button.fav, .thumb, .upbtn{ border-radius:8px; } .thumb{ border-radius:50%; }
.hudbtn{ border-radius:10px; border:1px solid rgba(160,205,255,.25); background:linear-gradient(180deg,#16233b,#070d19); box-shadow:0 8px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.2); }
.tbtn{ box-shadow:0 8px 22px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
#tip{ border-radius:8px; clip-path:none; background:linear-gradient(180deg,rgba(22,35,59,.94),rgba(7,13,25,.94)); border:1px solid rgba(160,205,255,.2); color:#eaf4ff; box-shadow:0 12px 28px rgba(0,0,0,.45); font-style:normal; transform:translateX(-50%); }
.lb-list li{ border-radius:6px; } .lb-list li:nth-child(odd){ background:rgba(255,255,255,.03); }
kbd{ border-radius:4px; }

.bug-cell{ flex:1 1 auto; } .bug-map{ flex:0 0 auto; }
#tip#tip{ top:calc(max(14px,env(safe-area-inset-top)) + 150px); }
@media (max-width:860px){ #tip#tip{ top:calc(max(14px,env(safe-area-inset-top)) + 124px); } }
@media (orientation:portrait){ #tip#tip{ top:calc(max(14px,env(safe-area-inset-top)) + 124px); } }
@media (orientation:portrait){ .bug-cell{ padding:0 9px; } .bug-team{ font-size:17px; gap:6px; padding:0 20px 0 8px; flex:1 1 0; } .bug-team img{ width:26px; height:26px; } .bug-sub{ overflow:hidden; } .bug-sub .meter:nth-child(4), .bug-sub .meter.spd, .bug-sub .meter.cam{ display:none; } }

/* ---------- Zenboni logo on the title screen ---------- */
.menu h1.menu-logo{ margin:0 0 14px -10px; line-height:0; font-size:0; text-shadow:none; }
.menu-logo img{ display:block; width:min(480px,40vw); height:auto; filter:drop-shadow(0 12px 34px rgba(0,0,0,.55)); }
@media (orientation:portrait){ .menu-logo img{ width:min(420px,86vw); } }
@media (max-height:520px){ .menu h1.menu-logo{ margin-bottom:6px; } .menu-logo img{ width:min(300px,34vw); } }

/* ---------- Install button + pop-up ---------- */
button.link.install{ color:var(--gold); border-bottom-color:rgba(255,184,28,.45); display:inline-flex; align-items:center; gap:7px; }
button.link.install .dl{ width:13px; height:13px; display:inline-block; background:
  linear-gradient(currentColor,currentColor) 50% 0/2px 9px no-repeat,
  linear-gradient(45deg,transparent 45%,currentColor 45% 60%,transparent 60%) 2px 4px/6px 6px no-repeat,
  linear-gradient(-45deg,transparent 45%,currentColor 45% 60%,transparent 60%) 5px 4px/6px 6px no-repeat,
  linear-gradient(currentColor,currentColor) 50% 100%/13px 2px no-repeat; }
.install-pop{ position:fixed; inset:0; z-index:30; display:flex; align-items:flex-end; justify-content:center; padding:20px; background:rgba(2,8,20,0); transition:background .25s; }
.install-pop.show{ background:rgba(2,8,20,.55); }
.install-card{ display:flex; gap:18px; align-items:flex-start; width:min(560px,100%); padding:20px 22px; border-radius:14px;
  background:linear-gradient(160deg,rgba(14,34,78,.97),rgba(4,14,32,.97)); border:1px solid rgba(255,184,28,.45); box-shadow:0 20px 60px rgba(0,0,0,.6);
  transform:translateY(30px); opacity:0; transition:transform .3s cubic-bezier(.2,.9,.2,1),opacity .25s; }
.install-pop.show .install-card{ transform:none; opacity:1; }
.install-icon{ width:72px; height:72px; border-radius:16px; flex:none; box-shadow:0 6px 18px rgba(0,0,0,.5); }
.install-body h3{ margin:0 0 6px; font:800 24px var(--disp); letter-spacing:.06em; text-transform:uppercase; color:#fff; }
.install-body p{ margin:0 0 10px; font-size:14.5px; line-height:1.45; color:#c7d9ef; }
.install-how{ background:rgba(255,255,255,.06); border-left:3px solid var(--gold); padding:8px 10px; border-radius:4px; }
.install-how b{ color:#fff; }
.ios-share{ display:inline-block; width:14px; height:16px; vertical-align:-2px; border:2px solid currentColor; border-top:0; border-radius:0 0 3px 3px; position:relative; margin:0 2px; }
.ios-share::before{ content:""; position:absolute; left:50%; top:-8px; width:2px; height:12px; margin-left:-1px; background:currentColor; }
.install-btns{ display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-top:4px; }
.install-btns button:not(.ghost){ font-size:20px; padding:10px 18px 10px 26px; }
@media (max-height:520px){ .install-pop{ padding:10px; } .install-card{ padding:12px 14px; } .install-body p{ font-size:13px; margin-bottom:6px; } .install-icon{ width:52px; height:52px; } }

/* ---------- Leaderboard: % / time / score columns ---------- */
.lb-cols, .lb-list li{ grid-template-columns:34px 1fr minmax(0,120px) 66px 52px 74px; }
.lb-cols{ display:grid; gap:12px; padding:2px 10px 4px; font:700 11px var(--disp); letter-spacing:.18em; text-transform:uppercase; color:#7f9bbd; }
.lb-cols span:nth-child(n+4){ text-align:right; }
.lb-list li .pc, .lb-list li .t, .lb-list li .sc{ text-align:right; font-variant-numeric:tabular-nums; }
.lb-list li .pc{ color:var(--cyan); } .lb-list li .t{ font-weight:600; color:#cfe0f3; } .lb-list li .sc{ font-weight:800; color:#fff; }
@media (max-width:640px){ .lb-cols, .lb-list li{ grid-template-columns:28px 1fr 58px 46px 64px; } .lb-cols span:nth-child(3), .lb-list li .tm{ display:none; } }

/* ---------- Clock: last minute ---------- */
.bug-cell.clock.low .num{ color:#ff6b6b; animation:blink .9s steps(2) infinite; }
#board .panel{ width:min(720px,96vw); }
.lb-cols, .lb-list li{ grid-template-columns:34px minmax(110px,1fr) minmax(0,110px) 64px 50px 72px; }
@media (max-width:640px){ .lb-cols, .lb-list li{ grid-template-columns:28px minmax(80px,1fr) 58px 46px 64px; } }

/* leaderboard: hometown under the name; two inputs in the submit form */
.lb-list .nm{ display:flex; flex-direction:column; line-height:1.1; min-width:0; }
.lb-list .nm .who{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lb-list .nm .town{ font:600 11px var(--disp); letter-spacing:.14em; text-transform:uppercase; color:#8fb4dc; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:2px; }
.lb-list li{ align-items:center; }
#lbForm{ display:flex; gap:8px; flex-wrap:wrap; }
#lbForm input{ flex:1 1 140px; min-width:0; }
#lbForm button{ flex:0 0 auto; }
#lbTown{ font-size:17px; }

/* ---------- Main menu: centred on every screen ---------- */
#start{ justify-content:center; align-items:center; text-align:center;
  background:radial-gradient(ellipse 70% 85% at 50% 50%,rgba(2,8,20,.82) 0,rgba(2,8,20,.6) 55%,rgba(2,8,20,.35) 100%); }
#start .menu{ max-width:560px; width:100%; display:flex; flex-direction:column; align-items:center; animation:menuIn .8s .1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes menuIn{ from{ opacity:0; transform:translateY(18px); } to{ opacity:1; transform:none; } }
#start .menu-row{ justify-content:center; }
#start .menu-btns, #start .menu-links, #start .credit{ justify-content:center; }
#start .up-note, #start .best{ text-align:center; }
#start .menu-btns button{ flex:0 0 auto; }

/* the logo floats gently, and a soft sheen passes across it every few seconds */
.menu h1.menu-logo{ position:relative; margin:0 auto 14px; animation:logoFloat 7s ease-in-out infinite; }
.menu h1.menu-logo::after{ content:""; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(105deg,transparent 42%,rgba(255,255,255,.55) 50%,transparent 58%) no-repeat;
  background-size:260% 100%; background-position:160% 0; mix-blend-mode:soft-light;
  -webkit-mask:url(../assets/brand/zenboni.webp) center/contain no-repeat; mask:url(../assets/brand/zenboni.webp) center/contain no-repeat;
  animation:logoSheen 8s 1.6s ease-in-out infinite; }
@keyframes logoFloat{ 0%,100%{ transform:translateY(0) rotate(0deg); } 50%{ transform:translateY(-6px) rotate(-.4deg); } }
@keyframes logoSheen{ 0%{ background-position:160% 0; } 22%,100%{ background-position:-60% 0; } }
.menu-logo img{ margin:0 auto; }
@media (prefers-reduced-motion:reduce){ .menu h1.menu-logo, .menu h1.menu-logo::after{ animation:none; } }
@media (orientation:portrait){ #start{ padding:6vh 6vw; } #start .menu{ max-width:none; } }
@media (max-height:520px){ #start{ padding:3vh 4vw; } #start .menu-links{ margin-top:10px; } #start .credit{ margin-top:8px; } }
#start{ overflow-y:auto; align-items:safe center; }
#start .menu{ min-width:0; max-width:min(560px,100%); }
#start .menu-row{ flex-wrap:wrap; max-width:100%; }
#start .menu-links{ flex-wrap:wrap; gap:8px 22px; }
#start .credit{ flex-wrap:nowrap; white-space:nowrap; }
@media (orientation:portrait){
  #start .menu-row{ gap:6px 10px; }
  #start .menu-row > label:first-child{ flex-basis:100%; text-align:center; }
  #start .menu-row #team{ flex:1 1 0; width:auto; }
  #start .menu-links{ gap:8px 16px; } #start button.link{ font-size:13px; letter-spacing:.16em; }
  #start .credit{ font-size:10px; gap:8px; } #start .credit img{ height:28px; }
}
@media (max-height:520px) and (orientation:landscape){
  #start{ padding:2vh 4vw; }
  .menu-logo img{ width:min(250px,calc(36vh * 1.78)); }
  .menu h1.menu-logo{ margin-bottom:6px; }
  #start .menu-row{ margin-bottom:6px; } #start .up-note{ margin:-2px 0 6px; }
  #start .menu-btns button{ font-size:20px; padding:8px 18px 8px 26px; }
  #start .menu-links{ margin-top:8px; } #start button.link{ font-size:13px; }
  #start .credit{ margin-top:6px; } #start .credit img{ height:24px; }
}

/* ---- pre-game fly-round: letterbox bars, arena name, skip hint ---- */
#cine{ position:fixed; inset:0; pointer-events:none; z-index:6; }
#cine .cbar{ position:absolute; left:0; right:0; height:9vh; background:#000; animation:cineIn .7s ease both; }
#cine .cbar.ctop{ top:0; } #cine .cbar.cbot{ bottom:0; display:flex; align-items:center; justify-content:space-between; padding:0 max(18px,4vw); padding-bottom:env(safe-area-inset-bottom); }
#cineName{ color:#fff; font:800 clamp(13px,2.2vh,20px)/1 "Arial Black",Impact,sans-serif; letter-spacing:.14em; text-transform:uppercase; }
#cine .cskip{ color:#9fb0c6; font:600 clamp(10px,1.6vh,13px)/1 Arial,sans-serif; letter-spacing:.16em; text-transform:uppercase; }
@keyframes cineIn{ from{ height:0; } to{ height:9vh; } }
@media (prefers-reduced-motion:reduce){ #cine .cbar{ animation:none; } }

/* ---- every menu: buttons centred ---- */
.panel{ align-items:stretch; text-align:center; }
.panel button, .panel.wide button{ justify-content:center; text-align:center; }
.panel .pstats{ justify-content:center; }
.rep-foot{ flex-direction:column; align-items:center; justify-content:center; gap:12px; }
.rep-foot .best{ text-align:center; white-space:normal; }
.foot-btns{ margin-left:0; justify-content:center; flex-wrap:wrap; }
.install-btns, .menu-btns, .menu-links, .lb-entry form, .seg{ justify-content:center; }
.install-body{ text-align:center; } .lb-head, .lb-entry .state{ text-align:center; }
button:hover{ transform:translateY(-2px); }
button.ghost:hover{ transform:none; }

/* ---- share card ---- */
#sharePop{ z-index:30; }
.panel.share{ align-items:center; gap:12px; }
#shareImg{ max-width:100%; max-height:46vh; width:auto; border-radius:10px; box-shadow:0 14px 50px rgba(0,0,0,.6); background:#04101f; }
.share-cap{ margin:0; font:500 13px/1.45 Arial,sans-serif; color:#b9c9dc; user-select:all; -webkit-user-select:all; text-align:center; }
.share-btns{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; align-items:center; }
.share-btns button:not(.ghost){ font-size:22px; padding:10px 22px 10px 28px; }
@media (max-height:560px){ #shareImg{ max-height:34vh; } .share-cap{ display:none; } }

/* ---- pause: one main button, two short rows, two text links ---- */
#pause .panel{ width:min(380px,92vw); gap:12px; }
#pause .panel h2{ font-size:34px; margin:0 0 4px; }
.prow{ display:flex; gap:10px; } .prow button{ flex:1 1 0; min-width:0; padding:12px 10px; font-size:15px; }
.plinks{ display:flex; justify-content:center; gap:22px; margin-top:2px; }

/* ---------- Options: sound, accessibility, controls ---------- */
.set-head{ margin:14px 0 0; padding-top:12px; border-top:1px solid rgba(160,205,255,.2); font:800 13px/1 var(--disp); letter-spacing:.3em; text-transform:uppercase; color:var(--gold); }
.set-head + .set-row{ border-top:0; }
.set-row.vols{ display:grid; grid-template-columns:1fr 1fr; gap:10px 22px; }
.vol{ display:grid; grid-template-columns:70px 1fr 30px; align-items:center; gap:10px; }
.vol .k{ font:700 12px var(--disp); letter-spacing:.16em; text-transform:uppercase; color:#b9cde6; }
.vol b{ font:800 15px var(--disp); text-align:right; color:#fff; font-variant-numeric:tabular-nums; }
.vol input[type=range]{ --v:50%; -webkit-appearance:none; appearance:none; width:100%; height:22px; background:transparent; cursor:pointer; margin:0; }
.vol input[type=range]::-webkit-slider-runnable-track{ height:6px; border-radius:3px; background:linear-gradient(90deg,var(--cyan) 0 var(--v),rgba(255,255,255,.14) var(--v) 100%); }
.vol input[type=range]::-moz-range-track{ height:6px; border-radius:3px; background:rgba(255,255,255,.14); }
.vol input[type=range]::-moz-range-progress{ height:6px; border-radius:3px; background:var(--cyan); }
.vol input[type=range]::-webkit-slider-thumb{ -webkit-appearance:none; width:18px; height:18px; margin-top:-6px; border-radius:50%; background:#fff; box-shadow:0 0 0 3px rgba(53,208,255,.45),0 2px 6px rgba(0,0,0,.5); }
.vol input[type=range]::-moz-range-thumb{ width:18px; height:18px; border:0; border-radius:50%; background:#fff; box-shadow:0 0 0 3px rgba(53,208,255,.45),0 2px 6px rgba(0,0,0,.5); }
.vol input[type=range]:focus-visible{ outline:2px solid var(--cyan); outline-offset:4px; border-radius:4px; }
.scan-key{ display:flex; flex-wrap:wrap; gap:6px 14px; font:600 12px var(--body); color:#cfdcec; }
.scan-key span{ display:inline-flex; align-items:center; gap:6px; } .scan-key i{ width:22px; height:12px; border-radius:3px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.2); }
.binds{ display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; }
.bind{ all:unset; box-sizing:border-box; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:7px 10px; cursor:pointer; border-radius:8px;
  background:rgba(255,255,255,.05); border:1px solid rgba(160,205,255,.18); font:600 13px var(--body); color:#dbe8f7; transition:background .15s,border-color .15s; }
.bind:hover{ background:rgba(53,208,255,.12); border-color:rgba(53,208,255,.5); } .bind:focus-visible{ outline:2px solid var(--cyan); outline-offset:2px; }
.bind kbd{ min-width:28px; text-align:center; padding:3px 8px; font:800 12px var(--disp); letter-spacing:.06em; color:#0b1424; background:#cfd8e4; border-radius:4px; white-space:nowrap; }
.bind.wait{ border-color:var(--gold); background:rgba(255,184,28,.12); } .bind.wait kbd{ background:var(--gold); animation:blink 1s steps(2) infinite; }
#bindNote.warn{ color:var(--gold); }
.pad-note b{ color:#fff; font-weight:600; }
body.touch .keys-only{ display:none; }
@media (max-width:620px){ .set-row.vols, .binds{ grid-template-columns:1fr; } }
/* reduced motion: everything that slides, pops or blinks just appears */
html.calm-motion *, html.calm-motion *::before, html.calm-motion *::after{ animation-duration:.001s!important; animation-iteration-count:1!important; transition-duration:.001s!important; scroll-behavior:auto!important; }

/* =====================================================================
   Presentation pass: one type and icon system, loading screen, transitions,
   broadcast lower third, milestone banners, time-lapse, stat sheet,
   touch controls, menu turntable, zen mode
   ===================================================================== */
/* one heading face (--disp), one body face (--body) everywhere in the interface */
#cineName{ font:800 clamp(13px,2.2vh,20px)/1 var(--disp); letter-spacing:.18em; }
#cine .cskip, #replay .cskip{ font:600 clamp(10px,1.6vh,13px)/1 var(--disp); letter-spacing:.2em; text-transform:uppercase; color:#9fb0c6; }
.share-cap{ font:500 13px/1.45 var(--body); }

/* line icons: 24-unit grid, 2-unit stroke, round ends; they take the colour and size of their text */
.ic{ width:1.15em; height:1.15em; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vertical-align:-.2em; }
button .ic{ width:1.05em; height:1.05em; }
button.ghost, button.link{ gap:8px; } button.link{ display:inline-flex; align-items:center; }
button:not(.ghost):not(.link):not(.tbtn) .ic{ margin-right:-8px; }
.bug-sub .st .ic, .bug-sub .meter .ic{ width:15px; height:15px; color:#8fa9cc; }
.bug-sub .st.on .ic{ color:var(--cyan); } .bug-sub .st.warn .ic{ color:var(--red); } .bug-sub .meter.cam .ic{ color:var(--gold); }
.ico.pill .ic{ width:15px; height:15px; vertical-align:-3px; }
.plinks button.link .ic{ width:15px; height:15px; }

/* loading screen */
#loader{ position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:26px;
  background:radial-gradient(ellipse at 50% 42%,#0d2547 0,#06142a 46%,#020812 100%); transition:opacity .7s ease, visibility .7s; }
#loader img{ display:block; width:min(440px,74vw); height:auto; filter:drop-shadow(0 16px 40px rgba(0,0,0,.6)); animation:ldFloat 4s ease-in-out infinite; }
#loader .ld-bar{ width:min(260px,60vw); height:3px; border-radius:2px; background:rgba(160,205,255,.16); overflow:hidden; }
#loader .ld-bar i{ display:block; height:100%; width:6%; border-radius:2px; background:linear-gradient(90deg,var(--cyan),#e9fbff); box-shadow:0 0 12px rgba(53,208,255,.7); transition:width .35s ease; }
#loader .ld-txt{ font:600 12px var(--disp); letter-spacing:.34em; text-transform:uppercase; color:#8fb4dc; }
#loader.done{ opacity:0; visibility:hidden; pointer-events:none; }
@keyframes ldFloat{ 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-6px); } }

/* scene changes: a short dip to navy */
#fader{ position:fixed; inset:0; z-index:50; pointer-events:none; background:radial-gradient(ellipse at center,#071a36,#020812); opacity:0; transition:opacity .42s ease; }
#fader.on{ opacity:1; transition-duration:.22s; }
/* overlays and panels arrive with a short rise */
.screen.overlay:not(.hide){ animation:ovIn .28s ease both; }
.screen.overlay:not(.hide) .panel{ animation:panelIn .34s cubic-bezier(.2,.9,.25,1) both; }
@keyframes ovIn{ from{ opacity:0; } to{ opacity:1; } }
@keyframes panelIn{ from{ opacity:0; transform:translateY(14px) scale(.98); } to{ opacity:1; transform:none; } }
#end:not(.hide){ animation:ovIn .45s ease both; }

/* broadcast lower third */
#lower{ position:fixed; z-index:7; left:max(4vw,env(safe-area-inset-left)); bottom:calc(9vh + 22px); display:flex; align-items:stretch; pointer-events:none;
  filter:drop-shadow(0 12px 26px rgba(0,0,0,.55)); font-family:var(--disp); }
#lower:not(.intro){ bottom:max(64px,env(safe-area-inset-bottom)); }
body.touch #lower:not(.intro){ bottom:200px; }
.lt-chip{ --tc:#003087; --tc2:#ffb81c; width:86px; display:grid; place-items:center; border-radius:8px 0 0 8px;
  background:var(--tc); background:linear-gradient(160deg,var(--tc),color-mix(in srgb,var(--tc) 60%,#000));
  border-right:4px solid var(--tc2); animation:ltChip .5s cubic-bezier(.2,.9,.2,1) both; }
.lt-chip img{ max-width:64px; max-height:64px; object-fit:contain; filter:drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.lt-chip span{ font:italic 900 30px/1 var(--disp); color:#fff; text-transform:uppercase; }
.lt-text{ padding:11px 26px 12px 18px; min-width:260px; border-radius:0 8px 8px 0; background:linear-gradient(180deg,rgba(22,35,59,.96),rgba(7,13,25,.96));
  clip-path:inset(0 0 0 0); animation:ltWipe .6s .12s cubic-bezier(.2,.9,.2,1) both; }
.lt-eye{ display:flex; align-items:center; gap:8px; font:700 12px var(--disp); letter-spacing:.26em; text-transform:uppercase; color:var(--gold); }
.lt-title{ margin-top:4px; font:800 30px/1 var(--disp); letter-spacing:.04em; text-transform:uppercase; color:#fff; white-space:nowrap; }
.lt-sub{ margin-top:5px; font:500 14px var(--body); color:#b9cde6; white-space:nowrap; }
i.live{ display:inline-block; width:8px; height:8px; border-radius:50%; background:#ff4d4f; box-shadow:0 0 8px #ff4d4f; animation:blink 1.4s steps(2) infinite; }
#lower.out .lt-text{ animation:ltWipeOut .35s ease both; } #lower.out .lt-chip{ animation:ltChipOut .35s .15s ease both; }
@keyframes ltChip{ from{ transform:translateX(-30px); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes ltChipOut{ to{ transform:translateX(-30px); opacity:0; } }
@keyframes ltWipe{ from{ clip-path:inset(0 100% 0 0); } to{ clip-path:inset(0 0 0 0); } }
@keyframes ltWipeOut{ from{ clip-path:inset(0 0 0 0); } to{ clip-path:inset(0 100% 0 0); } }
@media (max-width:640px), (max-height:520px){ .lt-chip{ width:62px; } .lt-chip img{ max-width:46px; max-height:46px; } .lt-text{ min-width:0; padding:8px 18px 9px 13px; }
  .lt-title{ font-size:22px; } .lt-sub{ font-size:12px; } .lt-eye{ font-size:10px; } }
@media (orientation:portrait){ body.touch #lower:not(.intro){ bottom:auto; top:calc(max(8px,env(safe-area-inset-top)) + 150px); } }

/* milestone banner: slides out from under the score bug */
.bug .ms{ position:absolute; left:50%; top:100%; z-index:-1; display:flex; align-items:center; gap:12px; padding:8px 18px; width:max-content; white-space:nowrap;
  border-radius:0 0 8px 8px; background:linear-gradient(180deg,#0b1424,#16233b); border:1px solid rgba(160,205,255,.2); border-top:2px solid var(--gold);
  transform:translate(-50%,-110%); opacity:0; transition:transform .45s cubic-bezier(.2,.9,.2,1), opacity .3s; font-family:var(--disp); }
.bug .ms.show{ transform:translate(-50%,0); opacity:1; }
.bug:has(#warn.show) .ms{ opacity:0; }
.ms b{ font:800 22px/1 var(--disp); color:var(--gold); } .ms span{ font:700 14px var(--disp); letter-spacing:.16em; text-transform:uppercase; color:#fff; }
.ms em{ font:800 16px var(--disp); font-style:normal; color:#cfe6ff; font-variant-numeric:tabular-nums; }
.ms s, .sp s, .cmp b{ text-decoration:none; font:800 13px var(--disp); padding:2px 7px; border-radius:4px; font-variant-numeric:tabular-nums; }
.ms s.up, .sp s.up, .cmp b.up{ color:#062a14; background:#3ee08a; } .ms s.dn, .sp s.dn, .cmp b.dn{ color:#fff; background:rgba(255,77,79,.75); }

/* the end-of-run time-lapse */
#replay{ position:fixed; inset:0; z-index:6; pointer-events:none; }
#replay .cbar{ position:absolute; left:0; right:0; height:9vh; background:#000; animation:cineIn .7s ease both; }
#replay .ctop{ top:0; } #replay .cbot{ bottom:0; display:flex; align-items:center; gap:18px; padding:0 max(18px,4vw); padding-bottom:env(safe-area-inset-bottom); }
.rp-tag{ display:flex; align-items:center; gap:9px; font:800 clamp(13px,2.2vh,20px)/1 var(--disp); letter-spacing:.2em; text-transform:uppercase; color:#fff; }
.rp-clock{ font:800 clamp(16px,2.6vh,24px)/1 var(--disp); color:var(--gold); font-variant-numeric:tabular-nums; margin-right:auto; }
.rp-bar{ position:absolute; left:0; right:0; bottom:9vh; height:3px; background:rgba(255,255,255,.08); } .rp-bar i{ display:block; height:100%; width:0; background:linear-gradient(90deg,var(--cyan),#e9fbff); }

/* results: split times, best comparison, projected rank */
.splits{ display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin:10px 0 4px; }
.sp{ display:flex; flex-direction:column; align-items:center; gap:3px; padding:7px 4px; border-radius:8px; background:rgba(255,255,255,.05); border:1px solid rgba(160,205,255,.14); }
.sp i{ font:700 11px var(--disp); font-style:normal; letter-spacing:.18em; color:#8fb4dc; } .sp b{ font:800 19px/1 var(--disp); color:#fff; font-variant-numeric:tabular-nums; }
.sp s{ font-size:11px; padding:1px 5px; } .sp.off b{ color:#4f6584; }
.sheet-meta{ display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 14px; margin:4px 0 2px; font:500 13px var(--body); color:#b9cde6; }
.sheet-meta:empty, .sheet-meta:has(.cmp:empty):has(.rank:empty){ display:none; }
.rank b{ color:var(--gold); font:800 16px var(--disp); }
@media (max-height:520px){ .splits{ margin:4px 0 2px; } .sp{ padding:4px; } .sp b{ font-size:15px; } }

/* touch controls: larger glass buttons with icons, a tank ring round the water button */
.tbtn{ background:radial-gradient(circle at 50% 28%,rgba(255,255,255,.2),rgba(255,255,255,.04) 48%),rgba(6,18,38,.58);
  border:1.5px solid rgba(190,225,255,.42); box-shadow:0 10px 26px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -10px 18px rgba(0,0,0,.25);
  backdrop-filter:blur(10px) saturate(1.2); -webkit-backdrop-filter:blur(10px) saturate(1.2); transition:transform .1s, background .15s, box-shadow .15s, border-color .15s; }
.tbig .tbtn{ width:104px; height:104px; position:relative; gap:1px; }
.tbig .tbtn .ic{ width:30px; height:30px; margin-bottom:2px; }
.tbig .tbtn b{ font-size:14px; letter-spacing:.14em; } .tbig .tbtn i{ font-size:11px; }
#tBlade{ margin-bottom:40px; }
.tbtn .ring{ position:absolute; inset:-7px; width:calc(100% + 14px); height:calc(100% + 14px); transform:rotate(-90deg); pointer-events:none; overflow:visible; }
.tbtn .ring circle{ fill:none; stroke-width:3.2; } .tbtn .ring .rbg{ stroke:rgba(160,205,255,.16); }
.tbtn .ring .rfg{ stroke:#5fe3ff; stroke-linecap:round; stroke-dasharray:100; stroke-dashoffset:0; transition:stroke-dashoffset .4s ease; filter:drop-shadow(0 0 4px rgba(95,227,255,.6)); }
.tbtn.low .rfg{ stroke:var(--red); }
.tbtn.on{ background:radial-gradient(circle at 50% 28%,rgba(255,255,255,.35),rgba(53,208,255,.18) 55%),rgba(10,60,100,.6); border-color:var(--cyan); box-shadow:0 0 26px rgba(53,208,255,.55), inset 0 1px 0 rgba(255,255,255,.5); }
.tbtn.warn{ background:radial-gradient(circle at 50% 28%,rgba(255,255,255,.3),rgba(255,77,79,.3) 55%),rgba(90,10,14,.6); border-color:var(--red); }
.tsmall{ bottom:178px; gap:10px; }
.tbtn.sm{ width:46px; height:46px; padding:0; border-radius:50%; } .tbtn.sm .ic{ width:21px; height:21px; }
.tbtn.sm.on{ border-color:var(--gold); color:var(--gold); }
#stick{ width:156px; height:156px; background:radial-gradient(circle at 50% 30%,rgba(255,255,255,.12),rgba(255,255,255,.02) 55%),rgba(6,18,38,.5);
  border:1.5px solid rgba(190,225,255,.38); box-shadow:0 10px 26px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.25); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }
@media (max-height:520px){ .tbig .tbtn{ width:86px; height:86px; } .tbig .tbtn .ic{ width:24px; height:24px; } #tBlade{ margin-bottom:28px; } .tsmall{ bottom:150px; }
  .tbtn.sm{ width:40px; height:40px; } #stick{ width:132px; height:132px; } }
@media (max-height:520px) and (orientation:landscape){ .tbtn.sm{ padding:0; height:40px; } }

/* main menu on wide screens: menu on the left, the machine turning slowly on the right */
html.menu-side #start{ justify-content:flex-start; padding-left:max(5vw,env(safe-area-inset-left));
  background:linear-gradient(90deg,rgba(2,8,20,.9) 0,rgba(2,8,20,.72) 34%,rgba(2,8,20,.12) 58%,rgba(2,8,20,0) 72%,rgba(2,8,20,.3) 100%); }
html.menu-side #start .menu{ max-width:min(520px,44vw); }

/* zen mode: soft letterbox bars, a hairline of progress, no score bug, and a calm line now and then */
#zenbars .zb{ position:fixed; left:0; right:0; z-index:3; height:0; pointer-events:none; transition:height 1.6s ease; }
#zenbars .ztop{ top:0; background:linear-gradient(180deg,rgba(0,0,0,.92),rgba(0,0,0,.55) 70%,rgba(0,0,0,0)); }
#zenbars .zbot{ bottom:0; background:linear-gradient(0deg,rgba(0,0,0,.92),rgba(0,0,0,.55) 70%,rgba(0,0,0,0)); }
html.zen-pres #zenbars .zb{ height:11vh; }
#zProg{ position:absolute; left:0; top:max(10px,env(safe-area-inset-top)); height:2px; width:0; background:linear-gradient(90deg,rgba(255,240,216,.2),rgba(255,240,216,.85)); transition:width 1s ease, opacity 1s; opacity:0; }
html.zen-pres #zProg{ opacity:1; }
.bug>*:not(#warn){ transition:opacity 1.2s ease; }
html.zen-pres .bug>*:not(#warn){ opacity:0; }
html.zen-pres .hints{ opacity:0; }
#zline{ position:fixed; left:50%; bottom:calc(11vh + 26px); z-index:7; transform:translate(-50%,8px); max-width:90vw; text-align:center; pointer-events:none; opacity:0;
  font:300 clamp(18px,2.6vw,30px)/1.3 var(--body); letter-spacing:.06em; color:#fff3e2; text-shadow:0 2px 18px rgba(0,0,0,.7); transition:opacity 1.6s ease, transform 1.6s ease; }
#zline.show{ opacity:1; transform:translate(-50%,0); }
body.touch #zline{ bottom:auto; top:calc(11vh + 24px); }

/* reduced motion: no float, no drift, bars and lines simply appear */
html.calm-motion #loader img{ animation:none; }
@media (orientation:portrait){
  #stick{ width:142px; height:142px; }
  .tbig .tbtn{ width:92px; height:92px; } .tbig .tbtn .ic{ width:26px; height:26px; } #tBlade{ margin-bottom:32px; }
  .tsmall{ bottom:calc(max(26px,env(safe-area-inset-bottom)) + 150px); left:auto; right:max(18px,env(safe-area-inset-right)); justify-content:flex-end; gap:10px; }
  .tbtn.sm{ width:44px; height:44px; padding:0; }
}
@media (orientation:portrait){ body.touch #lower:not(.intro){ top:auto; bottom:calc(max(26px,env(safe-area-inset-bottom)) + 214px); left:12px; } }
.plinks button.link{ white-space:nowrap; }
@media (max-width:420px){ .plinks{ gap:14px; } .plinks button.link{ font-size:13px; letter-spacing:.14em; } }
.vol.turn{ grid-template-columns:70px 1fr 78px; }
