/*
 * Baseball Scorekeeper — visual polish (operator 2026-10-17, mockup ~/ship/baseball-polish-mockup).
 *
 * Looks only: loaded AFTER the page's own styles (resources/views/scorekeeper/baseball-scoreboard.blade.php)
 * and only restyles the classes / ids that page already has. No markup or script depends on anything here,
 * so turning it off (config scorekeeper.baseball_polish / BASEBALL_POLISH=false) puts the old look back.
 * Every rule is scoped under .bsb-page so nothing else on the site changes.
 *
 * Palette (app CLAUDE.md §8): brand blue #2ba8ff accent, ink, team pair cyan #06b6d4 / orange #f97316
 * (the score-keeper-v2 pair); balls / strikes / outs keep their state colours.
 */

.bsb-page {
    --bsp-accent: #2ba8ff;
    --bsp-accent-deep: #0066cc;
    --bsp-ink: #0a0a0a;
    --bsp-p1: #06b6d4;
    --bsp-p2: #f97316;
    --bsp-grass: #2f7d3a;
    --bsp-grass2: #2a7034;
    --bsp-board: radial-gradient(120% 140% at 50% -20%, #1e293b 0%, #0b1220 55%, #05080f 100%);
    --bsp-muted: #64748b;
    max-width: 1100px;
}

/* ---------- 1. Toolbar: one tidy row of chips; Undo + Next inning lead ---------- */
.bsb-page .bsb-bar { gap: 8px; margin-bottom: 14px; }
.bsb-page .bsb-bar > button,
.bsb-page .bsb-bar > a.bsb-btn {
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    font-size: .85rem; font-weight: 600; padding: 9px 14px; border-radius: 999px;
    border: 1px solid #e2dccf; background: #fff; color: #0f172a; box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
}
.bsb-page .bsb-bar > button i { color: #475569; }
.bsb-page .bsb-bar > button .fa-lock { color: #94a3b8; }
.bsb-page .bsb-bar > a.bsb-btn { order: 10; }   /* Back / My games / Home last */
.bsb-page .bsb-bar #bsb-undo,
.bsb-page .bsb-bar #bsb-next-inning { order: -1; background: var(--bsp-ink); color: #fff; border-color: var(--bsp-ink); }
.bsb-page .bsb-bar #bsb-undo i,
.bsb-page .bsb-bar #bsb-next-inning i { color: #7dd3fc; }
.bsb-page .bsb-bar #bsb-undo:disabled { opacity: .45; }
.bsb-page .bsb-bar > button:hover { filter: brightness(.97); }
/* "Save to my account" carries inline colours on the page; give it the brand-blue chip. */
.bsb-page .bsb-bar #bsb-save-account { color: var(--bsp-accent-deep) !important; background: #e8f5ff !important; border-color: #bfe3ff !important; }
.bsb-page .bsb-bar #bsb-save-account i { color: var(--bsp-accent-deep); }
@media (max-width: 720px) {
    /* Phones (operator 2026-10-17): icons only, every button visible, no sideways scrolling: a grid of
       equal cells, five to a row (ten buttons = two rows, each cell ~65px wide, 42px tall). The labels stay
       in the DOM (font-size 0), so screen readers still read "Undo", "Next inning", … */
    .bsb-page .bsb-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
    .bsb-page .bsb-bar > button,
    .bsb-page .bsb-bar > a.bsb-btn {
        justify-content: center; gap: 3px !important; min-height: 42px; padding: 0 4px; font-size: 0; border-radius: 14px;
    }
    .bsb-page .bsb-bar > button > i:not(.fa-lock),
    .bsb-page .bsb-bar > a.bsb-btn > i { font-size: 16px; }
    .bsb-page .bsb-bar > button > .fa-lock { font-size: 9px !important; align-self: flex-start; margin-top: 9px; }
}

/* ---------- 2. Score header: a stadium scoreboard ---------- */
.bsb-page .bsb-header {
    position: relative; overflow: hidden; color: #fff; border: 0; border-radius: 20px;
    padding: clamp(14px, 2.6vw, 24px) clamp(14px, 3vw, 32px); margin-bottom: 14px;
    background: var(--bsp-board);
    box-shadow: 0 18px 40px -18px rgba(2, 6, 23, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.bsb-page .bsb-header::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 6px);
}
.bsb-page .bsb-header > * { position: relative; }
.bsb-page .bsb-team-name {
    color: #94a3b8; font-size: .72rem; font-weight: 800; letter-spacing: .16em;
}
.bsb-page .bsb-team-name:focus { color: #fff; outline: 1px solid var(--bsp-accent); }
.bsb-page .bsb-team.is-batting .bsb-team-name { color: #fff; }
.bsb-page .bsb-team-score {
    color: #fff; font-weight: 900; font-size: clamp(3.2rem, 12vw, 5.6rem); margin-top: 4px;
    text-shadow: 0 0 24px rgba(255, 255, 255, .12);
}
.bsb-page .bsb-team.is-batting .bsb-team-score { color: #fff; }
/* Team colour bar under each score; the batting team's glows, with an "AT BAT" tag. */
.bsb-page .bsb-team::after {
    content: ""; display: block; height: 4px; width: 44%; margin: 10px auto 0; border-radius: 4px; opacity: .35;
}
.bsb-page #bsb-team-0::after { background: var(--bsp-p1); }
.bsb-page #bsb-team-1::after { background: var(--bsp-p2); }
.bsb-page .bsb-team.is-batting::after { opacity: 1; box-shadow: 0 0 12px currentColor; }
.bsb-page #bsb-team-0.is-batting::after { color: var(--bsp-p1); }
.bsb-page #bsb-team-1.is-batting::after { color: var(--bsp-p2); }
.bsb-page .bsb-team.is-batting::before {
    content: "AT BAT"; position: absolute; left: 0; right: 0; bottom: -18px;
    font-size: .58rem; font-weight: 800; letter-spacing: .18em; color: #7dd3fc;
}
.bsb-page .bsb-header { padding-bottom: clamp(24px, 3.4vw, 32px); }
/* The middle column's LIVE / outs lines carry inline greys meant for a white card. */
.bsb-page .bsb-middle > div { color: #94a3b8 !important; }
.bsb-page .bsb-middle > div:first-child { color: #fca5a5 !important; letter-spacing: .18em !important; font-weight: 800 !important; }
.bsb-page .bsb-inning { color: #fff !important; font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 900; }
.bsb-page .bsb-half-arrow { color: var(--bsp-accent); }
.bsb-page #bsb-outs-label { font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

/* ---------- Panels ---------- */
.bsb-page .bsb-main { gap: 14px; }
.bsb-page .bsb-panel { border-radius: 20px; padding: clamp(14px, 2.4vw, 22px); }
.bsb-page .bsb-panel-title { font-size: .68rem; font-weight: 800; letter-spacing: .16em; color: var(--bsp-muted); }

/* ---------- 3. Field: grass + dirt behind the same bases; a runner's bag glows ---------- */
.bsb-page .bsb-diamond {
    border-radius: 16px; overflow: hidden; padding: clamp(12px, 3vw, 22px) 0;
    background:
        radial-gradient(70% 70% at 50% 50%, transparent 0 60%, rgba(0, 0, 0, .14) 100%),
        repeating-linear-gradient(0deg, var(--bsp-grass) 0 22px, var(--bsp-grass2) 22px 44px);
}
.bsb-page .bsb-diamond-svg {
    width: min(78%, 280px); height: auto; overflow: visible;
    /* Drawn on the svg's own 160x160 grid, so it always sits under the bases. */
    background: url("../../images/scorekeeper/baseball-field.svg") center / 100% 100% no-repeat;
}
.bsb-page .bsb-base { fill: #f8fafc; stroke: #e2e8f0; stroke-width: 1.5; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.bsb-page .bsb-base:hover { stroke: #fff; stroke-width: 2.5; }
.bsb-page .bsb-base.is-occupied {
    fill: #fff; stroke: var(--bsp-accent); stroke-width: 3;
    filter: drop-shadow(0 0 7px rgba(43, 168, 255, .95)) drop-shadow(0 2px 2px rgba(0, 0, 0, .35));
}
.bsb-page .bsb-base-label { fill: rgba(255, 255, 255, .88); font-weight: 800; letter-spacing: .08em; font-size: 10px; }
/* 3B / 1B labels sat on top of their bases; lift them clear (same text, same tap behaviour). */
.bsb-page .bsb-base-label[x="80"][y="14"] { transform: translateY(-5px); }
.bsb-page .bsb-base-label[x="10"] { transform: translate(-4px, -22px); }
.bsb-page .bsb-base-label[x="150"] { transform: translate(4px, -22px); }
.bsb-page .bsb-runner-label { paint-order: stroke; stroke: rgba(0, 0, 0, .45); stroke-width: 2.5px; font-weight: 700; }

/* Count dots: bigger; balls green, strikes amber, outs red when on */
.bsb-page .bsb-bso { margin-top: 14px; }
.bsb-page .bsb-bso-label { color: #334155; font-weight: 900; }
.bsb-page .bsb-bso-dots { gap: 7px; }
.bsb-page .bsb-bso-dot { width: 15px; height: 15px; background: #eef2f7; border: 1.5px solid #d6dde7; }
.bsb-page .bsb-bso-dot.is-on.balls   { background: #22c55e; border-color: #16a34a; box-shadow: 0 0 8px rgba(34, 197, 94, .55); }
.bsb-page .bsb-bso-dot.is-on.strikes { background: #f59e0b; border-color: #d97706; box-shadow: 0 0 8px rgba(245, 158, 11, .55); }
.bsb-page .bsb-bso-dot.is-on.outs    { background: #ef4444; border-color: #dc2626; box-shadow: 0 0 8px rgba(239, 68, 68, .55); }

/* Batter / pitcher as two cards */
.bsb-page .bsb-at-bat { gap: 10px; border-bottom: 0; padding: 14px 0 4px; }
.bsb-page .bsb-at-bat-row {
    border: 1px solid #eef0f3; background: #fafbfc; border-radius: 14px; padding: 10px 12px; text-align: left !important;
}
.bsb-page .bsb-at-bat-label { font-size: .62rem; font-weight: 800; letter-spacing: .16em; color: var(--bsp-muted); }
.bsb-page .bsb-at-bat-value { font-weight: 800; margin-top: 3px; color: #0f172a; }
.bsb-page .bsb-pitch-total { color: var(--bsp-muted); font-weight: 600; }

/* ---------- 4. Actions: tactile keys, colour by group ---------- */
.bsb-page .bsb-action-section-title {
    display: flex; align-items: center; gap: 8px; margin: 12px 0 7px;
    font-size: .62rem; font-weight: 800; letter-spacing: .16em; color: var(--bsp-muted);
}
.bsb-page .bsb-action-section-title::after { content: ""; flex: 1; height: 1px; background: #eef0f3; }
.bsb-page .bsb-action-group, .bsb-page .bsb-action-group-4 { gap: 8px; }
.bsb-page .bsb-btn {
    font-weight: 700; padding: 12px 8px; border-radius: 12px; border: 1px solid transparent;
    background: #f4f6f9; color: #1e293b; box-shadow: 0 2px 0 rgba(15, 23, 42, .10);
    transition: transform 60ms, box-shadow 60ms, filter 100ms;
}
.bsb-page .bsb-btn:hover { background: #eef1f5; filter: brightness(.98); }
.bsb-page .bsb-btn:active { transform: translateY(2px); box-shadow: none; }
.bsb-page .bsb-btn:disabled { opacity: .45; box-shadow: none; }
.bsb-page .bsb-btn-ball      { background: #ecfdf3; color: #15803d; box-shadow: 0 2px 0 #bbf7d0; }
.bsb-page .bsb-btn-strike    { background: #fef2f2; color: #b91c1c; box-shadow: 0 2px 0 #fecaca; }
.bsb-page .bsb-btn-swing     { background: #f5f3ff; color: #6d28d9; box-shadow: 0 2px 0 #ddd6fe; }
.bsb-page .bsb-btn-foul      { background: #fffbeb; color: #b45309; box-shadow: 0 2px 0 #fde68a; }
.bsb-page .bsb-btn-hit       { background: #ecfeff; color: #0e7490; box-shadow: 0 2px 0 #a5f3fc; }
.bsb-page .bsb-btn-hr        { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #451a03; box-shadow: 0 2px 0 #b45309; }
.bsb-page .bsb-btn-walk      { background: #22c55e; color: #fff; box-shadow: 0 2px 0 #15803d; }
.bsb-page .bsb-btn-strikeout { background: #ef4444; color: #fff; box-shadow: 0 2px 0 #b91c1c; }
.bsb-page .bsb-btn-out       { background: #fff7ed; color: #c2410c; box-shadow: 0 2px 0 #fed7aa; }
.bsb-page .bsb-btn-ball:hover { background: #dcfce7; }
.bsb-page .bsb-btn-strike:hover { background: #fee2e2; }
.bsb-page .bsb-btn-foul:hover { background: #fef3c7; }
.bsb-page .bsb-btn-hit:hover { background: #cffafe; }
.bsb-page .bsb-btn-out:hover { background: #ffedd5; }
.bsb-page .bsb-btn-walk:hover, .bsb-page .bsb-btn-strikeout:hover, .bsb-page .bsb-btn-hr:hover { filter: brightness(1.05); }
/* The toolbar's own .bsb-btn links keep the chip look above, not the key look. */
.bsb-page .bsb-bar > a.bsb-btn:active { transform: none; }

/* ---------- 5. Line score: the scoreboard's twin ---------- */
.bsb-page .bsb-linescore-wrap { border-radius: 18px; background: #0b1220; box-shadow: 0 14px 30px -18px rgba(2, 6, 23, .6); margin-bottom: 14px; }
.bsb-page .bsb-linescore { color: #e2e8f0; background: transparent; border: 0; font-variant-numeric: tabular-nums; }
.bsb-page .bsb-linescore th, .bsb-page .bsb-linescore td {
    border-color: rgba(255, 255, 255, .06); border-bottom-color: rgba(255, 255, 255, .06); font-weight: 700; padding: 10px 8px;
}
.bsb-page .bsb-linescore th { background: transparent; color: #64748b; font-size: .66rem; letter-spacing: .14em; font-weight: 800; }
.bsb-page .bsb-linescore tr td:first-child, .bsb-page .bsb-linescore tr th:first-child { padding-left: 16px; }
.bsb-page .bsb-linescore tbody td:first-child { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.bsb-page .bsb-linescore tbody tr:nth-child(1) td:first-child { box-shadow: inset 3px 0 0 var(--bsp-p1); }
.bsb-page .bsb-linescore tbody tr:nth-child(2) td:first-child { box-shadow: inset 3px 0 0 var(--bsp-p2); }
.bsb-page .bsb-linescore td.bsb-current-half { background: rgba(43, 168, 255, .18); color: #fff; box-shadow: inset 0 -2px 0 var(--bsp-accent); }
.bsb-page .bsb-linescore td.bsb-totals { background: rgba(255, 255, 255, .04); color: #fff; font-size: 1.05rem; font-weight: 900; }
.bsb-page .bsb-linescore th.bsb-totals { background: rgba(255, 255, 255, .04); }

/* Anything the page hides with the hidden attribute stays hidden (the display rules above would otherwise win). */
.bsb-page .bsb-bar > [hidden],
.bsb-page .bsb-action-section-title[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    .bsb-page .bsb-btn { transition: none; }
}
