/* ===== Ballpark Maestro Dark Theme ===== */
html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #1e1e2e;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
}

.maestro-app {
    min-height: 100vh;
}

.maestro-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 8px 16px;
}

/* Loading */
.loading {
    text-align: center;
    font-size: 24px;
    padding: 80px;
    color: #aaa;
}

/* Sidebar Controls */

/* --- Sidebar Toggle (pure CSS checkbox) --- */
.sidebar-toggle-check {
    display: none;
}

.sidebar-toggle {
    position: fixed;
    top: 12px;
    left: 216px;
    width: 28px;
    height: 28px;
    background: #2a2a3e;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 0;
    transition: left 0.2s ease;
    user-select: none;
}

.sidebar-toggle:hover {
    background: #4a4a6a;
    color: #fff;
}

/* Arrow direction: ◀ when expanded, ▶ when collapsed */
.sidebar-toggle::after {
    content: "◀";
}

.sidebar-toggle-check:checked ~ .sidebar .sidebar-toggle::after {
    content: "▶";
}

/* When checkbox is checked = sidebar collapsed */
.sidebar-toggle-check:checked ~ .sidebar .top-row,
.sidebar-toggle-check:checked ~ .sidebar .nav-scrollable {
    display: none !important;
}

.sidebar-toggle-check:checked ~ .sidebar {
    width: 40px !important;
    min-width: 40px !important;
    overflow: hidden;
}

.sidebar-toggle-check:checked ~ .sidebar .sidebar-toggle {
    left: 6px;
}

#sidebar-toggle-check:checked ~ main .sidebar-controls {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.sidebar-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: #1a1a2e;
    border-top: 1px solid #3a3a4a;
    z-index: 35;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* On narrow screens the sidebar isn't a side column, so anchor the controls
   into normal flow at the top of the main content and hide the (now broken) collapse toggle. */
@media (max-width: 640.98px) {
    .sidebar-controls {
        position: static;
        width: 100%;
        margin-bottom: 12px;
        border-top: none;
        border-bottom: 1px solid #3a3a4a;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .sidebar-controls > * {
        width: auto;
        flex: 0 1 auto;
    }

    .sidebar-toggle,
    .sidebar-toggle-check:checked ~ .sidebar .sidebar-toggle {
        display: none;
    }

    .scoreboard {
        gap: 6px;
    }

    .team-card {
        padding: 8px 6px;
        border-radius: 10px;
        min-width: 0;
    }

    .team-name {
        font-size: 16px;
        margin-bottom: 4px;
        word-break: break-word;
        overflow-wrap: anywhere;
        line-height: 1.1;
    }

    .score-row {
        gap: 6px;
    }

    .score {
        font-size: 32px;
        min-width: 0;
    }

    .score-btn {
        font-size: 22px;
        padding: 2px 6px;
    }

    .inning-card {
        padding: 4px 8px;
        min-width: 0;
        border-radius: 8px;
    }

    .inning-display { gap: 2px; }
    .inning-half { font-size: 14px; }
    .inning-number { font-size: 22px; }
    .inning-btn { font-size: 12px; padding: 0 4px; }

    /* On phones, cap the roster height so the full lineup stays visible
       and only the bench/roster list scrolls. */
    .lineup-panel {
        max-height: none;
        overflow-y: visible;
    }

    .bench-section {
        max-height: 180px;
        overflow-y: auto;
    }
}

.menu-btn {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    text-align: left;
}
.menu-btn:hover { background: #4a4a6a; }

.stop-all-btn {
    background: #b71c1c;
    color: white;
    border: 2px solid #ef5350;
    border-radius: 6px;
    padding: 6px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
    width: 100%;
}
.stop-all-btn:hover { background: #d32f2f; }

.fade-out-btn {
    background: #f9a825;
    color: #1e1e2e;
    border: 2px solid #ffd740;
    border-radius: 6px;
    padding: 6px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.5px;
    width: 100%;
}
.fade-out-btn:hover { background: #fdd835; }

.spotify-status {
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.spotify-status.clickable {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.spotify-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #1db954;
    flex-shrink: 0;
}

.spotify-profile-name {
    font-size: 13px;
    font-weight: 600;
    color: #1db954;
    text-align: center;
    padding: 4px 6px 6px;
    border-bottom: 1px solid #2a2a3a;
    margin-bottom: 4px;
}
.spotify-status.clickable:hover {
    background: #2a2a3a;
    color: #e0e0e0;
}

.spotify-menu {
    position: relative;
}

.spotify-dropdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
}

.device-list-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0 2px 0;
    border-top: 1px solid #3a3a4a;
    margin-top: 4px;
}

.device-active {
    border-color: #4caf50 !important;
    color: #4caf50 !important;
}

.account-menu {
    position: relative;
    margin-top: 4px;
    border-top: 1px solid #3a3a4a;
    padding-top: 6px;
}

.account-status.clickable {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: block;
    font-size: 12px;
    color: #aaa;
    transition: background 0.2s;
}

.account-status.clickable:hover {
    background: #2a2a3a;
    color: #e0e0e0;
}

.account-dropdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
}

.api-key-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 6px;
    border-top: 1px solid #3a3a4a;
    margin-top: 4px;
}

