/* MAVTRAX — navy + green brand. Built for a phone in bright sun, mid-game:
   huge tap targets, high contrast, zero ambiguity. */
:root {
  --navy:    #0e1d3a;   /* brand navy / background */
  --navy-2:  #16284c;   /* panels */
  --navy-3:  #1d3460;   /* raised */
  --green:   #5cb83a;   /* brand green / primary action */
  --green-d: #4aa02e;
  --ink:     #f2f6ff;
  --muted:   #9fb2d4;
  --line:    #243a64;
  /* pitch family accents (functional color-coding for fast recognition) */
  --fastball: #ff5a4d;
  --twoseam:  #ffa53b;
  --slider:   #3f9bff;
  --changeup: #16c0b0;
  --special:  #b27bff;
  --ok: var(--green);
  --warn: #ffbf3f;
}

/* ☀️ Sunlight / Day mode — high-contrast light palette for bright-field readability.
   Flips every component via the same vars; pitch family colors stay vivid (pop on white). */
:root[data-theme="day"] {
  --navy:   #eef1f8;   /* app background (light) */
  --navy-2: #ffffff;   /* panels / cells */
  --navy-3: #dde4f1;   /* raised */
  --green:  #2f8f1c;   /* deeper green for contrast on white */
  --green-d:#277a17;
  --ink:    #0c1830;   /* text — near-black navy */
  --muted:  #455774;
  --line:   #b9c5da;
}
[data-theme="day"] .overlay { background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #e7edf7 70%); }
[data-theme="day"] .zone { background: linear-gradient(180deg, #ffffff, #e9eef7); }
[data-theme="day"] .modal { background: rgba(20,40,70,.45); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--navy);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  user-select: none; -webkit-user-select: none;
  /* Top/sides inset here; the footer owns the BOTTOM inset (avoids double-padding). */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

/* ---- Brandmark (logo or fallback wordmark) ---- */
.brand-block { display: flex; flex-direction: column; align-items: center; }
.logo-img { width: min(300px, 74vw); height: auto; display: block; }
.logo-img.missing { display: none; }
.logo-img.missing ~ .logo-fallback { display: block; }
.logo-fallback { display: none; text-align: center; }
.wordmark { font-size: 56px; font-weight: 900; letter-spacing: 1px; font-style: italic; }
.wordmark span { color: var(--green); }
.tagline { color: var(--green); font-size: 13px; font-weight: 800; letter-spacing: 3px; margin-top: 4px; }

/* ---- Overlays (paywall + gate) ---- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: radial-gradient(120% 90% at 50% 0%, #16284c 0%, #0e1d3a 70%);
  display: flex; flex-direction: column; overflow-y: auto;   /* scroll-safe: tall content never clips the top */
  transition: opacity .25s ease;
}
.overlay[hidden] { display: none; }
.overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-inner { text-align: center; padding: 28px; max-width: 420px; width: 100%; margin: auto; box-sizing: border-box; }
.brand-mount { margin-bottom: 22px; }

.cta {
  display: inline-block; width: 100%; max-width: 320px;
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  padding: 20px 32px; border-radius: 16px; border: 0;
  background: var(--green); color: #06210a;
  box-shadow: 0 10px 30px rgba(92,184,58,.35);
  transition: transform .1s ease, filter .15s ease;
}
.cta:active { transform: scale(.97); filter: brightness(1.05); }
.cta.armed { animation: glow 2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 10px 40px rgba(92,184,58,.6); } }

.linklike { background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 700; margin-top: 18px; text-decoration: underline; }
.status-line { color: var(--muted); margin-top: 20px; font-size: 14px; min-height: 18px; }

.overlay-inner .big { font-size: 34px; font-weight: 900; margin: 4px 0 18px; color: var(--green); }
.plans { display: flex; flex-direction: column; gap: 12px; }
.plan {
  position: relative; text-align: left; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--navy-2); border: 2px solid var(--line); border-radius: 16px;
  padding: 18px 20px; color: var(--ink); font-family: inherit;
  transition: transform .08s ease, border-color .15s ease;
}
.plan:active { transform: scale(.98); }
.plan.hero { border-color: var(--green); box-shadow: 0 8px 24px rgba(92,184,58,.25); }
.plan-tag { position: absolute; top: -10px; left: 16px; background: var(--green); color: #06210a; font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 6px; }
.plan-info { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.plan-name { font-size: 19px; font-weight: 800; line-height: 1.1; }
.plan-note { font-size: 13px; color: var(--muted); }
.plan-price { font-size: 26px; font-weight: 900; white-space: nowrap; line-height: 1; }
.plan-price small { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.disclosure { color: var(--muted); font-size: 12px; margin-top: 18px; line-height: 1.5; }
.disclosure a { color: var(--green); }
.text-input { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--navy); color: var(--ink); font-size: 16px; margin: 10px 0; }
textarea.text-input { resize: vertical; min-height: 96px; font-family: inherit; line-height: 1.45; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* Social sign-in (Google + Apple) */
.social-signin { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin: 4px 0 14px; }
.social-signin[hidden] { display: none; }
.gsi-btn { display: flex; justify-content: center; }
.apple-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 12px; border: 0; border-radius: 999px; background: #000; color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.apple-btn[hidden] { display: none; }
.apple-btn svg { margin-top: -2px; }
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.voice-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.voice-group { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 8px 2px 0; }
.voice-group:first-child { margin-top: 0; }
.speed-control { margin: 0 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--navy-2); }
.speed-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.speed-head span { font-weight: 800; font-size: 15px; }
.speed-head b { color: var(--green); font-weight: 900; font-size: 17px; }
.speed-control input[type="range"] { width: 100%; accent-color: var(--green); height: 30px; }
.speed-ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.voice-row { text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--navy); color: var(--ink); font-family: inherit; display: flex; flex-direction: column; gap: 2px; }
.voice-row.active { border-color: var(--green); background: var(--navy-3); }
.voice-name { font-size: 17px; font-weight: 800; }
.voice-row.active .voice-name::after { content: " ✓"; color: var(--green); }
.voice-desc { font-size: 13px; color: var(--muted); }
.modal-card a { color: var(--green); }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.brand-sm { font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: .5px; }
.brand-sm span { color: var(--green); }
/* Pitch-count + undo in the header (the repurposed TEST/Ready space) */
.pitchcount { display: flex; align-items: center; gap: 8px; }
.pc-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--navy-3); color: var(--ink); font-size: 26px; font-weight: 800; line-height: 1; font-family: inherit; }
.pc-btn:active { filter: brightness(1.25); }
.pc-readout { display: flex; flex-direction: column; align-items: center; min-width: 56px; line-height: 1; }
.pc-readout b { font-size: 24px; font-weight: 900; color: var(--green); }
.pc-unit { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

/* More menu rows */
.menu-row { display: block; width: 100%; text-align: left; padding: 15px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--navy); color: var(--ink); font-family: inherit; font-size: 16px; font-weight: 700; text-decoration: none; }
.menu-row:active { background: var(--navy-3); }
.theme-seg { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.theme-seg-label { font-size: 13px; font-weight: 800; color: var(--muted); margin-right: 2px; }
.theme-opt { flex: 1; padding: 11px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--navy); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 14px; }
.theme-opt.active { background: var(--green); color: #06210a; border-color: var(--green); }

/* Pitches | Plays mode toggle */
.mode-toggle { display: flex; gap: 5px; margin: 8px 16px 0; background: var(--navy-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.mode-btn { flex: 1; padding: 9px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-family: inherit; font-size: 15px; font-weight: 800; }
.mode-btn.active { background: var(--green); color: #06210a; }
.plays-bar { display: flex; gap: 8px; padding: 10px 16px 2px; }
.plays-bar[hidden] { display: none; }
.plays-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; max-height: 46vh; overflow-y: auto; }
.play-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--navy); color: var(--ink); font-weight: 700; font-size: 15px; }
.play-row .del { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 0; background: #4a1f24; color: #ff9a9a; font-size: 13px; font-weight: 800; }

/* ---- Pitcher bar ---- */
.pitcher-bar { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pitcher-bar::-webkit-scrollbar { display: none; }
.pchip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  background: var(--navy-2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 700;
  padding: 8px 14px; white-space: nowrap;
}
.pchip.active { background: var(--green); color: #06210a; border-color: var(--green); }
.pchip-count { font-size: 13px; font-weight: 800; background: rgba(0,0,0,.18); border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center; }
.pchip.active .pchip-count { background: rgba(0,0,0,.25); }
.pchip.add, .pchip.edit { color: var(--muted); font-weight: 800; }
.pchip.edit { padding: 8px 12px; }

/* ---- Arsenal toggle grid (roster editor) ---- */
.arsenal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 14px; }
.arsenal-toggle {
  position: relative; text-align: left; padding: 12px 12px 12px 26px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--navy);
  color: var(--muted); font-family: inherit; font-size: 14px; font-weight: 700;
}
.arsenal-toggle::before { content: ""; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 9px; height: 9px; border-radius: 50%; background: var(--fam, var(--muted)); opacity: .35; }
.arsenal-toggle.on { color: var(--ink); border-color: var(--fam, var(--green)); background: var(--navy-3); }
.arsenal-toggle.on::before { opacity: 1; box-shadow: 0 0 6px var(--fam, var(--green)); }
.modal-close.danger { background: #4a1f24; color: #ff9a9a; }
.arsenal-toggle.custom { padding-right: 30px; }
.arsenal-del { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; border: 0; background: #4a1f24; color: #ff9a9a; font-size: 13px; font-weight: 800; line-height: 1; }

/* ---- Count strip (pitch sequencing) ---- */
.count-strip { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 4px 10px 0; flex-wrap: wrap; }
.count-group { display: flex; align-items: center; gap: 3px; background: var(--navy-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 5px 3px 9px; }
.count-tag { font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.cbtn { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--navy-3); color: var(--ink); font-size: 17px; font-weight: 800; font-family: inherit; line-height: 1; }
.cbtn:active { filter: brightness(1.2); }
.cbtn.reset { background: none; color: var(--muted); font-size: 18px; }
.cnum { font-size: 18px; font-weight: 900; min-width: 16px; text-align: center; }
.count-strip.on .cnum { color: var(--green); }

/* ---- Last call banner ---- */
.last-call {
  margin: 10px 16px 6px; padding: 12px; border-radius: 12px;
  background: var(--navy-2); border: 1px solid var(--line);
  text-align: center; font-size: 17px; font-weight: 800; color: var(--muted);
}
.last-call.flash { animation: banner .5s ease; }
@keyframes banner { 0% { background: var(--green); color: #06210a; } 100% { background: var(--navy-2); } }

/* ---- Pitch grid: navy cards, family-colored accent bar, green hit flash ---- */
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.grid {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;          /* all rows share available height -> always fits, never scrolls */
  gap: 8px; padding: 6px 14px 10px; min-height: 0; overflow: hidden;
}
.grid[hidden] { display: none; } /* explicit display:grid otherwise overrides the hidden attr */
.pitch {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--navy-2); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: inherit; cursor: pointer;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25);
  transition: transform .06s ease, background .06s ease;
  touch-action: pan-y;
}
.pitch::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--fam, var(--green)); }
.pitch[data-family="fastball"] { --fam: var(--fastball); }
.pitch[data-family="twoseam"]  { --fam: var(--twoseam); }
.pitch[data-family="slider"]   { --fam: var(--slider); }
.pitch[data-family="changeup"] { --fam: var(--changeup); }
.pitch[data-family="special"]  { --fam: var(--special); }
.pitch:active { transform: scale(.97); background: var(--navy-3); }
.pitch.hit { animation: hit .4s ease; }
@keyframes hit {
  0% { box-shadow: 0 0 0 0 rgba(92,184,58,.85), inset 0 -4px 0 rgba(0,0,0,.25); background: var(--green); }
  100% { box-shadow: 0 0 0 16px rgba(92,184,58,0), inset 0 -4px 0 rgba(0,0,0,.25); background: var(--navy-2); }
}
.p-label { font-size: clamp(14px, 5vw, 25px); font-weight: 800; line-height: 1.05; }
.p-loc { font-size: clamp(10px, 3vw, 14px); font-weight: 800; color: var(--fam, var(--green)); letter-spacing: 1.5px; text-transform: uppercase; }

/* ===== Two-step caller (Pitches mode): pick a pitch, then paint the spot ===== */
.caller { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 8px 14px 10px; gap: 9px; }
.caller[hidden] { display: none; }

/* Step 1 — arsenal rail */
.arsenal-rail { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.arsenal-rail.nudge { animation: nudge .4s ease; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.arsenal-chip {
  flex: 0 0 auto; padding: 10px 16px; border-radius: 999px;
  border: 2px solid var(--fam, var(--line)); background: var(--navy-2);
  color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25);
  transition: transform .08s ease, background .12s ease, box-shadow .12s ease;
  touch-action: pan-y;
}
.arsenal-chip::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--fam, var(--green)); margin-right: 8px; vertical-align: middle; }
.arsenal-chip:active { transform: scale(.95); }
.arsenal-chip.sel { background: var(--fam, var(--green)); color: #08131f; border-color: var(--fam, var(--green)); box-shadow: 0 7px 20px -5px var(--fam, var(--green)); }
.arsenal-chip.sel::before { background: rgba(0,0,0,.45); }

/* Step indicator */
.zone-hint { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 24px; color: var(--muted); font-size: 13px; font-weight: 700; }
.zone-hint.set { color: var(--fam, var(--ink)); }
.zone-hint b { font-size: 18px; font-weight: 900; letter-spacing: .3px; }
.zone-hint span { text-transform: uppercase; letter-spacing: 1.6px; font-size: 11px; opacity: .85; }

/* Step 2 — strike zone target */
.zone-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.zone {
  width: 100%; max-width: 440px; aspect-ratio: 1 / 1; max-height: 100%;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 6px; padding: 10px; border-radius: 18px;
  background: linear-gradient(180deg, #122448, #0b1730);
  border: 1px solid var(--line);
  box-shadow: 0 14px 32px -14px rgba(0,0,0,.7);
  transition: box-shadow .2s ease;
}
.zone.armed { box-shadow: 0 0 36px -8px var(--fam, var(--green)), 0 14px 32px -14px rgba(0,0,0,.7); }
.zone-cell {
  border: 0; border-radius: 12px; background: var(--navy-3); color: var(--muted);
  font-family: inherit; font-weight: 800; font-size: clamp(11px, 3.1vw, 15px); line-height: 1.1;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.3);
  transition: transform .06s ease, background .1s ease, color .1s ease;
  touch-action: pan-y;
}
.zone.armed .zone-cell { color: var(--ink); background: var(--navy-2); box-shadow: inset 0 0 0 1.5px var(--fam, var(--green)), inset 0 -3px 0 rgba(0,0,0,.3); }
.zone-cell:active { transform: scale(.93); }
.zone-cell.off { opacity: .25; }
.zone-cell.hit { animation: zhit .5s ease; }
@keyframes zhit {
  0% { background: var(--fam, var(--green)); color: #08131f; box-shadow: 0 0 0 0 var(--fam, var(--green)); transform: scale(.93); }
  100% { background: var(--navy-2); box-shadow: inset 0 0 0 1.5px var(--fam, var(--green)); transform: scale(1); }
}

/* Quick actions — pitch out / talk to pitcher (single tap, no location) */
.quick-row { display: flex; gap: 8px; flex: 0 0 auto; }
.quick-btn {
  flex: 1; padding: 13px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--navy-2); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 15px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); transition: transform .06s ease;
  touch-action: pan-y;
}
.quick-btn:active { transform: scale(.97); }
.quick-btn.hit { animation: hit .4s ease; }
.quick-btn.say { flex: 0 0 auto; width: 58px; font-size: 22px; padding: 13px 0; }
/* Type-to-say recent phrases */
.say-recent { margin: 16px 0 4px; display: flex; flex-wrap: wrap; gap: 7px; }
.say-recent-head { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.say-recent-label { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.say-clear { background: none; border: 0; color: var(--muted); font-family: inherit; font-weight: 800; font-size: 12px; letter-spacing: .3px; padding: 4px 4px; cursor: pointer; }
.say-clear:active { color: var(--ink); }
/* chip = text half (say) + ✕ half (delete), split by a hairline */
.say-chip { display: inline-flex; align-items: stretch; border-radius: 999px; border: 1px solid var(--line); background: var(--navy-2); overflow: hidden; }
.say-chip-text { padding: 9px 8px 9px 13px; background: none; border: 0; color: var(--ink); font-family: inherit; font-weight: 700; font-size: 14px; text-align: left; }
.say-chip-text:active { transform: scale(.96); }
.say-chip-x { padding: 9px 12px; background: none; border: 0; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1; cursor: pointer; }
.say-chip-x:active { color: #ff8a8a; background: rgba(255,90,90,.14); }

/* ===== Teams (selector lives in the header, left of the pitch count) ===== */
.team-bar { min-width: 0; max-width: 58%; display: flex; }
.team-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 8px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--navy-2); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 15px; }
.team-chip .team-ico { flex: 0 0 auto; font-size: 14px; }
.team-chip .team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-chip .team-caret { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.team-chip:active { transform: scale(.97); }
.team-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.team-row { display: flex; align-items: stretch; gap: 6px; }
.team-row-name { flex: 1; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--navy-2); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 16px; }
.team-row.active .team-row-name { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.team-row-name small { font-weight: 600; font-size: 12px; color: var(--muted); }
.team-row-btn { width: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--navy-3); color: var(--ink); font-size: 16px; font-family: inherit; }
.team-row-btn.danger { color: #ff9a9a; background: #3a1f24; }

/* ===== Drag-to-reorder ===== */
.dragging { opacity: .96; box-shadow: 0 18px 40px -8px rgba(0,0,0,.7) !important; border-color: var(--fam, var(--green)) !important; }
.reorder-ph { border-radius: 14px; border: 2px dashed var(--fam, var(--line)); background: rgba(255,255,255,.05); list-style: none; }

/* ---- Bottom bar ---- */
.bottombar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--navy);
}
.foot-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 700; font-family: inherit; padding: 4px 4px; }
.foot-icon { font-size: 19px; }
.foot-vol { flex: 1; display: flex; align-items: center; gap: 8px; }
.foot-vol input[type="range"] { flex: 1; accent-color: var(--green); height: 28px; }

/* ---- Modals ---- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(4,8,16,.72); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--navy-2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; max-width: 380px; width: 100%;
  max-height: calc(100dvh - 48px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-card h2 { margin: 0 0 12px; }
.modal-card ol { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; }
.modal-card li { margin-bottom: 6px; }
.modal-card p { color: var(--ink); line-height: 1.5; }
.modal-note { color: var(--muted); font-size: 13px; }
.modal-close { margin-top: 8px; width: 100%; padding: 14px; border: 0; border-radius: 12px; background: var(--green); color: #06210a; font-weight: 800; font-size: 16px; font-family: inherit; }
.modal-close.alt { background: var(--navy-3); color: var(--ink); margin-bottom: 8px; }
.acct-sub { margin: 2px 0 12px; font-size: 13px; opacity: .75; }

/* ===== Game logging: outcome bar, new-game dialog, history & stats ===== */
.outcome-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0 2px;padding:8px 10px;border-radius:14px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08)}
.outcome-tag{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#8fa3c8}
.outcome-last{font-weight:700;color:#e8eefc;font-size:13px;margin-right:auto}
.outcome-btns{display:flex;gap:6px;flex-wrap:wrap}
.oc-btn{appearance:none;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);color:#eaf0fb;font-weight:800;font-size:13px;padding:7px 12px;border-radius:10px;cursor:pointer}
.oc-btn:active{transform:scale(.96)}
.oc-strike,.oc-out{border-color:rgba(92,184,58,.5);background:rgba(92,184,58,.16)}
.oc-ball{border-color:rgba(63,155,255,.5);background:rgba(63,155,255,.16)}
.oc-hit{border-color:rgba(255,90,77,.5);background:rgba(255,90,77,.16)}
.ng-ha-row{display:flex;gap:8px;margin:6px 0 12px}
.ng-ha{flex:1;appearance:none;border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.05);color:#dce6f7;font-weight:800;padding:12px;border-radius:12px;cursor:pointer}
.ng-ha.sel{border-color:#5cb83a;background:rgba(92,184,58,.18);color:#fff}
.games-list{display:flex;flex-direction:column;gap:8px;max-height:60vh;overflow:auto;margin:8px 0 12px;text-align:left}
.game-row{appearance:none;text-align:left;border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.04);border-radius:12px;padding:12px;cursor:pointer;color:#eaf0fb}
.game-row:active{transform:scale(.99)}
.game-row-top{display:flex;justify-content:space-between;gap:8px;font-size:14px}
.game-row-top span{color:#9fb2d4;font-weight:700;white-space:nowrap}
.game-row-sub{color:#8fa3c8;font-size:12px;margin-top:3px}
.live-dot{font-size:10px;font-weight:900;color:#0b1220;background:#5cb83a;padding:1px 6px;border-radius:6px;vertical-align:middle}
.back-link{appearance:none;border:none;background:none;color:#5cb83a;font-weight:800;cursor:pointer;padding:4px 0;font-size:14px}
.game-detail-title{margin:6px 0 10px;font-size:16px}
.stat-cards{display:flex;gap:8px;margin-bottom:12px}
.stat-card{flex:1;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.09);border-radius:12px;padding:10px;text-align:center}
.stat-card b{display:block;font-size:20px;color:#fff}
.stat-card span{font-size:11px;color:#8fa3c8}
.stat-h{margin:12px 0 6px;font-size:12px;letter-spacing:.05em;text-transform:uppercase;color:#8fa3c8}
.stat-bar{display:flex;align-items:center;gap:8px;margin:5px 0;font-size:13px}
.stat-lab{flex:0 0 38%;color:#dce6f7;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat-track{flex:1;height:8px;border-radius:6px;background:rgba(255,255,255,.08);overflow:hidden}
.stat-track i{display:block;height:100%;background:linear-gradient(90deg,#5cb83a,#7ed957)}
.stat-num{flex:0 0 auto;color:#9fb2d4;font-weight:800;min-width:22px;text-align:right}

/* ===== GameChanger overlay (Phase 2: import + merge) ===== */
.gc-section { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--navy-3); }
.gc-head { font-weight: 800; font-size: 1.02rem; margin-bottom: 8px; }
.gc-help { margin-bottom: 10px; font-size: .86rem; }
.gc-help summary { cursor: pointer; color: var(--green); font-weight: 700; }
.gc-help ol { margin: 8px 0 4px; padding-left: 20px; line-height: 1.5; }
.gc-help li { margin-bottom: 3px; }
.gc-import { display: inline-block; }
.gc-import-btn { display: inline-block; background: var(--green); color: #fff; font-weight: 800;
  padding: 11px 18px; border-radius: 12px; cursor: pointer; font-size: .98rem; }
.gc-import-btn:active { background: var(--green-d); }
.gc-note { font-size: .82rem; opacity: .82; margin: 8px 0 0; line-height: 1.45; }
.gc-note.ok { color: var(--green); opacity: 1; font-weight: 700; }
.gc-note.err { color: #e0573e; opacity: 1; font-weight: 700; }
.gc-meta { display: flex; align-items: center; gap: 10px; font-size: .82rem; opacity: .8; margin: 10px 0 4px; }
.gc-clear { margin-left: auto; background: transparent; border: 1px solid var(--navy-3); color: inherit;
  border-radius: 8px; padding: 4px 10px; font-size: .78rem; cursor: pointer; }
.gc-table { border: 1px solid var(--navy-3); border-radius: 10px; overflow: hidden; margin: 6px 0 4px; }
.gc-tr { display: grid; grid-template-columns: 1.6fr .7fr .7fr .7fr .7fr; gap: 4px; padding: 8px 10px;
  font-size: .86rem; align-items: center; border-top: 1px solid var(--navy-3); }
.gc-tr.gc-bat { grid-template-columns: 1.6fr .6fr .6fr .6fr .6fr .8fr; }
.gc-tr:first-child { border-top: 0; }
.gc-tr span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.gc-th { background: var(--navy-3); font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.gc-matched { background: color-mix(in srgb, var(--green) 12%, transparent); font-weight: 700; }
.gc-rec span:first-child { font-weight: 600; }

/* ===== GameChanger AUTO-SYNC (the effortless path) ===== */
.gc-auto-card { background: color-mix(in srgb, var(--green) 9%, var(--navy-2)); border: 1px solid color-mix(in srgb, var(--green) 35%, var(--navy-3));
  border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.gc-on { display: inline-block; background: var(--green); color: #fff; font-size: .64rem; font-weight: 800; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.gc-addr { display: flex; align-items: stretch; gap: 8px; margin: 10px 0 4px; }
.gc-addr code { flex: 1; background: var(--navy-3); border-radius: 9px; padding: 11px 12px; font-size: .82rem;
  word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; display: flex; align-items: center; }
.gc-copy { background: var(--green); color: #fff; border: 0; border-radius: 9px; padding: 0 16px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.gc-copy:active { background: var(--green-d); }
.gc-net { font-size: .8rem; font-weight: 700; color: var(--green); margin: 12px 0 2px; }
.gc-tr.gc-synced { grid-template-columns: 1.7fr .7fr 1.1fr; }
.gc-tr.gc-synced span:not(:first-child) { text-align: right; opacity: .85; }
.gc-manual { margin-top: 6px; }
.gc-manual > summary { cursor: pointer; color: var(--green); font-weight: 700; font-size: .9rem; padding: 4px 0; }

/* ===== GameChanger sync STATE (synced vs not, tracked per game) ===== */
.sync-chip { display:inline-block; margin-left:8px; font-size:.7rem; font-weight:800; padding:2px 7px; border-radius:999px; vertical-align:middle; }
.sync-chip.ok   { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.sync-chip.part { background: color-mix(in srgb, #e8a13a 22%, transparent); color:#e8a13a; }
.sync-chip.none { background: color-mix(in srgb, #8a93a6 18%, transparent); color:#9aa3b4; }
.sync-status { margin: 10px 0 12px; }
.sync-bar { display:flex; height:8px; border-radius:999px; overflow:hidden; background: var(--navy-3); }
.sync-bar i { display:block; }
.sync-bar .sf { background: var(--green); }
.sync-bar .sp { background: #e8a13a; }
.sync-bar .sn { background: #586074; }
.sync-legend { display:flex; flex-wrap:wrap; gap:10px; margin-top:7px; font-size:.78rem; font-weight:700; }
.sync-legend .ok { color: var(--green); }
.sync-legend .part { color:#e8a13a; }
.sync-legend .none { color:#9aa3b4; }
.gc-note.ok { color: var(--green); opacity:1; font-weight:700; }

/* ===== Smart bulk uploader ===== */
.gcup-open-btn { display:block; width:100%; margin:10px 0 4px; text-align:center; }
.gcup-go, .gcup-save { display:block; width:100%; margin:12px 0 4px; text-align:center; }
.gcup-queue { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.gcup-thumb { position:relative; width:72px; height:72px; border-radius:8px; overflow:hidden; border:1px solid var(--navy-3); }
.gcup-thumb img { width:100%; height:100%; object-fit:cover; }
.gcup-x { position:absolute; top:2px; right:2px; width:20px; height:20px; border-radius:50%; border:0; background:rgba(0,0,0,.65); color:#fff; font-size:14px; line-height:1; cursor:pointer; }
.gcup-text { width:100%; min-height:90px; margin-top:8px; background:var(--navy-3); color:inherit; border:1px solid var(--navy-3); border-radius:10px; padding:10px; font:13px/1.4 ui-monospace,Menlo,monospace; resize:vertical; }
.gcup-card { border:1px solid var(--navy-3); border-radius:12px; padding:12px; margin:10px 0; background:var(--navy-2); }
.gcup-card-top { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.gcup-card-top b { font-size:.95rem; }
.gcup-q { margin:8px 0 0; padding-left:18px; }
.gcup-q li { font-size:.84rem; color:#e8a13a; margin-bottom:6px; line-height:1.4; }

/* ===== Sign-in-first paywall ===== */
.pw-h { margin: 6px 0 12px; font-size: 1.3rem; }
#social-signin { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 6px; }
#gsi-btn { display: flex; justify-content: center; min-height: 40px; }
#email-signin-link { margin-top: 2px; }
.pw-divider { display: flex; align-items: center; gap: 12px; width: 100%; margin: 16px 0 4px; opacity: .6; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.pw-divider::before, .pw-divider::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .3; }

/* ===== Inline email sign-in (standard login screen) ===== */
.or-sep { display:flex; align-items:center; gap:12px; width:100%; max-width:280px; margin:14px auto 12px; opacity:.55; font-size:.8rem; }
.or-sep::before, .or-sep::after { content:""; flex:1; height:1px; background:currentColor; opacity:.3; }
/* All sign-in controls share ONE full width so Google / email / button line up exactly. */
#social-signin .text-input { width:100%; max-width:none; margin:0 0 8px; display:block; }
.email-btn { display:block; width:100%; max-width:none; margin:0; background:var(--green); color:#fff; font-weight:800; border:0; border-radius:999px; padding:13px 18px; font-size:16px; cursor:pointer; }
.email-btn:active { background:var(--green-d); }

/* Outcome tagging (ball/strike/foul/in-play) disabled for now — kept code, hidden UI. */
#outcome-bar { display: none !important; }

/* Custom Google button — our own logo, always visible (Safari can't blank it) */
.google-btn { display:flex; align-items:center; justify-content:center; gap:10px; width:100%;
  padding:13px; border:1px solid #dadce0; border-radius:999px; background:#fff; color:#3c4043;
  font-family:inherit; font-size:16px; font-weight:600; cursor:pointer; }
.google-btn:active { background:#f1f3f4; }
.google-btn svg { flex:0 0 auto; }
/* The explicit display:flex above overrides the UA [hidden] rule, so el.hidden=true
   wouldn't visually hide these — pair them like .social-signin/.apple-btn already do.
   This missing rule is what kept "Sign in with Google" visible inside the iOS app
   (App Review 4.8 + 2.1a "Google button did nothing"). */
.google-btn[hidden], .gsi-btn[hidden] { display: none !important; }

.menu-row.danger { color: #e0573e; font-weight: 800; }
