/* Reset Stats button (Lineup screen) */
.btn-reset-stats {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid #e94560;
  border-radius: var(--radius);
  color: #e94560;
  cursor: pointer;
}
.btn-reset-stats:active { background: rgba(233, 69, 96, 0.15); }

/* ── Reset & Variables ──────────────────────────────────────────────────────── */

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface2: #0f3460;
  --accent: #e94560;
  --accent2: #533483;
  --text: #e0e0e0;
  --text-dim: #888;
  --success: #4ecca3;
  --warning: #f0c040;
  --fb: #e94560;
  --ch: #4ecca3;
  --cb: #7b68ee;
  --sl: #f0c040;
  --radius: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ── Screen Layout ──────────────────────────────────────────────────────────── */

#app {
  width: 100%;
  min-height: 100vh;
}

.screen {
  display: none;
  padding: 16px;
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* ── Screen 1: Setup ────────────────────────────────────────────────────────── */

.app-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-top: 32px;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
  margin-bottom: 24px;
}

/* Resume Prompt */
#resume-prompt {
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.resume-prompt-text {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 12px;
}

.resume-prompt-btns {
  display: flex;
  gap: 10px;
}

.btn-resume {
  flex: 1;
  height: 44px;
  border-radius: var(--radius);
  background: var(--warning);
  color: #111;
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity 0.15s;
}

.btn-resume:active {
  opacity: 0.8;
}

.btn-discard {
  flex: 1;
  height: 44px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-discard:active {
  background: var(--surface2);
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 8px;
}

.form-label-hint {
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  font-weight: 400;
}

.form-input {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 14px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-dim);
}

/* Pitch type toggles */
.pitch-type-select {
  display: flex;
  gap: 10px;
}

.pitch-toggle {
  flex: 1;
  height: 52px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}

.pitch-toggle[data-type="FB"].active { border-color: var(--fb); background: color-mix(in srgb, var(--fb) 20%, transparent); color: var(--fb); }
.pitch-toggle[data-type="CH"].active { border-color: var(--ch); background: color-mix(in srgb, var(--ch) 20%, transparent); color: var(--ch); }
.pitch-toggle[data-type="CB"].active { border-color: var(--cb); background: color-mix(in srgb, var(--cb) 20%, transparent); color: var(--cb); }
.pitch-toggle[data-type="SL"].active { border-color: var(--sl); background: color-mix(in srgb, var(--sl) 20%, transparent); color: var(--sl); }

/* Quick Lineup collapsible */
.lineup-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.lineup-skip-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex: 1;
  line-height: 1.4;
  padding-top: 4px;
}

.btn-lineup-toggle {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-lineup-toggle:active,
.btn-lineup-toggle.expanded {
  border-color: var(--accent2);
  color: var(--text);
}

#lineup-setup {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
}

#lineup-setup.expanded {
  display: flex;
}

.lineup-setup-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lineup-slot-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

.lineup-setup-row .form-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.9rem;
  min-width: 0;
}

.lineup-hand-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.lineup-hand {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.15s;
}

.lineup-hand.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}

/* Our Pitcher collapsible setup — same pattern as #lineup-setup */
#our-pitcher-setup {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
}

#our-pitcher-setup.expanded {
  display: flex;
}

/* Our-pitcher pitch toggles reuse .pitch-toggle but need the same active colours */
.our-pitch-toggle {
  flex: 1;
  height: 52px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}

.our-pitch-toggle[data-type="FB"].active { border-color: var(--fb); background: color-mix(in srgb, var(--fb) 20%, transparent); color: var(--fb); }
.our-pitch-toggle[data-type="CH"].active { border-color: var(--ch); background: color-mix(in srgb, var(--ch) 20%, transparent); color: var(--ch); }
.our-pitch-toggle[data-type="CB"].active { border-color: var(--cb); background: color-mix(in srgb, var(--cb) 20%, transparent); color: var(--cb); }
.our-pitch-toggle[data-type="SL"].active { border-color: var(--sl); background: color-mix(in srgb, var(--sl) 20%, transparent); color: var(--sl); }

/* Pitcher mode toggle button — full-width pill above the batter card */
.pitcher-mode-toggle {
  display: block;
  width: 100%;
  padding: 10px 16px;
  margin-bottom: 8px;
  border-radius: 24px;
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  transition: all 0.2s;
}