.api-key-value {
    font-size: 11px;
    color: #4fc3f7;
    background: #1a1a2e;
    padding: 4px 6px;
    border-radius: 4px;
    word-break: break-all;
    user-select: all;
}

.subscription-expiration {
    font-size: 11px;
    color: #aaa;
    padding: 2px 0;
}

.subscription-expiration.expired-text {
    color: #ef5350;
}

.game-panel {
    position: relative;
}

.game-panel.subscription-expired,
.subscription-expired {
    pointer-events: none !important;
    opacity: 0.3;
    filter: grayscale(100%);
    user-select: none;
    position: relative;
}

.subscription-expired * {
    pointer-events: none !important;
}

fieldset.game-panel,
fieldset.subscription-expired {
    border: none;
    padding: 0;
    margin: 0;
}

.expired-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.expired-message {
    background: #4a1c1c;
    color: #ef5350;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.subscription-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 4px;
    vertical-align: middle;
}

.subscription-badge.active {
    background: #1b5e20;
    color: #66bb6a;
}

.subscription-badge.expired {
    background: #4a1c1c;
    color: #ef5350;
}

/* Help Page */
.help-link {
    text-decoration: none;
    font-size: 12px;
}

.help-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    color: #e0e0e0;
}

.help-section {
    margin-bottom: 24px;
    padding: 16px;
    background: #1e1e2e;
    border-radius: 8px;
}

.help-section h3 {
    margin-top: 0;
    color: #4fc3f7;
}

.help-section ol, .help-section ul {
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 6px;
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.help-table th, .help-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #3a3a4a;
}

.help-table th {
    color: #4fc3f7;
}

.help-table code {
    color: #81c784;
}

.help-code-block {
    display: block;
    background: #1a1a2e;
    padding: 10px 14px;
    border-radius: 6px;
    margin-top: 8px;
    color: #81c784;
    word-break: break-all;
    user-select: all;
}

/* Scoreboard */
.scoreboard {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: stretch;
    margin-bottom: 8px;
}

