/* The Scorebook (/fan-school/, templates/scorebook.html). Loaded on that page only, after ring28.css
   and types.css. Tokens only; field green marks progress and nothing else. */

.sb-head .lede { margin-bottom: 1.5rem; }
/* What the script hides stays hidden, whatever display a class gives it. */
.scorebook [hidden] { display: none !important; }

.sb-card {
  max-width: 40rem;
  padding: 1rem 1rem 1.125rem;
  background: var(--paper);
  border-top: 4px double var(--navy);
}

/* The box score: innings 1 to 9, then R (innings played) and H (questions right). */
.linescore {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-mono);
  text-align: center;
}
.linescore caption {
  display: table-caption;
  caption-side: top;
  text-align: left;
  padding-bottom: 0.5rem;
}
.linescore th {
  background: var(--navy);
  color: var(--white);
  font-weight: 400;
  font-size: 0.8125rem;
  padding: 0;
}
.linescore th a {
  display: block;
  min-height: 2rem;
  padding-block: 0.375rem;
  color: inherit;
  text-decoration: none;
}
.linescore th a:hover { text-decoration: underline; }
.linescore th a:focus-visible { outline-color: var(--white); outline-offset: -4px; }
.linescore td {
  height: 2.75rem;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--road-gray);
  font-size: 0.75rem;
  color: var(--reading-gray);
}
.linescore .total { border-left: 4px double var(--navy); font-weight: 400; }
.linescore td.total { color: var(--navy); font-size: 1rem; }
.linescore td.played { color: var(--navy); }
.linescore td.hit { color: var(--field-green); font-weight: 600; }
.linescore td.next { outline: 2px dashed var(--field-green); outline-offset: -4px; }

.up-next {
  margin-top: 0.875rem;
  font-weight: 600;
}
.up-next .label { display: inline; margin-right: 0.375rem; color: var(--reading-gray); font-weight: 400; }
.up-next a { color: var(--field-green); }
.sb-note, .sb-small { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--reading-gray); }
.sb-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--road-gray);
  font-size: 0.8125rem;
  color: var(--reading-gray);
}
.sb-tools a { color: var(--navy); }

/* Buttons: the one action in field green (ring28.css .action), the rest quiet. */
button.action, button.quiet {
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0;
  cursor: pointer;
}
button.action { margin-top: 0; border: 0; }
button.quiet {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--navy);
}
button.quiet:hover { text-decoration: underline; }
button:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Finishing: the graduate box. */
.sb-board { display: grid; gap: 1.5rem; align-items: start; }
.graduate {
  max-width: 40rem;
  padding: 1.25rem;
  background: var(--white);
  border: 1px solid var(--road-gray);
  border-top: 4px double var(--navy);
}
.graduate h2 { font-size: clamp(1.75rem, 5vw, 2.25rem); margin: 0.5rem 0 0.75rem; }
.graduate b { font-weight: 600; }
.graduate-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }

/* The lineup: one row per inning. */
.lineup { padding: 0; list-style: none; }
.inning {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0 1rem;
  padding-block: 1.25rem;
  border-top: 4px double var(--road-gray);
}
.inning:first-child { border-top: 0; padding-top: 0; }
.inning-n {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--navy);
  font-family: var(--font-slab);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
}
.inning.played .inning-n { background: var(--navy); color: var(--white); }
.inning.next .inning-n { border: 2px dashed var(--field-green); color: var(--field-green); }
.inning-body h3 { font-size: clamp(1.375rem, 4vw, 1.75rem); margin-bottom: 0.375rem; }
.inning-body h3 .label {
  margin-bottom: 0.25rem;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.09em;
  color: var(--reading-gray);
}
.inning-body > p { max-width: 40rem; font-size: 0.9375rem; }
.inning-body > p + p { margin-top: 0.5rem; }
.opens .label, .inning-result .label { display: inline; margin-right: 0.375rem; color: var(--reading-gray); }
.opens a { font-weight: 600; }
.inning-result { font-family: var(--font-mono); font-size: 0.875rem; }
.inning-result.hit [data-result-text] { color: var(--field-green); font-weight: 600; }