/* "vs opp" mode — red accent */
.pitcher-mode-toggle[data-mode="opp"] {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

/* "own / pitching" mode — purple accent */
.pitcher-mode-toggle[data-mode="own"] {
  border-color: color-mix(in srgb, var(--accent2) 70%, transparent);
  color: #b8a0ff;
  background: color-mix(in srgb, var(--accent2) 12%, var(--surface));
}

.pitcher-mode-toggle:active {
  filter: brightness(1.2);
}

/* Primary button */
.btn-primary {
  width: 100%;
  height: 56px;
  margin-top: 16px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary:not(:disabled):active {
  transform: scale(0.97);
}

/* ── Screen 2: Logger ───────────────────────────────────────────────────────── */

/* Current Batter Card */
.current-batter-card {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  border-left: 4px solid var(--text-dim);
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
}

.current-batter-card[data-hand="R"] {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.current-batter-card[data-hand="L"] {
  border-left-color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 12%, var(--surface));
}

.batter-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batter-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
}

.batter-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--surface2);
  color: var(--text-dim);
}

.hand-badge[data-hand="R"] {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent);
}

.hand-badge[data-hand="L"] {
  background: color-mix(in srgb, var(--accent2) 40%, transparent);
  color: #b8a0ff;
}

.batter-ab-line {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 5px;
}

/* On Deck Line */
#on-deck-line {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 8px;
  font-style: italic;
}

/* Scoreboard */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.score-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 4px;
}
.score-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.score-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.score-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.score-btn:active { background: var(--accent); }
.score-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
}
.score-divider {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dim);
}

/* Game State Bar */
.game-state {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.state-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}

.state-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.state-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.state-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 700;
}

.state-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  min-width: 32px;
  min-height: 32px;
}

.state-btn:active {
  background: var(--accent2);
}

/* Count display */
.count-display {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  min-width: 36px;
  text-align: center;
}

/* Outs display */
.outs-display {
  display: flex;
  gap: 5px;
  align-items: center;
  cursor: pointer;
  padding: 4px;
}

.out-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  background: transparent;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s;
}

.out-dot.filled {
  background: var(--warning);
  border-color: var(--warning);
}

/* Runners Row */
.runners-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 8px;
}

/* Baseball diamond — compact, replaces individual base buttons */
.diamond-svg {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  cursor: pointer;
}

.diamond-infield {
  fill: color-mix(in srgb, var(--success) 8%, transparent);
  stroke: var(--surface2);
  stroke-width: 1;
}

.diamond-base {
  fill: var(--surface);
  stroke: var(--text-dim);
  stroke-width: 1.5;
  transition: fill 0.15s, stroke 0.15s;
}

.diamond-base.active {
  fill: var(--warning);
  stroke: var(--warning);
}

.diamond-base:active {
  opacity: 0.7;
}

.diamond-home {
  fill: var(--text-dim);
  stroke: var(--text-dim);
  stroke-width: 0.5;
}

.diamond-mound {
  fill: var(--surface2);
  stroke: var(--text-dim);
  stroke-width: 0.5;
}

.diamond-label {
  fill: var(--text-dim);
  font-size: 9px;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  pointer-events: none;
  user-select: none;
}

.pitcher-label {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Pitcher Stats Row */
#pitcher-stats {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

/* Prediction Bar */
.prediction-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.prediction-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* Confidence badge */
.confidence {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface2);
  color: var(--text-dim);
}

.confidence.low {
  background: color-mix(in srgb, var(--text-dim) 15%, transparent);
  color: var(--text-dim);
}

.confidence.medium {
  background: color-mix(in srgb, var(--warning) 20%, transparent);
  color: var(--warning);
}

.confidence.high {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}

/* Prediction list */
.prediction-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prediction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.85rem;
}

.prediction-item[data-type="FB"] { background: color-mix(in srgb, var(--fb) 18%, transparent); }
.prediction-item[data-type="CH"] { background: color-mix(in srgb, var(--ch) 18%, transparent); }
.prediction-item[data-type="CB"] { background: color-mix(in srgb, var(--cb) 18%, transparent); }
.prediction-item[data-type="SL"] { background: color-mix(in srgb, var(--sl) 18%, transparent); }

.pred-type {
  font-weight: 700;
  font-size: 0.9rem;
}

