* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #12301b;
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color: #eefbf0;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }

/* ============ screens ============ */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; background: rgba(6,20,11,.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow-y: auto; }
.panel { text-align: center; padding: 22px 18px; width: min(420px, 94vw); animation: pin .3s ease; }
@keyframes pin { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.logo { line-height: 1; filter: drop-shadow(0 6px 18px rgba(81,207,102,.35)); }
.logo svg { display: block; margin: 0 auto; }
h1 { font-size: 42px; font-weight: 900; letter-spacing: 2px; line-height: 1; }
h1 span { display: block; font-size: 22px; letter-spacing: 7px; background: linear-gradient(135deg, #a9e34b, #51cf66, #ffd43b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tag { color: rgba(238,251,240,.62); font-weight: 600; margin: 8px 0 14px; font-size: 14px; }

/* career ladder */
.tierRow { margin: 2px 0 14px; }
.tierRow .lbl { display: block; color: rgba(238,251,240,.6); font-size: 11px; font-weight: 800; letter-spacing: .6px; margin-bottom: 8px; }
.ladder { display: flex; flex-direction: column; gap: 7px; }
.ladder button {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 2px solid #245c31; background: #163a20; color: #eefbf0;
  border-radius: 14px; padding: 8px 12px; font-weight: 800; cursor: pointer;
  min-height: 52px; width: 100%;
}
.ladder .lrank { font-size: 15px; font-weight: 900; width: 20px; flex-shrink: 0; color: rgba(238,251,240,.5); }
.ladder .lmain { flex: 1; min-width: 0; }
.ladder .lname { font-size: 14px; display: block; }
.ladder .lblurb { display: block; font-size: 10.5px; font-weight: 700; opacity: .6; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ladder .ltag { font-size: 10px; font-weight: 900; letter-spacing: .5px; opacity: .7; }
.ladder .ltgt { font-size: 15px; font-weight: 900; color: #ffd43b; flex-shrink: 0; }
.ladder .ltgt small { display: block; font-size: 8.5px; font-weight: 800; color: rgba(238,251,240,.5); letter-spacing: .5px; }
.ladder button.sel { border-color: #ffd43b; box-shadow: 0 0 16px rgba(255,212,59,.28); background: #1d4527; }
.ladder button.lock { opacity: .5; }
.ladder button.lock .ltgt { color: rgba(238,251,240,.4); }

button.big {
  display: block; width: 100%; margin: 10px 0; padding: 15px 0 13px;
  font-size: 19px; font-weight: 900; letter-spacing: 1px;
  color: #0b3313; background: linear-gradient(135deg, #a9e34b, #51cf66);
  border: none; border-radius: 18px; cursor: pointer;
  box-shadow: 0 5px 0 #2f9e44, 0 10px 24px rgba(0,0,0,.45);
  min-height: 60px;
}
button.big small { display: block; font-size: 11px; font-weight: 700; opacity: .75; margin-top: 3px; letter-spacing: .2px; }
button.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #2f9e44; }
button.big.alt { color: #2a1354; background: linear-gradient(135deg, #d0bfff, #9775fa); box-shadow: 0 5px 0 #6741d9, 0 10px 24px rgba(0,0,0,.45); }
button.big.alt:active { box-shadow: 0 2px 0 #6741d9; }
.ghost { display: inline-block; background: none; border: none; color: rgba(238,251,240,.62); font-size: 14px; font-weight: 700; margin-top: 10px; text-decoration: none; padding: 10px; cursor: pointer; }
.best { color: #ffd43b; font-weight: 800; margin-top: 10px; min-height: 20px; font-size: 13px; line-height: 1.6; }

/* how-to strip on menu */
.howRow { display: flex; gap: 8px; margin: 4px 0 6px; }
.howCard { flex: 1; border-radius: 14px; padding: 10px 6px 9px; font-size: 11.5px; font-weight: 700; line-height: 1.45; color: rgba(238,251,240,.85); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.howCard b { display: block; font-size: 13px; margin-bottom: 2px; }
.howCard.grnd b { color: #a9e34b; }
.howCard.aer b { color: #ffd43b; }
.howCard.read b { color: #b197fc; }

/* ============ HUD ============ */
#hud { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 0; right: 0; max-width: 620px; margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 0 12px; z-index: 5; pointer-events: none; }
.chip { font-weight: 900; font-size: 13px; letter-spacing: .4px; background: rgba(5,18,9,.62); border: 1px solid rgba(255,255,255,.14); border-radius: 20px; padding: 7px 12px; white-space: nowrap; }
#scoreChip { color: #fff; font-size: 16px; }
#overChip { color: #a9e34b; }
#targetChip { color: #ffd43b; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; }
#quitBtn { pointer-events: auto; position: relative; width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; border: 1px solid rgba(255,255,255,.14); background: rgba(5,18,9,.62); color: #eefbf0; font-size: 15px; font-weight: 800; cursor: pointer; }
#quitBtn::after { content: ''; position: absolute; inset: -6px; }

/* pressure gauge — sits just under the HUD chips, climbs & reddens as the chase bites */
#pressureWrap {
  position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 44px); left: 50%; transform: translateX(-50%);
  z-index: 5; display: flex; align-items: center; gap: 7px; pointer-events: none;
  width: min(300px, 78vw);
}
#pressureWrap .pLbl {
  font-size: 9.5px; font-weight: 900; letter-spacing: .8px; white-space: nowrap;
  color: rgba(238,251,240,.72); text-shadow: 0 2px 6px rgba(0,0,0,.6); min-width: 58px; text-align: right;
}
#pressureWrap .pTrack {
  flex: 1; height: 7px; border-radius: 5px; overflow: hidden;
  background: rgba(5,18,9,.6); border: 1px solid rgba(255,255,255,.14);
}
#pressureWrap .pFill {
  height: 100%; width: 0%; border-radius: 5px;
  background: linear-gradient(90deg, #51cf66, #a9e34b);
  transition: width .5s ease, background .5s ease;
}
#pressureWrap.warn .pFill { background: linear-gradient(90deg, #ffd43b, #ffa94d); }
#pressureWrap.hot .pFill { background: linear-gradient(90deg, #ff8787, #ff6b6b); animation: pHot .7s ease-in-out infinite; }
@keyframes pHot { 50% { filter: brightness(1.4); } }
#pressureWrap.hot .pLbl { color: #ff8787; }

/* ONE pill token (fill/weight/radius) shared with the canvas banner + feedback plaque */
#commentary {
  position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 62px); left: 50%; transform: translateX(-50%);
  font-weight: 900; font-size: 15px; color: #eefbf0;
  text-shadow: 0 3px 12px rgba(0,0,0,.6);
  opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 6;
  background: rgba(10,24,14,.78); border-radius: 14px; padding: 7px 16px;
  border: 1px solid rgba(255,255,255,.12);
  white-space: nowrap; max-width: 94vw; overflow: hidden; text-overflow: ellipsis;
}
#commentary.show { opacity: 1; }

/* verdict plate: skewed dark-glass slab, rimmed in the event colour, anchored at
   the stand line — a designed broadcast graphic, not text floating in the sky */
#bigMsg {
  position: fixed; top: 31%; left: 50%; transform: translate(-50%,-50%) skewX(-6deg);
  font-size: min(40px, 9.4vw); font-weight: 900; font-style: italic; letter-spacing: 1px;
  padding: 8px 26px; border-radius: 14px;
  background: linear-gradient(165deg, #20301c, #0d1a10);
  border: 2px solid var(--evc, #ffd43b);
  box-shadow: 0 14px 34px rgba(0,0,0,.55), 0 0 22px rgba(0,0,0,.35);
  -webkit-text-stroke: 1px rgba(8,16,10,.55);
  text-shadow: 0 3px 10px rgba(0,0,0,.6);
  opacity: 0; pointer-events: none; z-index: 8;
  white-space: nowrap; max-width: 96vw;
}
#bigMsg.show { animation: bigPop 1.3s ease; }
#bigMsg.mega { font-size: min(48px, 10.8vw); }
@keyframes bigPop { 0% { transform: translate(-50%,-50%) skewX(-6deg) scale(.25); opacity: 0; } 20% { transform: translate(-50%,-50%) skewX(-6deg) scale(1.18); opacity: 1; } 78% { opacity: 1; transform: translate(-50%,-50%) skewX(-6deg) scale(1); } 100% { transform: translate(-50%,-50%) skewX(-6deg) scale(.98); opacity: 0; } }

/* ============ bottom: drive/loft shot grid + over strip on top ============ */
#bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  padding: 0 14px max(12px, env(safe-area-inset-bottom));
  pointer-events: none;
}
#controls { display: flex; gap: 8px; align-items: flex-end; justify-content: space-between; pointer-events: auto; }
.shotCol { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: auto; }
#overStrip {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center;
  min-height: 26px; margin: 0 auto 6px; pointer-events: none;
}
#overStrip .lab { width: 100%; text-align: center; font-size: 9.5px; font-weight: 900; letter-spacing: 1.5px; color: rgba(238,251,240,.6); }
.ob {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900;
  background: rgba(5,18,9,.62); border: 1.5px solid rgba(255,255,255,.18); color: rgba(238,251,240,.85);
  transition: transform .15s;
}
.ob.empty { background: rgba(5,18,9,.35); border-style: dashed; color: transparent; }
.ob.b4 { background: #2b8a3e; border-color: #51cf66; color: #fff; }
.ob.b6 { background: #b0872a; border-color: #ffd43b; color: #fff; box-shadow: 0 0 10px rgba(255,212,59,.5); }
.ob.bw { background: #a03030; border-color: #ff8787; color: #fff; }
.ob.pop { animation: obPop .3s ease; }
@keyframes obPop { 40% { transform: scale(1.45); } }

/* shot buttons: the end-modal's dark-glass language — deep glass fill, 2px ring,
   soft glow. GROUND = big round bat button (safe). LOFT = a hot gold pill above it
   (the six-or-out upgrade), so the risk/reward choice is legible at a glance. */
.shotBtn {
  flex-shrink: 0; padding: 0; position: relative;
  font-weight: 900; letter-spacing: 1px;
  background: rgba(10,24,14,.78);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  transition: transform .08s, filter .08s;
}
.shotBtn::-moz-focus-inner { border: 0; }
.shotBtn::before { content: ''; position: absolute; inset: -8px; }

/* GROUND — big round drive button */
.shotBtn.ground { width: 84px; height: 84px; border-radius: 50%; }
.shotBtn.ground::before { border-radius: 50%; }
.shotBtn.ground::after {
  content: ''; position: absolute; left: 18%; top: 6%; width: 64%; height: 30%;
  border-radius: 50%; pointer-events: none;
  background: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.02));
}
#btnLeg {
  border: 2px solid #ff922b; color: #ffc078;
  box-shadow: 0 0 16px rgba(255,146,43,.35), inset 0 0 14px rgba(255,146,43,.10), 0 6px 16px rgba(0,0,0,.5);
}
#btnOff {
  border: 2px solid #4dabf7; color: #a5d8ff;
  box-shadow: 0 0 16px rgba(77,171,247,.35), inset 0 0 14px rgba(77,171,247,.10), 0 6px 16px rgba(0,0,0,.5);
}
.shotBtn.ground .ico { display: block; width: 28px; height: 28px; margin: 12px auto 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.shotBtn.ground .ico.flip { transform: scaleX(-1); }
.shotBtn.ground b { display: block; font-size: 15px; margin-top: 2px; text-shadow: 0 2px 4px rgba(0,0,0,.5); }

/* LOFT — gold six-or-out pill */
.shotBtn.loft {
  width: 84px; min-height: 46px; border-radius: 16px;
  border: 2px solid #ffd43b; color: #ffe8a3;
  box-shadow: 0 0 16px rgba(255,212,59,.30), inset 0 0 12px rgba(255,212,59,.08), 0 5px 14px rgba(0,0,0,.5);
  padding: 5px 0 6px;
}
.shotBtn.loft .kico { display: block; font-size: 15px; line-height: 1; }
.shotBtn.loft b { display: block; font-size: 12.5px; letter-spacing: .5px; text-shadow: 0 2px 4px rgba(0,0,0,.5); }
.shotBtn.loft small { display: block; font-size: 8px; font-weight: 800; opacity: .62; letter-spacing: .5px; }

.shotBtn:active { transform: translateY(3px) scale(.94); filter: brightness(.9); }
.shotBtn.pressed { animation: btnPress .16s ease; }
@keyframes btnPress { 0% { transform: translateY(3px) scale(.86); filter: brightness(1.4); } 100% { transform: none; filter: none; } }
.shotBtn.glow { animation: btnGlow .5s ease-in-out infinite; }
#btnLeg.glow { box-shadow: 0 0 26px 6px rgba(255,146,43,.8); }
#btnOff.glow { box-shadow: 0 0 26px 6px rgba(77,171,247,.8); }
.shotBtn.loft.glow { box-shadow: 0 0 26px 6px rgba(255,212,59,.85); }
@keyframes btnGlow { 50% { filter: brightness(1.25); } }
.shotBtn.armed { animation: btnArmed .55s ease-in-out infinite; }
#btnLeg.armed { box-shadow: 0 0 30px 9px rgba(255,146,43,.95); }
#btnOff.armed { box-shadow: 0 0 30px 9px rgba(77,171,247,.95); }
.shotBtn.loft.armed { box-shadow: 0 0 30px 9px rgba(255,212,59,.95); }
@keyframes btnArmed { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.55); } }

@media (max-width: 374px) {
  .shotBtn.ground { width: 76px; height: 76px; }
  .shotBtn.ground .ico { width: 25px; height: 25px; margin-top: 10px; }
  .shotBtn.loft { width: 76px; min-height: 42px; }
  .ob { width: 19px; height: 19px; font-size: 10px; }
  #overStrip { gap: 3px; }
}
@media (max-height: 680px) {
  .shotBtn.ground { width: 72px; height: 72px; }
  .shotBtn.ground .ico { margin-top: 8px; }
  .shotBtn.loft { min-height: 38px; }
}
