:root{
  --bg: oklch(0.91 0.01 70);
  --ink: oklch(0.22 0.02 60);
  --muted: oklch(0.55 0.02 60);
  --line: oklch(0.85 0.015 70);
  --court: oklch(0.78 0.08 55);
  --court-dk: oklch(0.68 0.09 50);
  --ball: oklch(0.66 0.18 45);
  --ball-dk: oklch(0.48 0.17 40);
  --rim: oklch(0.58 0.19 30);
  --net: oklch(0.98 0.005 70);
  --good: oklch(0.68 0.17 145);
  --bad:  oklch(0.60 0.20 25);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-feature-settings: "ss01","cv11";
  -webkit-font-smoothing: antialiased;
  overflow:hidden;
  /* No double-tap zoom anywhere; pan still allowed for inner scroll containers. */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
canvas, virtual-joystick, .dunk-btn, .hud-btn{
  /* Block all browser-handled gestures (pinch, double-tap zoom) on play surfaces. */
  touch-action: none;
}
#stage{
  position:fixed; inset:0;
  display:grid; place-items:center;
  overflow:hidden;
}
canvas{
  display:block;
  background: var(--bg);
  cursor: none;
}
.hud{
  position: fixed; inset: 0;
  pointer-events: none;
  padding: 22px 26px;
  padding-top:    max(22px, env(safe-area-inset-top));
  padding-right:  max(26px, env(safe-area-inset-right));
  padding-left:   max(26px, env(safe-area-inset-left));
  display: grid;
  /* score | reset-btn | time | mute-btn | best */
  grid-template-columns: 1fr auto 1fr auto 1fr;
  column-gap: 16px;
  align-items: start;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.hud .group{
  display:flex; flex-direction:column; gap:6px;
}
.hud .group.right{ align-items:flex-end; text-align:right }
.hud .group.center{ align-items:center; text-align:center }
.label{
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 600;
}
.value{
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.value.sm{ font-size: 16px; font-weight:500 }
/* Shared HUD button style — used for the mute toggle and the round-reset
   button. The HUD has pointer-events:none so each button opts in. Pushed
   down with margin-top to sit roughly at the .value baseline. */
.hud-btn{
  align-self: start;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; padding: 0;
  pointer-events: auto;
  margin-top: 18px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.hud-btn:hover{ color: var(--ink); border-color: var(--ink); }
.hud-btn svg{ width: 16px; height: 16px; display:block; }
.mute-btn .mute-off{ display: none; }
.mute-btn[aria-pressed="true"] .mute-on{ display: none; }
.mute-btn[aria-pressed="true"] .mute-off{ display: block; }
.mute-btn[aria-pressed="true"]{ color: var(--muted); }
.hud-btn:active{ transform: scale(0.94); }
.pill{
  display:inline-flex; gap:8px; align-items:center;
  padding: 6px 10px; border:1px solid var(--line);
  border-radius: 999px; background: color-mix(in oklab, var(--bg), white 30%);
  font-size: 11.5px; color: var(--muted);
}
.pill kbd{
  font: 600 10.5px/1 ui-monospace,Menlo,Consolas,monospace;
  background: var(--ink); color: var(--bg);
  padding: 3px 5px; border-radius: 4px;
  letter-spacing: 0.04em;
}
.pill.unlocked{
  color: var(--ink);
  border-color: var(--ball);
  background: color-mix(in oklab, var(--ball) 18%, var(--bg));
  animation: pillReadyPulse 1.4s ease-in-out infinite;
}
@keyframes pillReadyPulse{
  0%,100%{ box-shadow: 0 0 0 0 oklch(0.66 0.18 45 / 0.40); }
  50%    { box-shadow: 0 0 0 6px oklch(0.66 0.18 45 / 0); }
}
.share-pill{
  position: fixed; bottom: 20px; left: 22px;
  display: inline-flex; gap: 8px; align-items: center;
  padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in oklab, var(--bg), white 30%);
  font-size: 11.5px; color: var(--muted);
  cursor: pointer; pointer-events: auto;
  z-index: 6;
  transition: color 120ms, border-color 120ms;
}
.share-pill:hover{ color: var(--ink); border-color: var(--ink); }
.share-pill .room-id{
  font: 600 11.5px/1 ui-monospace,Menlo,Consolas,monospace;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.share-pill svg{ width: 13px; height: 13px; }
.share-pill.copied{ color: var(--good); border-color: var(--good); }
body.mobile-on .share-pill{ bottom: 14px; left: 14px; }
.scoreboard{
  position: fixed; bottom: 62px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  pointer-events: none;
  z-index: 5;
  max-width: 80vw;
}
body.mobile-on .scoreboard{ bottom: 78px; }
.scoreboard .row{
  display: inline-flex; gap: 8px; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  background: color-mix(in oklab, var(--bg), white 40%);
  border: 1px solid var(--line);
}
.scoreboard .dot{
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.scoreboard .name{ color: var(--ink); font-weight: 600; }
.scoreboard .score{
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}
.scoreboard .row.me .name::after{
  content: ' (you)';
  color: var(--muted);
  font-weight: 400;
}
.scoreboard .row.poss{
  background: oklch(0.98 0.005 70);
  border-color: var(--ink);
}
.scoreboard .row.poss .name::before{
  content: '🏀 ';
}
.toast{
  position:fixed; left: 50%; top: 110px;
  transform: translate(-50%, 8px);
  font-weight: 600; font-size: 42px; letter-spacing:-0.02em;
  opacity: 0; transition: opacity .25s, transform .35s;
  color: var(--good);
  pointer-events:none;
  text-align: center;
  text-shadow: 0 1px 0 color-mix(in oklab, var(--bg), white 50%);
}
.toast.show{ opacity:1; transform: translate(-50%, 0) }
.toast.miss{ color: var(--bad) }
.footer{
  position: fixed; left:0; right:0; bottom: 14px;
  display:flex; justify-content:center; gap:10px;
  pointer-events:none;
}
.timer-wrap{
  display:flex; flex-direction:column; align-items:center; gap:6px;
}
.value.timer{
  font-variant-numeric: tabular-nums;
  transition: color .2s, transform .15s;
}
.value.timer.warn{
  color: var(--bad);
  animation: timerPulse 1s ease-in-out infinite;
}
.value.timer.hailmary{
  color: var(--good);
  animation: timerPulse .35s ease-in-out infinite;
}
@keyframes timerPulse{
  0%,100%{ transform: scale(1); }
  50%{ transform: scale(1.08); }
}
/* Game-over overlay */
#gameover{
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: oklch(0.22 0.02 60 / 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 40;
  animation: gofade .35s ease-out;
}
#gameover.open{ display:flex; }
@keyframes gofade{
  from{ opacity:0; }
  to{ opacity:1; }
}
#gameover .card{
  background: oklch(0.98 0.005 70);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 32px 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 30px 80px oklch(0 0 0 / 0.25);
  text-align: center;
  animation: gopop .4s cubic-bezier(.2,1.4,.4,1);
}
@keyframes gopop{
  from{ transform: translateY(14px) scale(.94); opacity:0; }
  to{ transform: translateY(0) scale(1); opacity:1; }
}

/* Last-round vs pre-game header swap. JS toggles .has-last / .no-last. */
#gameover .last-round,
#gameover .pre-header{ display: none; }
#gameover.has-last .last-round{ display: block; margin-bottom: 18px; }
#gameover.no-last  .pre-header{ display: block; margin-bottom: 18px; }

#gameover .eyebrow{
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}
#gameover .last-h{
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--ink);
}
#gameover .pre-header h1{
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--ink);
}
#gameover .pre-header .sub{
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
#gameover .stats{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
#gameover .stat .label{
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
#gameover .stat .num{
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
#gameover .hot-line{
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--good);
}
#gameover .newbest{
  display:inline-block;
  margin: 6px 0 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--good);
  color: oklch(0.98 0.005 70);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---- Leaderboard ---- */
