.hindsight-page {
    max-width: 1200px;
    padding: 18px 16px 30px;
    color: #eee;
}

.hindsight-header,
.hindsight-panel-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.hindsight-header h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

#hindsight-data-meta {
    margin-left: auto;
    color: #aaa;
    font-size: 0.72rem;
}

.hindsight-text-button {
    min-width: 36px;
    min-height: 36px;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: #bbb;
    font-size: 0.73rem;
}

.hindsight-text-button:hover {
    color: #fff;
}

.hindsight-summary {
    margin-bottom: 10px;
}

.hindsight-summary > div {
    min-height: 42px;
    padding: 6px 8px;
    font-variant-numeric: tabular-nums;
}

.hindsight-summary > div:last-child {
    border: 0;
}

.hindsight-summary .account-roster-stat-label {
    font-size: 0.55rem;
}

.hindsight-summary strong {
    font-size: 0.95rem;
}

.hindsight-summary small {
    margin-left: 5px;
    color: #999;
    font-size: 0.65rem;
}

#hindsight-total {
    color: #78dcea;
}

#hindsight-index {
    color: #f5c451;
}

.hindsight-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
    grid-template-areas: "weekly roster" "pool roster";
    align-items: start;
    gap: 16px;
}

.hindsight-panel {
    min-width: 0;
    padding: 12px;
    border: 1px solid #3d3d3d;
    border-radius: 3px;
    background: #252525;
}

.hindsight-pool-panel {
    grid-area: pool;
}

.hindsight-roster-panel h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.hindsight-panel-heading {
    justify-content: space-between;
}

.hindsight-panel h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.hindsight-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px;
    gap: 8px;
}

.hindsight-search,
.hindsight-page .form-select {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 8px 10px;
    border: 1px solid #505050;
    border-radius: 3px;
    background: #1b1b1b;
    color: #eee;
    font-size: 0.78rem;
}

.hindsight-search:focus {
    border-color: #d92bd0;
    outline: none;
}

.hindsight-filter-row,
.hindsight-position-filter,
.hindsight-mobile-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hindsight-filter-row {
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 10px 0;
    gap: 8px;
}

.hindsight-position-filter .form-check,
.hindsight-mobile-tabs .form-check {
    position: relative;
    min-height: 0;
    margin: 0;
    padding: 0;
}

.hindsight-tab-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hindsight-filter-label,
.hindsight-tab-label {
    display: block;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #aaa;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.hindsight-tab-input:checked + label {
    border-color: #59505c;
    background: #393039;
    color: #fff;
}

.hindsight-tab-input:focus-visible + label,
.hindsight-page button:focus-visible {
    outline: 2px solid #78dcea;
    outline-offset: 2px;
}

.hindsight-table-scroll {
    max-height: 650px;
    overflow: auto;
    scrollbar-color: #555 #222;
    scrollbar-width: thin;
}

.hindsight-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.hindsight-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 6px;
    background: #333;
    color: #bbb;
    font-size: 0.65rem;
    text-align: right;
}

.hindsight-table th:first-child,
.hindsight-table td:first-child {
    text-align: left;
}

.hindsight-name-column {
    width: 56%;
}

.hindsight-table th:last-child {
    width: 48px;
}

.hindsight-table td {
    padding: 6px;
    border-bottom: 1px solid #3a3a3a;
    text-align: right;
}

.hindsight-table tbody tr:hover {
    background: #303030;
}

.hindsight-identity {
    min-width: 0;
}

.hindsight-identity > strong {
    display: block;
    overflow: hidden;
    font-size: 0.77rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hindsight-player-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: #aaa;
    font-size: 0.62rem;
}

.hindsight-position {
    display: inline-flex;
    justify-content: center;
    min-width: 25px;
    padding: 1px 4px;
    border-radius: 2px;
    background: var(--position-color);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
}

.hindsight-player-points {
    color: #78dcea;
}

.hindsight-add-button,
.hindsight-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #505050;
    border-radius: 3px;
    background: #303030;
    color: #ddd;
    font-size: 0.8rem;
}

.hindsight-add-button:hover:not(:disabled) {
    border-color: #d92bd0;
    color: #ef80e6;
}

.hindsight-add-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hindsight-remove-button {
    border: 0;
    background: transparent;
    color: #aaa;
}

.hindsight-remove-button:hover {
    color: #ff9a8b;
}

.hindsight-load-more {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #505050;
    border-radius: 3px;
    background: #303030;
    color: #ddd;
    font-size: 0.75rem;
}

.hindsight-roster-panel {
    grid-area: roster;
    position: sticky;
    top: 12px;
    min-width: 0;
    max-height: calc(100dvh - 24px);
    border: 1px solid #33364d;
    border-top: 2px solid #d92bd0;
    border-radius: 3px;
    overflow: auto;
    scrollbar-width: thin;
}

.hindsight-roster-panel .account-roster-stat-label,
.hindsight-roster-panel .account-roster-stat-value,
.hindsight-roster-panel .account-roster-position-badge,
.hindsight-roster-panel .account-roster-position-count,
.hindsight-roster-panel .account-roster-columns,
.hindsight-roster-panel .account-roster-player-name,
.hindsight-roster-panel .account-roster-player-team,
.hindsight-roster-panel .account-roster-player-metric-value {
    font-family: inherit;
    letter-spacing: normal;
}

