* { box-sizing: border-box; }
:root {
  --paper: #e9e6dc;
  --board: #233d2e;
  --frame: #5a4632;
  --chalk: #eae6d8;
  --chalk-bright: #f2ede0;
  --chalk-muted: #a9b8ab;
  --gold: #e8d97a;
  --coral: #e2917c;
  --line: #5a6b58;
  --line-dim: #3a4a3d;
  --card-border: #c9c4ad;
}
body {
  margin: 0;
  padding: 36px 20px 64px;
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #2b2b2b;
}
.wrap { max-width: 1240px; margin: 0 auto; }
h1 {
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}
.subhead {
  text-align: center;
  font-size: 13px;
  color: #6b6b64;
  margin: 0 0 20px;
  line-height: 1.5;
}

/* --- toolbar --- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  justify-content: center;
  margin: 0 auto 6px;
  padding: 14px 16px;
  background: var(--frame);
  border-radius: 10px 10px 0 0;
}
.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.toolbar-group label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--chalk-muted);
}
.toolbar-group select {
  font-size: 13px;
  font-family: inherit;
  color: var(--chalk-bright);
  background: var(--board);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 140px;
}
.toolbar-group select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.chip-btn {
  font-size: 12px;
  font-family: inherit;
  color: var(--chalk-bright);
  background: transparent;
  border: 1px dashed var(--chalk-muted);
  border-radius: 20px;
  padding: 7px 14px;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--gold); color: var(--gold); }
.chip-btn:disabled { opacity: 0.4; cursor: default; border-color: var(--chalk-muted); color: var(--chalk-muted); }
.filter-note {
  text-align: center;
  font-size: 11.5px;
  color: #8a897f;
  min-height: 1.6em;
  margin: 0 0 14px;
}
.filter-note.active { color: var(--frame); font-weight: 600; }

.board-frame {
  background: var(--frame);
  border-radius: 0 0 12px 12px;
  padding: 10px;
}
.board {
  background: var(--board);
  border-radius: 8px;
  padding: 22px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1080px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .card-grid { grid-template-columns: 1fr; } .toolbar { justify-content: stretch; } .toolbar-group { flex: 1 1 45%; } }

.card {
  border: 1.5px dashed var(--card-border);
  border-radius: 10px;
  padding: 12px;
  background: rgba(0,0,0,0.06);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.card:hover { background: rgba(232,217,122,0.08); border-color: var(--gold); }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 2px;
}
.card-title {
  margin: 0;
  color: var(--chalk-bright);
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.3;
}
.card-title .rank { color: var(--chalk-muted); font-size: 11px; margin-right: 4px; }
.freq-badge {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--board);
  background: var(--gold);
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.card-svg-wrap {
  border: 1px dashed var(--line-dim);
  border-radius: 6px;
  margin: 8px 0;
}
.card-svg-wrap svg { width: 100%; display: block; }

/* Hand-drawn O-recipe markers (see markers.js) render inside a
   scale(radius/R) group in app.js's renderBoard -- R=30 is each recipe's
   native design radius, shrunk down to this dashboard's much smaller 13px/
   15px marker radius. non-scaling-stroke keeps each recipe's own hand-tuned
   stroke-width fixed in the SVG's root units instead of thinning along with
   that shrink; .marker-tex applies the shared chalkFine grain (defined once,
   globally, in index.html) uniformly across every marker regardless of which
   of the 20 recipes got picked. See dashboard/ui-design-journal.md. */
.card-svg-wrap g[id^="off-"] path,
.modal-svg-wrap g[id^="off-"] path,
.card-svg-wrap g[id^="def-"] path,
.modal-svg-wrap g[id^="def-"] path {
  vector-effect: non-scaling-stroke;
}
.card-svg-wrap .marker-tex,
.modal-svg-wrap .marker-tex {
  filter: url(#chalkFine);
}
/* Phase 2 of the hover animation ("settle + emphasize", see app.js's
   renderBoard/renderFrame): once every marker has arrived at its set
   position, a brief flat color swap on every marker -- a hard cut, not a
   fade or glow, matching this project's flat chalk-on-chalkboard aesthetic
   (no gradients/shadows anywhere else in this system). CSS wins over the
   paths' own inline stroke/fill presentation attributes without needing
   !important, per normal SVG/CSS cascade rules. */
.card-svg-wrap .marker-flash path,
.card-svg-wrap .marker-flash circle,
.card-svg-wrap .marker-flash line,
.modal-svg-wrap .marker-flash path,
.modal-svg-wrap .marker-flash circle,
.modal-svg-wrap .marker-flash line {
  stroke: var(--gold);
  fill: var(--gold);
}
.hover-hint {
  font-size: 9.5px;
  color: var(--chalk-muted);
  text-align: center;
  margin: -4px 0 8px;
  letter-spacing: 0.03em;
}
@media (hover: none) { .hover-hint { display: none; } }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.stat-cell { background: var(--board); padding: 7px 4px; text-align: center; }
.stat-cell .lab { margin: 0; font-size: 8.5px; letter-spacing: 0.05em; color: var(--chalk-muted); text-transform: uppercase; }
.stat-cell .val { margin: 2px 0 0; font-size: 15px; color: var(--chalk-bright); font-family: Georgia, serif; }
.card-foot {
  font-size: 9.5px;
  color: var(--chalk-muted);
  text-align: center;
  margin: 6px 0 0;
}

.section-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--chalk-muted);
  margin: 12px 0 5px;
  border-top: 1px dashed var(--line-dim);
  padding-top: 8px;
}
/* Named generically (not ".team-table") since this renders the modal's
   lineup breakdown, not a team breakdown -- see app.js's
   renderModalLineupTable/drawModalLineupTable. */
