/* Game Log styles. Loaded by index.html via <link rel="stylesheet" href="styles.css">. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --dirt:   #E8E8E8;       /* primary accent — light grey */
  --chalk:  #F0F0F0;       /* primary text — near white */
  --grass:  #A0A0A0;       /* links — medium grey */
  --night:  #1E1E1E;       /* page background — VS Code dark */
  --pine:   #252526;       /* card background — VS Code panel */
  --edge:   #3C3C3C;       /* borders — VS Code border */
  --fade:   #6B6B6B;       /* secondary text */
  --warn:   #C0392B;       /* destructive — muted red */
  --white:  #FFFFFF;
}

body {
  background: var(--night);
  color: var(--chalk);
  font-family: 'IBM Plex Sans', sans-serif;
  min-height: 100vh;
}

/* ── Real links (F11) ── */
/* Navigation is real <a href> links but keeps each element's own look: zero specificity, so class rules win */
:where(a.nav-link) { color: inherit; text-decoration: none; }
/* Card link: the title is the link and stretches over the whole card; the card's buttons sit above it */
.card { position: relative; }
.card-link { display: block; }
.card-link::after { content: ''; position: absolute; inset: 0; }
.card .card-reorder, .card .card-del, .card .play-actions { position: relative; z-index: 1; }
/* Sub-rows in the stats tables: the whole first cell is the link, as the cell was clickable before */
.stats-sub-table td:first-child > a.nav-link { display: inline-block; width: 100%; }

