*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
a { text-decoration: none; }
[hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --bg: #0f0f13;
    --surface: #1a1a23;
    --surface-2: #22222e;
    --border: #2e2e3e;
    --accent: #f5a623;
    --accent-dim: rgba(245,166,35,.15);
    --text: #e8e8f0;
    --text-muted: #8888a8;
    --red: #e05555;
    --radius: 12px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

:root:has(dialog:modal) body {
    overflow: hidden;
}

header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
}



header a {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: .03em;
    transition: opacity .15s;
}

header a:hover {
    opacity: .75;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #B897D8;
    font-family: 'Pixelify Sans', monospace;
    font-size: 1.1rem;
    letter-spacing: 0;
}


nav {
    display: flex;
    gap: 1.5rem;
}

.mobile-nav {
    display: none;
}



nav a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color .15s;
}

nav a:hover,
nav a.active {
    color: var(--text);
}

.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #000;
    font-size: .65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    padding: 0 .3rem;
    margin-left: .3rem;
}


main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
}

.upload-info-block__body a:not([class]),
.notice a:not([class]),
.empty a:not([class]) {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s;
}

.upload-info-block__body a:not([class]):hover,
.upload-info-block__body a:not([class]):focus-visible,
.notice a:not([class]):hover,
.notice a:not([class]):focus-visible,
.empty a:not([class]):hover,
.empty a:not([class]):focus-visible {
    color: var(--text);
}

/* Notices */
.notice {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    line-height: 1.5;
    border: 1px solid;
}

.notice--warning {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text);
}

.notice--warning svg {
    flex-shrink: 0;
    margin-top: .15rem;
    color: var(--accent);
}

.notice--info {
    background: color-mix(in srgb, #6b9fff 10%, transparent);
    border-color: color-mix(in srgb, #6b9fff 30%, transparent);
    color: var(--text);
}

.notice--info svg {
    flex-shrink: 0;
    margin-top: .15rem;
    color: #6b9fff;
}

.notice--event {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: .5rem;
    row-gap: .5rem;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text);
}

.notice--event svg {
    flex-shrink: 0;
    color: var(--accent);
}

.notice__title {
    font-weight: 700;
}

.notice__body {
    display: block;
}

.notice--event .notice__body {
    grid-column: 1 / -1;
    color: var(--text-muted);
}

.notice--event a {
    color: var(--accent);
    font-weight: 600;
}

.notice a {
    color: inherit;
    text-decoration: underline;
}

/* History */
.page-shell,
.page-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.onboarding-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.5rem;
    align-items: center;
    background: radial-gradient(circle at top left, rgba(245, 166, 35, .14), transparent 38%), var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}


.onboarding-panel__content {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}


.onboarding-panel__eyebrow {
    color: #7dd3a8;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.onboarding-panel h1 {
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    line-height: 1.1;
}

.onboarding-panel p:not(.onboarding-panel__eyebrow) {
    color: var(--text-muted);
    max-width: 680px;
}

.onboarding-checklist {
    display: grid;
    gap: .5rem;
    list-style: none;
    margin-bottom: 1rem;
}


.onboarding-checklist li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    color: var(--text);
    font-size: .92rem;
}


.onboarding-checklist svg {
    flex-shrink: 0;
    margin-top: .22rem;
    color: #7dd3a8;
}

.onboarding-steps {
    display: grid;
    align-items: start;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    list-style: none;
    margin-top: .25rem;
    position: relative;
}


.onboarding-steps::before {
    content: "";
    position: absolute;
    top: calc(.55rem - 1px);
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: var(--border);
}

.onboarding-steps__item {
    display: grid;
    grid-template-rows: 1.1rem auto;
    justify-items: center;
    align-items: start;
    gap: .45rem;
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.2;
    position: relative;
    text-align: center;
}


.onboarding-steps__item::before {
    content: "";
    align-self: center;
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    position: relative;
    z-index: 1;
}

.onboarding-steps__item--done {
    color: #7dd3a8;
}

.onboarding-steps__item--done::before {
    background: #7dd3a8;
    border-color: #7dd3a8;
}

.onboarding-steps__item--active {
    color: var(--text);
}

.onboarding-steps__item--active::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(245, 166, 35, .16);
}

.onboarding-steps__item--active a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.8rem;
    padding: .2rem .35rem;
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: .18em;
}


.onboarding-steps__item--active:focus-within {
    color: var(--accent);
}

.onboarding-example {
    display: flex;
    justify-content: center;
}


/* Raw screenshot mock card */
.raw-screenshot {
    width: 248px;
    height: 410px;
    border-radius: 28px;
    background: #000;
    padding: 6px;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    position: relative;
    flex: none;
}


.raw-screenshot--compact {
    width: 220px;
    height: 364px;
}

.raw-screenshot__label {
    position: absolute;
    top: -26px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Menlo', 'Monaco', monospace;
}

.raw-screenshot__inner {
    width: 100%;
    height: 100%;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
}