table.rank-table { width: 100%; border-collapse: collapse; }
table.rank-table th {
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--chalk-muted);
  text-align: right;
  font-weight: 600;
  padding: 2px 3px 4px;
  cursor: pointer;
  user-select: none;
}
table.rank-table th:first-child { text-align: left; }
table.rank-table th:hover { color: var(--gold); }
table.rank-table th .sort-arrow { font-size: 8px; }
table.rank-table td {
  font-size: 11.5px;
  color: var(--chalk);
  padding: 3px 3px;
  text-align: right;
  border-top: 1px dashed var(--line-dim);
  font-variant-numeric: tabular-nums;
}
table.rank-table td:first-child { text-align: left; color: var(--chalk-bright); font-weight: 600; }
table.rank-table td.index-hi { color: var(--gold); font-weight: 700; }
table.rank-table td.small-n { color: var(--coral); }
.small-n-star { color: var(--coral); }

footer {
  text-align: center;
  font-size: 11px;
  color: #8a897f;
  margin-top: 22px;
  line-height: 1.6;
}

/* --- modal --- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,26,20,0.72);
  z-index: 50;
  padding: 24px 16px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; align-items: flex-start; justify-content: center; }
.modal-frame {
  background: var(--frame);
  border-radius: 14px;
  padding: 12px;
  max-width: 1020px;
  width: 100%;
  margin: auto 0;
}
.modal-board {
  background: var(--board);
  border-radius: 9px;
  padding: 24px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--chalk-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--gold); }
.modal-title {
  font-family: Georgia, serif;
  font-size: 22px;
  color: var(--chalk-bright);
  margin: 0 0 2px;
}
.modal-sub {
  font-size: 12.5px;
  color: var(--chalk-muted);
  margin: 0 0 18px;
}
.modal-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}
@media (max-width: 700px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-svg-wrap svg { width: 100%; display: block; }
.modal-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin: 14px 0 0;
}
.modal-stat-grid .stat-cell { padding: 10px 6px; }
.modal-stat-grid .val { font-size: 18px; }
/* Second, smaller stat row (FG%/3P%/AST%/AST:TO) below the main PPP/shot-rate
   row -- 4 columns instead of 3, and a touch tighter so it reads as a
   secondary line, not competing with the primary stats above it. */
.modal-stat-grid-4 { grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
.modal-stat-grid-4 .stat-cell { padding: 7px 4px; }
.modal-stat-grid-4 .val { font-size: 14px; }

.modal-rank-table-wrap { max-height: 260px; overflow-y: auto; margin-top: 4px; }
.modal-footnote { font-size: 10.5px; color: var(--chalk-muted); margin: 6px 0 0; font-style: italic; }

/* Outcome-breakdown bars (modal-outcomes) -- same flat chalk-bar treatment
   the now-removed set-only modal's action-breakdown bars used (dashed-line-
   dim track, flat gold fill, no gradient), reused here rather than
   reinvented. */
.outcome-bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.outcome-bar-label { width: 92px; font-size: 11px; color: var(--chalk); flex: none; }
.outcome-bar-track { flex: 1; height: 12px; background: var(--line-dim); border-radius: 3px; overflow: hidden; }
.outcome-bar-fill { height: 100%; background: var(--gold); }
.outcome-bar-val { width: 46px; text-align: right; font-size: 10.5px; color: var(--chalk-muted); flex: none; font-variant-numeric: tabular-nums; }

/* --- tiered reveal ("Load more") --- */
.tier-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.tier-note {
  font-size: 11.5px;
  color: var(--chalk-muted);
  margin: 0;
  text-align: center;
}
#load-more-btn { color: var(--chalk-bright); border-color: var(--chalk-muted); }

/* ---------- site nav (shared markup across index.html and plays.html) ---------- */
.site-nav {
  max-width: 1240px;
  margin: 0 auto 22px;
  display: flex;
  gap: 6px;
}
.site-nav a {
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--chalk-muted);
  background: var(--frame);
  border: 1px solid var(--line-dim);
  border-radius: 20px;
  padding: 7px 16px;
}
.site-nav a:hover { border-color: var(--gold); color: var(--gold); }
.site-nav a.active { background: var(--gold); border-color: var(--gold); color: #2b2b2b; }

/* ---------- "see it in action" (modal, team-filtered view only) ---------- */
.modal-plays-links { display: flex; gap: 8px; margin-top: 4px; }
.modal-play-link {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  padding: 9px 10px;
}
.modal-play-link-good { background: var(--gold); color: #2b2b2b; }
.modal-play-link-bad { background: transparent; color: var(--coral); border: 1px solid var(--coral); }
.modal-play-link:hover { opacity: 0.85; }