/* ── Nav bar ── */
nav {
  background: var(--pine);
  border-bottom: 3px solid var(--dirt);
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0;
}
.nav-brand {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dirt);
  cursor: pointer;
  flex-shrink: 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 8px;
}
.bc-sep {
  color: var(--edge);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  padding: 0 8px;
}
.bc-item {
  font-size: 0.82rem;
  color: var(--fade);
  cursor: pointer;
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.bc-item:hover { color: var(--chalk); border-color: var(--fade); }
.bc-item.current { color: var(--chalk); cursor: default; border-color: transparent; }

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--chalk);
  letter-spacing: -0.01em;
}
.page-sub {
  font-size: 0.78rem;
  color: var(--fade);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Cards (seasons & games) ── */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--dirt);
  border-radius: 4px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: background 0.12s, border-left-color 0.12s;
}
.card:hover { background: #2D2D2D; border-left-color: #C8C8C8; }
.card-main { flex: 1; min-width: 0; }
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--chalk);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  font-size: 0.75rem;
  color: var(--fade);
  margin-top: 3px;
}
.card-arrow {
  color: var(--fade);
  font-size: 1rem;
  flex-shrink: 0;
  transition: color 0.12s;
}
.card:hover .card-arrow { color: var(--chalk); }
.card-del {
  background: none;
  border: none;
  color: var(--fade);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.card-del:hover { color: var(--warn); }
.card-reorder {
  background: none;
  border: none;
  color: var(--fade);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 4px 6px;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
}
.card-reorder:hover { color: var(--chalk); }
.card-reorder:disabled { opacity: 0.2; cursor: default; }
.card--editing { cursor: default; }
/* Under the games minimum, listed last in grey (F23). The pinned name cell is greyed by colour, not opacity: opacity
   made it see-through when the table is scrolled sideways (F29) */
.stats-row--few td:not(:first-child) { opacity: 0.55; }
.stats-table .stats-row--few td:first-child { color: var(--fade); }
/* Qualified / All switch next to the note (F29): a small text button */
.stats-note-btn { background: none; border: none; padding: 4px 0; margin-left: 8px; color: var(--grass); font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.stats-note-btn:hover { color: var(--chalk); }
@media (max-width: 640px) { .stats-note-btn { min-height: 44px; } }   /* per-game view: under the games minimum, listed last (F23) */
.season-rename { flex: 1; }
.season-rename .inline-row { align-items: center; }
.season-rename input { flex: 1; min-width: 160px; }
.season-rename-error { color: var(--warn); font-size: 0.78rem; margin-top: 6px; }
.season-rename-error:empty { display: none; }
.game-score {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  margin-top: 4px;
  color: var(--fade);
}
.game-score-result { font-weight: 600; }
.game-score-w .game-score-result { color: var(--chalk); }
.game-score-l .game-score-result { color: var(--fade); }
.game-score-t .game-score-result { color: var(--fade); }
.game-score-w { color: var(--chalk); }
/* No-video indicator on game cards */
.no-video-badge { font-size: 0.7rem; color: var(--fade); font-family: 'IBM Plex Mono', monospace; font-style: italic; margin-top: 4px; }
/* No-video notice on game screen */
.no-video-notice { background: var(--pine); border: 1px solid var(--edge); border-radius: 4px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.82rem; color: var(--fade); }
.no-video-notice strong { color: var(--chalk); }
/* Admin-only flag for data quality issues */
.admin-flag { display: none; font-size: 0.7rem; color: var(--warn); font-family: 'IBM Plex Mono', monospace; margin-top: 4px; }
.admin .admin-flag { display: block; }
.admin-flag--quiet { color: var(--fade); }
.game-field { font-size: 0.78rem; color: var(--fade); margin-top: 2px; }

/* Home/Away choice (Add Game, game edit panel): optional, so neither is picked at first */
.home-away { display: inline-flex; border: 1px solid var(--edge); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.home-away-btn {
  background: transparent; border: none; color: var(--fade); cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; min-height: 44px; padding: 0 18px;
}
.home-away-btn + .home-away-btn { border-left: 1px solid var(--edge); }
.home-away-btn.active { background: var(--dirt); color: var(--night); font-weight: 600; }
.home-away-btn:hover:not(.active) { color: var(--chalk); }

/* ── Inline add form ── */
.add-panel {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 18px 20px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.add-panel-title {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fade);
  font-weight: 600;
}
.inline-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-row input, .inline-row textarea {
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.86rem;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s;
  flex: 1;
  min-width: 120px;
}
.inline-row input:focus, .inline-row textarea:focus { border-color: var(--dirt); }
.inline-row input::placeholder, .inline-row textarea::placeholder { color: var(--fade); opacity: 0.55; }
.inline-row input.mono { font-family: 'IBM Plex Mono', monospace; }
.btn-row { display: flex; gap: 10px; align-items: center; }
.btn-primary {
  background: var(--dirt);
  border: none;
  border-radius: 3px;
  color: var(--night);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  padding: 9px 18px;
  text-transform: uppercase;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { background: #C8C8C8; color: #0A0A0A; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--fade);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  padding: 9px 16px;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--dirt); color: var(--dirt); }

/* ── Add trigger ── */
.add-trigger {
  background: transparent;
  border: 1px dashed var(--edge);
  border-radius: 4px;
  color: var(--fade);
  cursor: pointer;
  font-size: 0.84rem;
  padding: 13px 20px;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, color 0.15s;
  margin-top: 10px;
}
.add-trigger:hover { border-color: var(--dirt); color: var(--dirt); }

/* ── Loading ── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.loading {
  color: var(--fade);
  font-size: 0.85rem;
  font-family: 'IBM Plex Mono', monospace;
  padding: 16px 0;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── Empty state ── */
.empty {
  color: var(--fade);
  font-size: 0.85rem;
  padding: 16px 0;
  font-style: italic;
}

/* ── PLAYS screen ── */
.plays-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.plays-meta input[type="text"] {
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  padding: 7px 11px;
  outline: none;
  transition: border-color 0.15s;
  flex: 1;
  min-width: 200px;
}
.plays-meta input:focus { border-color: var(--dirt); }
.plays-meta input::placeholder { color: var(--fade); opacity: 0.55; }
.plays-meta .meta-label {
  font-size: 0.72rem;
  color: var(--fade);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.play-card {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--dirt);
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}
.play-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.12s;
}
.play-header:hover { background: #2D2D2D; }
.play-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dirt);
  min-width: 68px;
  flex-shrink: 0;
}
.play-players {
  font-size: 0.72rem;
  color: var(--fade);
  flex-shrink: 0;
  background: var(--edge);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
/* Full description, never cut off: beside the tags when there's room (at least 18rem),
   otherwise on its own line below them, wrapping as needed (F4). Phones: see the media query. */
.play-desc {
  font-size: 0.88rem;
  color: var(--chalk);
  flex: 1 1 18rem;
  line-height: 1.4;
}
.play-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-icon {
  background: none;
  border: none;
  color: var(--fade);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 4px 7px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--chalk); background: var(--edge); }
.btn-icon.del:hover { color: var(--warn); }

.play-embed {
  display: none;
  padding: 0 16px 14px;
}
.play-embed.open { display: block; }
.play-embed iframe {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 3px;
  background: var(--night);
}
.play-link {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--grass);
  margin-top: 8px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.play-link:hover { border-color: var(--grass); }

#game-yt-link:hover { border-bottom-color: var(--grass); }

/* ── Season Tabs ── */
.season-tabs {
  display: flex;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 24px;
}
.season-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fade);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 18px 10px;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.season-tab.active { color: var(--chalk); border-bottom-color: var(--dirt); }
.season-tab:hover:not(.active) { color: var(--chalk); }

/* ── Depth Chart ── */
.depth-chart-wrap {
  position: relative;
  width: 100%;
  min-width: 480px;
  aspect-ratio: 600 / 520;
  max-width: 620px;
  margin: 0 auto 20px;
  border-radius: 6px;
  overflow: visible;
  user-select: none;
}
.depth-chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 6px;
}
.depth-chart-positions {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.depth-pos-card {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(12, 24, 10, 0.82);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 4px 6px;
  min-width: 48px;
  text-align: center;
  pointer-events: all;
  backdrop-filter: blur(2px);
  transition: border-color 0.15s;
  z-index: 2;
}
body.admin .depth-pos-card { cursor: pointer; }
body.admin .depth-pos-card:hover { border-color: rgba(255,255,255,0.4); }
.depth-pos-card.editing {
  border-color: var(--dirt);
  background: rgba(10, 20, 8, 0.97);
  z-index: 10;
  min-width: 140px;
  text-align: left;
}
.depth-pos-card--empty { opacity: 0.55; }
.depth-pos-label {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--chalk);
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 1px 5px;
  margin-bottom: 3px;
  display: inline-block;
}
.depth-pos-card.editing .depth-pos-label { margin-bottom: 6px; display: block; }
.depth-player--starter {
  font-size: 0.68rem;
  color: var(--chalk);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.45;
  text-align: center;
}
.depth-player--backup {
  font-size: 0.63rem;
  color: var(--fade);
  white-space: nowrap;
  line-height: 1.45;
  text-align: center;
}
.depth-empty { font-size: 0.68rem; color: var(--fade); }
.depth-player-row {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 1px 0;
}
.depth-player-name {
  flex: 1;
  font-size: 0.68rem;
  color: var(--chalk);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.depth-player-actions { display: flex; gap: 1px; flex-shrink: 0; }
.depth-player-actions button {
  background: none;
  border: none;
  color: var(--fade);
  cursor: pointer;
  padding: 0 3px;
  font-size: 0.7rem;
  line-height: 1.4;
}
.depth-player-actions button:hover { color: var(--chalk); }
.depth-add-select {
  display: block;
  width: 100%;
  margin-top: 5px;
  background: var(--pine);
  border: 1px solid var(--edge);
  color: var(--chalk);
  border-radius: 4px;
  padding: 3px 4px;
  font-size: 0.68rem;
}
.depth-unassigned {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--pine);
  border-radius: 8px;
  border: 1px solid var(--edge);
}
.depth-unassigned-label {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fade);
  margin-bottom: 8px;
}
.depth-unassigned-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.depth-no-roster {
  color: var(--fade);
  font-size: 0.82rem;
  padding: 40px 0;
  text-align: center;
}

