.history-grid {
    display: block;
    width: 100%;
}

/* --- PREMIUM TABLE REDESIGN v2 --- */
.history-table-container {
    background: rgba(8, 10, 22, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 245, 255, 0.03);
    margin-top: 10px;
}

.history-table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

/* ── THEAD ── */
.history-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.history-table th {
    background: rgba(6, 9, 20, 0.92);
    padding: 13px 16px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(0, 245, 255, 0.12);
}

/* ── TBODY ROWS ── */
.history-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.035);
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.history-table tbody tr:hover {
    background: rgba(0, 245, 255, 0.035);
    box-shadow: inset 3px 0 0 rgba(0, 245, 255, 0.45);
}

.history-table tbody tr:last-child {
    border-bottom: none;
}

.history-table td {
    padding: 14px 16px;
    vertical-align: middle;
    font-size: 13px;
    color: var(--text-main);
}

/* ── COL TIME ── */
.history-table .col-time {
    width: 120px;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: rgba(164, 172, 235, 0.7);
    line-height: 1.6;
}

/* ── COL BRACKET ── */
.history-table .col-bracket {
    width: 220px;
}

.history-table .bracket-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.18);
    border-radius: 20px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── COL MATCHUP ── */
.history-table .col-matchup {
    min-width: 340px;
}

.history-table .matchup-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.history-table .matchup-team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.history-table .matchup-team.team-a {
    justify-content: flex-end;
    text-align: right;
    flex-direction: row-reverse;
}

.history-table .matchup-team.team-b {
    justify-content: flex-start;
    text-align: left;
}

.history-table .matchup-team-name {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

.history-table .matchup-team.team-a.winner .matchup-team-name {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

.history-table .matchup-team.team-b.winner .matchup-team-name {
    color: #a6e3a1;
    text-shadow: 0 0 10px rgba(166, 227, 161, 0.3);
}

.history-table .matchup-team-avatars {
    display: flex;
    gap: 3px;
}

.history-table .matchup-score-pill {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 100px;
    padding: 5px 16px;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 16px;
    min-width: 90px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.history-table .matchup-score-pill .score-a {
    color: var(--accent);
    text-shadow: 0 0 12px rgba(0, 245, 255, 0.45);
}

.history-table .matchup-score-pill .score-b {
    color: #a6e3a1;
    text-shadow: 0 0 12px rgba(166, 227, 161, 0.45);
}

.history-table .matchup-score-pill .divider {
    color: rgba(255, 255, 255, 0.15);
    font-weight: 300;
    font-size: 13px;
}

/* ── COL SYNCED ── */
.history-table .col-synced {
    width: 150px;
}

/* ── COL ACTIONS ── */
.history-table .col-actions {
    width: 290px;
    text-align: right;
}

.history-table .action-btn-group {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    align-items: center;
}

.history-table .action-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    outline: none;
}

.history-table .action-btn:hover {
    transform: translateY(-1px);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
}

.history-table .action-btn.btn-load {
    background: linear-gradient(135deg, #00f5ff 0%, #0096c7 100%);
    border: none;
    color: #060b18;
    font-weight: 800;
    letter-spacing: 0.2px;
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.2);
}

.history-table .action-btn.btn-load:hover {
    box-shadow: 0 0 18px rgba(0, 245, 255, 0.4);
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.history-table .action-btn.btn-detail {
    background: rgba(139, 148, 255, 0.06);
    border-color: rgba(139, 148, 255, 0.15);
    color: rgba(180, 185, 255, 0.8);
}

.history-table .action-btn.btn-detail:hover {
    background: rgba(139, 148, 255, 0.14);
    border-color: rgba(139, 148, 255, 0.3);
    color: #c4c8ff;
}

.history-table .action-btn.btn-sync {
    background: rgba(16, 185, 129, 0.05);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.18);
}

.history-table .action-btn.btn-sync:hover {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.18);
}

.history-table .action-btn.btn-delete {
    background: rgba(239, 68, 68, 0.04);
    color: rgba(243, 139, 168, 0.7);
    border-color: rgba(239, 68, 68, 0.15);
    padding: 6px 9px;
}

.history-table .action-btn.btn-delete:hover {
    background: rgba(239, 68, 68, 0.13);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f38ba8;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

/* Responsive Table Fallback for Mobile viewports */
@media (max-width: 900px) {
    .history-table thead {
        display: none;
    }

    .history-table tr {
        display: flex;
        flex-direction: column;
        padding: 14px;
        gap: 10px;
        background: rgba(12, 16, 30, 0.9);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 12px;
        margin-bottom: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .history-table td {
        display: flex;
        padding: 0;
        width: 100% !important;
        justify-content: space-between;
        align-items: center;
    }

    .history-table td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 800;
        color: rgba(255, 255, 255, 0.3);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .history-table .matchup-display {
        width: 100%;
        margin-top: 4px;
    }

    .history-table .action-btn-group {
        width: 100%;
        margin-top: 4px;
        justify-content: flex-start;
    }
}

/* ── HISTORY PAGE HEADER ── */
.hist-page-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 24px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0;
    background: rgba(8, 12, 28, 0.3);
}

.hist-page-brand {
    flex-shrink: 0;
}

.hist-page-brand h1 {
    font-size: 20px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
    line-height: 1;
    margin: 0;
    padding: 0;
    border: none;
}

/* ── SUBTAB NAVIGATION — PILL STYLE (in header) ── */
.history-subtabs-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.subtab-pill-group {
    display: inline-flex;
    background: rgba(6, 10, 24, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.history-subtabs-nav .subtab-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border-radius: 7px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.history-subtabs-nav .subtab-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.04);
}

.history-subtabs-nav .subtab-btn.active {
    background: rgba(0, 245, 255, 0.1);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(0, 245, 255, 0.2) inset;
}

.subtab-badge {
    background: rgba(0, 245, 255, 0.12);
    color: var(--accent);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    min-width: 22px;
    text-align: center;
    line-height: 1.6;
}

/* ── FILTER TOOLBAR ── */
.hist-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hist-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 380px;
}

.hist-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    pointer-events: none;
}

