/* Latest Heaves table: shared (home + playoffs) — one source of truth. */

.recent-heaves-table-container {
    padding-bottom: 2px;
}

.recent-heaves-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.recent-heaves-table col.rh-c-player { width: 40%; }
.recent-heaves-table col.rh-c-info { width: 40%; }
.recent-heaves-table col.rh-c-tags { width: 20%; }

.recent-heaves-table th {
    font-weight: 600;
    color: #1e293b;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    vertical-align: middle;
}

@media (min-width: 769px) {
    .recent-heaves-table thead { position: relative; }
    .recent-heaves-table thead th { position: relative; }
}

.recent-heaves-table .table-header-row { background: #f8fafc; }
.recent-heaves-table .table-header-with-nav {
    margin: 0 !important;
    padding: 4px 0 !important;
    text-align: center !important;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}
.recent-heaves-table .table-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.recent-heaves-table .table-header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.recent-heaves-table tbody tr.heave-row-postseason {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.07) 0%, transparent min(100%, 120px));
}
.recent-heaves-table tbody tr.heave-row-postseason.heave-made {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.09) 0%, rgba(220, 252, 231, 0.65) min(100%, 140px));
}

.recent-heaves-table .tags-cell--recent-heaves .flag-badge {
    font-weight: 400 !important;
    font-size: 0.78rem !important;
    color: #64748b !important;
    background: transparent !important;
}
.recent-heaves-table .tags-cell--recent-heaves .flag-long-distance {
    background: transparent !important;
    color: #64748b !important;
    padding: 0 !important;
}