/* ── Batting Order (Depth & Lineup tab) ── */
.lineup-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--edge);
}
.lineup-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.lineup-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fade);
  font-weight: 600;
}
.lineup-disclaimer {
  font-size: 0.65rem;
  color: var(--fade);
  font-style: italic;
}
.lineup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--edge);
}
.lineup-row:last-of-type { border-bottom: none; }
.lineup-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--fade);
  width: 20px;
  flex-shrink: 0;
  text-align: right;
}
.lineup-name {
  flex: 1;
  font-size: 0.88rem;
  color: var(--chalk);
}
.lineup-actions { display: flex; gap: 2px; }
.lineup-actions button {
  background: none;
  border: none;
  color: var(--fade);
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.75rem;
  line-height: 1.4;
}
.lineup-actions button:hover { color: var(--chalk); }
.lineup-add-wrap { margin-top: 10px; }
.lineup-empty-note {
  color: var(--fade);
  font-size: 0.8rem;
  font-style: italic;
  padding: 6px 0;
}

/* ── Player positions (career page + lineup) ── */
.pos-section { margin-bottom: 24px; }
.pos-section-title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fade);
  margin-bottom: 12px;
}
/* Viewer read-only chip groups */
.pos-group { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pos-group:last-child { margin-bottom: 0; }
.pos-group-label { font-size: 0.7rem; color: var(--fade); min-width: 72px; flex-shrink: 0; }
.pos-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.pos-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--edge);
}
.pos-chip--unassigned { color: var(--fade);  border-color: var(--edge); }
.pos-chip--preferred  { color: var(--chalk); border-color: var(--dirt); background: rgba(232,232,232,0.08); }
.pos-chip--playable   { color: var(--grass); border-color: var(--edge); }
.pos-chip--wont       { color: var(--warn);  border-color: rgba(192,57,43,0.35); }
/* Admin position grid */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 300px;
}
.pos-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  padding: 8px 4px;
  border-radius: 4px;
  border: 1px solid var(--edge);
  background: var(--pine);
  color: var(--fade);
  cursor: pointer;
  text-align: center;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  line-height: 1.2;
}
.pos-btn small { display: block; font-size: 0.6rem; opacity: 0.7; margin-top: 1px; }
.pos-btn--preferred { color: var(--chalk); border-color: var(--dirt); background: rgba(232,232,232,0.08); }
.pos-btn--playable  { color: var(--grass); border-color: var(--grass); background: rgba(160,160,160,0.08); }
.pos-btn--wontPlay  { color: #E74C3C;      border-color: rgba(231,76,60,0.5); background: rgba(231,76,60,0.08); }
.pos-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.68rem;
  color: var(--fade);
}
.pos-legend span { display: flex; align-items: center; gap: 4px; }
.pos-legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
/* Lineup name as link */
.lineup-name-link {
  color: var(--grass);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.lineup-name-link:hover { color: var(--chalk); border-bottom-color: var(--chalk); }
/* Preferred position badges in lineup rows */
.lineup-pos-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.lineup-pos-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  color: var(--fade);
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 0 4px;
  line-height: 1.6;
}

