/* Tactical 2D Board — animated play diagrams (professor-vision Stage 2).
   Palette is defined as tokens so the board follows the app's light/dark
   theme with no second set of assets — one of the concrete reasons this was
   built as inline SVG rather than pre-rendered video files. */

.tb-wrap {
  --tb-court: #e9e2d6;
  --tb-paint: #dcd2c0;
  --tb-line:  #c2c8d2;
  --tb-off:   var(--accent1, #1d428a);
  --tb-def:   #c0392b;
  --tb-ball:  #f59e0b;

  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: 16px;
  padding: 16px;
}

html[data-theme="dark"] .tb-wrap,
:root:not([data-theme="light"]) .tb-wrap {
  --tb-court: #1b2437;
  --tb-paint: #232e46;
  --tb-line:  #3a465e;
  --tb-def:   #ef6b5b;
}

/* ── Header: Layer 1, the hook ── */
.tb-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tb-title {
  font-family: "Barlow Condensed", "Heebo", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text, #111);
}
.tb-hook {
  font-size: .85rem;
  color: var(--muted, #6b7280);
}

/* ── Court ── */
.tb-courtwrap { overflow-x: auto; }
.tb-svg {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 420px;
  height: auto;
}

/* Player names ride above their dot. Painted with a soft halo so a name
   stays readable when it passes over a court line or another marker. */
.tb-name {
  font-family: "Heebo", sans-serif;
  font-size: 13px;
  font-weight: 700;
  fill: var(--text, #111);
  paint-order: stroke;
  stroke: var(--bg-card, #fff);
  stroke-width: 4px;
  stroke-linejoin: round;
}

/* ── Controls + legend ── */
.tb-ctl {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.tb-btn {
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  padding: 7px 16px;
  border: none;
  border-radius: 9px;
  background: var(--accent1, #1d428a);
  color: var(--accent-fg, #fff);
  cursor: pointer;
}
.tb-btn:hover { opacity: .88; }

.tb-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--muted, #6b7280);
}
.tb-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-inline-end: 5px;
  vertical-align: -1px;
}
.tb-dot-ball { background: var(--tb-ball); }
.tb-dot-off  { background: var(--tb-off); }
.tb-dot-def  { border: 2px solid var(--tb-def); }

/* ── Layer 2: the plain-language read, always visible ── */
.tb-simple {
  margin: 14px 0 0;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--text, #111);
}

/* ── Layer 3: the analyst depth, opt-in ──
   Collapsed by default on purpose: a newcomer gets a complete answer without
   ever opening it, and nobody is forced past the depth they wanted. */
.tb-more {
  margin-top: 12px;
  border-top: 1px solid var(--border, rgba(0,0,0,.08));
  padding-top: 10px;
}
.tb-more > summary {
  cursor: pointer;
  font-size: .87rem;
  font-weight: 700;
  color: var(--accent-ink, #1d428a);
  list-style: none;
}
.tb-more > summary::-webkit-details-marker { display: none; }
.tb-more > summary::after {
  content: " ▾";
  font-size: .8em;
}
.tb-more[open] > summary::after { content: " ▴"; }

.tb-more-body { margin-top: 10px; }
.tb-block + .tb-block { margin-top: 12px; }
.tb-block-t {
  display: block;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--muted, #6b7280);
  margin-bottom: 3px;
}
.tb-block p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text, #111);
}

/* Honesty footnote — the board is a schematic, never tracked positions.
   Small, but never hidden: the app's whole credibility rests on not letting
   an illustration read as data. */
.tb-note {
  margin: 12px 0 0;
  font-size: .72rem;
  line-height: 1.5;
  color: var(--muted, #6b7280);
  font-style: italic;
}

@media (max-width: 480px) {
  .tb-wrap { padding: 12px; }
  .tb-name { font-size: 14px; }
  .tb-title { font-size: 1.1rem; }
}

/* ── Modal host (opened from a tactical term in the Professor's text) ── */
.tb-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.tb-dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px;
}
.tb-close {
  position: absolute;
  inset-inline-end: 10px;
  top: 8px;
  z-index: 2;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 10px;
  border: none;
  background: none;
  color: var(--muted, #6b7280);
  cursor: pointer;
}
.tb-close:hover { color: var(--text, #111); }

/* Tactical terms read as links, distinct from glossary terms (which open a
   text popup) — these open the animated board. */
.term-link--play::after {
  content: " ⛹";
  font-size: .85em;
  opacity: .7;
}

/* Play switcher inside the modal — needed when the board is opened from the
   "learn plays" entry rather than from a specific term. */
/* Groups stack, one per row. As a wrapping ROW they sat side by side whenever
   two fit — so "Screens & movement" and "Advanced" ended up on one line with
   their buttons flowing underneath, and there was no way to tell which button
   belonged to which heading. Reported live. */
.tb-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 46px 0 14px;
  background: var(--bg-card, #fff);
  border-radius: 18px 18px 0 0;
}
.tb-pick {
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 9px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  background: transparent;
  color: var(--text, #111);
  cursor: pointer;
}
.tb-pick.active {
  background: var(--accent1, #1d428a);
  border-color: var(--accent1, #1d428a);
  color: var(--accent-fg, #fff);
}
.tb-picker + #tb-modal-body .tb-wrap { border-radius: 0 0 18px 18px; border-top: none; }

/* ── Phase engine (rewrite 2026-08-21) ────────────────────────────────── */
.tb-actor { transform-box: fill-box; }
.tb-ball-dot {
  fill: var(--tb-ball);
  stroke: #3b2600;
  stroke-width: 2;
  opacity: 0;
}

/* The defensive CHOICE that defines a play (drop vs hedge on a pick & roll).
   Shown as a question because that is literally what it is. */
.tb-variants {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tb-variants-q {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted, #6b7280);
}
.tb-variant {
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border, rgba(0,0,0,.15));
  background: transparent;
  color: var(--text, #111);
  cursor: pointer;
}
.tb-variant.active {
  background: var(--tb-def);
  border-color: var(--tb-def);
  color: #fff;
}

/* Phase caption — names what is happening at this instant. This is the part
   that turns the animation into a lesson, so it gets real weight. */
.tb-phase {
  min-height: 2.6em;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tb-phase-bg, rgba(29,66,138,.07));
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text, #111);
}
html[data-theme="dark"] .tb-phase,
:root:not([data-theme="light"]) .tb-phase { background: rgba(91,141,239,.14); }

.tb-nav { padding: 6px 13px; font-size: 1rem; line-height: 1; }
.tb-scrub { flex: 1 1 auto; min-width: 70px; }
.tb-step {
  font-size: .78rem;
  color: var(--muted, #6b7280);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

/* Grouped picker — deliberately not one flat list of every play. */
.tb-group + .tb-group {
  border-top: 1px solid var(--border, rgba(0,0,0,.08));
  padding-top: 10px;
}
.tb-group-t {
  display: block;
  font-size: .74rem;
  font-weight: 800;
  color: var(--muted, #6b7280);
  margin-bottom: 5px;
}
.tb-group-plays { display: flex; gap: 7px; flex-wrap: wrap; }

/* Why the play keeps its name whichever variant is showing: the name is the
   OFFENSE's action, the toggle is the DEFENSE's answer. Confusing enough that
   a basketball-literate reader asked about it, so it's stated outright. */
.tb-variants-note {
  flex-basis: 100%;
  font-size: .74rem;
  line-height: 1.45;
  color: var(--muted, #6b7280);
  font-style: italic;
}