.prediction-item[data-type="FB"] .pred-type { color: var(--fb); }
.prediction-item[data-type="CH"] .pred-type { color: var(--ch); }
.prediction-item[data-type="CB"] .pred-type { color: var(--cb); }
.prediction-item[data-type="SL"] .pred-type { color: var(--sl); }

.pred-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 0.9rem;
}

/* Pitch Input */
.pitch-input {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.input-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-align: center;
}

/* Step 1: Pitch type buttons */
.pitch-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pitch-btn {
  min-height: 64px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: transform 0.1s, opacity 0.15s, filter 0.1s;
}

.pitch-btn:active {
  transform: scale(0.95);
}

.pitch-btn[data-type="FB"] { background: color-mix(in srgb, var(--fb) 25%, transparent); border-color: var(--fb); color: var(--fb); }
.pitch-btn[data-type="CH"] { background: color-mix(in srgb, var(--ch) 25%, transparent); border-color: var(--ch); color: var(--ch); }
.pitch-btn[data-type="CB"] { background: color-mix(in srgb, var(--cb) 25%, transparent); border-color: var(--cb); color: var(--cb); }
.pitch-btn[data-type="SL"] { background: color-mix(in srgb, var(--sl) 25%, transparent); border-color: var(--sl); color: var(--sl); }

/* Step 2: Zone grid */
.ball-zones-row {
  display: flex;
  justify-content: center;
}

.zone-grid-wrapper {
  display: flex;
  align-items: stretch;
  gap: 0;
  justify-content: center;
}

.strike-zone {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  width: 180px;
  height: 180px;
  background: var(--surface2);
  border: 2px solid var(--surface2);
  border-radius: 4px;
}

.zone-btn {
  background: var(--bg);
  border: none;
  border-radius: 2px;
  transition: background 0.12s;
  min-height: 48px;
}

.zone-btn:active {
  background: var(--accent2);
}

.ball-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface2) 60%, transparent);
  border: 1px dashed var(--surface2);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: background 0.12s;
  min-height: 48px;
}

.ball-zone:active {
  background: color-mix(in srgb, var(--accent2) 40%, transparent);
}

.ball-zones-row .ball-zone {
  width: 180px;
  height: 44px;
  margin: 3px 0;
}

.side-zone {
  width: 52px;
  margin: 0 3px;
  font-size: 0.65rem;
}

/* Step 3: Result buttons */
.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-btn {
  flex: 1 1 calc(50% - 4px);
  min-height: 52px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  padding: 0 8px;
  text-align: center;
}

.result-btn:active {
  transform: scale(0.95);
  background: var(--accent2);
  border-color: var(--accent2);
}

.result-btn[data-result="ball"] { border-color: color-mix(in srgb, var(--success) 50%, transparent); }
.result-btn[data-result="called_strike"] { border-color: color-mix(in srgb, var(--fb) 50%, transparent); }
.result-btn[data-result="swinging_strike"] { border-color: color-mix(in srgb, var(--fb) 80%, transparent); }
.result-btn[data-result="foul"] { border-color: color-mix(in srgb, var(--warning) 50%, transparent); }
.result-btn[data-result="in_play"] { border-color: color-mix(in srgb, var(--ch) 50%, transparent); }

/* Step 4: In-Play buttons */
.inplay-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.inplay-btn {
  min-height: 58px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.1s, opacity 0.15s;
}

.inplay-btn:active {
  transform: scale(0.95);
  opacity: 0.85;
}

.inplay-btn[data-outcome="hit"],
.inplay-btn[data-outcome="single"],
.inplay-btn[data-outcome="double"],
.inplay-btn[data-outcome="triple"] {
  background: color-mix(in srgb, var(--success) 22%, transparent);
  border-color: var(--success);
  color: var(--success);
}

.inplay-btn[data-outcome="hr"] {
  background: color-mix(in srgb, var(--warning) 22%, transparent);
  border-color: var(--warning);
  color: var(--warning);
}

.inplay-btn[data-outcome="out"] {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}

.inplay-btn[data-outcome="error"] {
  background: color-mix(in srgb, var(--text-dim) 18%, transparent);
  border-color: var(--text-dim);
  color: var(--text-dim);
}

/* Back button */
.btn-back {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 0;
  align-self: flex-start;
  transition: color 0.15s;
  min-height: 36px;
}

.btn-back:active {
  color: var(--text);
}