/* ── Season Stats table ── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
}
.stats-table th {
  color: var(--fade);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  text-align: right;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 2px solid var(--edge);
  transition: color 0.12s;
}
.stats-table th:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--night); }
.stats-table th:hover { color: var(--chalk); }
.stats-table th.sort-active { color: var(--dirt); }
.stats-sort-arrow { font-size: 0.55rem; margin-left: 3px; }
.stats-table td {
  padding: 9px 10px;
  text-align: right;
  border-top: 1px solid var(--edge);
  color: var(--fade);
  white-space: nowrap;
}
.stats-table td:first-child { text-align: left; color: var(--chalk); cursor: pointer; position: sticky; left: 0; z-index: 1; background: var(--night); }
.stats-table td:first-child:hover { color: var(--dirt); }
.stats-expand-arrow {
  font-size: 0.6rem;
  color: var(--fade);
  display: inline-block;
  transition: transform 0.15s;
  margin-right: 6px;
}
.player-expanded .stats-expand-arrow { transform: rotate(90deg); }
.stats-avg { color: var(--chalk) !important; }
/* Player Games tab: real game labels and season names can be long, so let them wrap
   instead of pushing the stat columns off the right edge */
.player-games-table td:nth-child(1) { white-space: normal; min-width: 9rem; }
.player-games-table td:nth-child(2) { white-space: normal; min-width: 7rem; }
.stats-totals-row td { font-weight: 600; border-top: 2px solid var(--edge) !important; background: rgba(255,255,255,0.03); }
.stats-totals-row td:first-child { color: var(--fade); cursor: default; font-style: italic; background: var(--night); }
.stats-totals-row td:first-child:hover { color: var(--fade); }
.bs-totals-row td { font-weight: 600; border-top: 2px solid var(--edge) !important; background: rgba(255,255,255,0.03); }
.bs-totals-row td:first-child { color: var(--fade); font-style: italic; }
/* Per-game sub-table */
.stats-sub-row > td { padding: 0 !important; border-top: none !important; }
.stats-sub-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  background: var(--night);
  border-bottom: 2px solid var(--edge);
}
.stats-sub-table th {
  color: var(--fade);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  text-align: right;
  border-bottom: 1px solid var(--edge);
}
.stats-sub-table th:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--night); }
.stats-sub-table td {
  padding: 6px 10px;
  text-align: right;
  border-top: 1px solid var(--edge);
  color: var(--fade);
}
.stats-sub-table td:first-child { text-align: left; color: var(--grass); cursor: pointer; position: sticky; left: 0; z-index: 1; background: var(--night); }
.stats-sub-table td:first-child:hover { color: var(--chalk); text-decoration: underline; }
.stats-sub-table tr:first-child td { border-top: none; }
/* Clickable player name in roster chips */
.stats-player-link { cursor: pointer; border-bottom: 1px solid transparent; transition: border-color 0.12s, color 0.12s; }
.stats-player-link:hover { color: var(--dirt); border-bottom-color: var(--dirt); }
/* Player page nav icon in stats table rows */
.stats-player-nav { display: inline-block; margin-left: 6px; font-size: 0.6rem; color: var(--edge); vertical-align: middle; cursor: pointer; transition: color 0.12s, font-size 0.12s; }
.stats-table tr:hover .stats-player-nav { color: var(--fade); }
.player-expanded .stats-player-nav { color: var(--grass); font-size: 0.7rem; }
/* Roster tab — more prominent since it's a browsing view */
.roster-player-row .stats-player-nav { font-size: 0.75rem; color: var(--fade); }
.roster-player-row:hover .stats-player-nav { color: var(--grass); }
.roster-player-row.expanded .stats-player-nav { color: var(--grass); font-size: 0.9rem; font-weight: 600; }
/* Non-clickable stats table (career breakdown) */
.stats-table--plain td:first-child { cursor: default; }
.stats-table--plain td:first-child:hover { color: var(--fade); }
/* Player page link in game filter bar */
.player-page-link { display: inline-block; margin-top: 8px; font-size: 0.78rem; font-family: 'IBM Plex Mono', monospace; color: var(--grass); cursor: pointer; border-bottom: 1px solid transparent; transition: color 0.12s, border-color 0.12s; }
.player-page-link:hover { color: var(--chalk); border-bottom-color: var(--chalk); }
/* Player page — career stat highlights */
.player-stat-highlights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 500px) { .player-stat-highlights { grid-template-columns: repeat(2, 1fr); } }
/* Career tab: Totals and Rates side by side, stacked on phones */
.career-stat-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 640px) {
  .career-stat-groups { grid-template-columns: 1fr; }
  .career-stat-groups > :last-child { order: -1; }   /* Rates first: what most people look for */
}
.player-stat-card { background: var(--pine); border: 1px solid var(--edge); border-radius: 4px; padding: 14px 16px; }
.player-stat-card-label { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fade); margin-bottom: 6px; }
.player-stat-card-value { font-family: 'IBM Plex Mono', monospace; font-size: 1.5rem; font-weight: 600; color: var(--chalk); }
/* Player page — season filter chips */
.player-season-filter { margin-bottom: 20px; }
/* Season filter dropdown (F30): a button that opens a list of checkboxes */
.season-filter { position: relative; display: inline-block; margin-bottom: 18px; }
.season-filter > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  min-height: 36px; padding: 6px 12px; background: var(--pine); border: 1px solid var(--edge); border-radius: 4px;
  color: var(--chalk); font-size: 0.82rem;
}
.season-filter > summary::-webkit-details-marker { display: none; }
.season-filter > summary::after { content: '▾'; color: var(--fade); margin-left: 2px; }
.season-filter[open] > summary { border-color: var(--dirt); }
.sf-label { color: var(--fade); }
.sf-panel {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 240px; max-height: 60vh; overflow-y: auto;
  background: var(--pine); border: 1px solid var(--edge); border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); padding: 6px 0;
}
.sf-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; font-size: 0.85rem; color: var(--chalk); }
.sf-row:hover { background: var(--night); }
.sf-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--dirt); cursor: pointer; }
.sf-all { border-bottom: 1px solid var(--edge); }
.sf-year { font-weight: 600; }
.sf-indent { padding-left: 40px; }
.sf-done { display: block; margin: 6px 14px 4px auto; }
@media (max-width: 640px) {
  .season-filter > summary { min-height: 44px; }
  .sf-row { min-height: 44px; }
  .sf-panel { min-width: 0; width: calc(100vw - 32px); }
}
.player-season-filter-label { font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fade); margin-bottom: 8px; }