.hist-search-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 9px 14px 9px 36px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.hist-search-input:focus {
    border-color: rgba(0, 245, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.08);
}

.hist-search-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.hist-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.hist-select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-appearance: none;
}

.hist-select:focus {
    border-color: rgba(0, 245, 255, 0.3);
}

/* ── VIEW TOGGLE ── */
.hist-view-toggle {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.hist-view-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    width: 32px;
    height: 32px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
}

.hist-view-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
}

.hist-view-btn.active {
    background: rgba(0, 245, 255, 0.1);
    color: var(--accent);
}

/* ── CARD GRID VIEW ── */
.history-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

@media (max-width: 768px) {
    .history-card-grid {
        grid-template-columns: 1fr;
    }
}

div#history-list-view {
    padding: 16px 24px 20px;
}

@media (max-width: 768px) {
    .history-grid {
        grid-template-columns: 1fr;
    }
}


.history-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.history-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0.8;
}

.history-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 245, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0, 245, 255, 0.08);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.history-bracket-label {
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-timestamp {
    color: var(--text-dim);
    font-family: 'DM Mono', monospace;
}

.history-match-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

.history-team-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}

.history-team-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.history-team-score {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: #fff;
    margin-top: 2px;
}

.history-team-preview.team-a .history-team-score {
    color: var(--accent);
    text-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
}

.history-team-preview.team-b .history-team-score {
    color: var(--success);
    text-shadow: 0 0 15px rgba(166, 227, 161, 0.3);
}

.history-vs-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    color: var(--text-dim);
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 1px;
}

.history-vs-line {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    margin: 2px 0;
}

.history-rosters-summary {
    display: flex;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 14px;
    align-items: center;
}

.history-table>thead {
    box-sizing: revert;
}

.history-roster-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}

.history-roster-list.team-a {
    justify-content: flex-start;
}

.history-roster-list.team-b {
    justify-content: flex-end;
}

.history-mini-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    /* border: 2px solid rgba(255, 255, 255, 0.1); */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    position: relative;
}

.history-mini-avatar:hover {
    transform: scale(1.15);
    border-color: var(--accent);
    z-index: 2;
}

.history-mini-avatar span {
    display: none;
}

.history-mini-avatar.no-image span {
    display: inline;
}