.recent-heaves-table td {
    padding: 4px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.recent-heaves-table thead { background: #f8fafc; }
.recent-heaves-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.recent-heaves-table tbody tr:last-child td { border-bottom: none; }
.recent-heaves-table tbody tr { transition: all 0.2s ease; }
.recent-heaves-table tbody tr:hover { background-color: #f8fafc; }
.recent-heaves-table tr.heave-made {
    background-color: #ecfdf5;
    border-left: 3px solid #10b981;
}
.recent-heaves-table tr.heave-made:hover { background-color: #d1fae5; }

/* Player / heave info / tags */
.recent-heaves-table th:nth-child(1),
.recent-heaves-table td:nth-child(1) { text-align: left; }
.recent-heaves-table th:nth-child(2),
.recent-heaves-table td:nth-child(2) { text-align: left; }
.recent-heaves-table th:nth-child(3),
.recent-heaves-table td:nth-child(3) { text-align: center; }

.recent-heaves-table .player-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-width: 0;
}
.recent-heaves-table .team-abbrev {
    color: #64748b;
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0.7;
}
.recent-heaves-table .player-name-link {
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-heaves-table .player-name-link:hover { text-decoration: underline; }

.recent-heaves-table .game-info-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
}

.recent-heaves-table th.recent-heaves-tags-header {
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #475569;
}
.recent-heaves-table thead tr:nth-child(2) th.recent-heaves-tags-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
}

/* Playoffs: day table row 2 + archive header use same th layout as home (not full-bleed sort button / centered Heave Info) */
@media (min-width: 769px) {
    .recent-heaves-table.playoffs-heave-table thead tr:nth-child(2) th .sort-th-btn--recent-heaves {
        display: inline;
        width: auto;
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        font: inherit;
        font-weight: 600;
        color: #1e293b;
        text-align: left;
        border-radius: 0;
        cursor: pointer;
    }
    .recent-heaves-table.playoffs-heave-table thead tr:nth-child(2) th .sort-th-btn--recent-heaves:hover,
    .recent-heaves-table.playoffs-heave-table thead tr:nth-child(2) th .sort-th-btn--recent-heaves:focus-visible {
        background: transparent;
        text-decoration: underline;
        outline: none;
    }
    .recent-heaves-table.playoffs-heave-table thead tr:nth-child(2) th .sort-th-btn--recent-heaves[data-asc="1"],
    .recent-heaves-table.playoffs-heave-table thead tr:nth-child(2) th .sort-th-btn--recent-heaves[data-asc="0"] {
        background: #eff6ff;
        color: #1d4ed8;
    }
    .recent-heaves-table.playoffs-archive-table thead tr th .sort-th-btn--archive-heave {
        display: inline;
        width: auto;
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        font: inherit;
        font-weight: 600;
        color: #1e293b;
        text-align: left;
        text-decoration: none;
        border-radius: 0;
    }
    .recent-heaves-table.playoffs-archive-table thead tr th .sort-th-btn--archive-heave:hover,
    .recent-heaves-table.playoffs-archive-table thead tr th .sort-th-btn--archive-heave:focus-visible {
        text-decoration: underline;
        background: #eef2f7;
        outline: none;
    }
    .recent-heaves-table.playoffs-archive-table thead tr th .sort-th-btn--archive-heave.sort-th-btn--active {
        background: #eff6ff;
        color: #1d4ed8;
    }
}

.recent-heaves-table td.tags-cell { text-align: center; }
.recent-heaves-table .tags-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    width: 100%;
}
.recent-heaves-table .tags-cell .heave-slot {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
}

/* Desktop: heave info column + round watch (matches home) + playoffs ph- toggles */
@media (min-width: 769px) {
    .recent-heaves-table .ph-p-mobile { display: none !important; }
    .recent-heaves-table .ph-p-desktop {
        display: flex !important;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
        min-width: 0;
    }
    .recent-heaves-table .ph-heave-info-mobile { display: none !important; }
    .recent-heaves-table .ph-heave-info-desktop { display: block !important; }

    .recent-heaves-table th:nth-child(2),
    .recent-heaves-table td:nth-child(2) { text-align: left; }
    .recent-heaves-table th:nth-child(3),
    .recent-heaves-table td:nth-child(3) { text-align: center !important; }

    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
        min-width: 0;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-text {
        flex: 0 1 auto;
        min-width: 0;
        text-align: left;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-text .game-info-text {
        font-size: 0.9rem;
        font-weight: 500;
        color: #334155;
        line-height: 1.45;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-text .game-info-text a {
        color: #2563eb;
        text-decoration: none;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-text .game-info-distance,
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-text .game-info-mono {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-weight: 500;
        font-size: 0.88rem;
        color: #475569;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-watch {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-watch .watch-button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        margin-left: 0 !important;
        border-radius: 999px;
        border: 1px solid #e2e8f0 !important;
        background: #f8fafc !important;
        color: transparent !important;
        font-size: 0 !important;
        line-height: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
    .recent-heaves-table tbody td.recent-heaves-info-td .recent-heaves-info-desktop-watch .watch-button::before {
        content: "▶";
        font-size: 12px !important;
        color: #1e40af;
    }
}

/* Mobile: stacked heave table (home Live-site block, scoped) */
@media (max-width: 768px) {
    /* Avoid clipping the tags column; horizontal scroll lives on .recent-heaves-table-container */
    .recent-heaves-table {
        table-layout: fixed !important;
        width: 100% !important;
        overflow: visible !important;
    }
    .recent-heaves-table col.rh-c-player { width: 36%; }
    .recent-heaves-table col.rh-c-info { width: 46%; }
    .recent-heaves-table col.rh-c-tags { width: 18%; min-width: 3.25rem; }

    .recent-heaves-table .table-header-with-nav { padding: 0 !important; margin: 0 !important; }
    .recent-heaves-table thead tr.table-header-row th { padding: 2px 0 !important; margin: 0 !important; border-bottom: none; }
    .recent-heaves-table thead tr:nth-child(2) th { padding-top: 2px !important; padding-bottom: 2px !important; }

    .recent-heaves-table th,
    .recent-heaves-table td {
        padding: 4px 2px !important;
        vertical-align: middle !important;
    }
    .recent-heaves-table tbody tr { line-height: 1.25; }

    .recent-heaves-table .ph-p-desktop { display: none !important; }
    .recent-heaves-table .ph-p-mobile {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .recent-heaves-table .ph-heave-info-desktop { display: none !important; }
    .recent-heaves-table .ph-heave-info-mobile {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .recent-heaves-table .ph-heave-info-mobile .recent-heaves-info-stack {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        min-width: 0;
        width: 100%;
    }

    .recent-heaves-table .player-name-cell.recent-heaves-player-stack {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center;
        flex-wrap: nowrap !important;
        gap: 2px;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
    .recent-heaves-table .recent-heaves-team-row {
        font-size: 10px !important;
        font-weight: 600 !important;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #94a3b8 !important;
        line-height: 1.15;
    }
    .recent-heaves-table .recent-heaves-player-name-row {
        font-size: 13px !important;
        font-weight: 700 !important;
        line-height: 1.25;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }
    .recent-heaves-table .recent-heaves-info-stack {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        min-width: 0;
        width: 100%;
    }
    .recent-heaves-table .recent-heaves-info-line { min-width: 0; }
    .recent-heaves-table .recent-heaves-info-line .game-info-text,
    .recent-heaves-table .recent-heaves-info-line .game-info-text a {
        font-size: 13px !important;
        font-weight: 500 !important;
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
        line-height: 1.35;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }
    .recent-heaves-table .recent-heaves-info-line--mobile-top .game-info-text,
    .recent-heaves-table .recent-heaves-info-line--mobile-top .game-info-text a {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .recent-heaves-table .recent-heaves-info-line--mobile-top .recent-heaves-info-matchup-text,
    .recent-heaves-table .recent-heaves-info-line--mobile-top .recent-heaves-info-matchup-text a {
        display: block !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .recent-heaves-table .recent-heaves-info-line .game-info-mono {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
        font-variant-numeric: tabular-nums;
        font-size: 13px !important;
        font-weight: 500 !important;
    }
    .recent-heaves-table .recent-heaves-watch-link {
        display: inline-flex;
        align-items: center;
        font-size: 12px !important;
        font-weight: 500 !important;
        color: #64748b !important;
        text-decoration: none !important;
        padding: 1px 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    .recent-heaves-table .recent-heaves-watch-link:active { color: #334155 !important; }

    .recent-heaves-table tbody td.recent-heaves-info-td {
        overflow: hidden !important;
        vertical-align: top !important;
    }
    .recent-heaves-table .recent-heaves-info-line--mobile-hero {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        width: 100%;
        min-width: 0;
    }
    /* Full row width + center the matchup + distance as one group (keeps Watch under the middle of the line) */
    .recent-heaves-table .recent-heaves-info-mobile-line-inner {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        gap: 0;
    }
    .recent-heaves-table .recent-heaves-info-line--mobile-hero .recent-heaves-info-matchup {
        flex: 0 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .recent-heaves-table .recent-heaves-info-line--mobile-hero .recent-heaves-distance-suffix {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .recent-heaves-table .recent-heaves-info-line--mobile-hero .game-info-text,
    .recent-heaves-table .recent-heaves-info-line--mobile-hero .game-info-text a,
    .recent-heaves-table .recent-heaves-info-line--mobile-hero .recent-heaves-info-matchup-text {
        font-size: 12px !important;
        font-weight: 500 !important;
        line-height: 1.35;
    }
    .recent-heaves-table .heave-line-sep {
        color: #64748b;
        font-weight: 500;
        font-size: 12px;
    }
    .recent-heaves-table .heave-line-dist { color: #334155; font-weight: 500; }
    .recent-heaves-table .heave-line-dist-unit {
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        font-weight: 500;
        font-size: 12px !important;
    }
    .recent-heaves-table .heave-line-dist-num {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
        font-variant-numeric: tabular-nums;
        font-weight: 500 !important;
        font-size: 12px !important;
    }
    .recent-heaves-table .recent-heaves-watch-row--mobile {
        display: flex !important;
        justify-content: center;
        align-items: center;
        align-self: stretch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-top: 6px;
    }

    /* After generic hero/inner rules: one block = matchup line + Watch centered under that line only */
    .recent-heaves-table .recent-heaves-info-mobile-hero-cluster {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: max-content;
        max-width: 100%;
        min-width: 0;
        align-self: flex-start;
        box-sizing: border-box;
    }
    .recent-heaves-table .recent-heaves-info-mobile-hero-cluster .recent-heaves-info-line--mobile-hero {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start !important;
        width: auto !important;
        max-width: 100%;
        min-width: 0;
    }
    .recent-heaves-table .recent-heaves-info-mobile-hero-cluster .recent-heaves-info-mobile-line-inner {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: flex-start !important;
        width: auto !important;
        max-width: 100%;
        min-width: 0;
        gap: 0;
    }
    .recent-heaves-table .recent-heaves-info-mobile-hero-cluster .recent-heaves-watch-row--mobile {
        display: flex !important;
        justify-content: center !important;
        align-items: center;
        align-self: stretch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-width: 0;
        margin-top: 6px;
    }
    /* Clock in Q2 0:00 — match surrounding line (mono was 13px vs 12px body) */
    .recent-heaves-table .recent-heaves-info-mobile-hero-cluster .recent-heaves-info-matchup-text .game-info-mono {
        font-size: 12px !important;
        font-weight: 500 !important;
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
        font-variant-numeric: tabular-nums;
    }

    /* Column borders / padding: colgroup (mobile) */
    .recent-heaves-table thead tr:nth-child(2) th:nth-child(1),
    .recent-heaves-table tbody td:nth-child(1).recent-heaves-player-td {
        min-width: 0 !important;
        box-sizing: border-box !important;
        border-right: 1px solid #e2e8f0 !important;
    }
    .recent-heaves-table th:nth-child(1),
    .recent-heaves-table td:nth-child(1) {
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box !important;
        border-right: 1px solid #e2e8f0 !important;
        padding: 6px 2px !important;
        vertical-align: top !important;
    }
    .recent-heaves-table th:nth-child(2),
    .recent-heaves-table td:nth-child(2) {
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box !important;
        padding: 6px 4px !important;
        vertical-align: top !important;
        text-align: center !important;
    }
    .recent-heaves-table th:nth-child(3),
    .recent-heaves-table td:nth-child(3) {
        min-width: 3.25rem !important;
        max-width: none !important;
        box-sizing: border-box !important;
        padding: 6px 2px !important;
    }
    .recent-heaves-table thead tr:nth-child(2) th.recent-heaves-tags-header {
        font-size: 0.65rem !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
    .recent-heaves-table .tags-cell-wrap .tags-cell {
        justify-content: center !important;
        text-align: center !important;
    }
    .recent-heaves-table .tags-cell-wrap .heave-slot { justify-content: center !important; }

    .recent-heaves-table .tags-cell--mobile-heaves {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 2rem;
        padding: 0 !important;
    }
    .recent-heaves-table .tags-cell-wrap--mobile-empty .tags-cell--mobile-heaves { min-height: 0 !important; }
    .recent-heaves-table td.tags-cell-wrap.empty-only {
        width: 0 !important;
        padding: 0 !important;
        border-bottom-color: transparent;
    }
    .recent-heaves-table td.tags-cell-wrap.empty-only .tags-cell { display: none; }
}
