/* Bricklot Baseball: the game shell. HUD, menus and captions are DOM/SVG (crisp at any resolution); the field is the canvas. */
.is-play main { padding: 0; }
.game { display: grid; grid-template-rows: 1fr auto; height: calc(100svh - 67px); min-height: 560px; background: #05070b; color: var(--chalk); position: relative; }
.stage-wrap { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage { position: absolute; inset: 0; }
.view-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.game[data-phase="play"] .stage-wrap { cursor: crosshair; }

/* the aim pad over the 5 x 5 grid */
.pad { position: absolute; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.game[data-role="pitch"] .pad, .game[data-role="bat"] .pad, .game[data-view="lite"][data-phase="play"] .pad { opacity: 1; }
.pad-grid { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pad-grid path { stroke: rgba(242,238,230,0.22); stroke-width: 0.25; fill: none; vector-effect: non-scaling-stroke; }
.pad-grid rect { stroke: rgba(242,238,230,0.75); stroke-width: 1.5; fill: rgba(242,238,230,0.04); vector-effect: non-scaling-stroke; }
.game[data-role="bat"] .pad-grid rect { fill: none; stroke: rgba(242,238,230,0.35); }
.pad-cursor { position: absolute; width: 34px; height: 34px; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid var(--amber); box-shadow: 0 0 0 2px rgba(0,0,0,0.6), inset 0 0 0 2px rgba(0,0,0,0.35); }
.game[data-role="pitch"] .pad-cursor { border-radius: 2px; width: 30px; height: 30px; border-color: var(--teal-l); background: linear-gradient(var(--teal-l), var(--teal-l)) center / 2px 100% no-repeat, linear-gradient(var(--teal-l), var(--teal-l)) center / 100% 2px no-repeat; }
.game[data-role="bat"] .pad-cursor { background: radial-gradient(circle, rgba(242,178,51,0.22) 0 28%, rgba(242,178,51,0.08) 29% 100%); }
.pad-mark { position: absolute; width: 22px; height: 22px; transform: translate(-50%, -50%) rotate(45deg); border: 3px solid #fff; opacity: 0; transition: opacity 0.15s; }
.pad-mark.on { opacity: 1; }
.game:not([data-phase="play"]) .pad-cursor { display: none; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; }
.sb { position: absolute; top: 10px; left: 10px; background: rgba(11,13,16,0.92); border: 2px solid #2c3138; border-radius: 8px; padding: 6px 8px; font: 800 0.85rem/1 var(--display); min-width: 0; max-width: calc(100% - 80px); overflow: hidden; }
.sb:empty, .count:empty { display: none; }
.sb-row { display: grid; grid-auto-flow: column; grid-auto-columns: 22px; grid-template-columns: minmax(70px, auto); align-items: center; gap: 2px; min-height: 26px; }
.sb-row > span { text-align: center; }
.sb-head { color: var(--mute); font-size: 0.75rem; min-height: 16px; }
.sb-head .now { color: var(--amber); }
.sb-team { display: flex !important; align-items: center; gap: 6px; text-align: left !important; padding-right: 6px; white-space: nowrap; }
.sb-name { color: var(--chalk-2); font-weight: 600; max-width: 13em; overflow: hidden; text-overflow: ellipsis; }
.sb-row.batting .sb-team::before { content: ""; width: 0; height: 0; border-left: 6px solid var(--amber); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.sb-r { color: var(--amber); padding-left: 4px; border-left: 1px solid #2c3138; grid-column: auto; }
.sb small { font-size: 0.7rem; color: var(--mute); }
.dm { height: 15px; width: auto; display: inline-block; vertical-align: middle; }
.dm .on { fill: #ffbf47; } .dm .off { fill: #252a31; }
.count { position: absolute; top: 10px; right: 62px; display: flex; align-items: center; gap: 6px; background: rgba(11,13,16,0.92); border: 2px solid #2c3138; border-radius: 8px; padding: 6px 10px; font: 800 0.9rem/1 var(--display); }
.cl { color: var(--mute); }
.pips { display: inline-flex; gap: 3px; margin-right: 6px; }
.pip { display: inline-block; width: 11px; height: 11px; border: 2px solid #5b636d; }
.pip.round { border-radius: 50%; } .pip.square { border-radius: 1px; }
.pip.tri { border: 0; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid #3a4048; }
.pip.on.round { background: #5fc1c7; border-color: #5fc1c7; } .pip.on.square { background: var(--amber); border-color: var(--amber); } .pip.on.tri { border-bottom-color: #e8735a; }
.inn { color: var(--amber); margin-left: 4px; }
.diamond { width: 34px; height: 26px; }
.diamond rect { fill: none; stroke: #8a929c; stroke-width: 1.5; }
.diamond rect.on { fill: var(--amber); stroke: var(--amber); }
.who { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; font-size: 0.9rem; color: var(--chalk-2); background: rgba(11,13,16,0.75); padding: 4px 10px; border-radius: 6px; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.who:empty { display: none; }
.pause-btn { pointer-events: auto; position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 8px; border: 2px solid #2c3138; background: rgba(11,13,16,0.92); color: var(--chalk); font: 900 1rem/1 var(--display); cursor: pointer; }
.game:not([data-phase="play"]) .pause-btn { display: none; }
@media (max-width: 640px) {
  .sb-name { display: none; }
  .sb-row { grid-auto-columns: 17px; grid-template-columns: minmax(46px, auto); }
  .dm { height: 12px; }
  .count { top: auto; bottom: 40px; right: 10px; padding: 5px 8px; }
}

.fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.fade.on { opacity: 1; }
.game.hr .stage-wrap { box-shadow: inset 0 0 0 4px var(--amber); }

/* controls bar */
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; background: #0b0d10; border-top: 2px solid #2c3138; min-height: 62px; }
.controls:empty::before { content: ""; }
.pitches { display: flex; flex-wrap: wrap; gap: 6px; }
.pitches button { min-height: 44px; padding: 8px 10px; border-radius: 8px; border: 2px solid #2c3138; background: #1b1f24; color: var(--chalk); font: 800 0.95rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; }
.pitches button[aria-pressed="true"] { border-color: var(--teal-l); background: #123f42; }
kbd { font: 700 0.75rem/1 var(--body); background: #2c3138; border-radius: 3px; padding: 2px 4px; margin-right: 5px; }
.meter { position: relative; width: min(260px, 70vw); height: 22px; border-radius: 11px; background: linear-gradient(90deg, #262b31, #39414a); border: 2px solid #2c3138; overflow: hidden; }
.meter .sweet { position: absolute; top: 0; bottom: 0; left: 76%; width: 8%; background: var(--amber); }
.meter .needle { position: absolute; top: -2px; bottom: -2px; left: 0; width: 4px; background: #fff; box-shadow: 0 0 6px #fff; }
.big { min-width: 140px; }
.hint { color: var(--mute); font-size: 0.88rem; }
@media (max-width: 640px) { .controls .hint { display: none; } }
.caption { position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%); margin: 0; z-index: 4; background: rgba(11,13,16,0.9); border: 2px solid var(--amber); color: var(--chalk); font: 800 1.15rem/1.15 var(--display); letter-spacing: 0.04em; text-transform: uppercase; padding: 8px 14px; border-radius: 8px; max-width: 92%; text-align: center; pointer-events: none; }
.caption:empty { display: none; }
.caption.pop { animation: cap 0.25s ease-out; }
@keyframes cap { from { transform: translate(-50%, 8px); opacity: 0.2; } to { transform: translate(-50%, 0); opacity: 1; } }
/* QA-10 (v2.1.4): Captions off hides the bar visually only; the live region keeps announcing every call */
.no-captions .caption { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; animation: none; }
@media (max-width: 640px) { .caption { bottom: 158px; font-size: 1rem; } }
/* QA-3 (v2.1.4): short screens (a phone held sideways): the game fills the screen height, so the Swing / Throw bar is always
   on screen (the page scrolls the game to the top when play starts); the controls bar gets slimmer */
@media (max-height: 560px) {
  .game { height: 100svh; min-height: 300px; }
  .controls { min-height: 50px; padding: 4px 10px; gap: 8px; }
  .controls .hint { display: none; }
  .pitches button, .controls .btn { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
  .caption { bottom: 64px; font-size: 0.95rem; padding: 5px 10px; }
  .count { top: 10px; bottom: auto; right: 62px; }
  .sb-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { .caption.pop { animation: none; } }

/* overlays: title, pause, settings, between-innings ad, final */
.overlay { position: absolute; inset: 0; display: none; place-items: center; padding: 14px; background: rgba(5,7,11,0.78); backdrop-filter: blur(3px); z-index: 6; overflow-y: auto; }
.overlay.on { display: grid; }
.ov-card { background: #14171b; border: 2px solid #2c3138; border-radius: 14px; padding: 24px; width: min(940px, 100%); max-height: 100%; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
.ov-card h2 { color: var(--chalk); }
.ov-break .ov-card, .ov-pause .ov-card, .ov-over .ov-card { width: min(620px, 100%); }
.ttl { display: grid; gap: 24px; }
@media (min-width: 860px) { .ttl { grid-template-columns: 1fr 270px; align-items: start; } }
.ttl-h { font-size: clamp(1.8rem, 4vw, 2.8rem); text-transform: uppercase; color: var(--chalk); }
.ttl-team { color: var(--chalk-2); }
.modes { display: grid; gap: 10px; margin: 16px 0; }
@media (min-width: 560px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode { display: grid; gap: 4px; text-align: left; padding: 14px 16px; min-height: 64px; border-radius: 10px; border: 2px solid #2c3138; background: #1b1f24; color: var(--chalk); cursor: pointer; font: 400 0.95rem/1.35 var(--body); }
.mode b { font: 900 1.4rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.mode span { color: var(--mute); }
.mode:hover, .mode:focus-visible { border-color: var(--amber); }
.mode-off { opacity: 0.7; border-style: dashed; }
.diffs { display: inline-flex; border: 2px solid #2c3138; border-radius: 10px; overflow: hidden; }
.diffs button { min-height: 44px; padding: 8px 18px; background: #1b1f24; color: var(--chalk); border: 0; border-right: 1px solid #2c3138; font: 800 1.05rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; }
.diffs button:last-child { border-right: 0; }
.diffs button[aria-checked="true"] { background: var(--amber); color: var(--ink); }
.ttl-links { margin-top: 14px; color: var(--mute); }
.indep { color: var(--mute); font-size: 0.85rem; border-top: 1px solid #2c3138; padding-top: 12px; margin-top: 16px; }
.stack { display: flex; flex-wrap: wrap; gap: 10px; }
.ad-side, .ad-break, .ad-over { color: var(--chalk); --muted: #a9b0b8; }
.ad-break { margin: 10px 0 16px; }
.set-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .set-grid { grid-template-columns: repeat(3, 1fr); } }
fieldset { border: 1px solid #2c3138; border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
legend { font: 800 1rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber); padding: 0 6px; }
.tog, .sel, .rng { display: grid; gap: 6px; font-weight: 400; }
.tog { grid-template-columns: auto 1fr; align-items: center; }
.tog input { width: 22px; height: 22px; }
.sel select { max-width: 100%; }
.rng input { width: 100%; accent-color: var(--amber); }
.note { color: var(--mute); }

/* home hero stage */
.is-home .hero__stage .pad, .is-home .hero__stage .hud { display: none; }
@media (max-width: 559px) {
  .ov-card { padding: 16px; }
  .ttl-h { font-size: 1.55rem; }
  .ttl .eyebrow { display: none; }
  .modes { grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
  .mode { padding: 10px 12px; min-height: 56px; }
  .mode b { font-size: 1.12rem; }
  .mode span { display: none; }
  .mode-off { grid-column: 1 / -1; }
  .mode-off span { display: block; font-size: 0.85rem; }
}
/* v2.1.0 online play */
.mode-online { border-color: var(--teal-l); }
.join-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 12px; color: var(--chalk-2, #c9c4b8); }
.join-form input { width: 9.5em; min-height: 44px; padding: 8px 10px; border-radius: 8px; border: 2px solid #2c3138; background: #0b0d10; color: var(--chalk); font: 800 1.2rem/1 var(--display); letter-spacing: 0.18em; text-transform: uppercase; }
.room-code { font: 900 clamp(2.4rem, 11vw, 4.2rem)/1 var(--display); letter-spacing: 0.22em; color: var(--amber); margin: 8px 0 12px; overflow-wrap: anywhere; }
.room-url { overflow-wrap: anywhere; color: var(--chalk); }
.ostatus { margin: 0; color: var(--chalk); font: 700 1rem/1.3 var(--body); text-align: center; }
.oclock { min-width: 2.6em; font: 900 1.3rem/1 var(--display); color: var(--chalk); text-align: center; font-variant-numeric: tabular-nums; }
.oclock.low { color: var(--amber); }
.btn.small { min-height: 40px; padding: 6px 10px; font-size: 0.85rem; }
.rx-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 6px 12px 8px; background: #0b0d10; }
.rx { min-height: 36px; padding: 4px 10px; border-radius: 18px; border: 1px solid #2c3138; background: #1b1f24; color: var(--chalk); font: 700 0.85rem/1 var(--body); cursor: pointer; }
.rx:hover { border-color: var(--teal-l); }
.rx-mute[aria-pressed="true"] { opacity: 0.6; }
.rx-toast { flex-basis: 100%; margin: 2px 0 0; min-height: 1.2em; text-align: center; color: var(--teal-l); font: 700 0.95rem/1.2 var(--body); }
[data-ob="sit"][aria-pressed="true"] { border-color: var(--amber); }