.history-card-footer {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-history-load {
    flex: 1.5;
    background: linear-gradient(135deg, var(--accent) 0%, #00b8d4 100%);
    color: #0b0d14;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-history-load:hover {
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-history-delete {
    flex: 1;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-history-delete:hover {
    background: rgba(243, 139, 168, 0.1);
    transform: translateY(-1px);
}

.history-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 70px 40px;
    background: rgba(15, 17, 32, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.history-empty-state>i {
    font-size: 56px;
    color: var(--accent);
    opacity: 0.25;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.4);
}

.history-empty-state p {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.history-empty-state .btn-goto-control {
    background: linear-gradient(135deg, var(--accent) 0%, #00b8d4 100%);
    color: #0b0d14;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 700;
    text-decoration: none;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 12px;
    box-shadow: 0 4px 15px rgba(0, 245, 255, 0.2);
}

.history-empty-state .btn-goto-control:hover {
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.45);
    transform: translateY(-2px);
    filter: brightness(1.15);
}

.history-empty-state .btn-goto-control i {
    font-size: 14px;
    color: #0b0d14;
}

/* Modal Overlay for Details View */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeInModal 0.25s ease-out forwards;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpModal {
    from {
        transform: translateY(20px);
    }

    to {
        transform: translateY(0);
    }
}

.modal-close:hover {
    color: var(--danger) !important;
    transform: scale(1.1);
}

/* Roster Rows inside Details View */
.history-round-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.history-round-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.history-round-label {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    flex-shrink: 0;
}

.history-round-items {
    display: flex;
    gap: 4px;
    align-items: center;
}

.history-item-slot {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgb(79 79 79);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-item-slot.empty {
    border-style: dashed;
    opacity: 0.25;
}

.history-item-slot.empty i {
    font-size: 12px;
    color: var(--text-dim);
}

.history-slot-tag {
    position: absolute;
    bottom: -3px;
    right: -3px;
    background: #0b0d14;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    padding: 1px 2px;
    font-size: 7px;
    font-weight: 700;
    line-height: 1;
    font-family: 'Inter', sans-serif;
}

.history-slot-tag.hero {
    color: var(--accent);
    border-color: rgba(0, 245, 255, 0.3);
}

.history-slot-tag.weapon {
    color: var(--success);
    border-color: rgba(166, 227, 161, 0.3);
}

.history-score-display {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.history-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 32px;
}

.history-score-label {
    font-size: 7px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 2px;
    font-weight: 600;
}

.history-score-value {
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}

.history-score-value.plus {
    color: var(--accent);
}

.history-score-value.minus {
    color: var(--danger);
}

.history-score-value.net {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 800;
}

/* ── BRACKET DESIGNER STYLING ── */

.history-subtabs-nav .subtab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-subtabs-nav .subtab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

.history-subtabs-nav .subtab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(0, 245, 255, 0.04);
}

/* Workspace layout details */
.grid-bg {
    background-size: 30px 30px;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

.grid-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(4, 8, 20, 0.8) 100%);
    pointer-events: none;
}

/* Sidebar lists */
.sidebar-match-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.15s ease;
}

.sidebar-match-item:hover {
    background: rgba(0, 245, 255, 0.03);
    border-color: rgba(0, 245, 255, 0.15);
}

.sidebar-match-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

.sidebar-match-name {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-match-bracket {
    font-size: 9px;
    color: var(--accent);
    font-family: 'DM Mono', monospace;
    text-transform: uppercase;
}

.btn-sidebar-add {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

.btn-sidebar-add:hover {
    color: var(--accent);
    transform: scale(1.2);
}

/* Position HUD at bottom center to avoid overlapping with widgets at corners */
#bracket-hud {
    right: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: 20px !important;
}

/* Canvas HUD controls buttons */
.canvas-controls-hud button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.canvas-controls-hud button:hover {
    border-color: var(--accent);
    background: rgba(0, 245, 255, 0.1);
    color: var(--accent);
}

.canvas-controls-hud button.active {
    color: var(--accent);
    border-color: rgba(0, 245, 255, 0.4);
    background: rgba(0, 245, 255, 0.15);
}

/* Bracket Nodes */
.bracket-node {
    position: absolute;
    width: 200px;
    background: rgba(11, 16, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: visible;
    pointer-events: auto;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    z-index: 10;
}

.bracket-node:hover {
    border-color: rgba(0, 245, 255, 0.35);
    box-shadow: 0 4px 16px rgba(0, 245, 255, 0.1);
}

.bracket-node.dragging {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 245, 255, 0.25);
    opacity: 0.9;
    z-index: 1000 !important;
}

.node-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 10px;
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    cursor: move;
}

.node-header span {
    display: none;
}

.node-header>div,
.node-header>button.node-delete-btn {
    margin-left: auto !important;
}

.node-delete-btn {
    background: none !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.3) !important;
    font-size: 10px !important;
    cursor: pointer;
    padding: 2px !important;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-delete-btn:hover {
    color: var(--danger) !important;
    transform: scale(1.15);
}

.node-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.node-team-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    font-size: 11px;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
}

.node-team-row.winner {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.node-team-row.winner .node-team-name {
    font-weight: 700;
    color: #fff;
}

.node-team-row.winner .node-team-score {
    color: var(--success);
    font-weight: 800;
    text-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.node-team-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.node-team-score {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-dim);
}

.node-seed-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    width: 100%;
}

.node-seed-input:focus {
    border-color: var(--accent);
    outline: none;
}

/* Ports & Pins */
.node-port {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0b101e;
    cursor: crosshair;
    z-index: 100;
    transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
    pointer-events: auto;
}

.node-port:hover {
    transform: scale(1.3);
}

.node-port.port-in {
    left: -5px;
    border: 2.5px solid var(--text-dim);
}

.node-port.port-in:hover,
.node-port.port-in.connected {
    border-color: #fff;
    background-color: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.node-port.port-out {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border: 2.5px solid var(--accent);
}

.node-port.port-out:hover {
    background-color: #fff;
    box-shadow: 0 0 8px var(--accent);
}

.node-port.port-out.winner-port {
    /* Centered automatically within its row */
}

.node-port.port-out.loser-port {
    border-color: #ff9f43;
}

.node-port.port-out.loser-port:hover {
    box-shadow: 0 0 8px #ff9f43;
}

/* Connection delete button styles */
.connection-delete-btn circle {
    transition: fill 0.15s, stroke 0.15s, filter 0.15s;
}

.connection-delete-btn:hover circle {
    fill: #ff2a2a !important;
    stroke: #ffffff !important;
    filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.8));
}

/* Winner info label */
.node-winner-row {
    font-size: 9px;
    color: var(--text-dim);
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.node-winner-name {
    color: var(--accent);
    font-weight: 700;
}

/* SVG paths styles */
.bracket-svg-path {
    fill: none;
    stroke: rgba(0, 245, 255, 0.25);
    stroke-width: 2.5px;
    cursor: pointer;
    pointer-events: auto;
    transition: stroke 0.15s, stroke-width 0.15s;
}

.bracket-svg-path:hover {
    stroke: var(--accent);
    stroke-width: 3.5px;
    filter: drop-shadow(0 0 4px rgba(0, 245, 255, 0.5));
}

/* Region/Zone Nodes styles */
.bracket-node.region-node {
    width: 300px;
    height: 200px;
    background: rgba(var(--region-color-rgb, 0, 245, 255), 0.13) !important;
    border: 1px dashed rgba(var(--region-color-rgb, 0, 245, 255), 0.15) !important;
    box-shadow: none !important;
    z-index: 1 !important;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}

.bracket-node.region-node:hover {
    border-color: rgba(var(--region-color-rgb, 0, 245, 255), 0.35) !important;
    background: rgba(var(--region-color-rgb, 0, 245, 255), 0.06) !important;
}

.bracket-node.region-node .node-header {
    background: rgba(0, 0, 0, 0.3) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 4px 10px !important;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    opacity: 0.8;
}

.bracket-node.region-node:hover .node-header {
    opacity: 1;
}

.bracket-node.region-node .node-body {
    padding: 12px !important;
    height: calc(100% - 26px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
}

.bracket-node.region-node .node-label-input {
    color: var(--region-color, #00f5ff) !important;
    text-shadow: 0 0 8px rgba(var(--region-color-rgb, 0, 245, 255), 0.35) !important;
}

/* Palette button */
.node-palette-btn {
    background: none !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.3) !important;
    font-size: 10px !important;
    cursor: pointer;
    padding: 2px !important;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-palette-btn:hover {
    color: var(--region-color, var(--accent)) !important;
    transform: scale(1.15);
}

/* Resize Handle */
.region-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 60%, transparent 70%, rgba(255, 255, 255, 0.2) 80%);
    border-bottom-right-radius: 6px;
    z-index: 100;
}

.region-node:hover .region-resize-handle {
    background: linear-gradient(135deg, transparent 40%, var(--region-color, var(--accent)) 50%, var(--region-color, var(--accent)) 60%, transparent 70%, var(--region-color, var(--accent)) 80%);
}

.node-label-input {
    background: transparent !important;
    border: none !important;
    color: var(--region-color, var(--accent));
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 0 10px rgba(var(--region-color-rgb, 0, 245, 255), 0.4);
    width: 100%;
}

.node-label-input:focus {
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(var(--region-color-rgb, 0, 245, 255), 0.4) !important;
    border-radius: 4px;
    outline: none;
}

#hist-sort-order {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 32px 10px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cdd6f4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

#hist-sort-order:hover {
    border-color: rgba(0, 245, 255, 0.45);
    box-shadow: 0 0 8px rgba(0, 245, 255, 0.1);
}

#hist-sort-order:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.15);
}

