:root {
  color-scheme: light;
  --ink: #1a372d;
  --pine: #173a30;
  --board: #203f34;
  --paper: #f5ecd9;
  --card: #fff9eb;
  --cream: #f4e7cb;
  --muted: #5d6657;
  --line: #d5c9af;
  --orange: #ad3e25;
  --orange-dark: #86301e;
  --yellow: #f7ca70;
  --heading: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --numbers: 'IBM Plex Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); font: 500 15px/1.45 var(--body); background: var(--paper); }
body::before { content: ''; position: fixed; z-index: -1; inset: 0; opacity: .25; background: repeating-linear-gradient(0deg, transparent 0 3px, #c2a57424 3px 4px), radial-gradient(ellipse at 15% 25%, #fff9ec 0, transparent 65%); pointer-events: none; }
h1, h2, h3, p, fieldset { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #aa4b30; outline-offset: 3px; }

.topbar { background: var(--pine); color: var(--cream); border-bottom: 3px solid #bb6338; }
.topbar-inner { max-width: 1920px; min-height: 48px; margin: auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; white-space: nowrap; font: 800 22px/1 var(--heading); letter-spacing: .04em; text-transform: uppercase; }
.brand:hover { color: var(--yellow); }
.brand:focus-visible { outline-color: var(--yellow); }
.top-actions { display: flex; align-items: center; gap: clamp(6px, 2vw, 22px); }
.nav-button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 3px; color: var(--cream); background: none; border: 0; white-space: nowrap; font-size: 13px; font-weight: 700; }
.nav-button:hover { color: var(--yellow); }
.nav-button:focus-visible { outline-color: var(--yellow); }
.help-icon { border: 1px solid currentColor; border-radius: 50%; font: 600 11px/13px var(--numbers); width: 15px; height: 15px; text-align: center; }
.sound-icon { font: 700 20px/.75 system-ui; }
.nav-button { min-height: 44px; }
#fullscreen svg { flex: none; }
#fullscreen[aria-pressed='true'] { color: var(--yellow); }
#fullscreen-status { padding: 6px 18px; text-align: center; color: var(--cream); font-size: 12px; }

html.is-fullscreen { background: var(--paper); overflow: auto; }
.is-fullscreen .topbar { position: sticky; top: 0; z-index: 10; }
.is-fullscreen .topbar-inner { max-width: none; }
.is-fullscreen .shell { width: 100%; padding-top: 10px; }
.is-fullscreen .masthead { align-items: center; margin-bottom: 14px; }
.is-fullscreen .masthead h1 { font-size: 44px; }
.is-fullscreen .masthead p { display: none; }

.shell { width: min(100%, 1920px); margin: 0 auto; padding: 12px 16px 28px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
h1 { font: 900 clamp(36px, 3.8vw, 52px)/.95 var(--heading); letter-spacing: -.026em; text-transform: uppercase; }
h1 em { font-style: normal; color: var(--orange); }
.masthead p { color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 7px; }
.shell:has(#setup[hidden]) .masthead p { display: none; }
.mode-picker, .control-set { min-width: 0; border: 0; padding: 0; }
.mode-picker { display: flex; gap: 3px; padding: 4px; border: 1px solid #b8ad94; background: #eae0c8; border-radius: 9px; }
.mode-picker input, .choice-bar input, .team-bar input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-picker label, .choice-bar label, .team-bar label { display: grid; align-content: center; justify-items: center; cursor: pointer; user-select: none; }
.mode-picker label { padding: 9px 14px; border-radius: 5px; white-space: nowrap; font-size: 13px; font-weight: 700; }
.mode-picker label:hover { background: #f3ebd7; }
.mode-picker input:checked + label { background: var(--pine); color: var(--card); box-shadow: 0 1px 2px #2b302439; }
.mode-picker input:disabled + label { cursor: default; opacity: .65; }
input:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; z-index: 1; }

.game-grid { --play-card-width: clamp(280px, 22vw, 340px); display: grid; grid-template-columns: minmax(0, 1fr) var(--play-card-width); gap: 12px; align-items: stretch; }
@media (width > 700px) {
  html:not(.is-fullscreen) .game-grid {
    /* Leave room above the field for the page header and scoreboard. */
    max-width: calc(max(300px, (100svh - 244px) * 16 / 9) + var(--play-card-width) + 14px);
    margin-inline: auto;
  }
}
.ballpark, .play-card { overflow: hidden; border: 1px solid #3a4b38; border-radius: 12px; box-shadow: 0 4px 0 #9c907251, 0 12px 27px #5b4a2c11; }
.ballpark { background: var(--board); color: var(--cream); align-self: start; }
.scoreboard { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(90px, 1fr) minmax(75px, .8fr) minmax(120px, 1fr) 68px; min-height: 68px; border-bottom: 2px solid #f0bb67; }
.scoreboard.practice { grid-template-columns: minmax(90px, 1fr) minmax(75px, .8fr) minmax(120px, 1fr) 68px; }
.scoreboard > div { padding: 11px 15px; border-right: 1px solid #a0ad8834; }
.scoreboard > div:last-child { border-right: 0; }
.score-team, .score-inning { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; }
.score-caption { color: #e0d6b8; font: 600 10px/1 var(--numbers); letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.score-team strong, .score-inning strong { color: #ffdf95; font: 800 31px/.92 var(--heading); font-variant-numeric: tabular-nums; }
.score-inning strong span { color: #e1d8b8; font-size: 19px; }
.score-inning strong { white-space: nowrap; }
.score-counts { display: grid; align-content: center; gap: 5px; }
.count { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.dots { display: flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #aab292; }
.dots .filled { background: #ffd680; border-color: #ffd680; box-shadow: 0 0 6px #f8c36e6b; }
.score-bases { display: grid; place-content: center; }
.base-diamond { display: block; position: relative; width: 37px; height: 29px; }
.base-diamond i { position: absolute; width: 10px; height: 10px; border: 1px solid #b0bb9a; border-radius: 1px; transform: rotate(45deg); }
.base-diamond i:nth-child(1) { right: 2px; top: 13px; }
.base-diamond i:nth-child(2) { left: 13px; top: 2px; }
.base-diamond i:nth-child(3) { left: 2px; top: 13px; }
.base-diamond .filled { background: #ffd680; border-color: #ffd680; }

.field-stage { position: relative; container-type: inline-size; }
.field-wrap { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #678f4c; }
#field { display: block; width: 100%; height: 100%; }
.field-wrap.live { cursor: crosshair; touch-action: manipulation; }
.field-sign { position: absolute; top: 13px; left: 13px; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid #fff0cda0; border-radius: 5px; background: #19362ee8; color: #fff4d9; font: 600 10px/1.15 var(--numbers); letter-spacing: .06em; text-transform: uppercase; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #f7c763; }
.play-toast { position: absolute; right: 13px; bottom: 12px; max-width: 90%; white-space: nowrap; padding: 5px 14px 7px; border: 2px solid #f6e9c5; border-radius: 5px; background: #183a31; color: #ffdb8a; box-shadow: 0 4px 0 #142d2aba; font: 800 clamp(18px, 3.3vw, 32px)/1 var(--heading); text-transform: uppercase; animation: toast-in .25s ease-out both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px) scale(.93); } }
.batting-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px 13px; border-top: 1px solid #e0c4879c; background: #17362c; }
.batting-actions .field-styles { grid-column: 1 / -1; grid-row: 1; margin: 0; }
.field-styles legend { padding: 0 0 5px; }
.field-styles .swing-styles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.field-styles .swing-styles label { min-height: 36px; border-color: #82927b; color: var(--cream); background: #284a3e; }
.field-styles input:checked + label { border-color: #fae5a7; background: #f2e6c6; color: var(--pine); box-shadow: none; }
.field-styles input:enabled + label:hover { border-color: var(--yellow); }
.field-styles input:disabled + label { opacity: .72; cursor: default; }
.field-styles input:focus-visible + label { outline-color: var(--yellow); }
.batting-status { display: grid; grid-column: 1; grid-row: 2; gap: 4px; min-width: 0; color: #f5ebcf; font-size: 12px; line-height: 1.3; }
.batting-status .score-caption { color: var(--yellow); }
.aim-picker { display: flex; gap: 3px; padding: 3px; border: 1px solid #a1ae8f87; border-radius: 6px; }
.aim-picker button { min-height: 34px; padding: 3px 8px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--cream); font-size: 12px; font-weight: 700; }
.aim-picker button[aria-pressed='true'] { color: var(--pine); background: #f1e5c6; }
.aim-picker button:hover:not(:disabled):not([aria-pressed='true']) { background: #456454; }
.batting-actions .swing-action { grid-column: -2; grid-row: 2; min-width: 130px; touch-action: manipulation; }
.batting-actions .swing-action[aria-disabled='true'] { opacity: .74; cursor: default; }
.batting-actions button:focus-visible { outline-color: var(--yellow); }
.field-wrap.defense-interactive { cursor: crosshair; touch-action: manipulation; }
.landing-tag { position: absolute; z-index: 1; min-width: 94px; min-height: 44px; padding: 3px 8px; transform: translate(var(--landing-offset, -50%), calc(-100% - 11px)); border: 2px solid #283c31; border-radius: 7px; background: #ffe198; color: #20382e; box-shadow: 0 2px 3px #172c2580; font: 800 13px/1 var(--body); white-space: nowrap; touch-action: manipulation; }
.landing-tag::after { position: absolute; bottom: -7px; left: calc(var(--landing-pointer, 50%) - 5px); width: 10px; height: 10px; transform: rotate(45deg); border-right: 2px solid #283c31; border-bottom: 2px solid #283c31; background: inherit; content: ''; pointer-events: none; }
button.landing-tag:hover:not(:disabled), button.landing-tag:focus-visible { background: #fff2c7; outline: 2px solid #20382e; outline-offset: 2px; }
.landing-tag:disabled { pointer-events: none; }
.outfield-tag { transform: translate(var(--landing-offset, -50%), 11px); }
.outfield-tag::after { top: -7px; bottom: auto; transform: rotate(225deg); }
.hit-landing-tag { display: grid; place-items: center; min-height: 28px; min-width: 84px; pointer-events: none; }
.landing-near-left { --landing-offset: -19%; --landing-pointer: 19%; }
.landing-near-right { --landing-offset: -81%; --landing-pointer: 81%; }
.defense-actions { display: grid; gap: 9px; padding: 9px 12px 12px; border-top: 1px solid #e0c4879c; background: #17362c; }
.running-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px 12px 13px; border-top: 1px solid #e0c4879c; background: #17362c; }
.running-actions p { color: #fff2d0; font-size: 13px; line-height: 1.35; }
.running-actions button { touch-action: manipulation; }
.running-actions button:focus-visible { outline-color: var(--yellow); }
.runner-picker { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.runner-options { display: flex; flex-wrap: wrap; gap: 6px; }
.runner-options button { flex: 1 1 64px; max-width: 116px; min-height: 44px; padding: 4px 6px; border: 1px solid #82927b; border-radius: 6px; background: #284a3e; color: var(--cream); font-size: 13px; font-weight: 800; }
.runner-options button:hover:not(:disabled) { border-color: var(--yellow); }
.runner-options button[aria-pressed='true'] { border-color: #fae5a7; background: #f2e6c6; color: var(--pine); }
.runner-options button:disabled { opacity: .72; }
.runner-commands { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.runner-commands button { white-space: nowrap; }
.running-actions .primary:disabled { opacity: .65; }
.pitch-options { display: grid; gap: 7px; padding: 8px 10px; background: #17362c; border-bottom: 1px solid #e0c4879c; }
@container (min-width: 500px) {
  .pitch-options { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
}
@container (min-width: 720px) {
  .pitch-options {
    position: absolute;
    z-index: 1;
    top: 8px;
    left: 50%;
    width: 462px;
    transform: translateX(-50%);
    border: 1px solid #b9bd98;
    border-radius: 9px;
    box-shadow: 0 3px 8px #19362e50;
    pointer-events: none;
  }
  .pitch-options button { pointer-events: auto; }
  .pitch-options:not([hidden]) + .field-wrap .field-sign { display: none; }
}
.defense-control { display: grid; gap: 5px; }
.pitch-options .score-caption { text-align: center; }
.defense-choices { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 5px; }
.defense-choices button { min-height: 38px; padding: 3px 8px; border: 1px solid #82927b; border-radius: 5px; background: #284a3e; color: var(--cream); font-size: 13px; font-weight: 800; }
.defense-choices button:hover:not(:disabled) { border-color: var(--yellow); }
.defense-choices button[aria-pressed='true'] { border-color: #fae5a7; background: #f2e6c6; color: var(--pine); }
.defense-choices button:disabled { cursor: default; opacity: .72; }
.pitch-options .defense-choices button { min-width: 0; min-height: 40px; padding-inline: 6px; }
.pitch-options button:focus-visible, .defense-actions button:focus-visible { outline-color: var(--yellow); }
.aim-directions button { font-size: 19px; line-height: 1; }
.release-meter { position: relative; grid-column: 1 / -1; justify-self: center; width: min(100%, 360px); height: 10px; border: 1px solid #718e72; border-radius: 5px; background: #284a3e; }
.release-zone { position: absolute; inset-block: 0; left: 64.5%; width: 15%; background: #eeb758; }
.release-needle { position: absolute; z-index: 1; inset-block: -3px; left: 0; width: 4px; border-radius: 2px; background: #fff7dd; transform: translateX(-50%); }
.pitch-delivery { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.pitch-delivery .primary { grid-column: 2; justify-content: center; gap: 7px; width: 176px; min-height: 40px; padding: 5px 8px 7px; font-size: 16px; white-space: nowrap; touch-action: manipulation; }
.pitch-delivery .link-button { grid-column: 3; justify-self: center; min-height: 40px; color: var(--cream); font-size: 11px; line-height: 1.15; }
.pitch-delivery .link-button:hover { color: var(--yellow); }
.pitch-delivery .primary:disabled { opacity: .65; cursor: default; }
@media (pointer: coarse) {
  .pitch-options .defense-choices button, .pitch-delivery button { min-height: 44px; }
}
.defense-command { display: flex; min-height: 32px; align-items: center; justify-content: space-between; gap: 10px; }
.defense-command .primary { min-width: 142px; touch-action: manipulation; }
.defense-command .primary:disabled { opacity: .65; cursor: default; }
.throw-choices button { min-height: 43px; touch-action: manipulation; }
.throw-choices .force-base { border-color: #ffc76c; background: #5b5233; color: #ffe8a9; }
.field-footer { display: flex; min-height: 42px; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid #c3cba44f; font-size: 11px; font-weight: 700; }
.field-footer > span:first-child { color: #e3d9bd; }
.field-footer #streak { color: #ffda88; white-space: nowrap; }

.play-card { display: flex; flex-direction: column; min-width: 0; background: var(--card); }
.play-card:has(.setup[hidden]) { align-self: start; position: sticky; top: 12px; }
.is-fullscreen .play-card:has(.setup[hidden]) { top: 62px; }
.is-fullscreen:has(#fullscreen-status:not([hidden])) .play-card:has(.setup[hidden]) { top: 94px; }
.play-card .batting-actions { grid-template-columns: minmax(0, 1fr); }
.play-card .batting-actions .field-styles { grid-column: 1; }
.play-card .batting-actions .batting-status { grid-column: 1; grid-row: 2; }
.play-card .batting-actions .aim-picker { grid-column: 1; grid-row: 3; width: 100%; justify-content: center; }
.play-card .batting-actions .swing-action { grid-column: 1; grid-row: 4; width: 100%; }
.play-card .running-actions { grid-template-columns: minmax(0, 1fr); }
.play-card .defense-command { flex-direction: column; align-items: stretch; }
.play-card .runner-picker { grid-template-columns: minmax(0, 1fr); }
.play-card .runner-commands button { flex: 1 1 auto; }
.play-card:has(.batting-actions:not([hidden]), .defense-actions:not([hidden]), .running-actions:not([hidden])) .at-bat { min-height: 0; padding: 18px; }
.play-card:has(.setup:not([hidden])) { align-self: start; }
.card-header { display: flex; min-height: 55px; align-items: center; gap: 9px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #ecdfc2; }
.card-mark { color: var(--orange); font: 700 20px/1 system-ui; }
.card-header h2, .box-heading h2 { font: 800 26px/.95 var(--heading); letter-spacing: .025em; text-transform: uppercase; }
.link-button { border: 0; background: none; color: var(--ink); padding: 4px 0; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { color: var(--orange); }
#quit { margin-left: auto; white-space: nowrap; }
.card-content { display: flex; flex: 1; min-width: 0; flex-direction: column; padding: clamp(17px, 2vw, 25px); }
.setup-heading { margin-bottom: 20px; }
.setup .start-game { margin-bottom: 22px; min-height: 52px; }
.setup-heading h3, .at-bat-heading { font: 800 clamp(32px, 3.2vw, 44px)/.95 var(--heading); letter-spacing: -.01em; }
.at-bat-heading { font-size: clamp(32px, 3.2vw, 44px); }
.play-card .at-bat-heading { line-height: 1; }
.setup-heading p, .at-bat p { color: var(--muted); margin-top: 9px; font-size: 14px; }
.control-label, .play-label { color: #455647; font: 700 11px/1.25 var(--numbers); letter-spacing: .07em; text-transform: uppercase; }
.control-label { display: block; margin-bottom: 7px; }
select { appearance: auto; min-height: 42px; width: 100%; padding: 6px 12px; border: 1px solid #aaa28a; border-radius: 6px; color: var(--ink); background: #fffdf4; font-weight: 700; }
.control-set { margin: 17px 0 0; }
.choice-bar, .team-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.choice-bar label, .team-bar label { min-height: 41px; padding: 5px 3px; border: 1px solid #bdb29a; border-radius: 6px; color: var(--ink); background: #fffdf4; font-size: 12px; font-weight: 700; white-space: nowrap; }
.choice-bar label:hover, .team-bar label:hover { background: #efe9d6; }
.choice-bar input:checked + label, .team-bar input:checked + label { border-color: #436c52; background: #e0ead9; box-shadow: inset 0 0 0 1px #436c52; }
.team-bar label { min-height: 62px; gap: 4px; }
.jersey { display: block; width: 23px; height: 22px; clip-path: polygon(0 18%, 28% 0, 37% 0, 42% 14%, 58% 14%, 63% 0, 72% 0, 100% 18%, 89% 52%, 76% 45%, 76% 100%, 24% 100%, 24% 45%, 11% 52%); background: linear-gradient(90deg, var(--team) 47%, #f8f2d2 47% 53%, var(--team) 53%); }
.jersey.green { --team: #337954; }
.jersey.orange { --team: #b9582c; }
.jersey.blue { --team: #42658e; }
.primary, .secondary { min-height: 46px; border: 1px solid var(--orange-dark); border-radius: 7px; padding: 9px 13px; color: #fff8e8; background: var(--orange); box-shadow: 0 3px 0 var(--orange-dark); font: 800 20px/1 var(--heading); letter-spacing: .055em; text-transform: uppercase; }
.primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.primary:hover { background: #95341f; }
.primary:active, .secondary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--orange-dark); }
.team-builder { margin: 20px 0; }
.team-builder-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 3px 8px; }
.team-builder-header h4 { margin: 0; color: var(--ink); font: 800 24px/1 var(--heading); }
#roster-count { color: #455647; font: 700 11px/1.2 var(--numbers); text-transform: uppercase; }
.team-builder-tip { margin: 5px 0 8px; color: var(--muted); font-size: 13px; }
.roster-grid, .batting-order { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.roster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.roster-card {
  --nameplate: #fbf3e2;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 28px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 1px solid #bdb29a;
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(to top, var(--nameplate) 28px, #cbbc9e 28px 29px, transparent 29px),
    radial-gradient(ellipse at 50% 24%, #fff8e8 2%, #ebdfc5 85%);
  text-align: left;
}
.roster-card:hover { border-color: #6e7859; }
.roster-card:focus-visible { z-index: 1; outline-offset: 2px; }
.roster-card[aria-pressed='true'] { --nameplate: #e4edd9; border-color: #436c52; box-shadow: inset 0 0 0 1px #436c52; }
.roster-card[aria-pressed='true']::after { position: absolute; top: 5px; right: 5px; display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; color: #fff9eb; background: #41654b; content: '✓' / ''; font-size: 11px; }
.roster-card[data-pending='true'] { --nameplate: #f9e0bf; border-color: var(--orange); box-shadow: inset 0 0 0 2px var(--orange); }
.roster-card canvas { grid-column: 1 / -1; display: block; width: min(100%, 96px); height: auto; justify-self: center; }
.roster-name { padding-left: clamp(4px, 1.5vw, 8px); font: 800 14px/1.1 var(--body); }
.roster-jersey { padding-right: clamp(4px, 1.5vw, 8px); color: #566044; font: 700 10px/1.1 var(--numbers); }
.batting-order { counter-reset: lineup; }
.lineup-row { display: grid; min-height: 48px; grid-template-columns: 25px minmax(0, 1fr) repeat(2, 44px); align-items: center; gap: 5px; padding: 1px 3px 1px 7px; border: 1px solid #cfbfa0; border-radius: 6px; background: #fbf3df; counter-increment: lineup; }
.lineup-row::before { color: #48634c; content: counter(lineup); font: 700 13px/1 var(--numbers); text-align: center; }
.lineup-name { min-width: 0; color: var(--ink); font-size: 14px; font-weight: 800; }
.lineup-move { min-width: 44px; min-height: 44px; padding: 0; border: 1px solid #b3a68b; border-radius: 5px; color: var(--ink); background: #fffaf0; font-size: 19px; font-weight: 800; }
.lineup-move:hover:not(:disabled):not([aria-disabled='true']) { border-color: #507455; background: #e5ebd8; }
.lineup-move:disabled, .lineup-move[aria-disabled='true'] { opacity: .48; cursor: default; }
.lineup-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.setup .primary:disabled, .setup .primary[aria-disabled='true'] { opacity: .65; cursor: default; }
.secondary { border-color: #89856d; color: var(--ink); background: var(--cream); box-shadow: 0 3px 0 #89856d; }
.secondary:hover { background: #e7d8b9; }

.at-bat { justify-content: center; min-height: 345px; }
.play-label { margin-bottom: 10px; }
.at-bat .current-batter { margin: 0 0 6px; color: #455647; font-weight: 800; }
.equation { font: 800 clamp(36px, 3.6vw, 48px)/1 var(--heading); letter-spacing: .01em; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 21px 0 2px; }
.answer { position: relative; min-height: 65px; padding: 8px 16px; border: 1px solid #9d9a80; border-radius: 6px; color: var(--ink); background: #fffdf4; box-shadow: 0 2px 0 #d2c9ad; font: 800 31px/1 var(--heading); }
.answer:hover { border-color: #396548; background: #e5eddd; box-shadow: 0 2px 0 #94aa90; }
.answer kbd { position: absolute; left: 7px; top: 6px; }
.keyboard-tip, .at-bat .keyboard-tip { margin: 15px 0 0; color: #545f50; font-size: 12px; }
kbd { display: inline-block; min-width: 16px; padding: 0 3px; border: 1px solid #a8a58d; border-radius: 3px; color: #535d4a; background: #f7f1df; font: 500 10px/15px var(--numbers); text-align: center; }
.swing-guide { margin-top: 18px; padding: 12px 13px; border-left: 3px solid #a5663d; background: #eee1c5; }
.swing-guide .control-label { margin-bottom: 0; }
.swing-guide p { margin-top: 5px; font-size: 13px; }
.assisted { align-self: flex-start; min-height: 36px; margin-top: 10px; }
.result-heading { color: var(--orange); }
#result-detail { margin-bottom: 23px; }
.final-stats { display: grid; gap: 6px; margin: -5px 0 19px; font-size: 13px; }
.final-stats div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.final-stats strong { font-family: var(--numbers); }

.box-score { display: grid; grid-template-columns: minmax(100px, .65fr) minmax(0, 2.15fr) minmax(112px, .7fr); gap: 21px; align-items: center; margin-top: 19px; padding: 11px 17px; border: 1px solid #bcaf91; border-radius: 9px; background: #f7efd9; }
.box-heading p, #accuracy-detail { color: var(--muted); font-size: 11px; font-weight: 700; }
.box-heading p { margin-top: 3px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
td, th { text-align: center; padding: 3px 6px; }
tr :first-child { text-align: left; }
thead { color: #4e594c; font: 600 10px/1 var(--numbers); text-transform: uppercase; }
thead tr, tbody tr:first-child { border-bottom: 1px solid var(--line); }
td { font-family: var(--numbers); }
td:last-child, th:last-child { font-weight: 700; background: #e8dec4; }
.accuracy { padding-left: 12px; border-left: 1px solid var(--line); display: grid; align-content: center; }
.accuracy .control-label { margin-bottom: 0; }
.accuracy strong { font: 800 27px/1 var(--heading); }
.practice-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.practice-stats div { display: grid; justify-items: center; gap: 3px; }
.practice-stats strong { font: 800 26px/1 var(--heading); }
.practice-stats span { color: var(--muted); font-size: 11px; font-weight: 700; }

.dialog { width: min(calc(100% - 30px), 485px); max-height: calc(100% - 30px); padding: 23px; border: 1px solid var(--pine); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: 0 12px 40px #15281f61; }
.dialog::backdrop { background: #10251ec4; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.dialog-head h2 { font: 800 38px/1 var(--heading); }
.close-button { width: 36px; height: 36px; border: 1px solid #aea389; border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 24px; line-height: 1; }
.dialog ol { padding-left: 20px; }
.dialog li + li { margin-top: 11px; }
.dialog p { margin-top: 12px; }
.dialog > form > .primary { width: 100%; margin-top: 19px; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

@media (max-width: 920px) {
  .shell { padding: 12px 12px 24px; }
  .topbar-inner { padding-inline: 12px; }
  .scoreboard { grid-template-columns: minmax(64px, 1fr) minmax(64px, 1fr) minmax(53px, .8fr) minmax(85px, 1fr) 47px; }
  .scoreboard.practice { grid-template-columns: minmax(64px, 1fr) minmax(53px, .8fr) minmax(85px, 1fr) 47px; }
  .scoreboard > div { padding-inline: 8px; }
  .score-caption { font-size: 9px; letter-spacing: .035em; }
  .dots { gap: 3px; }
  .dots i { width: 6px; height: 6px; }
  .batting-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .aim-picker { grid-column: 1 / -1; grid-row: 3; width: max-content; }
  .running-actions { grid-template-columns: minmax(0, 1fr); }
  .runner-commands button { flex: 1 1 auto; }
}

@media (max-width: 700px) {
  .game-grid { grid-template-columns: minmax(0, 1fr); }
  .play-card:has(.setup[hidden]) { position: static; }
  .play-card:has(.setup:not([hidden])) { order: -1; }
  .field-wrap { aspect-ratio: 50 / 31; }
  .masthead { flex-wrap: wrap; gap: 14px; margin-bottom: 15px; }
  .masthead p { margin-top: 9px; }
  .masthead h1 { font-size: clamp(34px, 8.5vw, 46px); }
  .scoreboard { min-height: 61px; }
  .score-team strong, .score-inning strong { font-size: 26px; }
  .score-inning strong span { font-size: 16px; }
  .field-footer { min-height: 36px; }
  .card-content { padding: 18px; }
  .card-header { min-height: 44px; padding: 8px 17px; }
  .at-bat { min-height: 0; }
  .box-score { grid-template-columns: minmax(0, 1fr) minmax(96px, .34fr); gap: 8px 10px; margin-top: 15px; padding: 12px; }
  .box-heading { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; }
  .box-heading h2 { font-size: 21px; }
  .box-heading p { margin-top: 0; }
}

@media (max-width: 600px) {
  .top-actions { gap: 6px; }
  .help-text, #sound-text { display: none; }
  #help-open, #sound { justify-content: center; min-width: 32px; }
  #fullscreen-text { max-width: 65px; white-space: normal; text-align: left; line-height: 1.15; }
  .is-fullscreen .masthead h1 { font-size: 36px; }
}

@media (max-width: 400px) {
  .topbar-inner, .shell { padding-inline: 11px; }
  .topbar-inner { gap: 7px; }
  .brand { font-size: 19px; gap: 6px; }
  .nav-button { font-size: 12px; }
  #sound { justify-content: center; min-width: 33px; min-height: 38px; }
  #sound-text { display: none; }
  .scoreboard { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(45px, .8fr) minmax(73px, 1fr) 39px; }
  .scoreboard > div { padding-inline: 5px; }
  .score-inning strong { font-size: 23px; }
  .score-inning strong span { font-size: 14px; }
  .score-counts .dots { gap: 2px; }
  .score-counts .dots i { width: 5px; height: 5px; }
  .score-bases { padding-inline: 0; }
  .field-footer { padding-inline: 8px; font-size: 10px; }
  .batting-actions { gap: 8px; padding-inline: 8px; }
  .batting-actions .swing-action { min-width: 108px; font-size: 18px; }
  .running-actions { padding-inline: 8px; }
  .runner-commands button { gap: 5px; padding-inline: 7px; font-size: 18px; }
  .runner-picker { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .defense-actions { padding-inline: 8px; }
  .landing-tag { min-width: 80px; font-size: 12px; }
  button.landing-tag { min-height: 34px; }
  button.landing-tag::before { position: absolute; inset: -5px 0; content: ''; }
  .defense-command .primary { min-width: 115px; font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; scroll-behavior: auto !important; }
}