/* Logger Nav — 2×2 grid */
.logger-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 16px;
}

.nav-btn {
  height: 46px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}

.nav-btn:active {
  background: var(--surface2);
}

/* Tap-flash feedback */
.tap-flash {
  filter: brightness(1.35);
}

/* ── Screen 3: Lineup ───────────────────────────────────────────────────────── */

#lineup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
}

.lineup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
}

.lineup-row:active {
  background: var(--surface2);
}

.lineup-row.current {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.lineup-row-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  width: 20px;
  flex-shrink: 0;
  text-align: center;
}

.lineup-row-info {
  flex: 1;
  min-width: 0;
}

.lineup-row-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lineup-row-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.lineup-row-hand {
  flex-shrink: 0;
}

.lineup-row-edit {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--surface2);
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  transition: background 0.15s;
}

.lineup-row-edit:active {
  background: var(--accent2);
  color: var(--text);
}

/* ── Batter Edit Modal ───────────────────────────────────────────────────────── */

.batter-edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.batter-edit-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 320px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.batter-edit-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
}

.batter-edit-hand-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.batter-edit-hand-group {
  display: flex;
  gap: 10px;
}

.batter-edit-hand {
  flex: 1;
  height: 48px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: var(--surface2);
  color: var(--text-dim);
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.15s;
}

.batter-edit-hand.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}

.batter-edit-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batter-edit-actions .btn-primary {
  margin-top: 0;
}

.btn-cancel {
  width: 100%;
  height: 44px;
  border-radius: var(--radius);
  border: 2px solid var(--surface2);
  background: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-cancel:active {
  background: var(--surface2);
}

/* ── Screen 4: Summary ──────────────────────────────────────────────────────── */

.summary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-top: 8px;
}

.summary-header .btn-back {
  align-self: center;
  white-space: nowrap;
}

.summary-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.summary-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.summary-section h3 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  padding: 4px 0;
}

/* Distribution bars */
.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dist-label {
  font-size: 0.8rem;
  font-weight: 700;
  width: 30px;
  flex-shrink: 0;
}

.dist-label[data-type="FB"] { color: var(--fb); }
.dist-label[data-type="CH"] { color: var(--ch); }
.dist-label[data-type="CB"] { color: var(--cb); }
.dist-label[data-type="SL"] { color: var(--sl); }

.dist-bar-bg {
  flex: 1;
  height: 16px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.dist-bar[data-type="FB"] { background: var(--fb); }
.dist-bar[data-type="CH"] { background: var(--ch); }
.dist-bar[data-type="CB"] { background: var(--cb); }
.dist-bar[data-type="SL"] { background: var(--sl); }

.dist-pct {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* Count Tendencies Grid */
.tendencies-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tendency-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 10px;
}

.tendency-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.tendency-breakdown {
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* L/R hand comparison */
.hand-comparison {
  display: flex;
  gap: 12px;
}

.hand-col {
  flex: 1;
}

.hand-col-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-align: center;
}

/* Batter breakdown table */
.batter-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--surface2);
  font-size: 0.85rem;
}

.batter-breakdown-row:last-child {
  border-bottom: none;
}

.batter-breakdown-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batter-breakdown-stats {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Pitch Log */
.pitch-log-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.82rem;
}

.log-entry-num {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  width: 20px;
  flex-shrink: 0;
}

.log-entry-type {
  font-weight: 700;
  width: 32px;
  flex-shrink: 0;
}

.log-entry[data-type="FB"] .log-entry-type { color: var(--fb); }
.log-entry[data-type="CH"] .log-entry-type { color: var(--ch); }
.log-entry[data-type="CB"] .log-entry-type { color: var(--cb); }
.log-entry[data-type="SL"] .log-entry-type { color: var(--sl); }

.log-entry-result {
  color: var(--text-dim);
  flex: 1;
}

/* ── Zone grid active states ────────────────────────────────────────────────── */

.zone-btn.selected,
.ball-zone.selected {
  background: var(--accent2) !important;
  opacity: 0.85;
}

/* ── Scrollbar styling ──────────────────────────────────────────────────────── */

.pitch-log-list::-webkit-scrollbar {
  width: 4px;
}

.pitch-log-list::-webkit-scrollbar-track {
  background: var(--surface2);
  border-radius: 2px;
}

.pitch-log-list::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border-radius: 2px;
}