#history-list-view .controls {
    padding: 10px 16px;
    margin-bottom: 16px;
    gap: 12px;
    border-radius: 8px;
}

#history-list-view .search-box input {
    padding: 8px 12px;
    font-size: 13px;
}

#hist-sort-order {
    padding: 8px 28px 8px 12px;
    font-size: 13px;
    border-radius: 6px;
}

.modal-match-select-item {
    transition: all 0.2s ease;
}

.modal-match-select-item:hover {
    background: rgba(0, 245, 255, 0.05) !important;
    border-color: rgba(0, 245, 255, 0.25) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 245, 255, 0.05);
}

/* Collapsible HUD Animations */
.canvas-controls-hud.collapsed {
    padding: 6px !important;
}

.canvas-controls-hud.collapsed #hud-content-wrapper {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: scaleX(0);
}

.canvas-controls-hud.collapsed #btn-hud-toggle {
    transform: rotate(180deg);
}

#hud-content-wrapper {
    max-width: 1000px;
    opacity: 1;
    overflow: hidden;
}

/* ── CARD VIEW EXTRAS ── */

/* Dynamic card accent via CSS var */
.history-card::before {
    background: var(--card-accent, var(--accent));
}

/* WIN badge on cards */
.hist-win-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    background: rgba(0, 245, 255, 0.12);
    color: var(--accent);
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 0 9px 0 6px;
    font-size: 8px;
    font-weight: 900;
    padding: 3px 7px;
    letter-spacing: 1px;
    font-family: 'Outfit', sans-serif;
}

