:root {
  --navy: #0b1530;
  --navy-2: #13224a;
  --navy-3: #1c2f63;
  --gold: #ffd34d;
  --gold-2: #f5b82e;
  --orange: #ff7a1a;
  --red: #ff4d5a;
  --green: #2fd67b;
  --blue: #3fa2ff;
  --ink: #f4f6ff;
  --muted: #a9b4d6;
  --pad-a: #5cbf3a;
  --pad-b: #e8423f;
  --pad-x: #2f7de1;
  --pad-y: #f2c230;
  --display: 'Bungee', Impact, 'Arial Black', sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--ink);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
canvas#game, canvas#game3d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}
canvas#game { background: transparent; z-index: 1; }
canvas#game3d { z-index: 0; }
canvas#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
button { font-family: inherit; color: inherit; }
a { color: var(--gold); }
[hidden] { display: none !important; }

/* ---------- Button glyphs (A/B/X/Y or keys) ---------- */
.glyph {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 0.85em;
  line-height: 1;
  color: #fff;
  flex: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.4);
}
.glyph[data-btn="A"] { background: var(--pad-a); }
.glyph[data-btn="B"] { background: var(--pad-b); }
.glyph[data-btn="X"] { background: var(--pad-x); }
.glyph[data-btn="Y"] { background: var(--pad-y); color: #3a2a00; }
.glyph::after { content: attr(data-pad); }
body[data-input="keyboard"] .glyph { border-radius: 6px; background: #e9edf8; color: #18213e; box-shadow: inset 0 -3px 0 #b5bed6; }
body[data-input="keyboard"] .glyph::after { content: attr(data-key); }
body[data-input="touch"] .glyph.opt-glyph { display: none; }
body[data-input="touch"] .hide-touch { display: none !important; }
body:not([data-input="touch"]) .only-touch { display: none !important; }
body:not([data-input="gamepad"]) .only-pad { display: none !important; }

/* ---------- Screens (menus) ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.screen {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-r)) calc(24px + var(--safe-bot)) calc(16px + var(--safe-l));
  animation: screenIn 0.28s ease-out;
}
.screen.dim { background: linear-gradient(180deg, rgba(11,21,48,0.86), rgba(11,21,48,0.94)); }
.screen.glass { background: rgba(8,14,34,0.55); backdrop-filter: blur(3px); }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.wrap { max-width: 1040px; margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.topbar h2 {
  font-family: var(--display);
  font-size: clamp(22px, 4vw, 34px);
  margin: 0;
  letter-spacing: 0.5px;
  text-shadow: 0 3px 0 rgba(0,0,0,0.35);
}
.topbar .spacer { flex: 1; }
.backbtn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 8px 14px 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  background: var(--gold);
  color: #1d1600;
  box-shadow: 0 4px 0 #b88a12, 0 8px 18px rgba(0,0,0,0.35);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b88a12; }
.btn.ghost { background: rgba(255,255,255,0.08); color: var(--ink); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18); }
.btn.big { font-family: var(--display); font-size: clamp(18px, 3vw, 24px); padding: 16px 26px; font-weight: 400; }
.btn[disabled] { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }

[data-nav] { outline: none; }
[data-nav].focus, [data-nav]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(255,211,77,0.25), 0 8px 18px rgba(0,0,0,0.35);
}
body[data-input="touch"] [data-nav].focus { outline: none; box-shadow: none; }

/* ---------- Title screen ---------- */
.title-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  min-height: 100%;
  background: radial-gradient(ellipse at 20% 30%, rgba(11,21,48,0.55), rgba(11,21,48,0.88) 70%);
}
.logo-block { padding: 8px; }
.logo-kicker {
  display: inline-block;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--navy);
  background: var(--gold);
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 10px;
}
.logo {
  font-family: var(--display);
  font-size: clamp(42px, 8.5vw, 104px);
  line-height: 0.88;
  margin: 0;
  color: #fff;
  text-shadow: 0 5px 0 #091022, 0 10px 30px rgba(0,0,0,0.5);
  transform: rotate(-3deg);
  transform-origin: left center;
}
.logo span { color: var(--gold); display: block; }
.logo .ball-o {
  display: inline-block;
  width: 0.78em; height: 0.78em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #e8e8e8 60%, #cfcfcf);
  position: relative;
  vertical-align: -0.04em;
  box-shadow: inset -4px -6px 0 rgba(0,0,0,0.08);
}
.logo .ball-o::before, .logo .ball-o::after {
  content: '';
  position: absolute;
  top: 10%; bottom: 10%;
  width: 40%;
  border: 0.05em dashed #d0302f;
  border-radius: 50%;
}
.logo .ball-o::before { left: -18%; border-left: 0; border-top: 0; border-bottom: 0; }
.logo .ball-o::after { right: -18%; border-right: 0; border-top: 0; border-bottom: 0; }
.tagline { font-size: clamp(15px, 2vw, 19px); color: var(--muted); margin: 18px 0 0; max-width: 34ch; }
.tagline b { color: var(--ink); }