.team-card {
    flex: 1;
    border-radius: 12px;
    padding: 6px 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.away-card {
    background: linear-gradient(to bottom, #4a4a5a, #8b7d3c);
}

.home-card {
    background: linear-gradient(to bottom, #4a4a5a, #2e7d32);
}

.team-name {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    line-height: 1.1;
}

.score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.score {
    font-size: 32px;
    font-weight: bold;
    color: white;
    min-width: 36px;
    line-height: 1;
}

.score-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 8px;
    line-height: 1;
}
.score-btn:hover { color: #ffd740; }

/* Inning */
.inning-card {
    background: linear-gradient(to bottom, #505058, #3a3a42);
    border-radius: 10px;
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    min-width: 60px;
}

.inning-btn {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}
.inning-btn:hover { color: white; }

.inning-display {
    display: flex;
    align-items: center;
    gap: 4px;
}

.inning-half {
    font-size: 16px;
    color: #ffd740;
    line-height: 1;
}

.inning-number {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    color: white;
}

/* Hits & Runs */
.hits-runs-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px;
    background: #2a2a3a;
    border-radius: 8px;
    margin-bottom: 12px;
}

.hits-runs-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: #ccc;
}

.small-btn {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 14px;
}
.small-btn:hover { background: #4a4a6a; }

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

/* Condensed layout: show only batting team's lineup + fielding team's diamond */
.main-content.condensed {
    grid-template-columns: 1fr 1.4fr;
}

.main-content.condensed.top-inning .home-lineup,
.main-content.condensed.top-inning .away-field-section,
.main-content.condensed.bottom-inning .away-lineup,
.main-content.condensed.bottom-inning .home-field-section {
    display: none;
}

/* Bigger field diamond when condensed mode is active - fills available width */
.main-content.condensed .field-panel,
.main-content.condensed .field-section {
    align-self: stretch;
    align-items: stretch;
    width: 100%;
}

.main-content.condensed .field-diamond {
    width: 100%;
    max-width: 900px;
    height: auto;
    aspect-ratio: 560 / 620;
    margin: 0 auto;
}

.main-content.condensed .field-position select {
    font-size: 15px;
    padding: 4px 6px;
    max-width: 160px;
}

.main-content.condensed .field-label {
    font-size: 20px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .main-content .away-lineup {
        order: 1;
    }

    .main-content .field-panel {
        order: 2;
    }

    .main-content .home-lineup {
        order: 3;
    }

    /* Condensed mode: also stack vertically when narrow */
    .main-content.condensed {
        grid-template-columns: 1fr;
    }
}

/* Lineup Panels */
.lineup-panel {
    background: #2a2a3a;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(400px * 2 + 24px * 2 + 16px);
}

.lineup-panel h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: #ffd740;
}

.quick-edit {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.quick-edit input {
    flex: 1;
    background: #1e1e2e;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 4px 8px;
    font-size: 13px;
}

.quick-edit button {
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
}

.lineup-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 3px;
    background: #3a3a4a;
    transition: background 0.2s;
}

.lineup-row .player-info {
    flex: 0 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.lineup-row.current-batter {
    background: linear-gradient(to right, #2e7d32, #1b5e20);
    box-shadow: 0 0 8px rgba(46, 125, 50, 0.5);
}

.lineup-pos {
    font-weight: bold;
    font-size: 24px;
    min-width: 30px;
    cursor: pointer;
    color: #ffd740;
}

.player-info {
    font-size: 22px;
    cursor: pointer;
}

.position-label {
    opacity: 0.75;
    font-size: 18px;
    font-weight: bold;
}

.position-label.clickable {
    cursor: pointer;
}

.position-label.clickable:hover {
    opacity: 1;
    color: #4fc3f7;
}

.position-select {
    font-size: 16px;
    padding: 2px 6px;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #4fc3f7;
    border-radius: 4px;
}

.lineup-row .position-label + .icon-btn,
.lineup-row .position-select + .icon-btn,
.lineup-row .note-icon + .icon-btn {
    margin-left: auto;
}

.roster-tag.clickable {
    cursor: pointer;
    text-decoration: underline dotted;
}

.roster-tag.clickable:hover {
    color: #4fc3f7;
}

.icon-btn {
    background: transparent;
    border: 1px solid #555;
    color: #ccc;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
}
.icon-btn:hover { background: #4a4a6a; color: white; }

.play-btn { color: #4caf50; border-color: #4caf50; }
.play-btn:hover { background: #2e7d32; color: white; }

.bench-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #444;
    font-size: 13px;
    color: #999;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.bench-player {
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 1px;
}

.roster-active {
    color: #e0e0e0;
    background: rgba(46, 125, 50, 0.25);
    border-left: 3px solid #4caf50;
    padding-left: 6px;
}

.roster-partial {
    color: #e0e0e0;
    background: rgba(255, 193, 7, 0.2);
    border-left: 3px solid #ffc107;
    padding-left: 6px;
}

.note-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    cursor: help;
    opacity: 0.85;
}

.note-icon:hover {
    opacity: 1;
}

.player-notes-cell {
    color: #bbb;
    font-style: italic;
    font-size: 12px;
    max-width: 240px;
}

.roster-tag {
    display: inline-block;
    background: rgba(255, 215, 64, 0.2);
    color: #ffd740;
    font-size: 10px;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 3px;
    margin-left: 4px;
}

.roster-edit-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 0 3px;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.bench-player:hover .roster-edit-btn {
    opacity: 1;
}

.roster-add-btn, .roster-remove-btn {
    margin-left: auto;
    font-size: 10px;
    padding: 1px 5px;
    opacity: 0.5;
}
.bench-player:hover .roster-add-btn,
.bench-player:hover .roster-remove-btn {
    opacity: 1;
}

.swap-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    background: #2a2a3a;
    border-radius: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.swap-option {
    padding: 4px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3a3a4a;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
}

.swap-option:hover {
    background: #4a4a6a;
}

.swap-option.cancel {
    background: #5a2a2a;
    border-color: #833;
}

.swap-option.cancel:hover {
    background: #7a3a3a;
}

.roster-edit-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px;
    background: #1e1e2e;
    border-radius: 4px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.roster-edit-input {
    background: #2a2a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 3px 6px;
    font-size: 12px;
    flex: 1;
    min-width: 0;
}

.roster-edit-input.num-input {
    width: 42px;
    flex: 0 0 42px;
}

.roster-quick-add {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    border-top: 1px solid #444;
    margin-top: 4px;
}

.roster-edit-select {
    background: #2a2a3a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 3px 4px;
    font-size: 12px;
    flex: 0 0 auto;
}

.pitcher-btn {
    margin-top: 8px;
    width: 100%;
}

.pitcher-label {
    margin-top: 8px;
    padding: 6px 12px;
    background: #3a3a4a;
    border-radius: 6px;
    font-size: 13px;
    color: #ccc;
    text-align: center;
}

/* Field Panel */
.field-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.field-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.field-label {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    text-align: center;
}

.away-label {
    color: #d4a843;
}

.home-label {
    color: #66bb6a;
}

.field-diamond {
    position: relative;
    width: 360px;
    height: 400px;
    background: url('images/baseball-diamond.png') center/cover no-repeat;
    border-radius: 12px;
}

.field-position {
    position: absolute;
    text-align: center;
}

.field-position select {
    background: rgba(0,0,0,0.6);
    color: #e0e0e0;
    border: 1px solid #666;
    border-radius: 4px;
    font-size: 14px;
    padding: 3px 4px;
    max-width: 140px;
}

.pos-label {
    font-size: 14px;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 2px;
}

/* Field position placements */
.pos-pitcher   { left: 50%; top: 50%; transform: translateX(-50%); }
.pos-catcher   { left: 50%; top: 75%; transform: translateX(-50%); }
.pos-third     { left: 12.5%; top: 42%; transform: translateX(-50%); }
.pos-short     { left: 30%;   top: 32%; transform: translateX(-50%); }
.pos-second    { left: 70%;   top: 32%; transform: translateX(-50%); }
.pos-first     { left: 87.5%; top: 42%; transform: translateX(-50%); }
.pos-left      { left: 16.67%; top: 15%; transform: translateX(-50%); }
.pos-center    { left: 50%;    top: 6%;  transform: translateX(-50%); }
.pos-right     { left: 83.33%; top: 15%; transform: translateX(-50%); }

/* Action Bar */
.action-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    background: #2a2a3a;
    border-radius: 12px;
    margin-bottom: 12px;
}

.action-group {
    flex: 1;
    min-width: 200px;
}

.action-group h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: #ffd740;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.action-btn {
    display: inline-block;
    background: #3a3a5a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px 12px;
    margin: 2px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.action-btn:hover { background: #4a4a6a; }

.action-btn.pulsing {
    animation: pulse 1s ease-in-out infinite;
    border-color: #4fc3f7;
    box-shadow: 0 0 8px rgba(79, 195, 247, 0.4);
}

/* Split action button (main + caret dropdown) */
.split-action-btn {
    position: relative;
    display: inline-flex;
    margin: 2px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #3a3a5a;
    overflow: visible;
    transition: background 0.2s;
}

.split-action-btn:hover {
    background: #4a4a6a;
}

.split-action-btn.pulsing {
    animation: pulse 1s ease-in-out infinite;
    border-color: #4fc3f7;
    box-shadow: 0 0 8px rgba(79, 195, 247, 0.4);
}

.split-main, .split-caret {
    background: transparent;
    color: #e0e0e0;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
}

.split-main {
    border-right: 1px solid #555;
}

.split-caret {
    padding: 6px 8px;
    font-size: 12px;
}

.split-main:hover, .split-caret:hover {
    background: rgba(255, 255, 255, 0.08);
}

.split-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #2a2a3a;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.split-dropdown-item {
    background: transparent;
    color: #e0e0e0;
    border: none;
    padding: 6px 10px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
}

.split-dropdown-item:hover {
    background: #4a4a6a;
}

.split-dropdown-item.played {
    color: #888;
    font-style: italic;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.vol-btn {
    min-width: 50px;
    text-align: center;
}

/* Status Bar */
.status-bar {
    background: #3a3a5a;
    color: #ffd740;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    margin-top: 8px;
}

/* Blazor error UI */
#blazor-error-ui {
    background: #b32121;
    color: white;
    padding: 0.5rem 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    display: none;
}

#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    color: #ffd740;
    margin-left: 12px;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 8px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===== Page Title ===== */
.page-title {
    color: #ffd740;
    margin: 0 0 16px 0;
    font-size: 24px;
}

/* ===== Management Pages ===== */
.mgmt-section {
    background: #2a2a3a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.mgmt-section h3 {
    color: #ffd740;
    margin: 0 0 12px 0;
    font-size: 18px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.mgmt-input {
    background: #1e1e2e;
    border: 1px solid #555;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 14px;
}

.mgmt-input:focus {
    border-color: #ffd740;
    outline: none;
}

.num-input {
    width: 60px;
}

.mgmt-select {
    background: #1e1e2e;
    border: 1px solid #555;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 14px;
}

/* Team Block */
.team-block {
    background: #2a2a3a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.team-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.team-block-name {
    color: #ffd740;
    margin: 0;
    font-size: 20px;
    flex: 1;
}

.delete-btn {
    color: #ef5350 !important;
    border-color: #ef5350 !important;
}
.delete-btn:hover {
    background: #b71c1c !important;
    color: white !important;
}

/* Player Table */
.player-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 14px;
}

.player-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #444;
    color: #aaa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #333;
    color: #e0e0e0;
}

.player-table tr:hover td {
    background: #3a3a4a;
}

.add-player-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid #444;
}

/* ===== Game Setup Page ===== */
.setup-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.setup-card {
    flex: 1;
    min-width: 250px;
    background: #1e1e2e;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.setup-card h3 {
    margin: 0 0 12px 0;
}

.away-setup {
    border: 2px solid #8b7d3c;
}

.away-setup h3 {
    color: #d4a843;
}

.home-setup {
    border: 2px solid #2e7d32;
}

.home-setup h3 {
    color: #66bb6a;
}

.setup-vs {
    font-size: 32px;
    font-weight: bold;
    color: #666;
    align-self: center;
    padding: 20px 8px;
}

.team-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    margin-bottom: 12px;
}

.team-preview {
    text-align: left;
    background: #2a2a3a;
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    font-size: 13px;
}

.team-preview strong {
    color: #ffd740;
    font-size: 15px;
}

.team-preview ul {
    margin: 6px 0 0 0;
    padding-left: 18px;
    color: #ccc;
}

.team-preview li {
    padding: 2px 0;
}

.setup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.start-btn {
    background: #2e7d32 !important;
    color: white !important;
    font-size: 16px !important;
    padding: 10px 24px !important;
}
.start-btn:hover {
    background: #1b5e20 !important;
}
.start-btn:disabled {
    background: #3a3a5a !important;
    color: #666 !important;
    cursor: not-allowed;
}

.settings-container {
    max-width: 720px;
    padding: 24px;
    color: #e0e0e0;
}
.settings-container h2 {
    color: #4fc3f7;
    margin-bottom: 18px;
}
.settings-section {
    margin-bottom: 18px;
}
.settings-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: #ffd740;
}
.settings-checkbox-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.settings-checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4fc3f7;
    cursor: pointer;
}
.settings-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #4fc3f7;
    border-radius: 6px;
}
.settings-help {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.7;
}
.settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.settings-status {
    color: #66bb6a;
    font-size: 13px;
}