/* Mini avatar row in card view */
.history-mini-avatar-row {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-bottom: 4px;
}

/* Card-specific action buttons */
.btn-history-detail {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-history-detail:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-history-sync {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-history-sync:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* ── CARD VIEW — PREMIUM REDESIGN v2 ── */
.history-card-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.history-card {
    background: rgba(10, 13, 25, 0.7);
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 14px;
    padding: 0 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 120px;
    height: auto;
    width: 100%;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.history-card::before {
    display: none;
}

.history-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 245, 255, 0.2);
    box-shadow: 0 14px 40px rgba(0, 245, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ── LEFT PANEL ── */
.hist-card-left {
    position: relative;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 1;
    gap: 8px;
}

.hist-card-left-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(10px) brightness(0.28) saturate(1.4);
    opacity: 0.6;
    z-index: -2;
    transform: scale(1.15);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.history-card:hover .hist-card-left-bg {
    transform: scale(1.22);
    opacity: 0.7;
}

.hist-card-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(7, 10, 22, 0.96) 0%, rgba(7, 10, 22, 0.82) 100%);
    z-index: -1;
}

/* Top section: bracket tag */
.hist-card-bracket-tag {
    display: flex;
    align-items: flex-start;
}

.hist-card-map {
    font-style: normal !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    color: rgba(0, 245, 255, 0.55) !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}


.hist-card-outcome {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 900 !important;
    font-size: 22px !important;
    letter-spacing: 0.5px;
    line-height: 1;
}

.hist-card-outcome.outcome-win {
    color: #a6e3a1;
    text-shadow: 0 0 16px rgba(166, 227, 161, 0.35);
}

.hist-card-outcome.outcome-loss {
    color: #f38ba8;
    text-shadow: 0 0 16px rgba(243, 139, 168, 0.35);
}

.hist-card-outcome.outcome-incomplete {
    color: rgba(255, 255, 255, 0.3);
    text-shadow: none;
}

/* Bottom: time + synced tags + actions */
.hist-card-time {
    font-size: 10px !important;
    color: rgba(255, 255, 255, 0.3) !important;
    display: flex !important;
    gap: 6px !important;
    align-items: center;
}

.hist-card-synced-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    width: 100%;
}