.raw-screenshot__inner--valor {
    background: radial-gradient(120% 80% at 50% 0%, #f4b8c8 0%, #f4d3d8 35%, #e8c8d2 70%, #d9b8c4 100%);
}

.raw-screenshot__inner--mystic {
    background: radial-gradient(120% 80% at 50% 0%, #b8c8f4 0%, #c8d3f8 35%, #b8c4e8 70%, #98b4d9 100%);
}

.raw-screenshot__inner--instinct {
    background: radial-gradient(120% 80% at 50% 0%, #f3e8c8 0%, #f0dfb8 35%, #e8d3a8 70%, #d8c398 100%);
}

.raw-screenshot__inner--harmony {
    background: radial-gradient(120% 80% at 50% 0%, #b9e6cc 0%, #ccebd8 35%, #acd8c4 70%, #8fc3ac 100%);
}

.raw-screenshot__status-bar {
    padding: 10px 16px 6px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: rgba(40,20,40,0.7);
}


.raw-screenshot__signal {
    display: flex;
    gap: 4px;
    align-items: center;
}


.raw-screenshot__signal span:nth-child(1) { width: 14px; height: 8px; border-radius: 2px; background: rgba(40,20,40,0.4); }
.raw-screenshot__signal span:nth-child(2) { width: 14px; height: 8px; border-radius: 2px; background: rgba(40,20,40,0.5); }
.raw-screenshot__signal span:nth-child(3) { width: 18px; height: 8px; border-radius: 2px; background: rgba(40,20,40,0.3); }

.raw-screenshot__tabs {
    display: flex;
    justify-content: space-around;
    padding: 4px 12px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(40,20,40,0.55);
    text-transform: uppercase;
}


.raw-screenshot__avatar {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}


.raw-screenshot__level {
    position: absolute;
    left: 16px;
    top: 168px;
    color: rgba(40,20,40,0.7);
}

.raw-screenshot__level-num {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.raw-screenshot__level-label {
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 700;
}

.raw-screenshot__trainer-name {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: rgba(20, 10, 20, 0.7);
    margin-top: 6px;
    letter-spacing: 0.3px;
}

.raw-screenshot__stats {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(4px);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 10px;
    color: rgba(40,20,40,0.85);
}


.raw-screenshot__stat {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}


.raw-screenshot__stat span:first-child { opacity: 0.7; }

.upload-info-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
}

.upload-info-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 100%;
}

.upload-info-block__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.upload-info-block__body {
    font-size: .875rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.upload-info-tip {
    color: var(--accent);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.45;
    margin: 0;
}

.drop-zone__hint {
    font-size: .8rem;
    color: var(--text-muted);
}

.analysis-progress {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .875rem;
}

.analysis-progress__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.analysis-progress__title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .25rem;
}

.analysis-progress__summary,
.analysis-progress__counts {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.4;
    margin: 0;
}

.analysis-progress__counts {
    flex-shrink: 0;
    text-align: right;
}

.analysis-progress__track {
    height: .5rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.analysis-progress__bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #50c878);
    transition: width .25s ease;
}

.analysis-stream {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    list-style: none;
    margin: 0;
    max-height: 12rem;
    overflow: auto;
    padding: 0;
}

.analysis-stream__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem .625rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    animation: fade-in-row .2s ease;
}

.analysis-stream__file {
    color: var(--text-muted);
    font-size: .85rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.analysis-stream__file:hover,
a.analysis-stream__file:focus-visible {
    color: var(--text);
}

.analysis-stream__status {
    flex-shrink: 0;
    font-size: .8rem;
    font-weight: 700;
}

.analysis-stream__item--pending .analysis-stream__status { color: var(--accent); }
.analysis-stream__item--done .analysis-stream__status { color: #50c878; }
.analysis-stream__item--review .analysis-stream__status { color: #e8a030; }
.analysis-stream__item--failed .analysis-stream__status { color: var(--red); }

@media (max-width: 700px) {
    .onboarding-panel {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .onboarding-panel__content {
        gap: .65rem;
    }

    .onboarding-panel h1 {
        font-size: 1.45rem;
        line-height: 1.15;
    }

    .onboarding-panel p:not(.onboarding-panel__eyebrow) {
        font-size: .92rem;
    }

    .onboarding-checklist {
        gap: .4rem;
        margin-bottom: .35rem;
    }

    .onboarding-checklist li {
        font-size: .86rem;
    }

    .onboarding-steps__item {
        font-size: .68rem;
    }

    .onboarding-example {
        margin-top: .25rem;
    }

    .raw-screenshot--compact {
        width: 176px;
        height: 292px;
        border-radius: 22px;
        padding: 5px;
    }

    .raw-screenshot--compact .raw-screenshot__inner {
        border-radius: 17px;
    }

    .raw-screenshot--compact .raw-screenshot__avatar {
        margin-top: 3px;
        transform: scale(.78);
        transform-origin: top center;
    }

    .raw-screenshot--compact .raw-screenshot__level {
        left: 12px;
        top: 125px;
    }

    .raw-screenshot--compact .raw-screenshot__level-num {
        font-size: 21px;
    }

    .raw-screenshot--compact .raw-screenshot__trainer-name {
        margin-top: -20px;
        font-size: 11px;
    }

    .raw-screenshot--compact .raw-screenshot__stats {
        left: 9px;
        right: 9px;
        bottom: 9px;
        gap: 4px;
        padding: 8px 9px;
        font-size: 8.5px;
    }

    .upload-next-steps {
        align-items: stretch;
        flex-direction: column;
    }

    .upload-next-steps__actions {
        justify-content: flex-start;
    }

    .analysis-progress__header,
    .analysis-stream__item {
        align-items: stretch;
        flex-direction: column;
        gap: .375rem;
    }

    .analysis-progress__counts {
        text-align: left;
    }
}

.upload-next-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}


.upload-next-steps h2 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: .25rem;
}

.upload-next-steps p {
    color: var(--text-muted);
    font-size: .875rem;
}

.upload-next-steps__actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}


.uploads-table-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.highscore-page {
    width: 100%;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}


.view-toggle-btn {
    padding: .3rem .8rem;
    font-size: .8rem;
    font-weight: 600;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.view-toggle-btn + .view-toggle-btn {
    border-left: 1px solid var(--border);
}

.view-toggle-btn.is-active {
    background: var(--surface-2);
    color: var(--text);
}

.category-filter {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
}


.leaderboard-scope-filter {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}


.leaderboard-scope-filter__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: .35rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.2;
    transition: background .15s, border-color .15s, color .15s;
}


.leaderboard-scope-filter__link:hover,
.leaderboard-scope-filter__link.is-active {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.category-filter-btn {
    padding: .25rem .65rem;
    font-size: .75rem;
    font-weight: 600;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.category-filter-btn.is-active {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.leaderboard-onboarding {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 1.25fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}


.leaderboard-onboarding__copy {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}


.leaderboard-onboarding__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}


.leaderboard-onboarding h2 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
}

.leaderboard-onboarding p {
    margin: 0;
    color: var(--text-muted);
    font-size: .875rem;
    line-height: 1.5;
}

.leaderboard-onboarding__steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}


.leaderboard-onboarding__step {
    display: flex;
    gap: .7rem;
    min-width: 0;
    padding: .85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}


.leaderboard-onboarding__step--active {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.leaderboard-onboarding__step--done {
    border-color: color-mix(in srgb, #4caf7d 40%, var(--border));
}

.leaderboard-onboarding__step-icon {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-radius: 999px;
}


.leaderboard-onboarding__step--done .leaderboard-onboarding__step-icon {
    color: #4caf7d;
    background: color-mix(in srgb, #4caf7d 14%, transparent);
}

.leaderboard-onboarding__step strong {
    display: block;
    color: var(--text);
    font-size: .875rem;
}


.leaderboard-onboarding__step small {
    display: block;
    margin-top: .15rem;
    color: var(--text-muted);
    font-size: .78rem;
    line-height: 1.45;
}


.leaderboard-onboarding__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
}


.leaderboard-onboarding__actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    white-space: nowrap;
}


.leaderboard-ranking {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.leaderboard-all-metrics {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}


.metric-category-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.metric-category-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.metric-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}


.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.metric-card-header {
    padding: .55rem .85rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.metric-card-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .85rem;
}


.metric-card-row + .metric-card-row {
    border-top: 1px solid var(--border);
}

.metric-card-rank {
    font-size: .75rem;
    font-weight: 700;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

.metric-card-name {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex: 1;
    font-size: .9rem;
    overflow: hidden;
}


.metric-card-name a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.metric-card-value {
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    flex-shrink: 0;
}


.metric-card-row--gold   { background: rgba(255, 215, 0, .03); }
.metric-card-row--silver { background: rgba(192, 192, 192, .03); }
.metric-card-row--bronze { background: rgba(205, 127, 50, .03); }

.metric-card-row--current-player {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface)) !important;
    box-shadow: inset 3px 0 0 var(--accent);
}

.metric-card-row--gold   .metric-card-rank { color: #ffd700; }
.metric-card-row--silver .metric-card-rank { color: #b8b8c8; }
.metric-card-row--bronze .metric-card-rank { color: #cd7f32; }

.metric-card-row--gold   .metric-card-rank::after { content: ' ★'; }
.metric-card-row--silver .metric-card-rank::after { content: ' ★'; }
.metric-card-row--bronze .metric-card-rank::after { content: ' ★'; }

.medal-snapshot-groups {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.snapshot-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
}

.snapshot-category-tabs .metric-filter-btn {
    flex: 0 0 auto;
}

.snapshot-category-tabs__count {
    color: var(--text-muted);
    font-size: .78em;
    font-variant-numeric: tabular-nums;
}

.medal-snapshot-category-panels {
    min-width: 0;
}

.medal-snapshot-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.medal-snapshot-group__title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(4.5rem, auto) auto auto;
    align-items: center;
    gap: .75rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .05em;
    list-style: none;
    margin: 0;
    text-transform: uppercase;
}

.medal-snapshot-group__heading {
    display: flex;
    flex-direction: column;
    gap: .18rem;
    min-width: 0;
}

.medal-snapshot-group__label {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-snapshot-group__requirement {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 500;
    letter-spacing: 0;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.medal-snapshot-group__meta {
    display: contents;
    font-variant-numeric: tabular-nums;
}

.medal-snapshot-group__value {
    justify-self: end;
    color: var(--text);
    font-size: .82rem;
    letter-spacing: 0;
    text-align: right;
    text-transform: none;
    white-space: nowrap;
}

.medal-snapshot-group__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    min-width: 1.55rem;
    height: 1.55rem;
    padding: 0 .4rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .72rem;
    line-height: 1;
}

.medal-snapshot-group__title::-webkit-details-marker {
    display: none;
}

.medal-snapshot-group__title::after {
    content: '›';
    justify-self: end;
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1;
    transition: transform .15s, color .15s;
}

.medal-snapshot-group[open] .medal-snapshot-group__title::after {
    transform: rotate(90deg);
}

.medal-snapshot-list {
    position: relative;
    display: grid;
    gap: 0;
    overflow: visible;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: .5rem;
    padding: .35rem 0;
}

.medal-snapshot-list::before {
    content: '';
    position: absolute;
    top: 1.5rem;
    bottom: 1.75rem;
    left: 1.725rem;
    width: 2px;
    background: var(--border);
    transform: translateX(-50%);
}

.medal-snapshot-row {
    position: relative;
    display: grid;
    grid-template-columns: 1.75rem minmax(4.5rem, 6rem) minmax(6.5rem, 1fr) 2rem;
    align-items: center;
    gap: .7rem;
    min-width: 0;
    padding: .62rem .85rem;
}

.medal-snapshot-row--missing {
    background: rgba(224,85,85,.12);
}

.medal-snapshot-row__marker {
    position: relative;
    z-index: 1;
    justify-self: center;
    width: .5rem;
    height: .5rem;
    background: var(--accent);
    border: 2px solid var(--surface);
    border-radius: 999px;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.medal-snapshot-row--missing .medal-snapshot-row__marker {
    background: var(--red);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 45%, transparent);
}

.medal-snapshot-row__time {
    color: var(--text-muted);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
}

.medal-snapshot-row__metric {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    min-width: 0;
    color: var(--text);
    text-align: left;
}

.medal-snapshot-row__metric--delta {
    flex-direction: row;
    align-items: baseline;
    gap: .4rem;
}

.medal-snapshot-row__value {
    font-size: .95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    white-space: nowrap;
}

.medal-snapshot-row__delta {
    min-width: 0;
    color: var(--text-muted);
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: left;
    white-space: nowrap;
}

.medal-snapshot-row__delta .delta {
    font-size: 1em;
    margin-left: 0;
}

.medal-snapshot-row__first {
    color: var(--text-muted);
}

.medal-snapshot-row__settings {
    justify-self: end;
    min-width: 0;
}

.medal-snapshot-group-divider {
    display: none;
}

.medal-progress-compact {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.medal-progress-compact-section {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    margin-top: .5rem;
}

.medal-progress-compact-section h2 {
    margin: 0;
    font-size: .9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.medal-progress-compact-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "main numbers"
        "track track";
    gap: .5rem .75rem;
    min-width: 0;
    padding: .75rem .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.medal-progress-compact-row__main {
    grid-area: main;
    min-width: 0;
}

.medal-progress-compact-row__numbers {
    grid-area: numbers;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .15rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.medal-progress-compact-row__numbers span {
    color: var(--text);
    font-size: .95rem;
    font-weight: 700;
}

.medal-progress-compact-row__numbers small {
    color: var(--text-muted);
    font-size: .72rem;
    white-space: nowrap;
}

.medal-progress-compact-row__title {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}

.medal-progress-compact-row__title h2 {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: .95rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-progress-compact-row__title span {
    flex: 0 0 auto;
    max-width: 6.5rem;
    overflow: hidden;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .1rem .4rem;
    font-size: .68rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-progress-compact-row__meta {
    display: flex;
    min-width: 0;
    margin-top: .18rem;
    color: var(--text-muted);
    font-size: .78rem;
    line-height: 1.35;
}

.medal-progress-compact-row__meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-progress-compact-row__track {
    grid-area: track;
    position: relative;
    height: 1rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.medal-progress-compact-row__track-fill {
    position: absolute;
    top: .35rem;
    right: 0;
    left: 0;
    height: .3rem;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: 999px;
}

.medal-progress-compact-row__bar {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.medal-progress-compact-row__segment {
    position: absolute;
    top: 0;
    bottom: 0;
}

.medal-progress-compact-row__segment--neutral {
    background: #2f9e8f;
}

.medal-progress-compact-row__segment--bronze {
    background: #cd7f32;
}

.medal-progress-compact-row__segment--silver {
    background: #b8b8c8;
}

.medal-progress-compact-row__segment--gold {
    background: #d5a900;
}

.medal-progress-compact-row__segment--platinum {
    background: #9fb7d9;
}

.medal-progress-compact-row__marker {
    position: absolute;
    top: .14rem;
    z-index: 1;
    width: .7rem;
    height: .75rem;
    transform: translateX(-50%);
    color: var(--text-muted);
    opacity: .62;
}

.medal-progress-compact-row__marker.is-reached {
    opacity: 1;
}

.medal-progress-compact-row__marker-tick {
    position: absolute;
    top: .13rem;
    left: 50%;
    width: 2px;
    height: .55rem;
    border-radius: 999px;
    background: currentColor;
    transform: translateX(-50%);
}

.medal-progress-compact-row__marker-label {
    position: absolute;
    top: .72rem;
    left: 50%;
    color: currentColor;
    font-size: .55rem;
    font-weight: 700;
    line-height: 1;
    transform: translateX(-50%);
}

.medal-progress-compact-row__marker.is-end .medal-progress-compact-row__marker-label {
    right: 0;
    left: auto;
    transform: none;
}

.medal-progress-compact-row__marker--bronze {
    color: #cd7f32;
}

.medal-progress-compact-row__marker--silver {
    color: #b8b8c8;
}

.medal-progress-compact-row__marker--gold {
    color: #d5a900;
}

.medal-progress-compact-row__marker--platinum {
    color: #9fb7d9;
}

.medal-progress-compact-row--bronze .medal-progress-compact-row__title span {
    color: #cd7f32;
    border-color: color-mix(in srgb, #cd7f32 55%, var(--border));
    background: color-mix(in srgb, #cd7f32 12%, var(--surface-2));
}

.medal-progress-compact-row--silver .medal-progress-compact-row__title span {
    color: #b8b8c8;
    border-color: color-mix(in srgb, #b8b8c8 55%, var(--border));
    background: color-mix(in srgb, #b8b8c8 12%, var(--surface-2));
}

.medal-progress-compact-row--gold .medal-progress-compact-row__title span {
    color: #d5a900;
    border-color: color-mix(in srgb, #ffd700 55%, var(--border));
    background: color-mix(in srgb, #ffd700 12%, var(--surface-2));
}

.medal-progress-compact-row--platinum .medal-progress-compact-row__title span {
    color: #d9e7ff;
    border-color: color-mix(in srgb, #d9e7ff 60%, var(--border));
    background: color-mix(in srgb, #d9e7ff 14%, var(--surface-2));
}

.medal-summary-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1.25rem;
    padding: .7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.medal-summary-stat {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
}

.medal-summary-stat::before {
    content: '';
    display: block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.medal-summary-stat--platinum::before { background: #9fb7d9; }
.medal-summary-stat--gold::before     { background: #d5a900; }
.medal-summary-stat--silver::before   { background: #b8b8c8; }
.medal-summary-stat--bronze::before   { background: #cd7f32; }
.medal-summary-stat--untracked::before { background: var(--border); }

.medal-summary-stat strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.medal-summary-stat span {
    color: var(--text-muted);
}

.medal-summary-divider {
    width: 1px;
    height: 1rem;
    background: var(--border);
    flex-shrink: 0;
    align-self: center;
}

@media (max-width: 600px) {
    .medal-summary-bar { padding: .6rem .75rem; }
    .medal-summary-divider { display: none; }
}

.medal-progress-metrics {
    flex: 1 1 32rem;
}

.medal-progress-metrics .metric-filter-btn {
    flex: 0 0 auto;
}

.medal-progress-active {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .75rem .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.medal-progress-active[hidden] {
    display: none;
}

.medal-progress-active__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .35rem;
    min-width: 0;
}

.medal-progress-active__title {
    min-width: 0;
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.medal-progress-active__category {
    flex: 0 0 auto;
    max-width: 100%;
    padding: .2rem .45rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 750;
    line-height: 1.1;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.medal-progress-active__description {
    margin: 0;
    color: var(--text-muted);
    font-size: .88rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.medal-progress-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}
.medal-progress-summary:empty { display: none; }

.medal-progress-summary-card {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
    padding: .55rem .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.medal-progress-summary-card__label {
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.medal-progress-summary-card__value {
    color: var(--text);
    font-size: .95rem;
    font-weight: 750;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.medal-progress-chart {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.medal-platinum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .4rem;
}

.medal-platinum-chip {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .5rem .65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 0;
}

.medal-platinum-chip__name {
    color: var(--text);
    font-size: .82rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.medal-platinum-chip__value {
    color: #9fb7d9;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
}

.missing-medals-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.medals-review-warning {
    background: rgba(245,166,35,.1);
    border: 1px solid rgba(245,166,35,.35);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: .9rem;
}

.medals-review-warning__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: rgba(245,166,35,.16);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.medals-review-warning__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1 1 auto;
}

.medals-review-warning__body h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.medals-review-warning__body p {
    color: var(--text-muted);
    font-size: .88rem;
    margin: 0;
}

.medals-review-warning__action {
    width: auto;
    flex: 0 0 auto;
}

.missing-medals-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}

.missing-medals-panel__header::-webkit-details-marker {
    display: none;
}

.missing-medals-panel__header::after {
    content: '›';
    color: var(--text-muted);
    flex: 0 0 auto;
    font-size: 1.25rem;
    line-height: 1;
    margin-top: .15rem;
    transition: transform .15s, color .15s;
}

.missing-medals-panel[open] .missing-medals-panel__header::after {
    transform: rotate(90deg);
}

.missing-medals-panel__content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.missing-medals-panel__header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .15rem;
}

.missing-medals-panel__summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem .7rem;
    color: var(--text-muted);
    font-size: .85rem;
    margin: 0;
}

.missing-medals-panel__count {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.missing-medals-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.missing-medal-groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.missing-medal-group {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.missing-medal-group__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.missing-medal-group__title span:last-child {
    color: var(--accent);
    font-size: .7rem;
}

.missing-medal-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    max-width: 100%;
    padding: .35rem .55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: .85rem;
}

.missing-medal-chip__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Medal grid */

.medal-grid-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.medal-grid-section__title {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding-left: .25rem;
}

.medal-grid-section__title--platinum { color: #9fb7d9; }
.medal-grid-section__title--gold     { color: #d5a900; }
.medal-grid-section__title--silver   { color: #b8b8c8; }
.medal-grid-section__title--bronze   { color: #cd7f32; }
.medal-grid-section__title--untracked { color: var(--text-muted); }

.medal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: .75rem;
}

.medal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .6rem .4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.medal-card:hover {
    background: var(--surface-3, var(--surface-2));
    border-color: var(--border-strong, var(--border));
}

.medal-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.medal-card__name {
    font-size: .7rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.25;
    color: var(--text-muted);
}

.medal-card--platinum { border-color: rgba(159,183,217,.35); }
.medal-card--gold     { border-color: rgba(213,169,0,.3); }
.medal-card--silver   { border-color: rgba(184,184,200,.3); }
.medal-card--bronze   { border-color: rgba(205,127,50,.25); }

.medal-card__img-wrap {
    position: relative;
    margin-bottom: .6rem;
}

.medal-card__value-pill {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%);
    display: inline-flex;
    align-items: baseline;
    padding: .1rem .4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: .6rem;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
}

.medal-card--platinum .medal-card__value-pill {
    border-color: color-mix(in srgb, #9fb7d9 55%, var(--border));
    background: color-mix(in srgb, #9fb7d9 14%, var(--surface-2));
    color: #9fb7d9;
}
.medal-card--gold .medal-card__value-pill {
    border-color: color-mix(in srgb, #d5a900 55%, var(--border));
    background: color-mix(in srgb, #d5a900 12%, var(--surface-2));
    color: #d5a900;
}
.medal-card--silver .medal-card__value-pill {
    border-color: color-mix(in srgb, #b8b8c8 55%, var(--border));
    background: color-mix(in srgb, #b8b8c8 12%, var(--surface-2));
    color: #b8b8c8;
}
.medal-card--bronze .medal-card__value-pill {
    border-color: color-mix(in srgb, #cd7f32 55%, var(--border));
    background: color-mix(in srgb, #cd7f32 12%, var(--surface-2));
    color: #cd7f32;
}

.medal-card__pill-current {
    font-size: .65rem;
    font-weight: 700;
}
.medal-card__pill-sep {
    font-size: .55rem;
    font-weight: 500;
    opacity: .7;
}

/* Medal detail */

.back-link {
    color: var(--text-muted);
    font-size: .875rem;
    text-decoration: none;
}
.back-link:hover { color: var(--text); }

.page-subtitle {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.medal-detail {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.medal-detail__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
    text-align: center;
}

.medal-detail__img-wrap {
    position: relative;
}

.medal-detail__img-wrap .medal-card__value-pill {
    font-size: .75rem;
    padding: .15rem .55rem;
}
.medal-detail__img-wrap .medal-card__pill-current { font-size: .8rem; }
.medal-detail__img-wrap .medal-card__pill-sep     { font-size: .68rem; }

.medal-detail__image {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.medal-detail__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}

.medal-detail__meta {
    color: var(--text-muted);
    font-size: .875rem;
    margin: 0;
}

.medal-detail__tier {
    display: inline-block;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: .2rem .5rem;
    border-radius: 999px;
}
.medal-detail__tier--platinum { background: rgba(159,183,217,.2); color: #9fb7d9; }
.medal-detail__tier--gold     { background: rgba(213,169,0,.15);  color: #d5a900; }
.medal-detail__tier--silver   { background: rgba(184,184,200,.2); color: #b8b8c8; }
.medal-detail__tier--bronze   { background: rgba(205,127,50,.15); color: #cd7f32; }

.medal-detail__body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.medal-detail__value-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.medal-detail__current {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.medal-detail__current-target {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
}

.medal-detail__progress-block {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.medal-detail__stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.medal-detail__stat {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.medal-detail__stat--right { text-align: right; align-items: flex-end; }

.medal-detail__stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.medal-detail__stat-value--platinum { color: #9fb7d9; }

.medal-detail__stat-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.medal-detail__untracked {
    color: var(--text-muted);
    font-size: .875rem;
    margin: 0;
}

.medal-detail__tiers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin: .75rem 0 0;
}

@media (max-width: 600px) {
    .medal-detail__tier-row { padding: .5rem .35rem; }
}


.medal-detail__tier-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .75rem .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.medal-detail__tier-img {
    position: relative;
    margin-bottom: .15rem;
}

.medal-detail__tier-row img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.medal-detail__tier-check {
    position: absolute;
    bottom: -2px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #50c878;
}


.medal-detail__tier-row dt {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
}

.medal-detail__tier-row dd {
    font-size: .95rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

.medal-detail__tier-row--platinum dt { color: #9fb7d9; }
.medal-detail__tier-row--gold dt     { color: #d5a900; }
.medal-detail__tier-row--silver dt   { color: #b8b8c8; }
.medal-detail__tier-row--bronze dt   { color: #cd7f32; }

.medal-detail__tier-row--platinum.is-reached { border-color: rgba(159,183,217,.35); }
.medal-detail__tier-row--gold.is-reached     { border-color: rgba(213,169,0,.3); }
.medal-detail__tier-row--silver.is-reached   { border-color: rgba(184,184,200,.3); }
.medal-detail__tier-row--bronze.is-reached   { border-color: rgba(205,127,50,.25); }

.medal-detail__tier-row.is-target { box-shadow: 0 0 0 2px var(--accent); }
.medal-detail__tier-row.is-inactive { opacity: .3; }

.missing-medals-complete {
    display: flex;
    align-items: center;
    color: #50c878;
    font-size: .9rem;
}

.profile-hero {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--team-color, var(--accent)) 12%, var(--surface)) 0%,
        var(--surface) 65%
    );
    border: 1px solid color-mix(in srgb, var(--team-color, var(--border)) 30%, var(--border));
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.profile-hero__name {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.profile-hero__team-icon {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.profile-hero__badges {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

.profile-hero__rank {
    display: inline-flex;
    align-items: center;
    background: color-mix(in srgb, var(--team-color, var(--accent)) 15%, transparent);
    color: var(--team-color, var(--accent));
    border: 1px solid color-mix(in srgb, var(--team-color, var(--accent)) 35%, transparent);
    border-radius: .3rem;
    font-size: .8rem;
    font-weight: 700;
    padding: .2rem .5rem;
}

.profile-hero__flag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: .3rem;
    font-size: .75rem;
    color: var(--text-muted);
    padding: .2rem .5rem;
}

.profile-highlights {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}


.profile-highlights__card {
    background: var(--surface-2);
    border: 1px solid color-mix(in srgb, var(--card-accent, var(--border)) 24%, var(--border));
    border-radius: var(--radius);
    min-width: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--card-accent, var(--border)) 18%, transparent);
}

.profile-highlights__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: .15rem;
}

.profile-highlights__label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    line-height: 1.25;
}

.profile-highlights__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: var(--card-accent, var(--text-muted));
    background: color-mix(in srgb, var(--card-accent, var(--accent)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--card-accent, var(--border)) 28%, var(--border));
    border-radius: 50%;
    opacity: .9;
    flex-shrink: 0;
}

@media (max-width: 960px) {
    .profile-highlights {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.profile-highlights__value {
    min-width: 0;
    overflow: hidden;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-flag {
    font-size: .8rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    line-height: 1;
}

.profile-flag svg {
    flex: 0 0 auto;
}

.profile-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-section__title {
    margin: 0;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
}

.profile-metric-sections,
.profile-medal-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.profile-metric-sections[hidden],

.profile-metric-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.profile-metric-category-title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin: 0;
}

.profile-stats-table td:first-child {
    color: var(--text-muted);
    font-size: .9rem;
}

.profile-stat-list {
    display: grid;
    gap: .25rem;
}

.profile-stat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 1rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-stat-row__label {
    min-width: 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.profile-stat-row__value {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.profile-medal-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.profile-medal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: .65rem;
}

.profile-medal-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .6rem;
    padding: .65rem;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.profile-medal-card__image {
    position: relative;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
}

.profile-medal-card__image img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.profile-medal-card--untracked .profile-medal-card__image img {
    opacity: .58;
}

.profile-medal-card__value {
    position: absolute;
    left: 50%;
    bottom: -.25rem;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    max-width: 4.8rem;
    overflow: hidden;
    padding: .12rem .35rem;
    color: var(--text);
    background: rgba(8, 13, 20, .88);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transform: translateX(-50%);
}

.profile-medal-card__value small {
    color: var(--text-muted);
    font-size: .58rem;
    font-weight: 600;
}

.profile-medal-card--bronze { border-color: rgba(205,127,50,.25); }
.profile-medal-card--silver { border-color: rgba(184,184,200,.3); }
.profile-medal-card--gold { border-color: rgba(213,169,0,.3); }
.profile-medal-card--platinum { border-color: rgba(159,183,217,.35); }

.profile-medal-card__name {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: .86rem;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
}

.profile-updated {
    font-size: .8rem;
    color: var(--text-muted);
    text-align: right;
}

.backoffice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.backoffice-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.backoffice-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.backoffice-flag-list {
    display: flex;
    flex-direction: column;
}


.backoffice-flag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
}

.backoffice-flag-row:first-child { padding-top: 0; }
.backoffice-flag-row:last-child { border-bottom: none; padding-bottom: 0; }

.backoffice-flag-label {
    font-size: .9rem;
}

.toggle-switch {
    display: inline-flex;
    cursor: pointer;
    flex-shrink: 0;
}


.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch__track {
    width: 2.5rem;
    height: 1.4rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    position: relative;
    transition: background .2s, border-color .2s;
}

.toggle-switch__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform .2s, background .2s;
}

.toggle-switch input:checked + .toggle-switch__track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-switch__track::after {
    transform: translateX(1.1rem);
    background: #000;
}

.backoffice-section--danger {
    border-color: var(--red);
}

.backoffice-section__title {
    font-size: 1rem;
    font-weight: 600;
}

/* Tom Select dark theme overrides */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control,
.ts-wrapper .ts-control {
    background: var(--surface-2) !important;
    border: 1px solid #4a4a5e !important;
    border-radius: 8px !important;
    color: var(--text) !important;
    box-shadow: none !important;
    padding: .45rem .75rem !important;
    align-items: flex-start !important;
    gap: .75rem !important;
}
.ts-wrapper.single .ts-control::after {
    top: .8rem !important;
    margin-top: 0 !important;
}
.ts-wrapper.focus.single .ts-control,
.ts-wrapper.focus .ts-control {
    border-color: #4a4a5e !important;
    box-shadow: none !important;
}
.ts-wrapper .ts-control input {
    color: var(--text) !important;
    background: var(--surface-2) !important;
    border: 1px solid #4a4a5e !important;
    border-radius: 6px !important;
    padding: .35rem .6rem !important;
    min-width: 8rem !important;
    margin: 0 !important;
    outline: none !important;
}
.ts-wrapper .ts-control input:focus {
    border-color: var(--accent) !important;
}
.ts-dropdown .ts-dropdown-content {
    padding-top: 0 !important;
}
.ts-wrapper .ts-dropdown input.dropdown-input,
.ts-dropdown input {
    background: var(--surface-2) !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    color: var(--text) !important;
    padding: .5rem .75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    outline: none !important;
}
.ts-dropdown,
.ts-dropdown.single,
.ts-dropdown.multi {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}
.ts-wrapper.dropdown-up .ts-dropdown {
    top: auto !important;
    bottom: calc(100% + .25rem) !important;
}
.ts-dropdown .ts-dropdown-content .option,
.ts-dropdown .option {
    color: var(--text) !important;
    background: transparent !important;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}
.ts-dropdown .option.selected,
.ts-dropdown .option.selected.active {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}
.ts-wrapper .ts-control .item {
    color: var(--text) !important;
}

.field-hint {
    font-size: .8rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Copy field (inline input + copy button) */
.copy-field {
    display: flex;
    gap: .4rem;
    align-items: center;
}
.copy-field input {
    flex: 1;
    min-width: 0;
}

/* Copy button */
.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .15s, background .15s;
}
.btn-copy:hover { color: var(--text); background: var(--surface); }
.btn-copy--copied { color: var(--accent); border-color: var(--accent); }

/* Onboarding rows */
.onboarding-rows {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.onboarding-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.onboarding-row__label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    width: 6rem;
    flex-shrink: 0;
}

.onboarding-row__value {
    flex: 1;
    font-family: monospace;
    font-size: .9rem;
    word-break: break-all;
}

.role-badge {
    display: inline-block;
    margin-left: .4rem;
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.role-badge--admin {
    background: var(--accent-dim);
    color: var(--accent);
}

.role-badge--developer {
    background: rgba(100, 160, 255, .15);
    color: #6aa0ff;
}

.text-muted {
    color: var(--text-muted);
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

.impersonation-label {
    font-size: .8rem;
    color: #6aa0ff;
    font-weight: 500;
    margin-left: auto;
}

.rank-cell {
    text-align: center;
    color: var(--text-muted);
    position: sticky;
    left: 0;
    z-index: 1;
    white-space: nowrap;
    width: 3rem;
    min-width: 3rem;
    max-width: 3rem;
}

.name-cell {
    position: sticky;
    left: 3rem;
    z-index: 1;
    width: max-content;
    min-width: max-content;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, .15);
}


.rank-cell__content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.rank-cell__number {
    flex-shrink: 0;
}

.rank-cell__mobile-label,
.rank-cell__mobile-name {
    display: none;
}

.rank-cell__mobile-label[hidden],

.data-table th.rank-cell,
.data-table th.name-cell {
    background: var(--surface);
    z-index: 2;
}

.data-table td.rank-cell,
.data-table td.name-cell {
    background: var(--bg);
}

.name-cell__content {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    width: max-content;
}


.name-cell__content a {
    color: inherit;
}

.rank-cell__mobile-name a {
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.team-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
    opacity: .85;
}

.current-player-badge {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: .12rem .4rem;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-size: .6rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}


.name-cell a,
.metric-card-name a {
    color: inherit;
    transition: color .15s;
}

.name-cell a:hover,
.metric-card-name a:hover {
    color: var(--team-color, var(--accent));
}

.tr--rank-1 td.rank-cell, .tr--rank-1 td.name-cell { background: color-mix(in srgb, #ffd700 4%, var(--bg)); }
.tr--rank-2 td.rank-cell, .tr--rank-2 td.name-cell { background: color-mix(in srgb, #c0c0c0 4%, var(--bg)); }
.tr--rank-3 td.rank-cell, .tr--rank-3 td.name-cell { background: color-mix(in srgb, #cd7f32 4%, var(--bg)); }

.tr--current-player td.rank-cell,
.tr--current-player td.name-cell {
    background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.tr--current-player td.name-cell {
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, .15), inset 0 1px 0 color-mix(in srgb, var(--accent) 16%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--accent) 16%, transparent);
}

.data-table tbody tr:hover td.rank-cell,
.data-table tbody tr:hover td.name-cell {
    background: var(--surface-2);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--text);
}

.data-table th.sortable::after {
    content: ' ↕';
    opacity: 0.35;
    font-size: .8em;
}

.data-table th.sortable[data-sort-dir="asc"]::after {
    content: ' ↑';
    opacity: 1;
}

.data-table th.sortable[data-sort-dir="desc"]::after {
    content: ' ↓';
    opacity: 1;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}


.section-header h1,
.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.count {
    font-size: .85rem;
    color: var(--text-muted);
}

.empty {
    color: var(--text-muted);
    font-size: .9rem;
}

.empty a {
    color: var(--accent);
}

.empty-state {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 680px;
}

.empty-state__title {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.empty-state-actions .btn--small {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1.25rem;
    font-size: .9rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: opacity .15s, background .15s, border-color .15s, color .15s;
}

.btn--outline {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
}

.btn--outline:hover {
    opacity: 1;
    background: var(--surface-2);
    border-color: var(--text-muted);
    color: var(--text);
}

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}


.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.data-table th {
    text-align: left;
    padding: .75rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
}

.data-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

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

.data-table tbody tr:hover td {
    background: var(--surface-2);
}

.tr--rank-1 td { background: rgba(255, 215, 0, .04); }
.tr--rank-2 td { background: rgba(192, 192, 192, .04); }
.tr--rank-3 td { background: rgba(205, 127, 50, .04); }

.tr--current-player td {
    background: color-mix(in srgb, var(--accent) 8%, var(--bg));
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 16%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--accent) 16%, transparent);
}

.tr--current-player td:first-child {
    box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 color-mix(in srgb, var(--accent) 16%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--accent) 16%, transparent);
}

.tr--rank-1 .rank-cell { color: #ffd700; }
.tr--rank-2 .rank-cell { color: #b8b8c8; }
.tr--rank-3 .rank-cell { color: #cd7f32; }

.tr--rank-1 .rank-cell__number::after { content: ' ★'; color: #ffd700; font-size: .9em; }
.tr--rank-2 .rank-cell__number::after { content: ' ★'; color: #b8b8c8; font-size: .9em; }
.tr--rank-3 .rank-cell__number::after { content: ' ★'; color: #cd7f32; font-size: .9em; }

.stat-cell--gold { color: #ffd700; }
.stat-cell--gold::after { content: ' ★'; font-size: .9em; color: #ffd700; }

.stat-cell--silver { color: #b8b8c8; }
.stat-cell--silver::after { content: ' ★'; font-size: .9em; color: #b8b8c8; }

.stat-cell--bronze { color: #cd7f32; }
.stat-cell--bronze::after { content: ' ★'; font-size: .9em; color: #cd7f32; }

.defit-flag { font-size: .75em; }
.manual-catch-flag {
    display: inline-flex;
    align-items: center;
    vertical-align: -0.18em;
}

.highscore-page .manual-catch-flag {
    color: var(--text-muted);
}

.profile-flag svg,
.manual-catch-flag svg {
    flex: 0 0 auto;
}

.metric-value {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .3rem;
    white-space: nowrap;
}

.metric-value__award {
    order: 3;
    font-size: .9em;
}

.metric-value__number {
    order: 1;
}

.metric-value .manual-catch-flag {
    order: 2;
}

.metric-value .defit-flag {
    order: 2;
}

.metric-value__award--gold { color: #ffd700; }
.metric-value__award--silver { color: #b8b8c8; }
.metric-value__award--bronze { color: #cd7f32; }

.stat-cell:has(.metric-value)::after,
.stat-cell:has(.metric-value)::before {
    content: none;
}

.flag--mobile { display: none; }

.combined-cell__value { display: none; }

.combined-cell__meta {
    display: none;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .75em;
    letter-spacing: .05em;
    margin-bottom: .5rem;
}

.combined-cell__row { display: contents; }

.stat-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table th.stat-cell {
    text-align: right;
}

.data-table th.col-wrap {
    white-space: normal;
}

.date {
    color: var(--text-muted);
    white-space: nowrap;
}

.date-short { display: none; }

.medal-date-cell {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}


/* Combined content column — hidden on stats desktop, revealed on mobile */
.stats-page .combined-cell { display: none; }

.stats-followup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    border-radius: var(--radius);
}


.stats-panel,
.medals-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.stats-panel[hidden],

.stats-page[data-active-metric="totalXp"] { --active-metric-accent: #c060c0; }
.stats-page[data-active-metric="distanceWalked"] { --active-metric-accent: #4f83cc; }
.stats-page[data-active-metric="pokemonCaught"] { --active-metric-accent: #e8a838; }
.stats-page[data-active-metric="pokestopsVisited"] { --active-metric-accent: #60b060; }

.stats-period-header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.stats-period-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}


.stats-date-range {
    display: block;
    font-size: .95rem;
    font-weight: 650;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stats-filter-toggle {
    display: none;
    flex: 0 0 auto;
    padding: .3rem .65rem;
    font-size: .75rem;
    font-weight: 650;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
}


.stats-period-alert {
    display: block;
    padding: .85rem 1rem;
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: .95rem;
}


.stats-period-alert a {
    color: var(--accent);
    font-weight: 650;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.stats-summary:empty { display: none; }

.stats-summary-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
    position: relative;
    min-height: 6.5rem;
    padding: .85rem .9rem;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}


.stats-summary-row:hover,
.stats-summary-row:focus-visible {
    border-color: color-mix(in srgb, var(--summary-accent) 45%, var(--border));
}

.stats-summary-row--totalXp { --summary-accent: #c060c0; }
.stats-summary-row--distanceWalked { --summary-accent: #4f83cc; }
.stats-summary-row--pokemonCaught { --summary-accent: #e8a838; }
.stats-summary-row--pokestopsVisited { --summary-accent: #60b060; }

.stats-summary-row.is-active {
    border-color: color-mix(in srgb, var(--summary-accent) 35%, var(--border));
}

.stats-summary-row__label::before {
    content: '';
    flex: 0 0 auto;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--border);
    margin-right: 0.15rem;
}

.stats-summary-row.is-active .stats-summary-row__label::before {
    background: var(--summary-accent);
}

.stats-summary-row__label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .875rem;
    font-weight: 650;
    color: var(--text-muted);
    min-width: 0;
}


.stats-summary-row.is-active .stats-summary-row__label {
    font-weight: 750;
    color: var(--text);
}

.stats-summary-row.is-active .stats-summary-row__value {
    font-weight: 750;
    color: var(--text);
}

.stats-summary-row.is-active .stats-summary-row__caption {
    color: color-mix(in srgb, var(--text) 72%, var(--text-muted));
}

.stats-summary-row__values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    margin-top: auto;
    min-width: 0;
}


.stats-summary-row__metric {
    display: grid;
    gap: .2rem;
    justify-items: start;
    min-width: 0;
}


.stats-summary-row__caption {
    font-size: .68rem;
    line-height: 1;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}


.stats-summary-row__value {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    line-height: 1.2;
}


.stats-summary-row__value--missing {
    color: var(--text-muted);
}

.stats-summary-row__delta {
    font-size: .8rem;
    font-weight: 600;
    color: var(--green, #60b060);
    font-variant-numeric: tabular-nums;
}


.stats-summary-row__delta--neg {
    color: var(--red, #e05555);
}

.snapshots-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}


.progress-filters {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}


.metric-filter {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
}


.metric-filter--categories {
    justify-content: flex-start;
}


.metric-filter--time {
    justify-content: flex-end;
}


.metric-filter-btn {
    padding: .25rem .65rem;
    font-size: .75rem;
    font-weight: 600;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}


.metric-filter-btn.is-active {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.medal-progress-custom-btn {
    border-style: dashed;
}

.custom-medals-dialog {
    position: fixed;
    inset: 0;
    width: min(680px, calc(100vw - 2rem));
    max-height: min(760px, calc(100vh - 2rem));
    margin: auto;
    padding: 1.25rem;
    overflow: auto;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.custom-medals-dialog::backdrop {
    background: rgba(0, 0, 0, .6);
}

.custom-medals-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.custom-medals-dialog__header h2 {
    margin: 0;
    font-size: 1rem;
}

.custom-medals-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.custom-medals-list__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    padding: .65rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.custom-medals-list__text {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .15rem;
}

.custom-medals-list__text strong,
.custom-medals-list__text span {
    overflow-wrap: anywhere;
}

.custom-medals-list__text strong {
    font-size: .9rem;
}

.custom-medals-list__text span {
    color: var(--text-muted);
    font-size: .75rem;
}

.custom-medals-list__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .35rem;
}

.custom-medals-list__actions .btn {
    width: auto;
    min-height: 2rem;
    padding: .35rem .55rem;
    font-size: .72rem;
}

.custom-medals-empty {
    margin: .75rem 0 0;
    color: var(--red);
    font-size: .82rem;
    font-weight: 650;
}

.custom-medals-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: flex-start;
    margin-top: 1rem;
}

.custom-medals-add .ts-wrapper {
    min-width: 0;
}

.custom-medals-add .ts-wrapper .ts-control {
    align-items: center !important;
    min-height: 2.35rem !important;
    padding-top: .45rem !important;
    padding-bottom: .45rem !important;
}

.custom-medals-add .ts-wrapper .ts-control input {
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

.custom-medals-add .btn {
    width: auto;
    min-height: 2.35rem;
}

.custom-medals-dialog__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1rem;
}

.custom-medals-dialog__actions .btn {
    width: auto;
    padding: .5rem .9rem;
}

.custom-medals-dialog__spacer {
    flex: 1 1 auto;
}

.custom-date-filter {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}


.custom-date-filter__field {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 650;
    color: var(--text-muted);
}


.custom-date-filter__field input {
    min-width: 8.4rem;
    padding: .22rem .45rem;
    font: inherit;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stats-followup__content {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}


.stats-followup h2 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
}

.stats-followup p {
    margin: 0;
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.5;
}

.stats-followup .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    flex: 0 0 auto;
}


.stats-page .data-table td.combined-cell {
    white-space: normal;
    padding: .5rem 1rem;
    min-width: 10rem;
}

.combined-cell__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    line-height: 1.7;
}

.combined-cell__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .75em;
    letter-spacing: .05em;
    margin-bottom: .5rem;
}

.combined-cell__meta-primary {
    color: var(--text);
}

.combined-cell__label {
    color: var(--text-muted);
    font-size: .75em;
    min-width: 4.5rem;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.combined-cell__value {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.medal-value-badge {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    padding: .15rem .45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.medal-value-badge--bronze {
    border-color: color-mix(in srgb, #cd7f32 55%, var(--border));
    background: color-mix(in srgb, #cd7f32 12%, var(--surface-2));
}

.medal-value-badge--silver {
    border-color: color-mix(in srgb, #b8b8c8 55%, var(--border));
    background: color-mix(in srgb, #b8b8c8 12%, var(--surface-2));
}

.medal-value-badge--gold {
    border-color: color-mix(in srgb, #ffd700 55%, var(--border));
    background: color-mix(in srgb, #ffd700 12%, var(--surface-2));
}

.medal-value-badge--platinum {
    border-color: color-mix(in srgb, #d9e7ff 60%, var(--border));
    background: color-mix(in srgb, #d9e7ff 14%, var(--surface-2));
}

.profile-stats-table .medal-tier--bronze .medal-value-badge {
    border-color: color-mix(in srgb, #cd7f32 55%, var(--border));
    background: color-mix(in srgb, #cd7f32 12%, var(--surface-2));
}

.profile-stats-table .medal-tier--silver .medal-value-badge {
    border-color: color-mix(in srgb, #b8b8c8 55%, var(--border));
    background: color-mix(in srgb, #b8b8c8 12%, var(--surface-2));
}

.profile-stats-table .medal-tier--gold .medal-value-badge {
    border-color: color-mix(in srgb, #ffd700 55%, var(--border));
    background: color-mix(in srgb, #ffd700 12%, var(--surface-2));
}

.profile-stats-table .medal-tier--platinum .medal-value-badge {
    border-color: color-mix(in srgb, #d9e7ff 60%, var(--border));
    background: color-mix(in srgb, #d9e7ff 14%, var(--surface-2));
}

.filename {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: .8rem;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delta {
    font-size: .75em;
    color: #50c878;
    margin-left: .3em;
    font-weight: 500;
}

.delta--neg {
    color: var(--red);
}

/* Checkbox column */
.checkbox-cell {
    width: 1px;
    padding-left: 1rem !important;
    padding-right: .5rem !important;
}

.row-checkbox {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.row--selected td {
    background: var(--accent-dim);
}

.combined-cell__select-hint {
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}


/* Comparison panel */
.dated-snapshots .section-header {
    margin-bottom: .75rem;
}

.comparison-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.comparison-page {
    gap: 1.25rem;
}

.page-header {
    align-items: flex-start;
}

.page-title-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem .75rem;
}


.page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}


.page-meta__label {
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}


.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 600;
    transition: color .15s;
}


.back-link:hover {
    color: var(--text);
}

.comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.comparison-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.comparison-clear {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    padding: .5rem 1.25rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}


.stats-selection-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}


.month-filter {
    font-size: .875rem;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}


.comparison-clear:hover {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.comparison-title {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}


.comparison-table td:first-child {
    color: var(--text-muted);
    font-size: .85rem;
}

.comparison-table .delta-col {
    text-align: center;
    padding-left: .5rem;
    padding-right: .5rem;
    color: var(--text-muted);
}

.comparison-table th.delta-col {
    padding-left: .5rem;
    padding-right: .5rem;
}

.comparison-table th small {
    display: block;
    font-weight: 400;
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.action-cell {
    width: 1px;
    white-space: nowrap;
    padding-right: .75rem !important;
}

.btn-detail {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .78rem;
    padding: .25rem .6rem;
    border-radius: 6px;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}

.btn-detail:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-detail--primary {
    font-size: .875rem;
    padding: .45rem 1rem;
    border-color: var(--accent);
    color: var(--accent);
}

.btn-detail--primary:hover {
    background: var(--accent-dim);
}

.btn-delete--primary {
    padding: .45rem .65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.btn-delete--primary:hover {
    border-color: var(--red);
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: .25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}

.btn-delete:hover {
    color: var(--red);
    background: rgba(224,85,85,.1);
}

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge--done       { background: rgba(80,200,120,.15); color: #50c878; }
.badge--start      { background: rgba(100,160,255,.15); color: #64a0ff; }

.row--missing td {
    background: rgba(224,85,85,.12);
}

.icon-missing {
    color: var(--red);
    vertical-align: -0.15em;
}

.row-settings {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.btn-settings {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: .25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .15s, background .15s;
}

.btn-settings:hover {
    color: var(--text);
    background: var(--surface-2);
}

.row-settings-dropdown {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .35rem;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.settings-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: .85rem;
    padding: .45rem .65rem;
    border-radius: 7px;
    text-align: left;
    transition: background .1s, color .1s;
}

.settings-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.settings-item--delete:hover {
    color: var(--red);
}
.badge--pending    { background: rgba(245,166,35,.15);  color: var(--accent); }
.badge--processing { background: rgba(100,160,255,.15); color: #64a0ff; }
.badge--failed     { background: rgba(224,85,85,.15);   color: var(--red); }

/* Upload card */
.upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-card h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    color: var(--text-muted);
    font-size: .9rem;
}

.drop-zone:hover,
.drop-zone.has-file {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--text);
}

.drop-zone.has-error {
    border-color: var(--red);
    background: color-mix(in srgb, var(--red) 10%, transparent);
    color: var(--red);
}

.drop-zone input[type="file"] {
    display: none;
}

.drop-zone svg {
    opacity: .5;
}

.drop-zone.has-file svg {
    opacity: 1;
    color: var(--accent);
}

/* Preview */
.preview-thumb {
    border-radius: 8px;
    height: 120px;
    width: auto;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

/* Button */
.btn {
    width: 100%;
    padding: .75rem 1rem;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}


.btn:hover { opacity: .75; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Status */
.status-msg {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    color: var(--text-muted);
    padding: .75rem 1rem;
    background: var(--surface-2);
    border-radius: 8px;
}

.status-msg.error {
    color: var(--red);
    background: rgba(224,85,85,.1);
}

.status-msg.info {
    color: var(--text-muted);
    background: var(--surface-2);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}

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

/* Results */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.stat-card .label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}

/* History row link */
.row-link {
    color: var(--text);
}
.row-link:hover {
    color: var(--accent);
}

/* Detail page */
.detail-page {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-header {
    display: flex;
    justify-content: flex-end;
}

.detail-header-actions {
    display: flex;
    gap: .5rem;
}

.detail-image-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: .5rem;
}

.back-link {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-muted);
    font-size: .9rem;
    transition: color .15s;
}
.back-link:hover { color: var(--text); }

.detail-filename {
    font-size: .85rem;
    color: var(--text-muted);
    font-family: monospace;
}

.detail-date {
    font-size: .85rem;
    color: var(--text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

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

    .detail-image-wrap {
        order: 1;
    }
}

.detail-image-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: .75rem;
}

.detail-image-wrap .detail-image {
    align-self: center;
}

.detail-image {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    display: block;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.detail-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-section--primary {
    border-color: var(--accent);
}

.detail-section--primary .detail-section-title {
    color: var(--accent);
    border-bottom-color: rgba(245,166,35,.2);
    background: var(--accent-dim);
}

.detail-section--danger {
    border-color: var(--red);
}

.detail-section--danger .detail-section-title {
    color: var(--red);
    border-bottom-color: color-mix(in srgb, var(--red) 20%, transparent);
    background: color-mix(in srgb, var(--red) 8%, transparent);
}

.detail-section-title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-section-edit {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color .15s;
}

.btn-section-edit-group {
    display: flex;
    gap: .6rem;
}
.btn-section-edit:hover { color: var(--accent); }

.btn-section-edit--cancel {
    color: var(--text-muted);
}

.detail-view {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
}

.detail-row-label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.detail-row-value {
    font-size: .9rem;
    color: var(--text);
}

.ocr-details {
    display: flex;
    flex-direction: column;
}

.ocr-summary {
    cursor: pointer;
    list-style: none;
    border-bottom: none;
    user-select: none;
}

.ocr-details[open] .ocr-summary {
    border-bottom: 1px solid var(--border);
}

.ocr-summary::-webkit-details-marker { display: none; }

.ocr-summary::after {
    content: '▸';
    float: right;
    font-size: .7rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.ocr-details[open] .ocr-summary::after {
    content: '▾';
}

.detail-section .stats-grid {
    padding: .75rem;
}

.detail-section-body {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.btn-row .btn {
    width: auto;
}


/* Metadata form */
.metadata-form {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.metadata-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.metadata-field label:first-child {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.metadata-field .ts-wrapper {
    width: 100%;
}

.metadata-field input[type="date"],
.metadata-field input[type="number"],
.metadata-field select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .9rem;
    padding: .45rem .75rem;
    width: 100%;
    color-scheme: dark;
}

/* Medal review */
.medal-review-list {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}


.medal-review-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: .85rem;
    padding: 1rem;
}

.medal-review-item__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.medal-review-item__header h2 {
    font-size: 1rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.medal-review-item__title {
    min-width: 0;
}

.medal-review-item__header p {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

.medal-review-item__media {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-width: 0;
}

.medal-review-item__image-meta {
    display: block;
    min-width: 0;
}

.medal-review-item__image-meta .detail-filename {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .78rem;
}

.medal-review-item__image-link {
    display: block;
    background: var(--surface-2);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    height: clamp(13rem, 38vw, 22rem);
}

.medal-review-item__image-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}


.medal-review-item__image {
    display: block;
    position: absolute;
    left: 50%;
    top: 35%;
    width: 150%;
    max-width: none;
    height: auto;
    transform: translate(-50%, -35%);
}

.medal-review-item__image--stats {
    top: 78%;
    transform: translate(-50%, -78%);
}

.medal-review-item__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.medal-review-status {
    flex: 0 0 auto;
}

.medal-review-warning-label {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--accent);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
}

.medal-review-warning-label svg {
    flex: 0 0 auto;
    color: var(--accent);
}

.medal-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-start;
}


.medal-review-actions form,
.medal-review-correction-form {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: flex-end;
}

.medal-review-correction-form {
    flex: 1 1 26rem;
}

.medal-review-correction-form > .medal-review-correction-input {
    flex: 1 1 10rem;
}

.medal-review-correction-field {
    display: flex;
    flex: 1 1 9rem;
    flex-direction: column;
    gap: .35rem;
    min-width: 9rem;
}

.medal-review-correction-label {
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.medal-review-correction-field--flagged {
    flex-basis: 10rem;
}

.medal-review-correction-form > .medal-review-warning-label {
    flex: 1 1 100%;
}

.medal-review-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.medal-review-secondary-actions form {
    display: flex;
}

.medal-review-actions__divider {
    align-self: stretch;
    width: 1px;
    background: var(--border);
}

.medal-review-actions .btn {
    width: auto;
}

.medal-review-correction-form > .btn {
    margin-left: .4rem;
}

.medal-review-correction-form input[type="number"] {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    min-height: 2.5rem;
    padding: .5rem .75rem;
    width: 100%;
    color-scheme: dark;
}

.medal-review-correction-form input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245,166,35,.18);
    outline: none;
}

.medal-review-correction-form input[type="number"].medal-review-correction-input--flagged {
    background: rgba(245,166,35,.12);
    border-color: rgba(245,166,35,.55);
    box-shadow: 0 0 0 1px rgba(245,166,35,.16);
}

.metadata-field--confirm {
    flex-direction: row;
    align-items: center;
}

.confirm-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    cursor: pointer;
}

.confirm-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

.btn--small {
    width: auto;
    padding: .5rem 1.25rem;
    font-size: .875rem;
}

.btn--inline {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.raw-text {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: .78rem;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

/* File queue cards (multi-upload) */
[data-uploads-target="queue"] {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.upload-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
}

.upload-summary__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.upload-summary__title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .25rem;
}

.upload-summary__meta,
.upload-summary__counts {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.4;
    margin: 0;
}

.upload-summary__counts {
    flex-shrink: 0;
    text-align: right;
}

.upload-summary__track {
    height: .45rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.upload-summary__bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width .2s ease;
}

.upload-summary__details {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.upload-summary__detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem .625rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.upload-summary__file {
    color: var(--text-muted);
    font-size: .85rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-summary__status {
    flex-shrink: 0;
    font-size: .8rem;
    font-weight: 700;
}

.upload-summary__detail--existing .upload-summary__status { color: #e8a030; }
.upload-summary__detail--failed .upload-summary__status { color: var(--red); }

.upload-summary__status a {
    color: inherit;
    text-decoration: none;
}

.upload-summary__status a:hover,
.upload-summary__status a:focus-visible {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .upload-summary__header,
    .upload-summary__detail {
        align-items: stretch;
        flex-direction: column;
        gap: .375rem;
    }

    .upload-summary__counts {
        text-align: left;
    }
}

.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem .875rem;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    animation: slide-down .18s ease;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.row--new td {
    animation: fade-in-row .2s ease;
}

@keyframes fade-in-row {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.file-card--error {
    background: color-mix(in srgb, var(--red) 8%, var(--surface-2));
    border-color: color-mix(in srgb, var(--red) 25%, var(--border));
}

.file-card-name {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.file-card--error .file-card-name {
    color: var(--text);
}

.file-card-status {
    font-size: .8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-card-status--working  { color: var(--accent); }
.file-card-status--done     { color: #50c878; }
.file-card-status--warning  { color: #e8a030; }
.file-card-status--error    { color: var(--red); }

.file-card--done {
    background: color-mix(in srgb, #50c878 8%, var(--surface-2));
    border-color: color-mix(in srgb, #50c878 30%, var(--border));
}

.file-card--warning {
    background: color-mix(in srgb, #e8a030 8%, var(--surface-2));
    border-color: color-mix(in srgb, #e8a030 30%, var(--border));
}

.file-card-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 .2rem;
    font-size: .9rem;
    line-height: 1;
    flex-shrink: 0;
}
.file-card-dismiss:hover { color: var(--text); }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}


body.is-drag-selecting { user-select: none; cursor: cell; }

@media (max-width: 900px) {
    .stats-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


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

.progress-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}


.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
}

.stats-page[data-active-metric] .progress-charts .chart-card {
    border-color: color-mix(in srgb, var(--active-metric-accent) 35%, var(--border));
}

.chart-card__header {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}



.chart-card__title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: .04em;
}


.chart-card__subtitle {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.chart-card__subtitle::before {
    content: '';
    display: inline-block;
    width: .25rem;
    height: .25rem;
    margin-right: .45rem;
    border-radius: 50%;
    vertical-align: middle;
    background: var(--border);
}


.chart-card h2 {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 1rem;
}

.charts-empty {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.chart-skeleton {
    display: block;
    width: 100%;
    height: 180px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Auth ─────────────────────────────────────────────────── */
.auth-page {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-self: center;
}


.auth-page--wide {
    max-width: 720px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}


.auth-card__logo {
    position: absolute;
    top: -30px;
    left: 2rem;
}

.auth-card__logo svg {
    width: 60px;
    height: auto;
}

.auth-card__brand {
    font-size: 2.4rem;
    color: #B897D8;
    font-family: 'Pixelify Sans', monospace;
    letter-spacing: .03em;
}

.auth-card__title {
    margin: 0;
    color: var(--text);
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
}

.auth-card__brand:hover { opacity: .75; }
.auth-card__logo:hover { opacity: .75; }

.auth-card__intro,
.auth-card__footnote,
.auth-card__links {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.5;
}

.auth-card__intro a,
.auth-card__footnote a,
.auth-card__links a {
    color: var(--accent);
    font-weight: 700;
}

.auth-card__intro a:hover,
.auth-card__footnote a:hover,
.auth-card__links a:hover {
    opacity: .75;
}

.auth-card__links {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}


.auth-form .btn {
    background: linear-gradient(to bottom, #CAADEA, #9B6DC8);
    color: #1a0a2e;
    letter-spacing: 0.05rem;
}

.auth-form .btn[type=submit] {
    margin-top: 0.75rem;
}

.btn--discord {
    align-self: stretch;
    background: #5865f2;
    color: #fff;
    text-align: center;
}

.btn--discord:hover {
    background: #4752c4;
}

.backoffice-section .auth-form .btn {
    background: var(--accent);
    color: #000;
    letter-spacing: normal;
    margin-top: 0;
    margin-bottom: 0;
}

.auth-error {
    color: var(--red);
    font-size: .875rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}


.auth-onboarding-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}


.auth-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}


.auth-field--honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.auth-field label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.auth-field input,
.auth-field select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .65rem .85rem;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
    appearance: none;
}

.auth-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%238888a8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.auth-field input:focus,
.auth-field select:focus {
    border-color: #B897D8;
}

.btn--full {
    width: 100%;
    justify-content: center;
    margin-top: .25rem;
}

/* ── Profile menu ───────────────────────────────────────────── */
.profile-menu {
    margin-left: auto;
    position: relative;
}

.profile-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: 0;
    transition: color .15s;
}

.profile-menu-btn:hover { color: var(--text); }

.profile-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
    padding: .35rem;
    z-index: 100;
}


.profile-menu-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .45rem .65rem;
    font-size: .875rem;
    font-weight: 400;
    color: var(--text);
    background: none;
    border: none;
    border-radius: 7px;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}

.profile-menu-item:hover { background: var(--surface-2); }

.profile-menu-item--signout:hover {
    color: var(--red);
    background: rgba(224,85,85,.08);
}

.profile-menu-item--danger:hover {
    color: var(--red);
    background: rgba(224,85,85,.1);
}


.upload-countdown {
    color: var(--text-muted);
    font-size: .9rem;
    margin-top: .5rem;
}

.upload-countdown-dots span {
    animation: dot-fade 1.2s infinite;
    opacity: 0;
}

.upload-countdown-dots span:nth-child(2) { animation-delay: .3s; }
.upload-countdown-dots span:nth-child(3) { animation-delay: .6s; }

@keyframes dot-fade {
    0%, 100% { opacity: 0; }
    50%       { opacity: 1; }
}

/* Confirmation dialog */
.confirm-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
}

.confirm-dialog::backdrop {
    background: rgba(0, 0, 0, .6);
}

.confirm-dialog__message {
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.confirm-dialog__actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
}

.confirm-dialog__actions .btn {
    width: auto;
    padding: .5rem 1.25rem;
    font-size: .875rem;
}

.btn--ghost {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn--ghost:hover { opacity: .75; }


.btn--blue {
    background: #4a8fff;
    color: #fff;
}

.btn--blue:hover { opacity: .75; }

.btn--success {
    background: #50c878;
    color: #07150c;
}

.btn--success:hover { opacity: .85; }

.btn--xs {
    display: inline-flex;
    width: auto;
    padding: .25rem .75rem;
    font-size: .75rem;
}


.btn--danger {
    background: var(--red);
    color: #fff;
}

/* ── Mobile (≤ 600px) ────────────────────────────────────── */
@media (max-width: 600px) {
    .highscore-page .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
    }

    .highscore-page .header-actions {
        margin-left: 0;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle-btn {
        flex: 1;
        padding: .55rem .5rem;
    }

    .leaderboard-onboarding {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .leaderboard-onboarding__steps {
        grid-template-columns: 1fr;
    }

    .leaderboard-onboarding__actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .leaderboard-onboarding__actions .btn {
        flex: 1 1 180px;
    }

    .metric-cards-grid {
        grid-template-columns: 1fr;
    }

    .progress-charts {
        grid-template-columns: 1fr;
    }

    .stats-page,
    .medals-page {
        gap: 1.5rem;
    }

    .stats-panel,
    .medals-panel {
        gap: 1.5rem;
    }

    .stats-period-header {
        gap: 1.5rem;
    }

    .stats-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .progress-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-page:not([data-filters-open="true"]) .progress-filters,
    .medals-page:not([data-filters-open="true"]) .progress-filters {
        display: none;
    }

    .metric-filter--time,
    .metric-filter--categories {
        justify-content: flex-start;
    }

    .metric-filter-btn {
        flex: 1 1 auto;
    }

    .custom-medals-dialog {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        padding: 1rem;
    }

    .custom-medals-list__item {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .custom-medals-list__actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .custom-medals-list__actions .btn {
        min-width: 0;
    }

    .custom-medals-add .btn {
        width: auto;
    }

    .custom-medals-dialog__actions {
        flex-wrap: wrap;
    }

    .custom-medals-dialog__spacer {
        display: none;
    }

    .custom-date-filter {
        width: 100%;
    }

    .custom-date-filter__field {
        flex: 1 1 9rem;
    }

    .custom-date-filter__field input {
        width: 100%;
        min-width: 0;
    }

    .stats-summary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stats-summary-row {
        min-height: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: .6rem;
        padding: .6rem .7rem;
    }

    .stats-summary-row__values {
        flex: 0 0 auto;
        min-width: min(14rem, 64%);
        margin-top: 0;
        gap: .4rem;
    }

    .stats-summary-row__metric {
        justify-items: end;
    }

    .stats-summary-row__value {
        font-size: .85rem;
    }

    .medals-page .medal-progress-metrics {
        flex: 0 1 auto;
        width: 100%;
    }

    .medals-page .metric-filter--time {
        width: 100%;
    }

    .medal-progress-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }
    .medal-progress-summary--compact {
        grid-template-columns: 1fr;
    }
    .medal-progress-summary-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: .45rem .75rem;
    }

    .page-header {
        align-items: flex-start;
        gap: .75rem;
    }

    .page-title-block {
        flex-direction: column;
        align-items: flex-start;
        gap: .35rem;
        min-width: 0;
        padding-right: 1rem;
    }

    .page-header .header-actions {
        margin-left: auto;
        flex: 0 0 auto;
    }

    .page-header .back-link {
        width: auto;
        justify-content: flex-end;
        white-space: nowrap;
    }

    header {
        padding: .75rem 1rem;
        position: static;
        background: var(--bg);
    }

    header nav {
        display: none;
    }

    .mobile-nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: .65rem .75rem .75rem;
        gap: .4rem;
    }

    .mobile-nav__link {
        position: relative;
        min-width: 0;
        min-height: 4rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .3rem;
        padding: .55rem .25rem;
        border: 1px solid transparent;
        border-radius: var(--radius);
        color: var(--text-muted);
        font-size: .72rem;
        font-weight: 650;
        line-height: 1.15;
        text-align: center;
    }


    .mobile-nav__link:hover,
    .mobile-nav__link.active {
        color: var(--text);
        background: var(--surface-2);
        border-color: var(--border);
    }

    .mobile-nav__link.active {
        color: var(--accent);
    }

    .mobile-nav__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: currentColor;
    }


    .mobile-nav__label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }


    .mobile-nav .nav-count {
        position: absolute;
        top: .35rem;
        right: .45rem;
    }

    .page-title {
        display: none;
    }

    .section-header:has(> .page-title:only-child) {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .stats-page .section-header,
    .medals-page .section-header {
        flex-direction: column;
        align-items: stretch;
    }


    .stats-page .header-actions {
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .medals-page .header-actions {
        margin-left: 0;
    }

    .medals-review-warning {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: flex-start;
    }

    .medals-review-warning__icon {
        grid-column: 2;
        grid-row: 1;
    }

    .medals-review-warning__body {
        grid-column: 1;
        grid-row: 1;
    }

    .medals-review-warning__action {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }

    .medal-review-page {
        gap: 1rem;
    }

    .medal-review-page .page-title {
        display: block;
    }

    .medal-review-item {
        gap: .75rem;
        padding: .8rem;
    }

    .medal-review-item__header {
        align-items: flex-start;
        gap: .55rem;
    }

    .medal-review-item__header h2 {
        font-size: .95rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .medal-review-item__header p {
        font-size: .78rem;
    }

    .medal-review-item__media {
        gap: .35rem;
    }

    .medal-review-item__image-meta {
        display: none;
    }

    .medal-review-item__image-meta .detail-filename {
        width: 100%;
    }

    .medal-review-item__image-link {
        height: clamp(9.5rem, 48vw, 12.5rem);
        width: 100%;
    }

    .medal-review-item__image {
        width: 82%;
    }

    .medal-review-item__image--stats {
        top: 90%;
        transform: translate(-50%, -90%);
        width: 100%;
    }

    .medal-review-item__body {
        gap: .85rem;
    }

    .medal-review-actions {
        align-items: stretch;
        gap: .75rem;
    }

    .medal-review-actions > form {
        flex: 1 1 9rem;
    }

    .medal-review-correction-form {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: .45rem;
    }

    .medal-review-correction-field {
        flex: 1 1 100%;
        min-width: 0;
    }

    .medal-review-correction-form > .btn {
        margin-left: 0;
        margin-top: .15rem;
    }

    .medal-review-actions .btn {
        justify-content: center;
        min-height: 2.75rem;
        width: 100%;
    }

    .medal-review-actions__divider {
        flex: 1 1 100%;
        height: 1px;
        width: 100%;
    }

    .medal-review-secondary-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        flex: 1 1 100%;
        gap: .5rem;
    }

    .medal-review-secondary-actions > .btn--ghost {
        grid-column: 1 / -1;
        min-height: 2.5rem;
    }

    .medal-review-secondary-actions form {
        min-width: 0;
    }

    .medal-review-correction-form input[type="number"] {
        flex: 1 1 100%;
        font-size: 1rem;
        min-width: 0;
        width: 100%;
    }

    .medal-review-correction-form .btn {
        flex: 1 1 100%;
    }

    .stats-page .month-filter {
        width: 100%;
    }

    .stats-followup {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-followup .btn {
        width: 100%;
    }

    .auth-page {
        max-width: 100%;
    }

    body:has(.auth-page) {
        min-height: 100dvh;
    }

    body:has(.auth-page) main {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .auth-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin: 0 -1rem;
    }

    /* Checkboxes are not practical on mobile */
    .checkbox-cell { display: none; }
    .col-hide-mobile { display: none; }

    .date-full { display: none; }
    .date-short { display: inline; }

/* Delta values move below the stat value on mobile */
    .delta { display: block; margin-left: 0; }
    .comparison-panel .delta { display: inline; margin-left: .3em; }

    /* Stats table: hide individual columns and date, show combined cell */
    .col-xp, .col-catches, .col-pokestops, .col-distance { display: none; }
    .col-date { display: none; }
    .stats-page .combined-cell { display: table-cell; }
    .combined-cell .delta {
        display: inline;
        margin-left: 0;
        font-size: .72em;
        font-weight: 600;
        color: color-mix(in srgb, #50c878 75%, var(--text-muted));
    }

    .combined-cell .delta--neg {
        color: color-mix(in srgb, var(--red) 80%, var(--text-muted));
    }

    .combined-cell__value {
        display: inline-flex;
        align-items: baseline;
        justify-content: flex-end;
        gap: .35rem;
        min-width: 0;
    }
    .stats-page .combined-cell__meta { display: flex; }
    .stats-page .combined-cell__row {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: .5rem;
        line-height: 1.7;
    }
    .combined-cell__label {
        color: var(--text-muted);
        font-size: .75em;
        text-transform: uppercase;
        letter-spacing: .05em;
        flex-shrink: 0;
    }

    /* Stars move to the left on mobile */
    .stat-cell--gold::after, .stat-cell--silver::after, .stat-cell--bronze::after { content: none; }
    .stat-cell--gold::before { content: '★ '; font-size: .9em; color: #ffd700; }
    .stat-cell--silver::before { content: '★ '; font-size: .9em; color: #b8b8c8; }
    .stat-cell--bronze::before { content: '★ '; font-size: .9em; color: #cd7f32; }

    .highscore-page .metric-value__award {
        order: 1;
    }

    .highscore-page .metric-value .manual-catch-flag {
        order: 2;
    }

    .highscore-page .metric-value__number {
        order: 3;
    }

    /* Flags move to the left on mobile */
    .flag--desktop { display: none; }
    .flag--mobile { display: inline-flex; }

    .profile-highlights {
        grid-template-columns: 1fr;
    }

    .profile-highlights__card {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        column-gap: .5rem;
        row-gap: .15rem;
        padding: .65rem .85rem;
    }

    .profile-highlights__header {
        display: contents;
    }

    .profile-highlights__icon {
        order: -2;
        display: flex;
        flex-shrink: 0;
        width: auto;
        height: auto;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .profile-highlights__card {
        position: relative;
    }

    .profile-highlights__icon {
        position: absolute;
        top: .65rem;
        right: .85rem;
    }

    .profile-highlights__value {
        order: -1;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .profile-highlights__label {
        text-transform: none;
        letter-spacing: 0;
        font-size: .85rem;
        align-self: flex-end;
    }

    .profile-medal-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .highscore-page .table-scroll {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .highscore-page .rank-cell {
        width: auto;
        min-width: max-content;
        max-width: none;
        padding-right: .5rem;
        text-align: left;
    }

    .highscore-page .name-cell {
        display: none;
    }

    .highscore-page .rank-cell__desktop-label {
        display: none;
    }

    .highscore-page .rank-cell__mobile-label {
        display: inline;
    }


    .highscore-page .rank-cell__content {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: .45rem;
    }


    .highscore-page .rank-cell__number {
        display: inline;
    }

    .highscore-page .rank-cell__mobile-name {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        width: max-content;
        max-width: calc(16px + .4rem + 120px);
        overflow: hidden;
        color: var(--text);
    }

    .highscore-page .rank-cell__mobile-name a {
        display: block;
        flex: 0 1 auto;
        max-width: 120px;
    }

    .highscore-page .current-player-badge {
        display: none;
    }


    .highscore-page .rank-cell__mobile-name a:hover {
        color: var(--team-color, var(--accent));
    }

    .medal-snapshot-groups {
        gap: 1rem;
    }

    .snapshot-category-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: .25rem;
        margin-bottom: 0rem;
        overflow-x: visible;
        padding: 0;
    }

    .medal-snapshot-group {
        gap: 0;
    }

    .medal-snapshot-group-divider {
        display: block;
        height: 1px;
        background: var(--border);
    }

    .medal-snapshot-group__title {
        grid-template-columns: minmax(0, 1fr) minmax(3.75rem, auto) auto auto;
        gap: .4rem;
        font-size: .7rem;
        letter-spacing: .035em;
    }

    .medal-snapshot-group__heading {
        gap: .16rem;
    }

    .medal-snapshot-group__requirement {
        font-size: .68rem;
    }

    .medal-snapshot-group__value {
        font-size: .72rem;
    }

    .medal-snapshot-group__title::after {
        font-size: .95rem;
    }

    .medal-snapshot-list {
        overflow: visible;
        margin-top: .75rem;
        padding: .3rem 0;
    }

    .medal-snapshot-list::before {
        top: 1.25rem;
        bottom: 1.75rem;
        left: 1.35rem;
    }

    .medal-snapshot-row {
        display: grid;
        grid-template-columns: 1.5rem minmax(3.8rem, 4.7rem) minmax(0, 1fr) 2rem;
        gap: .45rem;
        padding: .55rem .6rem;
    }

    .medal-snapshot-row__time {
        align-self: center;
        font-size: .74rem;
        line-height: 1.1;
    }

    .medal-snapshot-row__metric {
        align-self: center;
        gap: .2rem;
        align-items: flex-end;
        text-align: right;
    }

    .medal-snapshot-row__delta {
        text-align: right;
    }

    .medal-snapshot-row__metric--delta {
        flex-direction: row;
        justify-content: flex-end;
    }

    .medal-snapshot-row__metric--first {
        flex-direction: column;
        align-items: flex-end;
    }

    .medal-snapshot-row__metric--delta .delta {
        display: inline;
    }

    .medal-snapshot-row__settings {
        align-self: center;
    }

    .medal-snapshot-row__settings .btn-settings {
        align-items: center;
        justify-content: center;
        margin: -.35rem;
        min-width: 2rem;
        min-height: 2rem;
        padding: .35rem;
    }

    /* Stats: card list instead of table on mobile */
    .stats-page .table-scroll {
        overflow: visible;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .stats-page .data-table {
        display: block;
    }

    .stats-page .data-table thead {
        display: none;
    }

    .stats-page .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: .75rem;
    }

    .stats-page .data-table tr {
        display: block;
        position: relative;
        background: var(--surface);
        border-radius: var(--radius);
        border: 1px solid var(--border);
        overflow: hidden;
    }


    .stats-page .data-table tr:hover {
        background: var(--surface);
    }

    .stats-page .data-table tr.row--selected,
    .stats-page .data-table tr.row--selected:hover {
        background: var(--accent-dim);
    }

    .stats-page .data-table tbody tr:hover td {
        background: transparent;
    }

    .stats-page .data-table tbody tr.row--selected:hover td {
        background: var(--accent-dim);
    }

    .stats-page .data-table td {
        display: none;
        border: none;
        padding: 0;
    }

    /* Content cell: takes full width */
    .stats-page .data-table .combined-cell {
        display: block;
        padding: .75rem 1rem;
        white-space: normal;
    }

    /* Header area inside card: filename + date stacked vertically, right padding for the button */
    .stats-page .data-table .combined-cell__meta {
        display: block;
        padding-right: 2.5rem;
        padding-bottom: .5rem;
        margin-bottom: .5rem;
        border-bottom: 1px solid var(--border);
    }

    .stats-page .data-table .combined-cell__meta-primary {
        display: inline;
        font-size: .85rem;
        color: var(--text);
        font-weight: 500;
    }

    .stats-page .data-table .combined-cell__select-hint {
        display: inline-flex;
        align-items: center;
        margin-left: .3rem;
        background: var(--surface-2);
        color: var(--text-muted);
        font-size: .7rem;
        font-weight: 600;
        padding: .15rem .45rem;
        border-radius: .3rem;
        line-height: 1.4;
    }


    /* Settings button: absolute top-right, padding compensates for btn-settings' own .25rem padding */
    .stats-page .data-table .action-cell {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        padding: .5rem .75rem;
        border: none;
        background: transparent;
    }

    .stats-page .data-table tbody tr:hover .action-cell,
    .stats-page .data-table tbody tr.row--selected:hover .action-cell {
        background: transparent;
    }

    .upload-card {
        padding: 1.25rem;
    }

    .detail-date {
        margin-left: 0;
    }

    .detail-filename {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }
}

/* Settings page */
.settings-flash {
    color: #4caf7d;
    font-size: .875rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.settings-section__title {
    font-size: 1rem;
    font-weight: 700;
}

.settings-section__desc {
    font-size: .875rem;
    color: var(--text-muted);
}

.settings-section__desc strong {
    color: var(--text);
}

.settings-field {
    display: grid;
    gap: .35rem;
    max-width: 20rem;
}

.settings-field__label {
    color: var(--text);
    font-size: .85rem;
    font-weight: 700;
}

.settings-field input[type="date"] {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    color-scheme: dark;
    font-size: .9rem;
    padding: .45rem .75rem;
    width: 100%;
}

.settings-field input[type="date"]:focus {
    outline: none;
    border-color: var(--accent, var(--border));
}

.settings-actions {
    max-width: 280px;
}

.settings-check {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
}


.settings-check input {
    margin-top: .2rem;
    accent-color: var(--accent);
}

.settings-trust-list {
    display: grid;
    gap: .55rem;
    color: var(--text-muted);
    font-size: .875rem;
    padding-left: 1.2rem;
}


.settings-danger-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}


@media (max-width: 700px) {
    .settings-danger-grid {
        grid-template-columns: 1fr;
    }
}

.settings-section--trust {
    border-color: color-mix(in srgb, #7dd3a8 25%, var(--border));
}

.settings-section--danger {
    border-color: color-mix(in srgb, var(--red) 35%, var(--border));
}

.settings-section--danger .btn {
    align-self: flex-start;
}

/* Location search */
.city-search {
    position: relative;
    max-width: 420px;
}

.city-search__field {
    position: relative;
    display: flex;
    align-items: center;
}

.city-search__input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .9rem;
    padding: .45rem 2rem .45rem .75rem;
    width: 100%;
}

.city-search__input:focus {
    outline: none;
    border-color: var(--accent, var(--border));
}

.city-search__input:invalid {
    border-color: #f87171;
}

.city-search__clear {
    position: absolute;
    right: .6rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 .2rem;
}

.city-search__clear:hover {
    color: var(--text);
}


.city-search__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    list-style: none;
    margin: 0;
    padding: .25rem 0;
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}


.city-search__option {
    padding: .45rem .75rem;
    font-size: .9rem;
    cursor: pointer;
}

.city-search__option:hover {
    background: var(--surface-3, var(--surface));
}

/* Team selector */
.team-selector {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
}

.team-card {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.team-card:has(input:checked) {
    border-color: var(--team-color, var(--text-muted));
    background: color-mix(in srgb, var(--team-color, var(--text-muted)) 12%, transparent);
}

.team-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.team-card__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--team-color, transparent);
    border: 1.5px solid var(--team-color, var(--text-muted));
    flex-shrink: 0;
}

.team-card__name {
    font-size: .875rem;
    font-weight: 600;
}

/* Profile menu divider */
.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: .3rem .35rem;
}

/* Public landing */
.landing-page {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 5rem;
}


.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
}


.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: #caa6ea;
    font-family: 'Pixelify Sans', monospace;
    font-size: 1.15rem;
    font-weight: 700;
}


.landing-nav__links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}


.landing-nav__links a {
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 600;
}

.landing-nav__links a:hover,
.landing-nav__links a:focus-visible {
    color: var(--text);
}

.landing-nav__links .landing-nav__cta {
    color: #0f0f13;
    background: var(--accent);
    border-radius: 999px;
    padding: .55rem .9rem;
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
    align-items: center;
    gap: 3rem;
    min-height: min(720px, calc(100vh - 10rem));
}


.landing-hero__content {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}


.landing-kicker {
    color: #7dd3a8;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.landing-hero h1,
.landing-section h2,
.landing-final-cta h2,
.legal-page h1 {
    color: var(--text);
    letter-spacing: 0;
    line-height: 1.05;
}

.landing-hero h1 {
    max-width: 760px;
    font-size: clamp(2.55rem, 5vw, 5rem);
}

.landing-hero__lead {
    max-width: 680px;
    color: #c5c5d8;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.65;
}

.landing-actions {
    display: flex;
    gap: .85rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: .3rem;
}


.landing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 999px;
    padding: .75rem 1.1rem;
    font-weight: 800;
    border: 1px solid transparent;
}


.landing-btn--primary {
    background: linear-gradient(135deg, var(--accent), #7dd3a8);
    color: #101014;
}

.landing-btn--secondary {
    color: var(--text);
    border-color: var(--border);
    background: rgba(255, 255, 255, .04);
}

.landing-btn:hover,
.landing-btn:focus-visible {
    transform: translateY(-1px);
}

.landing-trust-line {
    color: var(--text-muted);
    font-size: .92rem;
}

.landing-demo {
    display: flex;
    justify-content: center;
}


.landing-demo__window {
    width: min(100%, 460px);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(34, 34, 46, .98), rgba(20, 20, 28, .98));
    box-shadow: 0 28px 80px rgba(0, 0, 0, .45);
}


.landing-demo__topbar {
    display: flex;
    gap: .4rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
}


.landing-demo__topbar span {
    width: .65rem;
    height: .65rem;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: .5;
}

.landing-demo__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}


.landing-demo__panel {
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 10px;
    padding: 1rem;
}

.landing-demo__panel--wide {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}


.landing-demo__label {
    display: block;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}


.landing-demo__panel strong {
    display: block;
    color: var(--text);
    font-size: 1.45rem;
    margin-top: .15rem;
}


.landing-demo__chart {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    gap: .45rem;
    height: 120px;
}


.landing-demo__chart span {
    display: block;
    min-height: 32px;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, #7dd3a8, var(--accent));
}


.landing-demo__chart span:nth-child(1) { height: 42%; }
.landing-demo__chart span:nth-child(2) { height: 64%; }
.landing-demo__chart span:nth-child(3) { height: 52%; }
.landing-demo__chart span:nth-child(4) { height: 82%; }
.landing-demo__chart span:nth-child(5) { height: 100%; }

.landing-demo__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}


.landing-demo__upload {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #7dd3a8;
    background: rgba(125, 211, 168, .1);
    border: 1px solid rgba(125, 211, 168, .2);
    border-radius: 10px;
    padding: .85rem 1rem;
    font-size: .9rem;
    font-weight: 700;
}


.landing-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.landing-section__header {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    max-width: 760px;
}


.landing-section h2,
.landing-final-cta h2 {
    font-size: clamp(1.85rem, 3.2vw, 3rem);
}

.landing-section__header p:not(.landing-kicker),
.landing-trust p,
.landing-final-cta p,
.legal-page p {
    color: #b8b8cb;
    font-size: 1rem;
    line-height: 1.65;
}

.landing-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}


.landing-card-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.landing-card {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    min-height: 190px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
    padding: 1.2rem;
}


.landing-card svg {
    color: var(--accent);
}

.landing-card h3 {
    color: var(--text);
    font-size: 1.05rem;
}

.landing-card p {
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1.55;
}

.landing-card--compact {
    min-height: 165px;
}

.landing-section--split,
.landing-trust {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(280px, 1fr);
    gap: 2rem;
    align-items: start;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: radial-gradient(circle at top left, rgba(245, 166, 35, .12), transparent 34%), var(--surface);
    padding: 2rem;
}

.landing-section--split[hidden],

.landing-feature-list,
.landing-trust-list {
    display: grid;
    gap: .8rem;
    list-style: none;
}

.landing-feature-list[hidden],

.landing-feature-list div,
.landing-trust-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--text);
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    padding: .9rem 1rem;
    font-weight: 700;
}

.landing-feature-list div[hidden],

.landing-feature-list svg,
.landing-trust-list svg {
    color: #7dd3a8;
    flex-shrink: 0;
}

.landing-results {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 0;
}

.landing-result-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
    list-style: none;
}


.landing-result-list li {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 1rem;
    font-weight: 700;
}

.landing-trust a,
.legal-back {
    color: var(--accent);
    font-weight: 800;
}

.legal-back:hover { opacity: .75; }

.landing-trust-links {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    margin-top: .8rem;
}


.legal-page a:not(.legal-back),
.settings-section__desc a {
    color: var(--accent);
    font-weight: 700;
}

.legal-page a:not(.legal-back):hover,
.settings-section__desc a:hover {
    opacity: .75;
}

.landing-disclaimer {
    border: 1px solid rgba(245, 166, 35, .35);
    border-radius: 12px;
    background: rgba(245, 166, 35, .08);
    padding: 1rem 1.2rem;
}


.landing-disclaimer p {
    color: #ded5c5;
    font-size: .92rem;
}

.landing-final-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(245, 166, 35, .16), rgba(125, 211, 168, .1));
    border: 1px solid rgba(255, 255, 255, .1);
    padding: 3rem 1.5rem;
}


.landing-final-cta span {
    color: var(--text-muted);
    font-size: .9rem;
}

.legal-page {
    width: 100%;
    max-width: 840px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.legal-page h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

.legal-page section {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    border-top: 1px solid var(--border);
    padding-top: 1.2rem;
}


.legal-page h2 {
    color: var(--text);
    font-size: 1.15rem;
}

@media (max-width: 980px) {
    .landing-page {
        gap: 4rem;
    }

    .landing-hero,
    .landing-section--split,
    .landing-trust {
        grid-template-columns: 1fr;
    }

    .landing-card-grid,
    .landing-card-grid--four,
    .landing-result-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    main {
        padding: 1.5rem 1rem;
    }

    .landing-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .landing-nav__links {
        justify-content: flex-start;
    }

    .landing-nav__links a:not(.landing-nav__cta) {
        display: none;
    }


    .landing-hero {
        min-height: 0;
        gap: 2rem;
    }

    .landing-actions,
    .landing-btn {
        width: 100%;
    }

    .landing-demo__grid,
    .landing-card-grid,
    .landing-card-grid--four,
    .landing-result-list {
        grid-template-columns: 1fr;
    }

    .landing-section--split,
    .landing-trust,
    .landing-final-cta {
        border-radius: 14px;
        padding: 1.25rem;
    }
}