/* ── Roster tab ── */
.roster-player-row { border-bottom: 1px solid var(--edge); padding: 12px 0; }
.roster-player-row:last-child { border-bottom: none; }
.roster-player-header { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.roster-player-name { font-family: 'IBM Plex Mono', monospace; font-size: 0.9rem; color: var(--chalk); flex: 1; }
.roster-player-meta { font-size: 0.75rem; color: var(--fade); font-family: 'IBM Plex Mono', monospace; white-space: nowrap; }
.roster-player-seasons { margin-top: 10px; margin-left: 20px; }
.roster-season-row { border-top: 1px solid var(--edge); padding: 8px 0; }
.roster-season-header { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.roster-season-name { font-size: 0.82rem; color: var(--chalk); flex: 1; }
.roster-season-meta { font-size: 0.72rem; color: var(--fade); font-family: 'IBM Plex Mono', monospace; white-space: nowrap; }
.roster-season-stats-link { font-size: 0.72rem; color: var(--grass); cursor: pointer; font-family: 'IBM Plex Mono', monospace; white-space: nowrap; border-bottom: 1px solid transparent; transition: color 0.12s, border-color 0.12s; }
.roster-season-stats-link:hover { color: var(--chalk); border-bottom-color: var(--chalk); }
.roster-season-games { margin: 8px 0 4px 20px; display: flex; flex-direction: column; gap: 4px; }
.roster-game-link { font-size: 0.78rem; color: var(--grass); cursor: pointer; font-family: 'IBM Plex Mono', monospace; border-bottom: 1px solid transparent; transition: color 0.12s, border-color 0.12s; display: inline-block; }
.roster-game-link:hover { color: var(--chalk); border-bottom-color: var(--chalk); }
.roster-player-row.expanded > .roster-player-header .stats-expand-arrow { transform: rotate(90deg); }
.roster-season-row.expanded > .roster-season-header .stats-expand-arrow { transform: rotate(90deg); }

/* ── Box Score ── */
.bs-card {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.bs-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.bs-score-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  color: var(--chalk);
  margin-bottom: 14px;
}
.bs-winner { color: var(--dirt); font-weight: 600; }
.bs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 14px;
}
.bs-table th {
  color: var(--fade);
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  text-align: right;
  white-space: nowrap;
}
.bs-table th:first-child { text-align: left; }
.bs-table td {
  padding: 5px 8px;
  text-align: right;
  border-top: 1px solid var(--edge);
  color: var(--fade);
  white-space: nowrap;
}
.bs-table td:first-child { text-align: left; color: var(--chalk); min-width: 80px; }
.bs-total {
  font-weight: 600;
  color: var(--chalk) !important;
  padding-left: 12px !important;
  border-left: 1px solid var(--edge);
}
.bs-total.bs-winner { color: var(--dirt) !important; }
.bs-add-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--grass);
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
  text-align: left;
}
.bs-add-btn:hover { opacity: 1; }
.bs-toggle-group {
  display: flex;
  border: 1px solid var(--edge);
  border-radius: 3px;
  overflow: hidden;
}
.bs-toggle-btn {
  background: transparent;
  border: none;
  color: var(--fade);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  padding: 6px 14px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.bs-toggle-btn + .bs-toggle-btn { border-left: 1px solid var(--edge); }
.bs-toggle-btn.active { background: var(--dirt); color: var(--night); font-weight: 600; }
.bs-toggle-btn:hover:not(.active) { color: var(--chalk); }
/* Box Score form */
.bs-form {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.bs-form-title {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fade);
  font-weight: 600;
  margin-bottom: 16px;
}
.bs-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.bs-form-label {
  font-size: 0.75rem;
  color: var(--fade);
  min-width: 65px;
  flex-shrink: 0;
}
.bs-input {
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.86rem;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.bs-input:focus { border-color: var(--dirt); }
.bs-input::placeholder { color: var(--fade); opacity: 0.55; }
.bs-input-sm { width: 52px; text-align: center; padding: 7px 4px; }
.bs-innings-grid {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bs-inn-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.bs-inn-label {
  font-size: 0.65rem;
  color: var(--fade);
  font-family: 'IBM Plex Mono', monospace;
  line-height: 2;
  min-height: 1.2em;
}
.bs-inn-input {
  width: 34px;
  text-align: center;
  padding: 5px 2px;
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}
.bs-inn-input:focus { border-color: var(--dirt); }
.bs-batting-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}
.bs-batting-table th {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fade);
  padding: 4px 3px;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}
.bs-batting-table th:first-child { text-align: left; padding-left: 0; }
.bs-batting-table td { padding: 3px 3px; border-top: 1px solid var(--edge); }
.bs-batting-table td:first-child {
  color: var(--chalk);
  font-size: 0.82rem;
  white-space: nowrap;
  padding-left: 0;
  min-width: 80px;
}
.bs-stat-input {
  width: 34px;
  text-align: center;
  padding: 4px 2px;
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.15s;
}
.bs-stat-input:focus { border-color: var(--dirt); }
.bs-reorder-btn {
  background: none;
  border: none;
  color: var(--fade);
  cursor: pointer;
  font-size: 0.55rem;
  padding: 1px 3px;
  display: block;
  line-height: 1.4;
  transition: color 0.12s;
}
.bs-reorder-btn:hover:not(:disabled) { color: var(--chalk); }
.bs-reorder-btn:disabled { opacity: 0.15; cursor: default; }
.bs-batting-toggle {
  border-top: 1px solid var(--edge);
  margin-top: 12px;
  padding-top: 10px;
  cursor: pointer;
  user-select: none;
}
.bs-batting-toggle-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fade);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bs-toggle-arrow {
  font-size: 0.6rem;
  transition: transform 0.15s;
  display: inline-block;
}
.bs-batting-toggle.open .bs-toggle-arrow { transform: rotate(90deg); }
.bs-batting-body { display: none; margin-top: 10px; }
.bs-batting-toggle.open .bs-batting-body { display: block; }