.synced-tab-tag {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.22);
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
    color: #10b981;
    font-size: 9px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
}

.hist-card-actions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    width: 100%;
}

.hist-action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.55);
    padding: 6px 4px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.18s ease;
    outline: none;
    white-space: nowrap;
}

.hist-action-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: translateY(-1px);
}

.hist-action-btn.btn-load {
    background: linear-gradient(135deg, #00f5ff 0%, #0096c7 100%);
    border: none;
    color: #050d18;
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(0, 245, 255, 0.22);
}

.hist-action-btn.btn-load:hover {
    box-shadow: 0 4px 16px rgba(0, 245, 255, 0.38);
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.hist-action-btn.btn-delete {
    flex: 0 0 30px;
    background: rgba(243, 139, 168, 0.06);
    border-color: rgba(243, 139, 168, 0.14);
    color: rgba(243, 139, 168, 0.7);
}

.hist-action-btn.btn-delete:hover {
    background: rgba(243, 139, 168, 0.16);
    border-color: rgba(243, 139, 168, 0.32);
    color: #f38ba8;
}

/* ── RIGHT PANEL: Header score + Roster rounds ── */
.hist-card-right {
    display: flex;
    flex-direction: column;
    background: rgba(6, 8, 18, 0.3);
    height: 100%;
    overflow: hidden;
}

/* Header: Team A score | VS | Team B score */
.hist-card-right-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    gap: 10px;
    flex-shrink: 0;
}

.hist-right-team {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.hist-right-team.team-a-side {
    justify-content: flex-end;
    text-align: right;
}

.hist-right-team.team-b-side {
    justify-content: flex-start;
    text-align: left;
}

.hist-right-team-name {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.hist-right-team-score {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 900;
    flex-shrink: 0;
    line-height: 1;
}

.hist-right-team-score.score-win {
    color: #00f5ff;
    text-shadow: 0 0 16px rgba(0, 245, 255, 0.4);
}

.hist-right-team-score.score-lose {
    color: rgba(255, 255, 255, 0.35);
}

.hist-right-team-score.score-draw {
    color: rgba(255, 255, 255, 0.5);
}

.hist-right-vs {
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 2px;
    flex-shrink: 0;
}

/* Rounds container */
.hist-card-right-rounds {
    flex: 1;
    padding: 10px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    overflow: hidden;
}


.hist-roster-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.012);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 5px 10px;
    gap: 10px;
    transition: all 0.15s ease;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
}

.hist-roster-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

.hist-roster-row.empty {
    opacity: 0.2;
    background: transparent;
    border-style: dashed;
}

.hist-roster-side {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.hist-roster-side.left {
    justify-content: flex-start;
}

.hist-roster-side.right {
    justify-content: flex-end;
}

.hist-roster-name {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    min-width: 42px;
}

.hist-roster-side.right .hist-roster-name {
    text-align: right;
}

.hist-roster-avatars {
    display: flex;
    gap: 2px;
}

.hist-roster-avatars .history-mini-avatar {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.hist-roster-score {
    font-size: 11px;
    min-width: 24px;
}

.hist-roster-side.left .hist-roster-score {
    text-align: right;
}

.hist-roster-side.right .hist-roster-score {
    text-align: left;
}

.hist-roster-vs {
    font-size: 8px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
    padding: 0 4px;
    text-align: center;
    min-width: 18px;
    flex-shrink: 0;
}

/* ── Middle panel (legacy) ── */
.hist-card-middle {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid rgba(255, 255, 255, 0.055);
    background: rgba(8, 12, 24, 0.2);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .history-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .hist-card-left {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    }

    .hist-card-middle {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    }
}

/* Prevent main-content from scrolling as a whole */
.main-content {
    height: 100vh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

#history-list-view {
    flex: 1;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

#char-editor-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hist-toolbar {
    flex-shrink: 0;
}

.history-grid {
    flex: 1;
    overflow-y: auto !important;
    padding-bottom: 60px !important;
    padding-right: 4px;
}