/* Only relevant after a finished round — hide on the pre-game / first-run modal,
   matching the share button (.no-last hides both). */
#gameover .lb{
  margin: 18px 0 16px;
  text-align: left;
}
#gameover.no-last .lb{ display: none; }
#gameover .lb-head{
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
#gameover .lb-title{
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}
#gameover .lb-status{
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#gameover .lb-list{
  list-style: none;
  margin: 0; padding: 6px 0;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
#gameover .lb-row{
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
#gameover .lb-row .rank{
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: right;
}
#gameover .lb-row .nm{
  font-weight: 500;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#gameover .lb-row .sc{
  font-weight: 700;
  color: var(--ink);
}
#gameover .lb-row.you{
  background: color-mix(in oklab, var(--ball), white 70%);
}
#gameover .lb-row.you .nm,
#gameover .lb-row.you .sc,
#gameover .lb-row.you .rank{ color: var(--ball-dk); }
#gameover .lb-empty{
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 14px 0;
}

/* ---- Name input ---- */
#gameover .name-row{
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  text-align: left;
}
#gameover .name-label{
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}
#gameover #nameInput{
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font: 600 15px/1.2 Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.005em;
  color: var(--ink);
  background: oklch(0.99 0.003 70);
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#gameover #nameInput:focus{
  border-color: var(--ink);
  box-shadow: 0 0 0 3px oklch(0.22 0.02 60 / 0.08);
}