.profile-chip {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 10px 14px;
  margin-top: 22px;
  max-width: 420px;
}
.profile-chip .lvl {
  font-family: var(--display);
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--gold), var(--orange));
  color: #2b1500;
  font-size: 18px;
  flex: none;
}
.profile-chip .who { flex: 1; min-width: 0; }
.profile-chip .name { font-weight: 900; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-chip .rank { color: var(--muted); font-size: 13px; }
.xpbar { height: 8px; background: rgba(255,255,255,0.12); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 99px; }

.menu { display: grid; gap: 12px; }
.menu-main {
  display: flex; align-items: center; gap: 14px;
  text-align: left;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-3), var(--navy-2));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.1), 0 6px 0 #060c1d, 0 12px 26px rgba(0,0,0,0.35);
  transition: transform 0.1s;
}
.menu-main:hover { transform: translateY(-2px); }
.menu-main .ico { font-size: 30px; width: 44px; text-align: center; flex: none; }
.menu-main .t { font-family: var(--display); font-size: clamp(17px, 2.4vw, 22px); line-height: 1.05; }
.menu-main .d { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.menu-main.hero { background: linear-gradient(135deg, #ff9a2e, #ff5a1f); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25), 0 6px 0 #9c3008, 0 12px 26px rgba(0,0,0,0.35); }
.menu-main.hero .d { color: #ffe6cf; }
.menu-main { position: relative; }
.menu-main .badge { position: absolute; top: 8px; right: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 2px 8px; letter-spacing: 0.04em; }
.sport-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 16px; background: rgba(8,14,34,0.6); border: 2px solid rgba(255,255,255,0.12); }
.sport-opt { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border-radius: 11px; border: 0; cursor: pointer;
  font-family: var(--display); font-size: clamp(15px, 2vw, 19px); letter-spacing: 1px; color: var(--muted); background: transparent; }
.sport-opt .ico { font-size: 1.35em; }
.sport-opt.on.baseball { background: linear-gradient(180deg, #2f6bff, #1b3fa8); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,0.3); }
.sport-opt.on.softball { background: linear-gradient(180deg, #e4f23c, #b9c814); color: #24280a; box-shadow: 0 4px 0 rgba(0,0,0,0.3); }
.sport-opt:not(.on):hover, .sport-opt:not(.on):focus-visible { color: #fff; background: rgba(255,255,255,0.08); }
.menu-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.menu-mini {
  border: 0; border-radius: 14px; padding: 12px 6px; cursor: pointer;
  background: rgba(255,255,255,0.07);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.1);
  color: var(--ink); font-weight: 800; font-size: 12.5px;
  display: grid; gap: 4px; place-items: center;
  position: relative;
}
.menu-mini .ico { font-size: 22px; }
.menu-mini .badge { position: absolute; top: 6px; right: 8px; background: var(--red); color: #fff; font-size: 10px; border-radius: 99px; padding: 1px 6px; }
.footer-note { color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.drills-head { font-family: Bungee, Impact, sans-serif; font-size: 20px; letter-spacing: 0.5px; margin: 22px 0 6px; color: var(--gold); }
.footer-note a { color: var(--gold); }
.controls-hint { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 10px; align-items: center; }
.controls-hint span { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  background: linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  position: relative;
}
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.card.locked { opacity: 0.55; }
.card.gold { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,211,77,0.25), 0 0 24px rgba(255,211,77,0.15); }
.card .ico-big { font-size: 34px; }
/* A, B, C position badges: one look for all three (there's no emoji for C to match A and B) */
.pos-badge { display: inline-grid; place-items: center; width: 1.1em; height: 1.1em; border-radius: 0.2em; background: #d7261e; color: #fff; font-family: var(--display); font-size: 0.9em; line-height: 1; box-shadow: inset 0 -0.08em 0 rgba(0, 0, 0, 0.25); }
button.card { text-align: left; cursor: pointer; color: inherit; font: inherit; }

/* Rookie Camp hub: progress, NEXT UP, one-line camps, small tiles */
.camp-progress { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; font-weight: 800; color: var(--gold); font-size: 14px; }
.camp-progress .bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(255,255,255,0.1); overflow: hidden; }
.camp-progress .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffd34d, #ff9a2e); }
.nextup { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; border-radius: 18px; padding: 14px 18px; color: #fff; font: inherit; background: linear-gradient(135deg, #ff9a2e, #ff5a1f); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25), 0 6px 0 #9c3008, 0 12px 26px rgba(0,0,0,0.35); transition: transform 0.1s; }
button.nextup { cursor: pointer; }
button.nextup:hover { transform: translateY(-2px); }
.nextup .nu-ico { font-size: 40px; width: 52px; text-align: center; flex: none; line-height: 1; }
.nextup .nu-k { font-size: 11px; font-weight: 900; letter-spacing: 0.14em; color: #ffe6cf; }
.nextup .nu-t { font-family: var(--display); font-size: clamp(19px, 2.6vw, 24px); line-height: 1.05; margin: 2px 0 3px; }
.nextup .nu-d { font-size: 13.5px; color: #ffe6cf; }
.nextup .nu-go { margin-left: auto; font-size: 24px; flex: none; }
.nextup.mastered { background: linear-gradient(135deg, #0b4a2a, #062a17); box-shadow: inset 0 0 0 2px var(--green), 0 12px 26px rgba(0,0,0,0.35); }
.nextup.mastered .nu-d { color: #bfeccf; }
.camps { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.camp-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.camp-card .ci { font-size: 30px; flex: none; }
.camp-card h3 { margin: 0 0 2px; font-size: 16px; }
.camp-card p { font-size: 12.5px; line-height: 1.3; }
.camp-card .st { margin-left: auto; flex: none; white-space: nowrap; font-size: 13px; color: rgba(255,255,255,0.3); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 4), 1fr); }
button.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 12px 6px 10px; text-align: center; }
.tile .ti { font-size: 32px; line-height: 1.1; }
.tile .tt { font-weight: 800; font-size: 14px; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; }
.tile .ts { font-size: 13px; letter-spacing: 1px; color: rgba(255,255,255,0.3); }
.tile .ts b, .camp-card .st b { color: var(--gold); font-weight: 400; }
.tile .new, .camp-card .new { background: var(--red); color: #fff; font-size: 10px; font-weight: 800; border-radius: 99px; padding: 1px 7px; letter-spacing: 0.04em; }
.tile .new { position: absolute; top: 6px; right: 6px; }
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(var(--cols-sm, 2), 1fr); }
  .camps { grid-template-columns: 1fr; }
  .nextup { padding: 12px 14px; gap: 10px; }
  .nextup .nu-ico { font-size: 32px; width: 40px; }
  button.tile { padding: 9px 6px 8px; gap: 3px; }
  .tile .ti { font-size: 26px; }
  .tile .tt { font-size: 13px; }
}

.division-strip { display: grid; gap: 14px; }
.division {
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03));
  border: 2px solid rgba(255,255,255,0.12);
}
.division.locked { opacity: 0.6; }
.division header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.division .dname { font-family: var(--display); font-size: 24px; }
.division .dsub { color: var(--muted); font-size: 13.5px; }
.division .stars-total { margin-left: auto; font-weight: 900; color: var(--gold); }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.game-tile {
  border: 0; cursor: pointer; text-align: left;
  border-radius: 14px; padding: 12px;
  background: var(--navy-2);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.12);
  color: var(--ink);
  display: grid; gap: 4px;
}
.game-tile .gt { font-weight: 900; }
.game-tile .gr { font-size: 12.5px; color: var(--muted); }
.game-tile .st { color: var(--gold); letter-spacing: 2px; font-size: 18px; }
.game-tile[disabled] { opacity: 0.45; cursor: not-allowed; }
.lockmsg { font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 0; cursor: pointer; border-radius: 999px; padding: 8px 14px; font-weight: 800; background: rgba(255,255,255,0.08); color: var(--ink); }
.tab.on { background: var(--gold); color: #241a00; }

/* ---------- Locker ---------- */
.locker { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.locker-preview { background: radial-gradient(circle at 50% 70%, #2d7a34, #18451d); border-radius: 20px; min-height: 320px; position: relative; overflow: hidden; border: 2px solid rgba(255,255,255,0.15); }
.locker-preview canvas { width: 100%; height: 100%; display: block; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 18px; }
.swatch {
  width: 54px; height: 54px; border-radius: 14px; cursor: pointer; border: 3px solid rgba(255,255,255,0.2);
  position: relative;
}
.swatch.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,211,77,0.35); }
.swatch.locked::after { content: '🔒'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.55); border-radius: 10px; font-size: 18px; }
.locker h3 { margin: 6px 0; }
.locker small { color: var(--muted); }
.name-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.name-big { font-family: var(--display); font-size: 24px; color: var(--gold); }

/* ---------- Stats ---------- */
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.stat { background: rgba(255,255,255,0.06); border-radius: 14px; padding: 12px; }
.stat .v { font-family: var(--display); font-size: 26px; color: var(--gold); }
.stat .k { color: var(--muted); font-size: 13px; }
.bars { display: grid; gap: 8px; margin-top: 14px; }
.barrow { display: grid; grid-template-columns: 150px 1fr 54px; gap: 10px; align-items: center; font-size: 14px; }
.barrow .track { height: 12px; background: rgba(255,255,255,0.1); border-radius: 99px; overflow: hidden; }
.barrow .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #b9f36b); }

/* ---------- Settings ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.setting .lbl b { display: block; }
.setting .lbl small { color: var(--muted); }
.seg { display: inline-flex; background: rgba(255,255,255,0.08); border-radius: 999px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; cursor: pointer; font-weight: 800; color: var(--ink); }
.seg button.on { background: var(--gold); color: #251b00; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.bug {
  position: absolute;
  top: calc(10px + var(--safe-top)); left: calc(10px + var(--safe-l));
  background: rgba(8,14,34,0.88);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 6px 10px 8px;
  min-width: 132px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.bug-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 900; letter-spacing: 1px; color: var(--muted); }
.bug-div { color: var(--gold); }
.bug-body { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.bug-diamond { position: relative; width: 38px; height: 30px; }
.bug-diamond i {
  position: absolute; width: 12px; height: 12px; transform: rotate(45deg);
  border: 2px solid rgba(255,255,255,0.5); background: transparent;
}
.bug-diamond i[data-b="2"] { left: 13px; top: 1px; }
.bug-diamond i[data-b="3"] { left: 2px; top: 13px; }
.bug-diamond i[data-b="1"] { left: 24px; top: 13px; }
.bug-diamond i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgba(255,211,77,0.8); }
.count { font-family: var(--display); font-size: 20px; line-height: 1; }
.count b { font-weight: 400; }
.outs { display: flex; gap: 4px; margin-top: 4px; }
.outs i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); }
.outs i.on { background: var(--red); border-color: var(--red); }

.scorebox {
  position: absolute; top: calc(10px + var(--safe-top)); right: calc(62px + var(--safe-r));
  text-align: right;
}
.score { font-family: var(--display); font-size: clamp(22px, 3.6vw, 32px); text-shadow: 0 3px 0 rgba(0,0,0,0.45); }
.streak { font-weight: 900; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,0.5); font-size: 15px; min-height: 18px; }
.streak.fire { color: #ff8a1f; animation: firePulse 0.6s infinite alternate; }
@keyframes firePulse { from { transform: scale(1); } to { transform: scale(1.12); } }
.lives { font-size: 18px; letter-spacing: 2px; }
.pause-btn {
  position: absolute; top: calc(10px + var(--safe-top)); right: calc(10px + var(--safe-r));
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.18);
  background: rgba(8,14,34,0.8); color: #fff; font-size: 14px; pointer-events: auto; cursor: pointer;
}
.progress {
  position: absolute; top: calc(14px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px;
}
.progress i { width: 14px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.25); }
.progress i.ok { background: var(--green); }
.progress i.bad { background: var(--red); }
.progress i.cur { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.progress.many { gap: 3px; max-width: min(46vw, 420px); flex-wrap: wrap; justify-content: center; }
.progress.many i { width: 7px; height: 7px; border-radius: 50%; }

/* Behind the plate: are you in the slot? Sits under the count so it never covers the plate */
.slot-chip {
  position: absolute; top: calc(82px + var(--safe-top)); left: calc(10px + var(--safe-l));
  background: rgba(8,14,34,0.82); border: 2px solid rgba(53,208,127,0.7); border-radius: 99px;
  padding: 3px 10px; font-weight: 900; font-size: 12px; letter-spacing: 0.5px; color: #c8f5dc;
  pointer-events: none; white-space: nowrap;
}
.slot-chip.bad { border-color: var(--red); color: #ffd0d0; animation: chipPulse 0.9s ease-in-out infinite alternate; }
@keyframes chipPulse { from { box-shadow: 0 0 0 rgba(255,80,80,0); } to { box-shadow: 0 0 12px rgba(255,80,80,0.7); } }

.prompt {
  position: absolute; top: calc(70px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  text-align: center; width: min(92vw, 720px);
  transition: opacity 0.2s;
}
.prompt-main {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(18px, 3.4vw, 30px);
  text-shadow: 0 3px 0 rgba(0,0,0,0.55), 0 0 18px rgba(0,0,0,0.5);
  line-height: 1.1;
}
.prompt-main:empty, .prompt-sub:empty { display: none; }
.prompt-sub {
  margin-top: 6px;
  display: inline-block;
  background: rgba(8,14,34,0.82);
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: clamp(13px, 1.9vw, 16px);
}
.prompt.flash .prompt-main { animation: promptFlash 0.5s ease-out; }
@keyframes promptFlash { 0% { transform: scale(1.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.stamp {
  position: absolute; left: 50%; top: 40%;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-family: var(--display);
  font-size: clamp(40px, 10vw, 110px);
  color: #fff;
  -webkit-text-stroke: 3px #0b1530;
  text-shadow: 0 6px 0 #0b1530, 0 0 40px rgba(0,0,0,0.5);
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
}
.stamp.go { animation: stampIn 1.1s cubic-bezier(.2,1.4,.4,1) forwards; }
.stamp.good { color: var(--green); }
.stamp.bad { color: var(--red); }
.stamp.gold { color: var(--gold); }
.stamp.low { top: 74%; }
@keyframes stampIn {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(2.2); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1.03); }
  100% { opacity: 0; transform: translate(-50%, -60%) rotate(-6deg) scale(0.96); }
}

.lower3 {
  position: absolute; left: calc(10px + var(--safe-l)); top: calc(138px + var(--safe-top));
  display: flex; align-items: stretch; max-width: min(44vw, 380px);
  opacity: 0; transform: translateX(-120%) skewX(-8deg);
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.45));
}
.lower3.go { animation: l3In 3.8s cubic-bezier(.2,1.2,.3,1) forwards; }
.l3-num {
  font-family: var(--display); font-size: 30px; line-height: 1; color: #fff;
  background: linear-gradient(160deg, #ff4253, #a3121f); padding: 10px 12px 8px; border-radius: 10px 0 0 10px;
  display: flex; align-items: center; text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.l3-num small { font-size: 15px; opacity: 0.8; margin-right: 1px; }
.l3-txt { background: rgba(8,14,34,0.92); padding: 6px 14px 7px 12px; border-radius: 0 10px 10px 0; border-bottom: 3px solid var(--gold); min-width: 0; }
.l3-k { font-size: 10.5px; font-weight: 900; letter-spacing: 2px; color: var(--gold); }
.l3-n { font-family: var(--display); font-size: clamp(16px, 2.4vw, 22px); line-height: 1.05; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l3-n b { font-weight: 400; color: #fff; }
.l3-s { font-size: 11.5px; font-weight: 700; color: #c9d3ee; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes l3In {
  0% { opacity: 0; transform: translateX(-120%) skewX(-8deg); }
  12% { opacity: 1; transform: translateX(0) skewX(-8deg); }
  88% { opacity: 1; transform: translateX(0) skewX(-8deg); }
  100% { opacity: 0; transform: translateX(-120%) skewX(-8deg); }
}

.floaters { position: absolute; inset: 0; }
.floater {
  position: absolute; font-family: var(--display); font-size: 22px; color: var(--gold);
  text-shadow: 0 3px 0 rgba(0,0,0,0.6);
  animation: floatUp 1.3s ease-out forwards;
  white-space: nowrap;
}
.floater.bad { color: var(--red); }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -70px); } }

.timerbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(118px + var(--safe-bot)); width: min(60vw, 420px); height: 6px; border-radius: 99px; background: rgba(255,255,255,0.15); overflow: hidden; opacity: 0; transition: opacity 0.2s; }
.timerbar.on { opacity: 1; }
.timerbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); transform-origin: left; }

.options {
  position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-bot));
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 0 calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l));
  pointer-events: none;
}
.opt {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 150px; max-width: 360px;
  flex: 0 1 auto;
  border: 0; border-radius: 16px;
  padding: 12px 16px;
  font-weight: 900; font-size: clamp(14px, 2vw, 17px);
  text-align: left;
  cursor: pointer;
  color: #fff;
  background: rgba(8,14,34,0.92);
  box-shadow: inset 0 0 0 3px var(--c, rgba(255,255,255,0.25)), 0 6px 0 rgba(0,0,0,0.45);
  animation: optIn 0.25s cubic-bezier(.2,1.3,.4,1) backwards;
  line-height: 1.15;
}
.opt[data-btn="A"] { --c: var(--pad-a); }
.opt[data-btn="B"] { --c: var(--pad-b); }
.opt[data-btn="X"] { --c: var(--pad-x); }
.opt[data-btn="Y"] { --c: var(--pad-y); }
.opt small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
.opt:active, .opt.hit { transform: translateY(3px) scale(0.98); background: var(--c); }
.opt.big { min-width: min(42vw, 260px); justify-content: center; white-space: nowrap; font-family: var(--display); font-weight: 400; font-size: clamp(20px, 3.6vw, 30px); padding: 16px 20px; }
.options.locked .opt { opacity: 0.5; }
/* TRY AGAIN after a missed call: make it the obvious choice */
.opt.hot, .btn.hot { border-color: var(--gold) !important; box-shadow: 0 0 0 2px rgba(255,211,77,0.35), 0 0 22px rgba(255,211,77,0.45); animation: hotPulse 1.1s ease-in-out infinite alternate; }
.btn.hot, .opt.hot { background: var(--gold); color: #251b00; font-family: var(--display); font-weight: 400; }
.opt.hot small { color: #4a3800; }
@keyframes hotPulse { from { transform: scale(1); } to { transform: scale(1.05); } }
.vpractice { display: inline-block; vertical-align: middle; font-family: var(--body); font-size: 12px; font-weight: 900; letter-spacing: 1px; color: #251b00; background: var(--gold); border-radius: 999px; padding: 3px 9px; margin-left: 6px; }
@keyframes optIn { from { opacity: 0; transform: translateY(20px) scale(0.9); } }
body[data-input="touch"] .opt { min-height: 58px; }

.kzone {
  position: absolute; right: calc(14px + var(--safe-r)); top: calc(66px + var(--safe-top));
  background: rgba(8,14,34,0.88);
  border: 2px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  padding: 8px;
  animation: screenIn 0.2s ease-out;
  width: 190px;
}
.kzone canvas { width: 172px; height: 203px; display: block; }
.kz-label { text-align: center; font-weight: 800; font-size: 13px; margin-top: 4px; }

.coach-tip {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(110px + var(--safe-bot));
  width: min(92vw, 560px);
  background: #fff8db; color: #2a2100;
  border-radius: 14px; padding: 10px 14px 10px 54px;
  font-weight: 600; font-size: 14.5px; line-height: 1.35;
  box-shadow: 0 8px 22px rgba(0,0,0,0.4);
  animation: screenIn 0.25s ease-out;
}
.coach-tip::before { content: '🧢'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.coach-tip b { color: #000; }

/* Setting up in the slot: the catcher and the plate are at the bottom of the screen, so keep it clear */
.hud[data-mode="slot"] .options { justify-content: flex-end; }
.hud[data-mode="slot"] .opt.big { min-width: 0; flex: 0 0 auto; padding: 11px 18px; font-size: clamp(16px, 2.4vw, 22px); }
.hud[data-mode="slot"] .coach-tip {
  left: auto; right: calc(10px + var(--safe-r)); transform: none;
  top: calc(140px + var(--safe-top)); bottom: auto;
  width: min(44vw, 380px); font-size: 13px; line-height: 1.3; padding: 8px 12px 8px 42px;
}
.hud[data-mode="slot"] .coach-tip::before { font-size: 22px; left: 10px; }
body.portrait .hud[data-mode="slot"] .coach-tip { right: auto; left: 50%; transform: translateX(-50%); width: min(92vw, 440px); top: calc(222px + var(--safe-top)); }

.verdict {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(94vw, 620px);
  max-height: calc(100% - 24px - var(--safe-top) - var(--safe-bot));
  overflow-y: auto;
  pointer-events: auto;
  background: linear-gradient(170deg, #17295a, #0b1530 60%);
  border-radius: 22px;
  border: 3px solid var(--vc, var(--green));
  padding: 18px 20px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: verdictIn 0.35s cubic-bezier(.2,1.3,.4,1);
}
@keyframes verdictIn { from { opacity: 0; transform: translate(-50%, -40%) scale(0.92); } }
.verdict.bad { --vc: var(--red); }
.verdict .vhead { display: flex; align-items: center; gap: 12px; }
.verdict .vicon { font-size: 40px; }
.verdict .vtitle { font-family: var(--display); font-size: clamp(24px, 4.4vw, 34px); color: var(--vc, var(--green)); line-height: 1; }
.verdict .vsub { color: var(--muted); font-weight: 700; font-size: 14px; margin-top: 4px; }
.verdict .vbody { margin: 12px 0; font-size: 15.5px; line-height: 1.45; }
.verdict .vbody p { margin: 0 0 8px; }
.verdict .vcall { background: rgba(255,255,255,0.07); border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 14.5px; }
.verdict .vcall b { color: var(--gold); }
.verdict .points { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.verdict .pt { background: rgba(255,255,255,0.08); border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 13px; }
.verdict .pt.plus { color: var(--green); }
.verdict .pt.minus { color: var(--red); }
.verdict .pt.mult { color: var(--gold); }
.verdict .vfoot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin-top: 8px; }
.verdict .lesson { font-weight: 700; font-size: 14px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.rulecard-mini { display: flex; gap: 10px; align-items: center; background: rgba(255,211,77,0.12); border: 1px solid rgba(255,211,77,0.4); border-radius: 12px; padding: 8px 10px; font-size: 13.5px; margin-top: 8px; }
.rulecard-mini .rc-ico { font-size: 24px; }

.coach-card { display: flex; gap: 14px; align-items: flex-start; margin: 12px 0; }
.coach-face { width: 74px; height: 74px; flex: none; }
.bubble { background: #fff; color: #1a1a1a; border-radius: 16px; padding: 12px 14px; font-weight: 700; position: relative; font-size: 16px; line-height: 1.35; }
.bubble::before { content: ''; position: absolute; left: -10px; top: 22px; border: 6px solid transparent; border-right: 10px solid #fff; }
.bubble .who { display: block; font-size: 12px; color: #7a7a7a; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }

/* ---------- Results ---------- */
.results { text-align: center; max-width: 640px; margin: 0 auto; padding-top: 2vh; }
.results h2 { font-family: var(--display); font-size: clamp(30px, 6vw, 54px); margin: 6px 0; }
.big-stars { font-size: clamp(44px, 9vw, 72px); letter-spacing: 8px; }
.big-stars .s { display: inline-block; color: rgba(255,255,255,0.18); }
.big-stars .s.on { color: var(--gold); animation: starPop 0.5s cubic-bezier(.2,1.6,.4,1) backwards; text-shadow: 0 0 24px rgba(255,211,77,0.6); }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); } }
.results .rows { display: grid; gap: 6px; margin: 16px 0; text-align: left; }
.results .rowline { display: flex; justify-content: space-between; background: rgba(255,255,255,0.06); padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.results .rowline span:last-child { color: var(--gold); }
.results .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.xp-gain { font-family: var(--display); color: var(--green); font-size: 20px; }
.newbadges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.newbadges .nb { background: rgba(255,211,77,0.15); border: 1px solid var(--gold); padding: 6px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; top: calc(70px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #2a1d00, #4a3500);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 10px 16px 10px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 30px rgba(255,211,77,0.25);
  animation: toastIn 0.5s cubic-bezier(.2,1.4,.4,1), toastOut 0.4s ease-in 3.6s forwards;
  min-width: 260px;
}
.toast .ti { font-size: 34px; }
.toast .tk { font-size: 11px; font-weight: 900; letter-spacing: 2px; color: var(--gold); }
.toast .tt { font-weight: 900; font-size: 16px; }
.toast .td { font-size: 12.5px; color: #e9d9a6; }
.toast.level { background: linear-gradient(135deg, #062a17, #0b4a2a); border-color: var(--green); }
.toast.level .tk { color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-30px) scale(0.8); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-20px); } }

/* Name picker */
.slot-machine { display: flex; gap: 10px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.slot { background: #fff; color: var(--navy); font-family: var(--display); font-size: clamp(20px, 4vw, 30px); padding: 12px 18px; border-radius: 14px; min-width: 150px; text-align: center; box-shadow: inset 0 -5px 0 #c8cfe3; }
.slot.spin { animation: spin 0.12s linear infinite; }
@keyframes spin { 0% { transform: translateY(-3px); } 50% { transform: translateY(3px); } 100% { transform: translateY(-3px); } }

.modal-center { display: grid; place-items: center; min-height: 100%; }
.panel {
  background: linear-gradient(170deg, #17295a, #0b1530 70%);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 22px;
  padding: 22px;
  width: min(94vw, 560px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  text-align: center;
}
.panel h2 { font-family: var(--display); margin: 0 0 8px; font-size: clamp(24px, 4vw, 32px); }
.panel p { color: var(--muted); }
.stack { display: grid; gap: 10px; margin-top: 14px; }

.howto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; text-align: left; }
.howto .card p { font-size: 13.5px; }
.keys { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }

@media (max-width: 760px) {
  .title-screen { grid-template-columns: 1fr; gap: 14px; align-items: start; }
  .logo { font-size: clamp(40px, 13vw, 70px); }
  .tagline { margin-top: 10px; }
  .menu-row { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .menu-mini { font-size: 11px; padding: 10px 4px; }
  .locker { grid-template-columns: 1fr; }
  .locker-preview { min-height: 240px; }
  .barrow { grid-template-columns: 110px 1fr 46px; font-size: 13px; }
  .opt { min-width: 0; flex: 1 1 40%; padding: 10px 12px; }
  .opt.big { min-width: 0; flex: 1 1 40%; }
  .kzone { width: 140px; top: auto; bottom: calc(150px + var(--safe-bot)); }
  .kzone canvas { width: 122px; height: 144px; }
  .bug { min-width: 0; padding: 5px 8px 6px; }
  .count { font-size: 17px; }
}
@media (max-height: 480px) {
  .prompt { top: calc(54px + var(--safe-top)); }
  .hud[data-mode="slot"] .coach-tip { top: calc(118px + var(--safe-top)); font-size: 12px; width: min(40vw, 340px); }
  .lower3 { top: calc(124px + var(--safe-top)); max-width: 34vw; }
  .l3-num { font-size: 22px; padding: 6px 8px; }
  .l3-s { display: none; }
  .opt { padding: 8px 12px; }
  .opt.big { padding: 10px 14px; font-size: 20px; }
  .verdict { padding: 12px 14px; }
  .verdict .vbody { font-size: 14px; margin: 8px 0; }
  .timerbar { bottom: calc(84px + var(--safe-bot)); }
  .coach-tip { bottom: calc(80px + var(--safe-bot)); }
  .kzone { top: calc(54px + var(--safe-top)); bottom: auto; }
}
@media (max-height: 520px) {
  .title-screen { gap: 14px; }
  .logo { font-size: min(15vh, 8.5vw); }
  .logo-kicker { font-size: 10px; margin-bottom: 6px; }
  .tagline { font-size: 13px; margin-top: 8px; }
  .profile-chip { margin-top: 10px; padding: 6px 10px; }
  .profile-chip .lvl { width: 36px; height: 36px; font-size: 15px; }
  .title-screen .controls-hint, .title-screen .footer-note { display: none; }
  .menu { gap: 8px; }
  .menu-main { padding: 9px 12px; border-radius: 14px; }
  .menu-main .ico { font-size: 22px; width: 32px; }
  .menu-main .t { font-size: 16px; }
  .menu-main .d { font-size: 11.5px; }
  .menu-row { gap: 6px; }
  .sport-opt { padding: 6px 8px; font-size: 14px; }
  .menu-mini { padding: 6px 4px; font-size: 11px; border-radius: 10px; }
  .menu-mini .ico { font-size: 17px; }
  .screen { padding-top: calc(8px + var(--safe-top)); }
  .topbar { margin-bottom: 8px; }
  .panel { padding: 14px; }
  .panel h2 { font-size: 22px; }
  .big-stars { font-size: 40px; }
  .results h2 { font-size: 30px; }
  .results .rows { margin: 8px 0; gap: 4px; }
  .results .rowline { padding: 6px 12px; }
  .bug { top: calc(6px + var(--safe-top)); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01s !important; }
  /* keep key feedback visible: fade only, no motion */
  .stamp.go { animation: fadeHold 1.1s linear forwards !important; transform: translate(-50%, -50%) rotate(-6deg); }
  .lower3.go { animation: fadeHold 3.8s linear forwards !important; transform: skewX(-8deg); }
  .floater { animation: fadeHold 1.3s linear forwards !important; transform: translate(-50%, 0); }
}
@keyframes fadeHold { 0% { opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
