:root {
    --font-primary: 'Roboto', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    --bg-color: #f4f6f8;
    --text-color: #1a202c;
    --border-color: #e2e8f0;
    --highlight-bg: #fff;
    --header-bg: #2d3748;

    /* Navy Theme Heatmap Colors */
    --heat-low: #ffffff;
    --heat-mid: #90cdf4;
    /* Light Blue */
    --heat-high: #2c5282;
    /* Navy Blue */
    --heat-max: #1a365d;
    /* Dark Navy */
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1400px;
    /* Wider for more columns/logos */
    margin: 0 auto;
    background: white;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 8px;
}

header h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: #2d3748;
}

.subtitle {
    color: #718096;
    font-size: 15px;
    margin-bottom: 24px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #2c5282;
}

.tab-btn.active {
    color: #2c5282;
    border-bottom-color: #2c5282;
}


/* Sim Controls Headers */
.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.loading-indicator {
    display: none;
    font-size: 13px;
    color: #2c5282;
    font-weight: 600;
    align-items: center;
    gap: 8px;
}

.loading-indicator.visible {
    display: flex;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    /* Fixed breaks */
    border-spacing: 0;
    font-size: 13px;
    border-top: 2px solid #2d3748;
}

thead th {
    text-transform: uppercase;
    font-weight: 700;
    padding: 12px 10px;
    text-align: center;
    border-bottom: 2px solid #cbd5e0;
    /* Thicker for header */
    background-color: #fff;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: pointer;
    user-select: none;
}

/* Remove Link Styling from Headers */
thead th a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

thead th:hover {
    background-color: #f7fafc;
}

thead th.col-playoff {
    min-width: 120px;
}

thead th.col-division {
    min-width: 120px;
}

thead th.col-seed1 {
    min-width: 120px;
}

thead th.col-sb {
    min-width: 120px;
}

tbody td {
    padding: 6px 10px;
    /* Condensed */
    text-align: right;
    font-family: var(--font-mono);
    color: #2d3748;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0;
}

tbody tr:nth-of-type(even) {
    background-color: #f8fafc;
    /* Visible subtly */
}

tbody tr:hover {
    background-color: #edf2f7 !important;
}

/* Team Cell */
tbody td.team-cell {
    text-align: left;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
    /* Ensure border exists */
}

/* Inline Tabs as Segmented Control */
.table-tabs {
    display: inline-flex;
    background: #edf2f7;
    padding: 4px;
    border-radius: 8px;
    gap: 0;
}

.table-tab-btn {
    text-decoration: none;
    color: #718096;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.table-tab-btn:hover {
    color: #4a5568;
    background-color: rgba(255, 255, 255, 0.5);
}

.table-tab-btn.active {
    color: #2d3748;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}


/* Group Divider Row - Elegant Header Version */
.group-divider td {
    background-color: #f8fafc !important;
    color: #4a5568 !important;
    padding: 12px 14px !important;
    font-weight: 800 !important;
    font-size: 12px !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    border-top: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    text-align: left !important;
}

.group-divider .conf-logo-inline {
    height: 16px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
    margin-top: -3px;
}

/* Fix Team Cell border conflict */


.team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.conf-badge-inline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Left align for consistency */
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #718096;
    text-transform: uppercase;
    white-space: nowrap;
    width: 90px;
    margin: 0 auto;
}

.conf-icon-sm {
    height: 14px;
    width: 20px;
    /* Fixed width for alignment */
    object-fit: contain;
    opacity: 0.9;
    flex-shrink: 0;
}

tbody td.record-cell {
    text-align: center;
    color: #718096;
    font-family: var(--font-primary);
    font-size: 12px;
}

/* Heatmap base */
.heatmap-cell {
    color: #000;
    font-weight: 500;
    transition: background-color 0.8s ease, color 0.8s ease;
}