.hindsight-roster-panel .hindsight-roster-player .account-roster-player-name {
    font-size: 0.77rem;
    font-weight: 600;
}

.hindsight-roster-panel .hindsight-roster-player .account-roster-player-team {
    font-size: 0.62rem;
    font-weight: 400;
}

.hindsight-roster-panel .hindsight-roster-player .account-roster-player-metric-value {
    font-size: 0.78rem;
    font-weight: 400;
}

.hindsight-roster-panel .account-roster-columns,
.hindsight-roster-panel .account-roster-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}

.hindsight-roster-panel .hindsight-roster-player,
.hindsight-roster-panel .hindsight-roster-columns {
    grid-template-columns: minmax(0, 1fr) 35px 52px 30px;
    gap: 5px;
}

.hindsight-roster-panel .hindsight-roster-player {
    min-height: 34px;
}

.hindsight-roster-player .hindsight-remove-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
}

.hindsight-roster-panel .account-roster-position-header {
    justify-content: flex-start;
    margin: 5px 0 3px;
}

.hindsight-roster-player .account-roster-player-score-value,
.hindsight-roster-player .account-roster-player-pick-value {
    text-align: right;
}

.hindsight-unavailable-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
}

.hindsight-empty {
    padding: 25px 8px;
    color: #999;
    font-size: 0.78rem;
    text-align: center;
}

.hindsight-weekly-panel {
    grid-area: weekly;
}

.hindsight-week-chart {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0;
}

.hindsight-week-button {
    display: flex;
    flex: 1 0 42px;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #aaa;
    font-size: 0.65rem;
    font-variant-numeric: tabular-nums;
}

.hindsight-week-button strong {
    color: #ddd;
    font-size: 0.7rem;
}

.hindsight-week-selected,
.hindsight-week-button:hover {
    border-color: #555;
    background: #333;
}

.hindsight-week-track {
    display: flex;
    align-items: flex-end;
    width: 100%;
    max-width: 48px;
    height: 65px;
}

.hindsight-week-track > div {
    width: 100%;
    min-height: 3px;
    border-radius: 2px 2px 0 0;
    background: #487985;
}

.hindsight-week-selected .hindsight-week-track > div {
    background: #78dcea;
}

.hindsight-alert,
.hindsight-action-error:not(:empty) {
    margin: 10px 0;
    padding: 10px;
    font-size: 0.75rem;
}

.hindsight-action-error {
    color: #ff9a8b;
}

.hindsight-mobile-tabs {
    display: none;
    grid-area: tabs;
}

@media (max-width: 767px) {
    .hindsight-page {
        padding: 12px 8px 24px;
    }

    .hindsight-header {
        gap: 6px;
    }

    .hindsight-header h1 {
        font-size: 1rem;
    }

    #hindsight-data-meta {
        font-size: 0.62rem;
    }

    .hindsight-summary > div {
        padding: 6px 8px;
    }

    .hindsight-summary strong {
        font-size: 1rem;
    }

    .hindsight-summary small {
        margin-left: 3px;
        font-size: 0.58rem;
    }

    .hindsight-mobile-tabs {
        display: flex;
        margin: 0;
        padding: 3px;
        border: 1px solid #444;
        border-radius: 3px;
        background: #252525;
    }

    .hindsight-mobile-tabs .form-check {
        flex: 1;
    }

    .hindsight-tab-label {
        padding: 12px 6px;
        text-align: center;
    }

    .hindsight-workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "weekly" "tabs" "roster" "pool";
        gap: 12px;
    }

    .hindsight-panel {
        padding: 10px;
    }

    .hindsight-roster-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .hindsight-view-players #hindsight-roster-content,
    .hindsight-view-players .hindsight-roster-panel .hindsight-panel-heading,
    .hindsight-view-roster .hindsight-pool-panel {
        display: none;
    }

    .hindsight-view-players .hindsight-roster-panel {
        position: sticky;
        top: 0;
        z-index: 5;
    }

    .hindsight-view-players .hindsight-summary {
        margin-bottom: 0;
    }

    .hindsight-table-scroll {
        max-height: 65dvh;
    }

    .hindsight-name-column {
        width: 51%;
    }

    .hindsight-table td,
    .hindsight-table th {
        padding: 6px 4px;
    }

    .hindsight-add-button,
    .hindsight-remove-button,
    .hindsight-text-button {
        min-width: 44px;
        height: 44px;
    }

    .hindsight-roster-panel .hindsight-roster-player {
        grid-template-columns: minmax(0, 1fr) 35px 52px 44px;
    }

    .hindsight-roster-panel .hindsight-roster-columns {
        grid-template-columns: minmax(0, 1fr) 35px 52px 44px;
    }

    .hindsight-roster-player .hindsight-remove-button {
        width: 44px;
        height: 44px;
    }

    .hindsight-search,
    .hindsight-page .form-select {
        height: 44px;
    }

    .hindsight-filter-label {
        min-height: 44px;
        padding: 12px 9px;
    }

    .hindsight-week-button {
        flex-basis: 36px;
        padding: 7px 2px;
    }
}