/* ── Play add form ── */
.play-add-form {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.play-add-form .add-panel-title {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fade);
  font-weight: 600;
}
.play-form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.play-form-row input, .play-form-row textarea {
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.86rem;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s;
}
.play-form-row input:focus, .play-form-row textarea:focus { border-color: var(--dirt); }
.play-form-row input::placeholder, .play-form-row textarea::placeholder { color: var(--fade); opacity: 0.55; }
.play-form-row input.mono { font-family: 'IBM Plex Mono', monospace; }
.play-form-row .f-time { width: 120px; flex-shrink: 0; }
.play-form-row .f-players { flex: 1; min-width: 140px; }
.play-form-row .f-desc { flex: 2; min-width: 200px; }

/* ── Copy section ── */
.divider {
  border: none;
  border-top: 1px solid var(--edge);
  margin: 28px 0 20px;
}
.section-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fade);
  font-weight: 600;
  margin-bottom: 12px;
}
.copy-box {
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.9;
  color: var(--chalk);
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 60px;
  margin-bottom: 10px;
}
.btn-copy {
  background: transparent;
  border: 1px solid var(--dirt);
  border-radius: 3px;
  color: var(--dirt);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}
.btn-copy:hover { background: var(--dirt); color: var(--night); }
.btn-copy.copied { background: var(--grass); border-color: var(--grass); color: var(--white); }

/* ── Auth ── */
/* Quick find (js/search.js) */
.nav-search { position: relative; margin-left: auto; }
.nav-search + .nav-auth { margin-left: 16px; }
.nav-search-box { position: relative; display: flex; align-items: center; }
.nav-search-icon { position: absolute; left: 10px; font-size: 0.75rem; opacity: 0.6; pointer-events: none; }
#search-input {
  width: 220px;
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.86rem;
  padding: 7px 10px 7px 30px;
  outline: none;
}
#search-input:focus { border-color: var(--dirt); }
#search-input::placeholder { color: var(--fade); opacity: 0.7; }
.nav-search-open, .nav-search-close { display: none; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  background: var(--pine);
  border: 1px solid var(--edge);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 6px 0;
  z-index: 50;
}
.search-results[hidden] { display: none; }
.search-group-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fade);
  padding: 6px 14px 4px;
}
.search-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--chalk);
  font-size: 0.88rem;
}
.search-option.active, .search-option:hover { background: var(--night); }
.search-option--stack { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding-top: 6px; padding-bottom: 6px; }
.search-option--stack .search-meta { white-space: normal; }
.search-option mark, .search-meta mark { background: none; color: var(--chalk); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.search-meta { font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; color: var(--fade); white-space: nowrap; }
.search-more { color: var(--grass); font-size: 0.8rem; }
.search-empty { padding: 12px 14px; color: var(--fade); font-size: 0.85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.nav-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
#auth-user {
  font-size: 0.75rem;
  color: var(--fade);
  font-family: 'IBM Plex Mono', monospace;
}
.btn-auth {
  background: transparent;
  border: 1px solid var(--dirt);
  border-radius: 3px;
  color: var(--dirt);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}
.btn-auth:hover { background: var(--dirt); color: var(--night); }

.auth-msg-box {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--warn);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 20px auto;
  max-width: 860px;
  padding: 14px 20px;
  font-size: 0.88rem;
}

