.draw-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
        gap: 1.5rem;
        width: 100%;
    }
    .scorecard {
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 6px;
        overflow: hidden;
        page-break-inside: avoid;
    }
    .scorecard .table {
        font-size: 0.8rem;
        margin-bottom: 0;
    }
    .scorecard .table th, .scorecard .table td {
        padding: 4px 6px;
        text-align: center;
        vertical-align: middle;
    }
    .scorecard .col-fixed {
        white-space: nowrap;
    }
    .scorecard .col-result {
        width: 50px;
    }
    .scorecard .col-dynamic {
        width: 60px;
    }
    .agg-pos { color: #198754; font-weight: bold; }
    .agg-neg { color: #dc3545; font-weight: bold; }
    .totals-row { font-weight: bold; background: #f8f9fa; }
    .team-title {
        font-size: 0.85rem;
        font-weight: 600;
    }
    .pos-indicator {
        font-size: 0.75rem;
        background: rgba(255,255,255,0.2);
        padding: 2px 8px;
        border-radius: 12px;
    }
    .section-container {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
    }
    .section-main-caption {
        background: #001f3f;
        color: #fff;
        padding: 8px 16px;
        font-weight: bold;
        border-radius: 4px;
        text-transform: uppercase;
        letter-spacing: 1px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .section-standings-sub-caption {
        background: #e9ecef;
        color: #001f3f;
        padding: 6px 12px;
        font-weight: bold;
        border-radius: 4px;
    }
    .standings-table { font-size: 0.85rem; }
    .standings-table th, .standings-table td { padding: 6px 10px; }
    .bg-navy { background-color: #001f3f !important; }
    .text-navy { color: #001f3f !important; }
    .bg-orange { background-color: #ff8c00 !important; }
    .bg-orange.text-white { color: #fff !important; }
    .knockout-bracket { display: flex; flex-wrap: wrap; gap: 1.5rem; }
    .knockout-stage { flex: 1; min-width: 300px; }
    .knockout-match-card { background: #fff; }
    .date-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
    .date-pill {
        padding: 6px 14px;
        border-radius: 20px;
        background: #fff;
        border: 1px solid #dee2e6;
        cursor: pointer;
        font-size: 0.85rem;
        text-decoration: none;
        color: #001f3f;
    }
    .date-pill.active { background: #001f3f; color: #fff; }
    .section-caption {
        background: #001f3f;
        color: #fff;
        padding: 8px 16px;
        font-weight: bold;
        border-radius: 4px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* ── Mobile: keep the live round/standings area as one horizontal scroll unit ─────────────── */
    @media (max-width: 600px) {
        html, body {
            overflow-x: auto !important;
            -webkit-overflow-scrolling: touch;
        }
        body {
            min-width: 620px;
        }
        .draw-grid {
            display: block;
            grid-template-columns: 1fr;
            gap: 0.5rem;
            min-width: 620px;
            width: max-content;
        }
        .section-container,
        .knockout-container,
        .rr-section-body,
        .scorecard,
        .table-responsive,
        .table-responsive-scorecard,
        .svss-sheet-wrap,
        .svss-sheet-scroll-wrapper {
            overflow-x: auto;
            overflow-y: visible;
            -webkit-overflow-scrolling: touch;
        }
        .scorecard .table,
        .standings-table,
        .svss-sheet {
            min-width: 560px;
        }
        .svss-pos-col,
        .svss-pos-cell,
        .svss-team-col,
        .svss-team-cell,
        .svss-total-head,
        .svss-total-col {
            position: static !important;
            left: auto !important;
            z-index: auto !important;
            min-width: auto !important;
            max-width: none !important;
            width: auto !important;
        }
        .svss-round-instruction-box,
        .svss-sheet-heading .svss-round-instruction-box {
            display: none !important;
        }
        .mobile-hscroll-note {
            display: block !important;
        }
        .section-tab-nav .d-flex {
            overflow-x: auto;
            flex-wrap: nowrap !important;
        }
        /* Strip Bootstrap container/row padding */
        .container, .container-fluid {
            padding-left: 4px !important;
            padding-right: 4px !important;
        }
        .row.px-3 { padding-left: 4px !important; padding-right: 4px !important; }
    }
    .mobile-hscroll-note,
    .mobile-file-check {
        display: none;
        margin: 0 0 0.75rem;
        padding: 0.55rem 0.85rem;
        border-radius: 999px;
        background: rgba(0, 31, 63, 0.06);
        border: 1px solid rgba(0, 31, 63, 0.14);
        color: #001f3f;
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-align: center;
    }
    .mobile-file-check {
        display: block;
        background: rgba(40, 167, 69, 0.12);
        border-color: rgba(40, 167, 69, 0.45);
        color: #0d5d1f;
        box-shadow: inset 0 0 0 1px rgba(40, 167, 69, 0.18);
        margin-top: 0.5rem;
    }
    .refresh-timer {
        font-size: 0.85rem;
        color: #666;
        display: flex;
        align-items: center;
        gap: 8px;
        background: #fff;
        padding: 4px 12px;
        border-radius: 20px;
        border: 1px solid #ddd;
    }
    .refresh-timer #refresh-icon {
        font-size: 1.1rem;
        color: #001f3f;
        transition: transform 0.3s;
    }
    .refresh-timer #refresh-icon:hover {
        transform: rotate(180deg);
        color: #198754;
    }
    /* Public read-only score display */
    .score-display {
        display: inline-block;
        min-width: 35px;
        padding: 4px 8px;
        text-align: center;
        font-weight: bold;
        font-size: 0.9rem;
    }
    .ends-display {
        display: inline-block;
        min-width: 25px;
        padding: 2px 6px;
        text-align: center;
        font-size: 0.7rem;
        font-weight: bold;
        color: #495057;
        background: #f8f9fa;
        border-radius: 4px;
    }
    .live-indicator {
        display: inline-block;
        width: 8px;
        height: 8px;
        background: #fff;
        border-radius: 50%;
        margin-right: 6px;
        animation: pulse-live 1.5s infinite;
        vertical-align: middle;
    }
    @keyframes pulse-live {
        0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,255,255,0.7); }
        50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255,255,255,0); }
    }
    /* Bracket match styles */
    .bracket-container {
        display: flex;
        flex-direction: row;
        gap: 1rem;
        overflow-x: auto;
        padding: 1rem;
        width: 100%;
        background-color: #f0f2f5;
        min-height: 800px;
        align-items: stretch;
    }
    .bracket-col {
        display: flex;
        flex-direction: column;
        min-width: 200px;
        flex: 1;
    }
    .bracket-round-header {
        background-color: #001f3f;
        color: white;
        padding: 8px;
        margin-bottom: 10px;
        border-radius: 4px;
        text-align: center;
        font-size: 0.9rem;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    .bracket-matches-list {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        flex-grow: 1;
        gap: 10px;
    }
    .bracket-match {
        margin: 5px 0;
        width: 100%;
        background: #fff;
        border-radius: 6px;
        border: 1px solid #dee2e6 !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 140px;
    }
    .bracket-match.is-bronze { border: 2px solid #cd7f32 !important; margin-top: 20px; }
    .bracket-match .card-header {
        background-color: #e9ecef !important;
        color: #495057 !important;
        padding: 4px 8px !important;
        font-size: 0.75rem;
        border-bottom: 1px solid #dee2e6;
    }
    .bracket-match.is-bronze .card-header { background-color: #cd7f32 !important; color: white !important; }
    .bracket-match .card-body { padding: 8px !important; flex-grow: 1; }
    .score-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 8px;
        border-radius: 4px;
        margin-bottom: 4px;
    }
    .score-winner { background-color: #28a745 !important; color: #fff !important; }
    .score-loser { background-color: #dc3545 !important; color: #fff !important; }
    .score-final-gold { background-color: #ffd700 !important; color: #000 !important; font-weight: bold; }
    .score-final-silver { background-color: #c0c0c0 !important; color: #000 !important; font-weight: bold; }
    .team-name {
        font-size: 0.8rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
        cursor: help;
        border-bottom: 1px dashed #666;
    }
    .team-name:hover {
        background-color: rgba(0, 31, 63, 0.1);
        border-bottom-style: solid;
    }
    .team-opponent {
        cursor: help;
        border-bottom: 1px dashed #001f3f;
    }
    .team-opponent:hover {
        background-color: rgba(0, 31, 63, 0.1);
    }
    .ends-row {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 5px;
        font-size: 0.7rem;
        color: #6c757d;
        margin-top: 5px;
        padding: 0 8px;
    }
    .medal-display {
        background: #fff;
        border-radius: 8px;
        border: 2px solid #001f3f;
        padding: 10px 15px;
        margin-bottom: 10px;
        text-align: center;
    }
    .medal-display h6 {
        font-size: 1.2rem;
        margin-bottom: 10px !important;
        color: #001f3f;
        text-transform: uppercase;
        letter-spacing: 2px;
    }
    .medal-item {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 15px;
        margin-bottom: 6px;
        padding: 8px 15px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    .medal-item i { font-size: 1.6rem; }
    .medal-item span { font-size: 1.1rem; letter-spacing: 0.5px; }
    .medal-gold { background-color: rgba(255, 215, 0, 0.15); border: 2px solid #ffd700; }
    .medal-silver { background-color: rgba(192, 192, 192, 0.15); border: 2px solid #c0c0c0; }
    .medal-bronze { background-color: rgba(205, 127, 50, 0.15); border: 2px solid #cd7f32; }
    .final-col-layout { justify-content: flex-start !important; gap: 0 !important; }
    .final-match-wrapper {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 400px;
    }
    .bronze-match-wrapper { margin-top: auto; padding-top: 20px; }
    .badge-gold-silver {
        background: linear-gradient(45deg, #ffd700, #fff 50%, #ffd700);
        background-size: 200% auto;
        color: #001f3f;
        font-weight: 800;
        border: 2px solid #001f3f;
        text-transform: uppercase;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        animation: shine 3s linear infinite;
    }
    @keyframes shine { to { background-position: 200% center; } }
    
    @media print {
        .no-print { display: none !important; }
        .draw-grid { grid-template-columns: 1fr; }
        .section-container { break-inside: avoid; }
    }
    /* Integrated KO phase styles */
    .phase-divider {
        border-top: 3px dashed #198754;
        margin: 20px 0;
        position: relative;
    }
    .phase-divider::after {
        content: 'Knockout Phase';
        position: absolute;
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        background: #198754;
        color: white;
        padding: 2px 15px;
        border-radius: 15px;
        font-size: 0.8rem;
        font-weight: bold;
    }
    .bg-purple { background-color: #198754 !important; }
    .alert-purple {
        background-color: #f3e5f5;
        border-color: #ce93d8;
        color: #4a148c;
    }
    .bracket-display {
        background: #fafafa;
        border-radius: 8px;
        padding: 20px;
    }
    .bracket-round { position: relative; }
    .bracket-match-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        font-size: 0.75rem;
        padding-bottom: 6px;
        border-bottom: 1px solid #eee;
    }
    .bracket-team {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 8px;
        margin: 4px 0;
        background: #f8f9fa;
        border-radius: 4px;
    }
    .bracket-team.winner {
        background: #d4edda;
        font-weight: bold;
    }
    .bracket-team.gold-winner {
        background: linear-gradient(135deg, #fff3cd, #ffc107);
        border: 2px solid #ffc107;
    }
    .bracket-team.bronze-winner {
        background: rgba(205, 127, 50, 0.2);
        border: 1px solid #cd7f32;
    }
    .bracket-team .score {
        font-weight: bold;
        min-width: 30px;
        text-align: center;
    }
    .bracket-team.winner::after {
        content: '✓';
        color: #28a745;
        margin-left: 5px;
    }
    .final-match {
        border-color: #ffc107 !important;
        box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
    }
    .final-match .bracket-match-header {
        background: #ffc107;
        color: #212529;
        margin: -12px -12px 12px -12px;
        padding: 8px 12px;
        border-radius: 6px 6px 0 0;
        font-weight: bold;
        border-bottom: none;
    }
    .bronze-match { border-color: #cd7f32 !important; }
    .bronze-match .bracket-match-header {
        background: #cd7f32;
        color: white;
        margin: -12px -12px 12px -12px;
        padding: 8px 12px;
        border-radius: 6px 6px 0 0;
        border-bottom: none;
    }
    .medal-icon { font-size: 1.2rem; margin-right: 5px; }


/* ── PBA section header styles (shared with draw page) ─────────────────────
   The live page delegates to draw_render.php so needs the same PBA classes. */
.pba-hdr-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}
.pba-hdr-left {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    overflow: hidden;
}
.pba-hdr-left .pba-section-players {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}
.pba-hdr-centre {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}
.pba-hdr-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}
.pba-pts-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 0.7rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
    cursor: help;
    line-height: 1;
    vertical-align: middle;
}
.pba-player-name {
    cursor: help;
    border-bottom: 1px dotted rgba(255,255,200,0.7);
    padding-bottom: 1px;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pba-player-name:hover {
    border-bottom-style: solid;
    color: #fff !important;
}
.pba-section-winner-badge {
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 3px 10px;
    vertical-align: middle;
    flex-shrink: 0;
}