/* ---- Tutorial steps (folded in) ---- */
#gameover .steps{
  display: none;
  gap: 12px;
  margin: 4px 0 18px;
}
#gameover.show-tutorial .steps{ display: grid; }
#gameover .step{
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
}
#gameover .step .glyph{
  width: 40px; height: 40px;
  border-radius: 50%;
  background: oklch(0.94 0.01 70);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
#gameover .step .glyph.circle-o{
  border: 1.5px solid var(--ink);
  background: transparent;
}
#gameover .step .glyph.circle-o::after{
  content:'';
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink);
  position: absolute;
}
#gameover .step .glyph.dunk{ background: var(--ink); }
#gameover .step .glyph.dunk svg{ width: 18px; height: 18px; color: oklch(0.98 0.005 70); }
#gameover .step .txt strong{
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 1px;
}
#gameover .step .txt span{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
#gameover .step .txt kbd{
  font: 600 10.5px/1 ui-monospace,Menlo,Consolas,monospace;
  background: var(--ink); color: var(--bg);
  padding: 2px 5px; border-radius: 4px;
}

/* Desktop/mobile copy swap inside the tutorial steps. */
#gameover .step .txt .is-mobile{ display: none; }
body.mobile-on #gameover .step .txt .is-desktop{ display: none; }
body.mobile-on #gameover .step .txt .is-mobile{ display: inline; }

#gameover .actions{
  display:flex; gap:10px; justify-content:center; flex-wrap:wrap;
}
#gameover button.play[disabled]{
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
#gameover button.play{
  border: 0;
  background: var(--ink);
  color: oklch(0.98 0.005 70);
  font: 600 15px/1 Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.02em;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s, background .2s;
}
#gameover button.play:hover{
  background: var(--ball-dk);
  transform: translateY(-1px);
}
#gameover button.share{
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.02em;
  padding: 14px 22px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s, background .2s, border-color .2s;
}
#gameover button.share:hover{
  background: color-mix(in oklab, var(--bg), white 20%);
  border-color: var(--ink);
  transform: translateY(-1px);
}
#gameover button.share svg{ width:16px; height:16px; }
#gameover button.share.copied{
  background: var(--good);
  color: oklch(0.98 0.005 70);
  border-color: var(--good);
}
/* Sharing only makes sense after a round — there's no score to share on the
   pre-game / first-run modal. */
#gameover.no-last button.share{ display: none; }
#gameover .hint{
  display:block;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
@media (max-width: 640px){
  .value{font-size:22px}
}

/* ---------- Mobile controls ---------- */
/* Everything under .mobile-on only renders on touch devices. */
#mobileControls{ display: none; }
body.mobile-on #mobileControls{ display: block; }
body.mobile-on .footer{ display: none; }
body.mobile-on canvas{ cursor: default; }

/* Reflow HUD: bigger values so they're legible over the action. */
body.mobile-on .hud{
  padding: 14px 16px;
  padding-top:   max(14px, env(safe-area-inset-top));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-left:  max(16px, env(safe-area-inset-left));
  font-size: 13px;
}
body.mobile-on .hud .value{ font-size: 26px; }
body.mobile-on .hud .value.sm{ font-size: 13px; }
body.mobile-on .hud .label{ font-size: 10px; letter-spacing: 0.14em; }