.script-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.script-panel {
    background: #1e1e2e;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.script-panel h3 { margin: 0; color: #fff; }
.script-panel textarea {
    flex: 1;
    background: #2a2a3a;
    color: #eee;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}
.script-actions { display: flex; gap: 8px; justify-content: flex-end; }

.third-out-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: thirdOutFadeIn 0.15s ease-out;
}
@keyframes thirdOutFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.third-out-panel {
    background: linear-gradient(160deg, #1f2940 0%, #141a2b 100%);
    border: 2px solid #4a90e2;
    border-radius: 16px;
    padding: 32px 36px;
    width: 92%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(74,144,226,0.25);
    color: #fff;
    text-align: center;
    animation: thirdOutPop 0.2s ease-out;
}
@keyframes thirdOutPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.third-out-header {
    font-size: 28px;
    font-weight: 700;
    color: #ffd166;
    margin-bottom: 18px;
    letter-spacing: 0.5px;
}
.third-out-summary {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 14px;
    color: #fff;
}
.third-out-errors {
    font-size: 20px;
    color: #ff8a8a;
    margin-bottom: 14px;
    font-weight: 500;
}
.third-out-question {
    font-size: 22px;
    color: #b8c5d6;
    margin: 18px 0 24px;
}
.third-out-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.third-out-btn {
    font-size: 20px;
    font-weight: 600;
    padding: 14px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
    min-width: 200px;
}
.third-out-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.third-out-btn:active { transform: translateY(0); }
.third-out-confirm {
    background: linear-gradient(180deg, #2ecc71, #27a35a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(46,204,113,0.4);
}
.third-out-cancel {
    background: linear-gradient(180deg, #555, #3a3a3a);
    color: #eee;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.ab-wrap { position: relative; display: inline-block; }
.popover-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: transparent;
    z-index: 40;
}
.runs-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2940;
    border: 1.5px solid #4a90e2;
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.55);
    z-index: 50;
    white-space: nowrap;
    animation: runsMenuPop 0.12s ease-out;
}
.runs-menu::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border: 6px solid transparent;
    border-top-color: #4a90e2;
}
@keyframes runsMenuPop {
    from { opacity: 0; transform: translate(-50%, 4px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
.runs-menu-title {
    font-size: 12px;
    color: #b8c5d6;
    margin-bottom: 6px;
    text-align: center;
}
.runs-menu-options { display: flex; gap: 6px; }
.runs-menu-btn {
    min-width: 34px;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(180deg, #2ecc71, #27a35a);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: filter 0.1s ease, transform 0.1s ease;
}
.runs-menu-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.runs-menu-btn.outs-menu-btn {
    background: linear-gradient(180deg, #e74c3c, #b03020);
}

.bases-mini {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 60px;
    margin: 0 12px;
    vertical-align: middle;
}
.bases-mini .base-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: rotate(45deg);
    background: #2a2a3a;
    border: 1.5px solid #6a6a7a;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.bases-mini .base-2 { top: 0; left: 50%; margin-left: -8px; }
.bases-mini .base-3 { top: 50%; left: 0; margin-top: -8px; }
.bases-mini .base-1 { top: 50%; right: 0; margin-top: -8px; }
.bases-mini .base-home {
    bottom: 0;
    left: 50%;
    margin-left: -8px;
    background: #1a1a24;
    border-color: #888;
    cursor: default;
}
.bases-mini .base-dot.on {
    background: #ffd166;
    border-color: #c9a23f;
    box-shadow: 0 0 8px rgba(255,209,102,0.85), 0 0 14px rgba(255,209,102,0.5);
}
.bases-mini::before {
    /* Infield diamond outline connecting the bases */
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%) rotate(45deg);
    border: 1px dashed rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.03);
    pointer-events: none;
}

.song-edit-row > td { background: #1e1e2e; }
.song-editor { display: flex; flex-direction: column; gap: 16px; padding: 12px; }
.song-editor-section { background: #2a2a3a; padding: 12px; border-radius: 8px; }
.song-editor-section h4 { margin: 0 0 8px 0; color: #fff; }
.song-current { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; color: #ddd; }
.song-search { display: flex; gap: 8px; margin-bottom: 8px; }
.song-search .mgmt-input { flex: 1; }
.song-results { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.song-result-btn { background: #3a3a4a; color: #eee; border: 1px solid #555; border-radius: 4px; padding: 6px 10px; text-align: left; cursor: pointer; }
.song-result-btn:hover { background: #4a4a5a; }
.song-warning { color: #ffb74d; font-size: 13px; }
.start-ms-input { width: 110px; min-width: 8ch; }
.coaches-section { background: #2a2a3a; padding: 12px; border-radius: 8px; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.coaches-list { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: #ddd; }
.coach-tag { background: #3a3a4a; color: #eee; border: 1px solid #555; border-radius: 12px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; }
.import-team-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; background: #2a2a3a; border-radius: 8px; }
.import-textarea { width: 100%; font-family: monospace; }


.song-indicator {
    display: inline-block;
    margin-right: 6px;
    font-size: 16px;
    opacity: 0.25;
    filter: grayscale(1);
}
.song-indicator.assigned {
    opacity: 1;
    filter: none;
}

.impersonation-banner {
    background: #ff9800;
    color: #1a1a2e;
    padding: 8px 16px;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #f57c00;
}

.impersonation-link {
    margin-left: 12px;
    color: #1a1a2e;
    text-decoration: underline;
}

.admin-section {
    border: 1px solid #ff9800;
    border-radius: 6px;
    padding: 12px;
    margin-top: 16px;
    background: rgba(255, 152, 0, 0.08);
}

.admin-section h3 {
    margin-top: 0;
    color: #ff9800;
}

/* Line Score */
.line-score {
    margin: 8px 0 12px 0;
    overflow-x: auto;
}
.line-score table {
    border-collapse: collapse;
    width: 100%;
    background: #2a2a3a;
    border-radius: 8px;
    overflow: hidden;
}
.line-score th,
.line-score td {
    padding: 6px 10px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid #1e1e2e;
    color: #e0e0e0;
}
.line-score thead th {
    background: #1e1e2e;
    color: #ffd740;
    font-weight: 600;
}
.line-score .ls-team {
    text-align: left;
    font-weight: 600;
    color: #ffd740;
    min-width: 110px;
}
.line-score .ls-total {
    background: #1e1e2e;
    font-weight: 700;
    color: white;
}
.line-score .ls-current {
    background: rgba(76, 175, 80, 0.25);
    color: white;
}

/* Highlight the current half-inning's score on the old-school spectator board. */
.line-score.old-school .ls-current {
    background: transparent;
}
.line-score.old-school .ls-current .flip-tile {
    background: #2a1a05;
    border-color: #ff8c1a;
    color: #ff8c1a;
    text-shadow: 0 0 8px rgba(255,140,26,0.85), 0 0 2px rgba(255,140,26,1);
    box-shadow:
        inset 0 -8px 14px rgba(0,0,0,0.65),
        inset 0 8px 14px rgba(255,255,255,0.04),
        0 0 8px rgba(255,140,26,0.55);
}

.situation-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin: 10px 0 12px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
}
.situation-diamond {
    position: relative;
    width: 90px;
    height: 90px;
}
.situation-diamond .sd-base {
    position: absolute;
    width: 22px;
    height: 22px;
    transform: rotate(45deg);
    background: #2a2a3a;
    border: 2px solid #6a6a7a;
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.situation-diamond .sd-2 { top: 0; left: 50%; margin-left: -11px; }
.situation-diamond .sd-3 { top: 50%; left: 0; margin-top: -11px; }
.situation-diamond .sd-1 { top: 50%; right: 0; margin-top: -11px; }
.situation-diamond .sd-home {
    bottom: 0;
    left: 50%;
    margin-left: -11px;
    background: #1a1a24;
    border-color: #888;
}
.situation-diamond .sd-base.on {
    background: #ffd166;
    border-color: #c9a23f;
    box-shadow: 0 0 10px rgba(255,209,102,0.85), 0 0 18px rgba(255,209,102,0.55);
}
.situation-diamond::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%) rotate(45deg);
    border: 1px dashed rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}
.situation-outs {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.situation-outs .so-label {
    font-size: 13px;
    color: #b8c5d6;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.situation-outs .so-dots { display: flex; gap: 8px; }
.situation-outs .so-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2a2a3a;
    border: 2px solid #6a6a7a;
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.situation-outs .so-dot.on {
    background: #e74c3c;
    border-color: #b03020;
    box-shadow: 0 0 8px rgba(231,76,60,0.7);
}

/* Now-Batting Banner */
.now-batting-banner {
    margin: 8px 0 12px 0;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    color: white;
    animation: nb-fadein 0.25s ease-out;
}
.now-batting-banner.away {
    background: linear-gradient(90deg, #4a4a5a, var(--team-color, #8b7d3c));
}
.now-batting-banner.home {
    background: linear-gradient(90deg, #4a4a5a, var(--team-color, #2e7d32));
}
.now-batting-banner .nb-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.85;
}
.now-batting-banner .nb-name {
    font-size: 28px;
    font-weight: 700;
    margin: 4px 0;
}
.now-batting-banner .nb-meta {
    font-size: 14px;
    opacity: 0.95;
}
.due-up {
    margin: 8px 0 12px 0;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    color: white;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
}
.due-up .nb-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.75;
    margin-bottom: 4px;
}
.due-up .nb-name {
    font-size: 18px;
    font-weight: 600;
    margin: 2px 0;
    opacity: 0.9;
}
@keyframes nb-fadein {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Lineup drag-and-drop */
.lineup-row[draggable="true"] {
    cursor: grab;
}
.lineup-row.drag-over {
    outline: 2px dashed #ffd740;
    outline-offset: -2px;
    background: rgba(255, 215, 64, 0.12);
}

/* Undo button */
.undo-btn {
    background: #4a4a6a;
}
.undo-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Spectator page */
.spectator-page {
    max-width: 900px;
    margin: 16px auto;
    padding: 0 12px;
    color: #e0e0e0;
}
.spectator-footer {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-top: 12px;
}

/* Old-School scoreboard for spectator view */
.scoreboard.old-school {
    background: linear-gradient(180deg, #0d1a0d 0%, #061206 100%);
    border: 4px solid #1a1a1a;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8), 0 6px 18px rgba(0,0,0,0.5);
    flex-wrap: nowrap;
}
.scoreboard.old-school .team-card {
    background: transparent !important;
    box-shadow: none;
    /* When a team color is set, show it as a colored bar on top of the card. */
    border-top: 4px solid var(--team-color, transparent);
    border-radius: 8px 8px 4px 4px;
    min-width: 0; /* allow flex children to shrink so team names fit */
}
.scoreboard.old-school .team-name {
    font-family: 'Courier New', monospace;
    color: #e8d96b;
    text-shadow: 0 0 6px rgba(232,217,107,0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
    /* Cap height and let autoshrink.js shrink the font to fit width. */
    max-height: 1.4em;
    line-height: 1.2;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    width: 100%;
    text-align: center;
}
.scoreboard.old-school .inning-display {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.line-score.old-school table {
    background: linear-gradient(180deg, #0d1a0d, #061206);
    border: 3px solid #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.7);
    border-collapse: separate;
    border-spacing: 4px;
}
.line-score.old-school th,
.line-score.old-school td {
    color: #e8d96b;
    font-family: 'Courier New', monospace;
    background: transparent;
    border: none;
    padding: 4px 6px;
}
.line-score.old-school .ls-team {
    color: #e8d96b;
    text-shadow: 0 0 4px rgba(232,217,107,0.5);
}

/* Flip tile (split-flap) */
.flip-tile {
    display: inline-block;
    position: relative;
    background: #111;
    color: #ffd166;
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    border: 1.5px solid #2a2a2a;
    box-shadow:
        inset 0 -8px 14px rgba(0,0,0,0.65),
        inset 0 8px 14px rgba(255,255,255,0.04),
        0 2px 4px rgba(0,0,0,0.6);
    line-height: 1;
    overflow: hidden;
    perspective: 200px;
    text-shadow: 0 0 6px rgba(255,209,102,0.65), 0 0 1px rgba(255,209,102,0.9);
}
.flip-tile.big {
    min-width: 64px;
    height: 84px;
    font-size: 64px;
}
.flip-tile.small {
    min-width: 36px;
    height: 36px;
    font-size: 22px;
}
.flip-tile.tiny {
    min-width: 26px;
    height: 30px;
    font-size: 20px;
}
.flip-tile::before {
    /* Center seam line like a split-flap display */
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0,0,0,0.85);
    z-index: 2;
    pointer-events: none;
}
.flip-digit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transform-origin: center;
    animation: flipIn 0.45s ease-out;
    backface-visibility: hidden;
}
@keyframes flipIn {
    0%   { transform: rotateX(-90deg); opacity: 0; }
    55%  { transform: rotateX(15deg);  opacity: 1; }
    80%  { transform: rotateX(-6deg); }
    100% { transform: rotateX(0deg); }
}

/* Spectator scoreboard mobile sizing */
@media (max-width: 640.98px) {
    .spectator-page { padding: 0 6px; margin: 6px auto; }
    .scoreboard.old-school {
        padding: 6px 6px;
        gap: 6px;
    }
    .scoreboard.old-school .team-name {
        font-size: 11px;
        letter-spacing: 0.5px;
    }
    .scoreboard.old-school .team-card { padding: 4px 4px; min-width: 0; flex: 1 1 0; }
    .scoreboard.old-school .inning-display { gap: 2px; padding: 0 2px; flex: 0 0 auto; }
    .flip-tile.big {
        min-width: 28px;
        height: 32px;
        font-size: 22px;
    }
    .flip-tile.small {
        min-width: 18px;
        height: 18px;
        font-size: 12px;
    }
    .flip-tile.tiny {
        min-width: 16px;
        height: 18px;
        font-size: 12px;
    }
    .line-score.old-school table { border-spacing: 1px; }
    .line-score.old-school th,
    .line-score.old-school td { padding: 1px 2px; font-size: 11px; }

    /* Situation row (diamond + outs) */
    .situation-row { gap: 16px; padding: 6px 8px; margin: 6px 0; }
    .situation-diamond { width: 64px; height: 64px; }
    .situation-diamond .sd-base { width: 16px; height: 16px; border-width: 1.5px; }
    .situation-diamond .sd-2 { margin-left: -8px; }
    .situation-diamond .sd-3 { margin-top: -8px; }
    .situation-diamond .sd-1 { margin-top: -8px; }
    .situation-diamond .sd-home { margin-left: -8px; }
    .situation-diamond::before { width: 38px; height: 38px; }
    .situation-outs .so-label { font-size: 11px; letter-spacing: 0.5px; }
    .situation-outs .so-dot { width: 13px; height: 13px; border-width: 1.5px; }
    .situation-outs .so-dots { gap: 5px; }

    /* Now batting + due up + inning summary */
    .now-batting-banner { margin: 6px 0 8px; padding: 8px 10px; border-radius: 8px; }
    .now-batting-banner .nb-label { font-size: 10px; letter-spacing: 1px; }
    .now-batting-banner .nb-name { font-size: 18px; margin: 2px 0; }
    .now-batting-banner .nb-meta { font-size: 12px; }
    .due-up { margin: 6px 0 8px; padding: 6px 10px; border-radius: 8px; }
    .due-up .nb-label { font-size: 10px; margin-bottom: 2px; }
    .due-up .nb-name { font-size: 13px; margin: 1px 0; }
    .inning-summary { padding: 6px 8px; }
    .inning-summary .nb-label { font-size: 10px; }
    .inning-summary-head { font-size: 12px; }
    .inning-summary-row { font-size: 12px; gap: 6px; padding: 2px 0; }
    .inning-summary-row .isr-outcome { font-size: 11px; padding: 1px 6px; }
    .spectator-footer { font-size: 10px; margin-top: 8px; }
}

/* At-Bat Outcome Bar */
.at-bat-bar {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.at-bat-current {
    color: #ddd;
    font-size: 14px;
}
.at-bat-current .at-bat-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.75;
    margin-right: 8px;
    font-size: 12px;
}
.at-bat-current .at-bat-name {
    font-weight: 700;
    font-size: 16px;
}
.at-bat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ab-btn {
    min-width: 44px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-weight: 600;
    cursor: pointer;
    background: #444;
}
.ab-btn:hover { filter: brightness(1.15); }
.ab-btn.ab-hit { background: #2e7d32; }
.ab-btn.ab-walk { background: #1565c0; }
.ab-btn.ab-out { background: #6a1b1b; }
.ab-btn.ab-err { background: #b8860b; color: #111; }
.at-bat-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: #ddd;
    font-size: 14px;
}
.at-bat-meta .at-bat-totals { opacity: 0.85; margin-left: 6px; }

/* Player at-bat history shown in lineup row */
.player-history {
    margin-left: 8px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    vertical-align: middle;
}
.player-history .ph-chip {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.4;
    color: #fff;
    background: rgba(255,255,255,0.1);
    cursor: help;
}
.player-history .ph-chip.ab-hit { background: #2e7d32; }
.player-history .ph-chip.ab-walk { background: #1565c0; }
.player-history .ph-chip.ab-out { background: #6a1b1b; }
.player-history .ph-chip.ab-err { background: #b8860b; color: #111; }

/* Compact at-bat count indicator next to player name */
.player-history-indicator {
    margin-left: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
    color: #ddd;
    cursor: help;
}

/* Spectator inning summary */
.inning-summary {
    margin: 8px 0 12px 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #ddd;
}
.inning-summary-group { margin-top: 8px; }
.inning-summary-group:first-of-type { margin-top: 4px; }
.inning-summary-head {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.85;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 2px;
}
.inning-summary-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 2px 0;
    font-size: 14px;
}
.inning-summary-row .isr-outcome {
    display: inline-block;
    min-width: 36px;
    text-align: center;
    background: rgba(255,255,255,0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
}
.inning-summary-row .isr-outcome.ab-hit { background: #2e7d32; color: #fff; }
.inning-summary-row .isr-outcome.ab-walk { background: #1565c0; color: #fff; }
.inning-summary-row .isr-outcome.ab-out { background: #6a1b1b; color: #fff; }
.inning-summary-row .isr-outcome.ab-err { background: #b8860b; color: #111; }
.inning-summary-row .isr-name { opacity: 0.95; }