/* An at-bat: three questions, each with its answer. */
.at-bat { max-width: 40rem; }
.at-bat > summary { font-size: 0.9375rem; }
.at-bat-form { margin-top: 0.25rem; }
.pitch {
  margin: 0;
  padding: 0.875rem 0 0;
  border: 0;
  min-width: 0;
}
.pitch + .pitch { margin-top: 0.75rem; border-top: 1px solid var(--road-gray); }
.pitch legend {
  padding: 0;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.45;
}
.pitch legend .label { color: var(--reading-gray); font-weight: 400; margin-bottom: 0.125rem; }
.choices { display: grid; gap: 0.375rem; margin-top: 0.625rem; }
.choices label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0.375rem 0.75rem;
  background: var(--white);
  border: 1px solid var(--road-gray);
  cursor: pointer;
}
.choices input { flex: none; width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--navy); }
.choices label:has(input:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.choices label:has(input:focus-visible) { outline: 3px solid var(--field-green); outline-offset: 2px; }
.choices label:has(input:disabled) { cursor: default; }
.choices label.correct { border-color: var(--field-green); box-shadow: inset 0 0 0 1px var(--field-green); }
.verdict { margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.8125rem; }
.verdict.right { color: var(--field-green); font-weight: 600; }
.answer { margin-top: 0.5rem; padding-top: 0.25rem; }
.answer p { font-size: 0.875rem; }
.answer p + p { margin-top: 0.375rem; }
.answer b { font-weight: 600; }
.swing { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.swing-note { flex-basis: 100%; font-size: 0.875rem; font-weight: 600; }
.swing-note:empty { display: none; }

/* The printable scorecard: hidden on screen. In print, with the script on, it is the whole page. */
.sb-sheet { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .linescore td, .inning-n { transition: background-color 0.4s ease, color 0.4s ease; }
}

@media (min-width: 60rem) {
  .sb-board { grid-template-columns: minmax(0, 40rem) minmax(0, 1fr); }
}

@media (min-width: 40rem) {
  .inning { grid-template-columns: 4rem minmax(0, 1fr); gap: 0 1.5rem; }
  .inning-n { width: 4rem; height: 4rem; font-size: 2rem; }
  .sb-card { padding: 1.25rem; }
  .linescore td { font-size: 0.875rem; }
}

@media (forced-colors: active) {
  .linescore td.next, .inning.next .inning-n { outline: 2px dashed CanvasText; }
  .inning.played .inning-n { border: 3px solid CanvasText; }
  button.action { border: 2px solid ButtonText; }
}

@media print {
  @page { size: letter; margin: 0.5in; }
  .sb-js body { background: var(--white); }
  .sb-js .skip, .sb-js header, .sb-js .site-footer, .sb-js main .wrap > :not(.sb-sheet) { display: none; }
  .sb-js main .wrap { max-width: none; padding: 0; }
  .sb-js .sb-sheet { display: block; color: var(--navy); font-size: 10.5pt; }
  .sb-sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    padding-bottom: 8pt;
    margin-bottom: 14pt;
    border-bottom: 4px double var(--navy);
  }
  .sb-sheet-head img { width: 1.9in; }
  .sb-sheet-head p { text-align: right; }
  .sb-sheet-head b { display: block; font-family: var(--font-slab); font-weight: 900; font-size: 20pt; line-height: 1.1; }
  .sb-sheet-head span { font-family: var(--font-mono); font-size: 8pt; letter-spacing: 0.06em; }
  .sb-sheet .linescore th { font-size: 10pt; padding: 4pt 0; }
  .sb-sheet .linescore td { height: 0.45in; font-size: 11pt; }
  .sb-sheet .linescore td.next { outline: 0; }
  .sb-sheet-innings { width: 100%; margin-top: 18pt; border-collapse: collapse; }
  .sb-sheet-innings th {
    text-align: left;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 7.5pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--navy);
    padding: 4pt 6pt 4pt 0;
  }
  .sb-sheet-innings td { padding: 6pt 6pt 6pt 0; border-bottom: 1px solid var(--road-gray); font-size: 10.5pt; }
  .sb-sheet-innings td:first-child, .sb-sheet-innings td:nth-child(3), .sb-sheet-innings td:last-child { font-family: var(--font-mono); }
  .sb-sheet-foot {
    margin-top: 16pt;
    padding-top: 6pt;
    border-top: 1px solid var(--road-gray);
    font-family: var(--font-mono);
    font-size: 7.5pt;
    color: var(--reading-gray);
  }
}