/* Hide edit controls for viewers */
body.viewer .edit-only { display: none !important; }

/* Admin-only controls */
body:not(.admin) .admin-only { display: none !important; }

/* Show viewer-only elements only for viewers */
.viewer-only { display: none; }
body.viewer .viewer-only { display: block; }

.contribute-msg {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--pine);
  border: 1px dashed var(--edge);
  border-radius: 4px;
  color: var(--fade);
  font-size: 0.85rem;
}

/* ── Game roster edit ── */
.card-wrapper { display: flex; flex-direction: column; margin-bottom: 10px; }
.card-wrapper .card { margin-bottom: 0; }
.game-roster-edit {
  background: #2D2D2D;
  border: 1px solid var(--edge);
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 14px 16px;
}

/* ── Play inline edit ── */
.play-edit-form {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #2D2D2D;
}
.roster-section {
  background: var(--pine);
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.roster-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  min-height: 28px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--edge);
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--chalk);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 12px;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}
.chip:hover { background: #2A2A2A; }
.chip.active { background: var(--chalk); color: var(--night); border-color: var(--chalk); }
/* Chips that are real buttons (F27): buttons don't inherit the page's font or line height, so set them */
button.chip, button.player-chip { font-family: inherit; line-height: inherit; letter-spacing: inherit; margin: 0; text-align: inherit; }
.chip .chip-del {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.7rem;
  opacity: 0.7;
  padding: 0;
  line-height: 1;
}
.chip .chip-del:hover { opacity: 1; }
.roster-missing-title { font-size: 0.72rem; color: var(--fade); margin: 14px 0 8px; }
.roster-missing:empty { display: none; }
.chip--missing { border-style: dashed; }
.chip-count { font-size: 0.7rem; color: var(--fade); }
.roster-add {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.roster-add input {
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--chalk);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.86rem;
  padding: 7px 11px;
  outline: none;
  transition: border-color 0.15s;
  flex: 1;
}
.roster-add input:focus { border-color: var(--dirt); }
.roster-add input::placeholder { color: var(--fade); opacity: 0.55; }

/* Player picker in play form */
.player-chip {
  display: inline-flex;
  align-items: center;
  background: var(--night);
  border: 1px solid var(--edge);
  border-radius: 20px;
  color: var(--fade);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 12px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  user-select: none;
}
.player-chip:hover { border-color: var(--dirt); color: var(--chalk); }
.player-chip.selected { background: var(--chalk); border-color: var(--chalk); color: var(--night); }

/* ── Mobile ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
  /* Nav: stack breadcrumb below brand + auth */
  nav {
    height: auto;
    min-height: 52px;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-auth { margin-left: auto; }
  #auth-user { display: none; }
  .card-edit { min-width: 44px; min-height: 44px; }
  .nav-search { margin-right: 4px; }
  .nav-search + .nav-auth { margin-left: 0; }
  .nav-search-open {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; background: transparent; border: none; font-size: 1rem; cursor: pointer;
  }
  .nav-search-box { display: none; }
  .nav-search.open { order: 2; flex-basis: 100%; margin: 6px 0 4px; }
  .nav-search.open + .nav-auth { margin-left: auto; }
  .nav-search.open .nav-search-open { display: none; }
  .nav-search.open .nav-search-box { display: flex; }
  #search-input { flex: 1; width: auto; min-height: 44px; font-size: 16px; }   /* 16px: iOS doesn't zoom in */
  #search-input::-webkit-search-cancel-button { display: none; }                /* ✕ below clears and closes */
  .nav-search-close {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; background: transparent; border: none; color: var(--fade); font-size: 1rem; cursor: pointer;
  }
  .search-results { left: 0; right: 0; width: auto; }
  .breadcrumb { width: 100%; order: 3; margin-left: 0; }
  .bc-item {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Container */
  .container { padding: 20px 16px 40px; }

  /* Page title */
  .page-title { font-size: 1.2rem; }

  /* Touch targets */
  .btn-primary { padding: 11px 18px; }
  .btn-ghost   { padding: 11px 16px; }
  .btn-auth    { padding: 8px 14px; }
  .btn-copy    { padding: 10px 16px; }
  .btn-icon    { padding: 8px 10px; font-size: 0.82rem; }
  .chip, .player-chip { padding: 6px 14px; font-size: 0.82rem; }
  .season-tab  { padding: 10px 16px 12px; font-size: 0.82rem; }

  /* Play card: move description below timestamp + players + actions */
  .play-header { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .play-desc {
    order: 10;
    flex: 1 1 100%;  /* base rule's flex:1 overrides width, squeezing the text beside the tags */
    white-space: normal;
    line-height: 1.4;
  }
  .play-actions { margin-left: auto; }

  /* Box score card padding */
  .bs-card { padding: 14px 14px; }
}

/* Session expiry warning (js/auth.js updateSessionBanner) */
.session-banner {
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--pine);
  border-bottom: 1px solid var(--warn);
  color: var(--chalk);
  font-size: 0.82rem;
}

/* Tagging mode (js/tagging.js) */
.tagging-toggle { margin-bottom: 10px; }
.tagging-panel { margin-bottom: 12px; }
.tagging-video { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 4px; overflow: hidden; }
.tagging-video iframe, .tagging-video #tagging-player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tagging-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.tagging-controls .tagging-tag-btn { margin-left: auto; }
.tagging-status { min-height: 1.2em; margin-top: 6px; font-size: 0.78rem; color: var(--fade); }
@media (max-width: 640px) {
  .tagging-controls .tagging-tag-btn { margin-left: 0; width: 100%; }
}

/* Quick description chips under the play description (js/plays.js addDescChip) */
.desc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.desc-chip {
  background: var(--edge);
  color: var(--chalk);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}
.desc-chip:hover { border-color: var(--dirt); }
.desc-chip--type { background: transparent; border-color: var(--dirt); }   /* play types: outlined */
.desc-chip--back { background: transparent; color: var(--fade); }
.desc-chips-break { flex-basis: 100%; height: 0; }   /* results, then where: separate lines */
.desc-chip-hint { min-height: 1.1em; font-size: 0.78rem; color: var(--warn); margin-bottom: 4px; }
@media (max-width: 640px) {
  .desc-chip { min-height: 44px; padding: 0 14px; font-size: 0.85rem; }   /* 44px tap targets on phones */
}
@media (max-width: 640px) {
  /* Templated descriptions are long: give the description its own full-width line on phones */
  .play-add-form .play-form-row { flex-wrap: wrap; }
  .play-add-form .play-form-row .f-desc { flex: 1 1 100%; min-width: 0; }
}

/* Tagging shortcut hints (js/tagging.js handleTaggingKey): only on devices with a mouse and keyboard */
.tagging-keys { display: none; margin-top: 4px; font-size: 0.72rem; color: var(--fade); }
.tagging-keys kbd { font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem; padding: 0 4px; border: 1px solid var(--edge); border-radius: 3px; }
.key-badge { display: none; margin-right: 5px; font-family: 'IBM Plex Mono', monospace; font-size: 0.65rem; color: var(--fade); }
@media (hover: hover) and (pointer: fine) {
  .tagging-keys { display: block; }
  .key-badge { display: inline; }
}

/* ── Tap targets on phones (F12) ──
   Everything you tap is around 44×44 px on a phone (rule 8; Apple 44pt, Google 48dp). Desktop is unchanged.
   tests/browser/tapTargets.spec.js checks every screen, so a new small target fails the tests. */
@media (max-width: 640px) {
  /* Chips: player pickers, game screen filter, Manage Roster */
  .chip, .player-chip { min-height: 44px; }
  /* Small icon buttons: card ↑ ↓ ✎ ✕, play edit/delete, chip ✎ ✕, depth chart and lineup ↑ ↓ × */
  .card-reorder, .card-del, .btn-icon, .chip .chip-del, .depth-player-actions button, .lineup-actions button {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  /* ↗ to a player's page: a bigger tap area without making rows taller */
  .stats-player-nav { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -14px -12px -14px -6px; }
  /* Admin cards: 44px buttons would squeeze the title ("Sprin…"), so the title gets the first line and the
     buttons (and →) a second line, on the right. Viewers have no buttons, so their cards don't change. */
  body.admin .card { flex-wrap: wrap; row-gap: 4px; }
  body.admin .card .card-main { flex: 1 0 100%; }
  body.admin .card .card-main + * { margin-left: auto; }
  /* Buttons and toggles */
  .bs-toggle-btn, .btn-primary, .btn-ghost, .btn-copy, .btn-auth, .tagging-toggle, .season-tab, .add-trigger { min-height: 44px; }
  /* Text boxes: 44px tall, and 16px text so iPhones don't zoom in when you tap one */
  input[type="text"], input[type="search"], input[type="number"], input[type="date"], select, textarea { min-height: 44px; font-size: 16px; }
  .inline-row input, .roster-add input, .play-add-form input { font-size: 16px; }
  /* Links you tap to go somewhere */
  .nav-brand, .bc-item, .lineup-name-link, .stats-player-link, .player-page-link, .roster-game-link, .roster-season-stats-link, #game-yt-link {
    display: inline-flex; align-items: center; min-height: 44px;
  }
  /* Rows and headers you tap: sortable headers, the Roster tab's expandable rows, box score player stats */
  .stats-table:not(.stats-table--plain) th { height: 44px; min-width: 44px; }
  .stats-table:not(.stats-table--plain) > tbody > tr:not(.stats-sub-row) > td { height: 44px; }   /* rows open on tap */
  .roster-player-header, .roster-season-header, .bs-batting-toggle { min-height: 44px; }
  .depth-pos-card { min-height: 44px; }
  .sf-done { min-height: 44px; }
  /* Box score form (admin): innings boxes and the Home Team toggle */
  .bs-toggle-btn { min-width: 44px; }
  .bs-inn-input, .bs-input-sm, .bs-stat-input { min-width: 44px; min-height: 44px; }
  .bs-reorder-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
}