/* Sim Controls */
.sim-controls {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.cb-cell {
    text-align: center;
    vertical-align: middle;
    padding: 0;
}

.cb-link {
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px 2px;
    height: 100%;
}

/* Custom Checkbox (Compact Style) */
.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e0;
    border-radius: 3px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.custom-checkbox::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 7px;
    width: 6px;
    height: 12px;
    border: solid transparent;
    border-width: 0 3px 3px 0;
    /* Thick checkmark */
    transform: rotate(45deg) scale(0);
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Checked States - Show Checkmark */
.custom-checkbox.checked::after {
    transform: rotate(45deg) scale(1.2);
}

/* Specific Colors for Checkmarks */
/* Specific Colors for Checkmarks - Monochrome Update */
.cb-link.win .custom-checkbox.checked,
.cb-link.loss .custom-checkbox.checked,
.cb-link.tie .custom-checkbox.checked,
.cb-link.win_out .custom-checkbox.checked {
    border-color: #4a5568;
    background-color: #fff;
}

.cb-link.win .custom-checkbox.checked::after,
.cb-link.loss .custom-checkbox.checked::after,
.cb-link.tie .custom-checkbox.checked::after,
.cb-link.win_out .custom-checkbox.checked::after {
    border-color: #1a202c;
    /* Black checkmark */
}

/* Hover Effects */
.cb-link:hover .custom-checkbox {
    border-color: #718096;
    box-shadow: 0 0 0 3px rgba(160, 174, 192, 0.2);
}

/* Action Buttons (Condensed) */
.actions-cell {
    text-align: center;
    padding: 6px 4px;
    white-space: nowrap;
}

.action-btn-group {
    display: inline-flex;
    background: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    overflow: hidden;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    color: #718096;
    border-right: 1px solid #cbd5e0;
    transition: all 0.1s;
}

.action-btn:last-child {
    border-right: none;
}

.action-btn:hover {
    background-color: #edf2f7;
    color: #4a5568;
}

.action-btn.active.win {
    background-color: #c6f6d5;
    color: #22543d;
}

.action-btn.active.loss {
    background-color: #fed7d7;
    color: #742a2a;
}

.action-btn.active.tie {
    background-color: #e2e8f0;
    color: #2d3748;
}

/* Legend */
.legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 10px;
    font-size: 11px;
    color: #718096;
}

