/* Dungeon Tracker player page: summary, scan banner, class cards, filters, the dungeon × class grid and legend */
.player-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.player-summary__name {
    margin-top: 0.25rem;
    font-size: var(--text-2xl);
    line-height: var(--text-2xl-lh);
    font-weight: 600;
    letter-spacing: -0.025em;

    @media (min-width: 40rem) {
        font-size: var(--text-3xl);
        line-height: var(--text-3xl-lh);
    }
}

.player-summary__scanned {
    margin-top: 0.25rem;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
}

.player-summary__total {
    text-align: right;
}

.player-summary__score {
    font-size: var(--text-3xl);
    line-height: var(--text-3xl-lh);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.player-summary__possible {
    color: var(--color-muted);
}

/* Thin rounded progress bar; the fill's width is set inline */
.progress-bar {
    height: 0.375rem;
    overflow: hidden;
    border-radius: 9999px;
    background: var(--color-line-soft);
}

.progress-bar--thin {
    height: 0.25rem;
}

.progress-bar__fill {
    height: 100%;
    border-radius: 9999px;
    background: var(--color-green);
    transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar__fill--gold {
    background: var(--color-gold);
}

.scan-status {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid color-mix(in oklab, var(--color-gold) 40%, transparent);
    border-radius: var(--radius-card);
    background: color-mix(in oklab, var(--color-gold) 5%, transparent);
}

.scan-status__message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
}

.scan-status__spinner {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--color-gold);
    animation: spin 1s linear infinite;
}

.scan-status__detail {
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.scan-status .progress-bar {
    margin-top: 0.625rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.class-cards {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;

    @media (min-width: 40rem) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.class-card {
    padding: 1rem;
    border: 1px solid var(--color-line-soft);
    border-radius: var(--radius-card);
    background: var(--color-surface);
    transition: opacity var(--transition);

    .progress-bar {
        margin-top: 0.75rem;
    }
}

.class-card--dimmed {
    opacity: 0.4;
}

.class-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.class-card__name {
    font-weight: 600;
}

.class-card__count {
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;

    strong {
        color: var(--color-text);
        font-weight: inherit;
    }
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Radio buttons styled as a segmented control; the inputs themselves are visually hidden */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 0.125rem;
    border: 1px solid var(--color-line-soft);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}

.segmented__option {
    padding: 0.375rem 0.75rem;
    border-radius: 3px;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition);

    &:hover {
        color: var(--color-text);
    }

    &:has(:checked) {
        background: var(--color-surface-raised);
        color: var(--color-gold);
    }

    &:has(:focus-visible) {
        outline: 2px solid var(--color-gold);
    }
}

.checkbox-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
    cursor: pointer;
    transition: color var(--transition);

    &:hover {
        color: var(--color-text);
    }

    input {
        width: 1rem;
        height: 1rem;
        accent-color: var(--color-gold);
    }
}

/*
 * Dungeon rows × class columns. On narrow screens each dungeon's name spans the full width above its class cells;
 * from 40rem the name becomes the first column.
 */
.progress-grid {
    --class-count: 3;

    margin-top: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--color-line-soft);
    border-radius: var(--radius-card);
}

.progress-grid--single {
    --class-count: 1;
}

.progress-grid__head,
.progress-grid__row {
    grid-template-columns: repeat(var(--class-count), minmax(0, 1fr));

    @media (min-width: 40rem) {
        grid-template-columns: minmax(0, 1.3fr) repeat(var(--class-count), minmax(0, 1fr));
    }
}

.progress-grid__head {
    display: none;
    border-bottom: 1px solid var(--color-line-soft);
    background: var(--color-surface-subtle);
    color: var(--color-muted);
    font-size: var(--text-xs);
    line-height: var(--text-xs-lh);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;

    @media (min-width: 40rem) {
        display: grid;
    }

    > div {
        padding: 0.625rem 0.75rem;
    }

    > div:first-child {
        padding-inline: 1rem;
    }
}

.progress-grid__row {
    display: grid;
    gap: 1px;
    border-bottom: 1px solid var(--color-line-soft);
    background: var(--color-line-soft);

    &:last-child {
        border-bottom: 0;
    }
}

.progress-grid__dungeon {
    position: relative;
    display: flex;
    grid-column: 1 / -1;
    min-height: 3.5rem;
    align-items: center;
    overflow: hidden;
    padding: 0.75rem 1rem;
    background: var(--color-surface);

    @media (min-width: 40rem) {
        grid-column: auto;
    }
}

.progress-grid__art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.25;
}

.progress-grid__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right in oklab,
        var(--color-surface),
        color-mix(in oklab, var(--color-surface) 70%, transparent),
        transparent
    );
}

.progress-grid__name {
    position: relative;
    font-weight: 600;
}

.progress-grid__empty {
    padding: 2.5rem 1rem;
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
    text-align: center;
}

/* One dungeon × class square; links to that combination's run list */
.grid-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-surface-subtle);
    transition: filter var(--transition);

    &:hover {
        filter: brightness(1.25);
    }

    &:focus-visible {
        position: relative;
        outline-offset: 0;
    }
}

.grid-cell--solo-flawless {
    background: var(--color-green-dark);
}

.grid-cell--explorer {
    background: var(--color-amber-dark);
    box-shadow: inset 0 0 0 1px var(--color-gold);
}

.grid-cell--partial {
    background: color-mix(in oklab, var(--color-amber-dark) 60%, transparent);
}

.grid-cell--cleared {
    background: var(--color-surface-raised);
}

/* Class name, only shown when the column headers are hidden on narrow screens */
.grid-cell__class {
    color: var(--color-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;

    @media (min-width: 40rem) {
        display: none;
    }
}

.grid-cell__status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-green);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
    font-weight: 600;

    .grid-cell--explorer & {
        color: var(--color-gold);
    }

    svg {
        width: 0.875rem;
        height: 0.875rem;
        flex-shrink: 0;
    }
}

.grid-cell__date {
    color: var(--color-muted-strong);
    font-size: var(--text-xs);
    line-height: var(--text-xs-lh);
}

.grid-cell__partial {
    color: var(--color-amber);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
    font-weight: 600;
}

.grid-cell__meta {
    color: var(--color-muted);
    font-size: var(--text-xs);
    line-height: var(--text-xs-lh);
}

.grid-cell__clears {
    color: var(--color-muted-strong);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
}

.grid-cell__none {
    color: var(--color-line);
    font-size: var(--text-sm);
    line-height: var(--text-sm-lh);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1rem;
    color: var(--color-muted);
    font-size: var(--text-xs);
    line-height: var(--text-xs-lh);
}

.legend__item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.legend__swatch {
    width: 0.625rem;
    height: 0.625rem;
    border: 1px solid var(--color-line);
    border-radius: 0.25rem;
    background: var(--color-surface-raised);
}

.legend__swatch--solo-flawless {
    border-color: color-mix(in oklab, var(--color-green) 50%, transparent);
    background: var(--color-green-dark);
}

.legend__swatch--explorer {
    border-color: color-mix(in oklab, var(--color-gold) 60%, transparent);
    background: var(--color-amber-dark);
}

.legend__swatch--partial {
    border-color: color-mix(in oklab, var(--color-amber) 40%, transparent);
    background: color-mix(in oklab, var(--color-amber-dark) 60%, transparent);
}