/* Portrait: a bit tighter to leave more room for the action. */
@media (orientation: portrait){
  body.mobile-on .hud{
    padding: 10px 12px;
    padding-top:   max(10px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left:  max(12px, env(safe-area-inset-left));
  }
  body.mobile-on .hud .value{ font-size: 22px; }
  body.mobile-on .hud .value.sm{ font-size: 12px; }
}

/* Joystick layout + base/knob come from <virtual-joystick>.
   Everything below is game-specific: right-stick charge ring
   and the warm "charging" tint on the knob.

   Floating-stick hit zones: each stick covers half the bottom of the
   screen on mobile so the player can plant a thumb anywhere on its side.
   The visible base/knob/ring appear under the finger (driven by
   --vj-origin-x/y set by the component on press). */
body.mobile-on virtual-joystick[side="left"]{
  width: 50vw; height: 60vh;
  left: 0; bottom: 0;
}
body.mobile-on virtual-joystick[side="right"]{
  width: 50vw; height: 60vh;
  right: 0; bottom: 0;
}
/* Hint the floating sticks at rest so the player sees where to thumb-down.
   They still relocate to the touch origin on press; the shared .active rules
   take over and bump opacity to full once engaged. */
virtual-joystick[floating] .vj-base{ opacity: 0.18; }
virtual-joystick[floating] .vj-knob{ opacity: 0.28; }
virtual-joystick[side="right"].charging .vj-knob{
  background: var(--ball);
  box-shadow: 0 2px 14px oklch(0.66 0.18 45 / 0.5), 0 0 0 3px oklch(0.66 0.18 45 / 0.25);
}
/* Slingshot power field. The track is a fixed ring at "max travel"; the fill
   is a solid disc that scales from 0 → 1 with --charge-pct, growing from the
   center to fill the ring as the player pulls farther. Color shifts via
   --charge-color (warm yellow → orange → red), and stays muted below the
   SHOOT_MIN gate so the player can see when they've pulled hard enough. */
/* The right stick is the slingshot. Sized much larger than the left so the
   player has room to pull, and tuned for low sensitivity (max-travel="110"
   on the element). Layers, bottom to top:
     1. .cancel-ring  — dashed outer ring at ~1.6× max-travel; release here = abort
     2. .vj-base      — bowl outline
     3. .charge-ring  — solid disc that fills the bowl with power as you pull
     4. .vj-knob      — your finger anchor, always on top */
virtual-joystick[side="right"] .vj-base{
  width: 280px; height: 280px;
}
virtual-joystick[side="right"] .vj-knob{
  width: 80px; height: 80px;
  margin-left: -40px; margin-top: -40px;
  z-index: 3;
}
@media (orientation: portrait){
  virtual-joystick[side="right"] .vj-base{ width: 256px; height: 256px; }
  virtual-joystick[side="right"] .vj-knob{
    width: 72px; height: 72px;
    margin-left: -36px; margin-top: -36px;
  }
}

virtual-joystick[side="right"] .charge-ring{
  position: absolute;
  left: var(--vj-origin-x, 50%); top: var(--vj-origin-y, 50%);
  width: 240px; height: 240px;
  transform: translate(-50%,-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  overflow: visible;
  z-index: 2;
}
@media (orientation: portrait){
  virtual-joystick[side="right"] .charge-ring{ width: 220px; height: 220px; }
}

/* Cancel ring — dashed outer ring. Touch crossing it arms cancel; releasing
   while armed aborts the shot. Mirrors the bowl visually so the player reads
   "outside the bowl = different territory" at a glance. */
virtual-joystick[side="right"] .cancel-ring{
  position: absolute;
  left: var(--vj-origin-x, 50%); top: var(--vj-origin-y, 50%);
  width: 400px; height: 400px;
  transform: translate(-50%,-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  overflow: visible;
  z-index: 1;
}
@media (orientation: portrait){
  virtual-joystick[side="right"] .cancel-ring{ width: 360px; height: 360px; }
}
virtual-joystick[side="right"].charging .cancel-ring{ opacity: 0.55; }
.cancel-ring circle{
  fill: none;
  stroke: oklch(0.55 0.02 60 / 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
}
virtual-joystick[side="right"].armed .cancel-ring{ opacity: 1; }
virtual-joystick[side="right"].armed .cancel-ring circle{
  stroke: oklch(0.62 0.20 30);
  stroke-width: 3;
}

/* Floating "release to cancel" label — positioned at the top of the cancel
   ring, anchored to the floating origin. Hidden by default; visible when
   charging (faint) and prominent when armed. */
virtual-joystick[side="right"] .cancel-label{
  position: absolute;
  left: var(--vj-origin-x, 50%); top: var(--vj-origin-y, 50%);
  transform: translate(-50%, -210px);
  font: 600 11px/1 Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: oklch(0.55 0.02 60 / 0.7);
  background: oklch(0.98 0.005 70 / 0.85);
  padding: 5px 9px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
  z-index: 4;
}
@media (orientation: portrait){
  virtual-joystick[side="right"] .cancel-label{ transform: translate(-50%, -190px); }
}
virtual-joystick[side="right"].charging .cancel-label{ opacity: 0.6; }
virtual-joystick[side="right"].armed .cancel-label{
  opacity: 1;
  color: oklch(0.98 0.005 70);
  background: oklch(0.62 0.20 30);
}

/* Armed: the inner power disc grays out so the player sees the energy "leak". */
virtual-joystick[side="right"].armed .charge-ring .fill{
  fill: oklch(0.55 0.02 60 / 0.5) !important;
  opacity: 0.5;
}
@media (orientation: portrait){
  virtual-joystick[side="right"] .charge-ring{ width: 96px; height: 96px; }
}
virtual-joystick[side="right"].charging .charge-ring{ opacity: 1; }
.charge-ring circle{
  transform-origin: center;
  transform-box: fill-box;
}
.charge-ring .track{
  fill: oklch(0.98 0.005 70 / 0.06);
  stroke: oklch(0.22 0.02 60 / 0.35);
  stroke-width: 2;
}
.charge-ring .fill{
  fill: var(--charge-color, oklch(0.66 0.18 45));
  stroke: none;
  opacity: 0.7;
  transform: scale(var(--charge-pct, 0));
  transition: none;
}

/* Dunk button — right side, just above the right-joystick zone (which
   takes the bottom 60vh on mobile). Sits near where the right thumb
   already lives during a sprint, so the slam is reachable without a
   long stretch up to the corner. Only visible while a streak has
   unlocked it. */
.dunk-btn{
  position: fixed;
  right: 16px;
  bottom: calc(60vh + 12px);
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--ball);
  color: oklch(0.98 0.005 70);
  border: 0;
  font: 700 11px/1 Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px oklch(0 0 0 / 0.25);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  z-index: 30;
  transition: opacity .2s, transform .1s, background .2s;
  display: none;
}
/* Only visible on mobile, and only once a streak has unlocked the dunk. */
body.mobile-on .dunk-btn.unlocked{
  display: flex; align-items: center; justify-content: center;
  animation: dunkReadyPulse 1.2s ease-in-out infinite;
}
.dunk-btn.unlocked.disabled{
  /* Unlocked but out of range: dimmed — "get closer". */
  opacity: 0.55;
  animation: dunkReadyPulse 1.6s ease-in-out infinite;
}
@keyframes dunkReadyPulse{
  0%,100%{ box-shadow: 0 4px 14px oklch(0 0 0 / 0.25), 0 0 0 0 oklch(0.66 0.18 45 / 0.35); }
  50%    { box-shadow: 0 4px 14px oklch(0 0 0 / 0.25), 0 0 0 8px  oklch(0.66 0.18 45 / 0); }
}
.dunk-btn:active:not(.disabled){
  transform: scale(0.92);
  background: var(--ball-dk);
}
.dunk-btn .dunk-icon{
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dunk-btn .dunk-icon svg{ width: 22px; height: 22px; }
@media (orientation: portrait){
  .dunk-btn{ right: 14px; bottom: calc(60vh + 10px); width: 66px; height: 66px; font-size: 10px; }
  .dunk-btn .dunk-icon svg{ width: 20px; height: 20px; }
}

/* ---------- Landscape lock overlay ----------
   Basket is tuned for portrait; landscape on a phone breaks the layout. The
   overlay is injected by mobile.js on touch devices and shown only when the
   viewport is wider than tall. */
#rotateOverlay{
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
  padding: 24px;
  text-align: center;
}
#rotateOverlay .rotate-card{
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--ink);
  max-width: 280px;
}
#rotateOverlay svg{
  width: 64px; height: 64px; color: var(--muted);
  animation: rotateHint 2.4s ease-in-out infinite;
}
#rotateOverlay strong{
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
}
#rotateOverlay span{
  font-size: 13px; color: var(--muted); line-height: 1.4;
}
@keyframes rotateHint{
  0%, 60%, 100% { transform: rotate(0deg); }
  30%          { transform: rotate(-90deg); }
}
body.mobile-on.is-landscape #rotateOverlay{ display: flex; }
body.mobile-on.is-landscape .hud,
body.mobile-on.is-landscape .footer,
body.mobile-on.is-landscape #stage,
body.mobile-on.is-landscape #mobileControls,
body.mobile-on.is-landscape #gameover,
body.mobile-on.is-landscape .toast,
body.mobile-on.is-landscape .scoreboard,
body.mobile-on.is-landscape .share-pill,
body.mobile-on.is-landscape .mute-btn{
  display: none !important;
}


/* Studio attribution — Looop wordmark in gameover modal */
.studio-attr{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid var(--line);
  opacity:0.45;
  text-decoration:none;
  color:inherit;
  font-size:11px;
  letter-spacing:0.04em;
  transition:opacity 0.2s ease;
}
.studio-attr:hover,
.studio-attr:focus-visible{ opacity:0.85; }
.studio-attr-mark{
  height:14px;
  width:auto;
  display:block;
}