.gradient-bar {
    width: 120px;
    height: 12px;
    /* White -> Light Blue -> Navy */
    background: linear-gradient(to right, #ffffff, #90cdf4, #2c5282, #1a365d);
    margin: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 2px;
}

.footer-note {
    margin-top: 20px;
    font-size: 12px;
    color: #a0aec0;
    font-style: italic;
}

/* Ticker and Key Games styles removed */

/* --- Still In The Hunt --- */
.alive-section {
    margin-top: 40px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.alive-title {
    font-size: 18px;
    font-weight: 800;
    color: #2d3748;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alive-columns {
    display: flex;
    gap: 40px;
}

.alive-col {
    flex: 1;
}

.alive-header {
    font-size: 14px;
    font-weight: 700;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.alive-header.afc {
    color: #c53030;
    border-bottom: 2px solid #fed7d7;
}

.alive-header.nfc {
    color: #2c5282;
    border-bottom: 2px solid #bee3f8;
}

.alive-team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alive-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
}

.alive-team-row.afc {
    background: #fff5f5;
    border: 1px solid #fed7d7;
}

.alive-team-row.nfc {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
}

.alive-team-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alive-status {
    text-align: right;
}

.alive-status-text {
    font-size: 12px;
    font-weight: 700;
}

.alive-status-text.afc {
    color: #c53030;
}

.alive-status-text.nfc {
    color: #2b6cb0;
}

.clinch-subtext {
    font-size: 10px;
    color: #718096;
}

.empty-alive {
    color: #cbd5e0;
    font-style: italic;
    padding: 10px;
}

/* --- Legend --- */
.legend-container {
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: #718096;
    margin-top: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

/* --- Spinner Animation --- */
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Layout styles simplified */
.app-layout {
    display: block;
    margin-top: 20px;
}

.main-area {
    flex: 1;
    min-width: 0;
}

.stories-aside {
    width: 350px;
    flex-shrink: 0;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: sticky;
    top: 20px;
}

.aside-header {
    font-size: 13px;
    font-weight: 900;
    color: #475569;
    letter-spacing: 1.5px;
    margin-bottom: 20px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aside-header::after {
    content: '';
    flex: 1;
    height: 2px;
    background: #cbd5e0;
}

.stories-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.story-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.story-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.story-image-header {
    width: 100%;
    height: auto;
    /* Show full image, no cropping */
    display: block;
    /* Removes bottom spacing */
    background: #2d3748;
}

/* Stories styles removed */

/* Media query for app layout simplified */
@media (max-width: 1100px) {
    .app-layout {
        display: block;
    }
}

/* Antigravity Footer */
.antigravity-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #edf2f7;
    font-family: var(--font-primary);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.antigravity-footer:hover {
    opacity: 1;
}

.powered-by {
    color: #a0aec0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.antigravity-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.brand-name {
    color: #4a5568;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.3px;
    background: linear-gradient(90deg, #4a5568, #2d3748);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* --- Scoreboard Strip (New) --- */
/* Scoreboard styles removed */

/* Responsive Utility Classes */
.abbr-name {
    display: none;
}

.full-name {
    display: inline;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Media Queries for Responsiveness */

@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px;
        border-radius: 0;
        max-width: 100%;
    }

    header h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 13px;
        margin-bottom: 15px;
    }

    /* Table Adjustments */
    table {
        font-size: 12px;
    }

    thead th,
    tbody td {
        padding: 8px 4px;
    }

    /* Column Visibility */
    .col-confdiv,
    .col-record {
        display: none;
    }

    /* Team Name Abbreviations */
    .full-name {
        display: none;
    }

    .abbr-name {
        display: inline;
    }

    /* Heatmap Padding */
    .heatmap-cell {
        min-width: 45px;
        font-size: 11px;
    }

    .team-cell {
        padding-left: 5px !important;
    }

    .team-logo {
        width: 18px;
        height: 18px;
    }

    /* Bracket Adjustments */
    .bracket-wrapper-inter {
        gap: 10px;
        padding: 10px;
    }

    .round-col {
        min-width: 150px;
    }

    .bracket-node {
        padding: 6px;
    }

    .node-logo {
        width: 18px;
        height: 18px;
    }

    .node-team {
        font-size: 11px;
        padding: 4px;
    }

    .prob-text {
        font-size: 10px;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 18px;
    }

    /* Hide more columns on tiny screens */
    .col-seed1,
    .col-sb-app {
        display: none !important;
    }

    table {
        font-size: 11px;
    }

    .heatmap-cell {
        width: 60px !important;
        min-width: 60px !important;
        text-align: center !important;
        padding: 8px 2px !important;
    }

    .round-col {
        min-width: 120px;
    }
}

/* Interactive Bracket Improvements */
.bracket-wrapper-inter {
    display: flex;
    gap: 24px;
    padding: 24px;
    overflow-x: auto;
    background: #1a202c;
    border-radius: 12px;
    margin-top: 20px;
    scrollbar-width: thin;
    scrollbar-color: #4a5568 #1a202c;
}

.round-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 220px;
    flex-shrink: 0;
}

.round-header {
    text-align: center;
    color: #a0aec0;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.matchup-col-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: space-around;
    flex: 1;
}

.bracket-node {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.bracket-node.empty {
    border-style: dashed;
    background: transparent;
    opacity: 0.5;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 80px;
}

.node-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    color: #e2e8f0;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.node-team:hover {
    background: #4a5568;
}

.node-team.picked {
    background: #2b6cb0;
    border-color: #4299e1;
    color: white;
}

.prob-text {
    font-size: 11px;
    font-weight: 700;
    color: #cbd5e0;
}

.node-team.picked .prob-text {
    color: white;
}

.preview-btn-sm {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 5;
}

.preview-btn-sm:hover {
    background: #63b3ed;
}

/* Preview Modal */
#preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    /* Flex when active */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#preview-content {
    background: #2d3748;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    color: #fff;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #4a5568;
}

.team-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 40%;
}

.team-logo-lg {
    width: 60px;
    height: 60px;
}

.vs-col {
    font-size: 24px;
    font-weight: bold;
    color: #718096;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a202c;
    padding: 10px;
    border-radius: 8px;
}

.stat-val {
    width: 60px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    color: #a0aec0;
}

.stat-val.better {
    color: #48bb78;
    /* Green */
}

.stat-label {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-footer {
    margin-top: 20px;
    text-align: center;
}

.close-btn {
    background: #e2e8f0;
    color: #1a202c;
    border: none;
    padding: 8px 24px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #fff;
}