:root {
    --bg: #0b0d12;
    --panel: #151924;
    --panel-soft: #1c2130;
    --line: #262c3d;
    --text: #e8ecf5;
    --muted: #8891a8;

    --lighter: #D0D5E2;
    --trash: #6b7280;
    --common: #9aa5bd;
    --uncommon: #46c86a;
    --rare: #3b9dff;
    --epic: #a76bff;
    --legendary: #ff9f3b;
    --fabled: #26d7d0;
    --mythic: #ff4fa3;
    --godly: #ffe566;
    --space: #ffa0fe;
    --creator: #ff5a36;
    --recursive: #3ecf7a;
    --scrabble: #b78bff;
    --shiny: #ffd24a;
    --shiny-ink: #1a1408;
    --shiny-glow: #7cf0ff;
    --foil: #a8b4c6;
    --foil-ink: #1a2030;
    --foil-glow: #7f93ad;
    --echo: #7cf0ff;
    --copied: #c9b6ff;

    --logo-fill: var(--foil-ink);
    --logo-outline: var(--text);
    --logo-mark: var(--fabled);
    --logo-background: var(--legendary);
}

/* Pip text (--logo-background) carries the user color. Tile interiors stay dark. */
html.has-logo-user {
    --logo-fill: var(--bg);
    --logo-background: var(--logo-user);
}

html.has-dark-logo-user {
    --logo-fill: color-mix(in srgb, var(--logo-user) 16%, var(--text));
}

html.has-logo-user-2 {
    --logo-mark: var(--logo-user-2);
}

@property --shiny-from {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@property --foil-from {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 2.5rem 1.25rem 3.2rem;
    background: radial-gradient(900px 500px at 50% -12%, #1d2440 0%, transparent 70%),
    var(--bg);
    color: var(--text);
    font-family: "Space Grotesk", system-ui, sans-serif;
    min-height: 100vh;
}

.shell {
    max-width: 720px;
    margin: 0 auto;
}

/* ---------- masthead ---------- */

.masthead {
    text-align: center;
    margin-bottom: 1.75rem;
}

.masthead h1 {
    margin: 0;
    font-size: 2.5rem;
    letter-spacing: -0.04em;
}

.home-link {
    display: inline-block;
    text-decoration: none;
    color: inherit;
}

.site-logo {
    display: block;
    width: min(200px, 88vw);
    aspect-ratio: 557 / 120;
}

.site-logo svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

html.page-home .usertab,
html.page-home .friends-tab,
html.page-home .account-session-actions,
html.page-home .account-danger,
html.page-home .admin-report,
html.page-home .admin-notify,
html.page-home .leaderboards,
html.page-home .infotab,
html.page-home .changelogtab,
html.page-profile .stage,
html.page-profile .results,
html.page-profile .friends-tab,
html.page-profile .leaderboards,
html.page-profile .infotab,
html.page-profile .changelogtab,
html.page-friends .stage,
html.page-friends .results,
html.page-friends .usertab,
html.page-friends .account-session-actions,
html.page-friends .account-danger,
html.page-friends .admin-report,
html.page-friends .admin-notify,
html.page-friends .leaderboards,
html.page-friends .infotab,
html.page-friends .changelogtab,
html.page-leaderboard .stage,
html.page-leaderboard .results,
html.page-leaderboard .usertab,
html.page-leaderboard .friends-tab,
html.page-leaderboard .account-session-actions,
html.page-leaderboard .account-danger,
html.page-leaderboard .admin-report,
html.page-leaderboard .admin-notify,
html.page-leaderboard .infotab,
html.page-leaderboard .changelogtab,
html.page-info .stage,
html.page-info .results,
html.page-info .usertab,
html.page-info .friends-tab,
html.page-info .account-session-actions,
html.page-info .account-danger,
html.page-info .admin-report,
html.page-info .admin-notify,
html.page-info .leaderboards,
html.page-info .changelogtab,
html.page-info .contacttab,
html.page-contact .stage,
html.page-contact .results,
html.page-contact .usertab,
html.page-contact .friends-tab,
html.page-contact .account-session-actions,
html.page-contact .account-danger,
html.page-contact .admin-report,
html.page-contact .admin-notify,
html.page-contact .leaderboards,
html.page-contact .infotab,
html.page-contact .changelogtab,
html.page-changelog .stage,
html.page-changelog .results,
html.page-changelog .usertab,
html.page-changelog .friends-tab,
html.page-changelog .account-session-actions,
html.page-changelog .account-danger,
html.page-changelog .admin-report,
html.page-changelog .admin-notify,
html.page-changelog .leaderboards,
html.page-changelog .infotab,
html.page-changelog .contacttab,
html.page-roll .usertab,
html.page-roll .friends-tab,
html.page-roll .account-session-actions,
html.page-roll .account-danger,
html.page-roll .admin-report,
html.page-roll .admin-notify,
html.page-roll .leaderboards,
html.page-roll .infotab,
html.page-roll .changelogtab,
html.page-roll .contacttab,
html.page-home .contacttab,
html.page-profile .contacttab,
html.page-friends .contacttab,
html.page-leaderboard .contacttab,
html.page-roll .stage-cta {
    display: none !important;
}

html.page-home #back-home {
    display: none !important;
}

.tagline {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.roll-byline {
    display: block;
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.roll-byline a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.roll-byline a:hover {
    text-decoration: underline;
}

/* Me / Leaderboard / Back sit above the page so they stay put after a roll. */
.stage-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 0.45rem;
    min-height: 2.4rem;
    overflow: visible;
}

.stage-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
    align-items: center;
    overflow: visible;
}

.usertab {
    --user-wash-end: var(--panel);
    margin-bottom: 0.85rem;
    background: var(--panel);
    /*border: 1px solid color-mix(in srgb, var(--user-color, var(--line)) 55%, var(--line));*/
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: visible;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--user-color, transparent) 16%, transparent);
}

.usertab.has-secondary-color {
    --user-wash-end: var(--user-color-2);
    /*border: 1px solid color-mix(*/
    /*  in srgb,*/
    /*  color-mix(in srgb, var(--user-color, var(--rare)) 60%, var(--user-color-2)) 55%,*/
    /*  var(--line)*/
    /*);*/
}

.account-user:has(.account-hero) {
    gap: 0;
}

.account-hero {
    margin: -1.15rem -1.25rem 0;
    padding: 1.15rem 1.25rem 1rem;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--user-color, var(--rare)) 60%, var(--panel)) 0%,
            color-mix(in srgb, var(--user-wash-end) 70%, var(--panel)) 90%
    );
}

.account-body {
    margin: 0 -1.25rem -1.25rem;
    padding-bottom: 0;
    border-radius: 0 0 14px 14px;
    background: color-mix(in srgb, var(--user-wash-end) 70%, var(--panel));
}

.account-body > .account-history,
.account-body > .account-stickers,
.account-body > .account-news {
    margin: 0;
}

.account-body > .account-history + .account-stickers,
.account-body > .account-history + .account-news,
.account-body > .account-stickers + .account-news {
    /*margin-top: 0.35rem;*/
}

.account-bar {
    padding: 1.15rem 1.25rem 1.25rem;
}

.account-hint {
    margin: 0 0 0.55rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.account-login-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.discord-login {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #5865F2;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.discord-login:hover {
    filter: brightness(1.08);
}

.google-login {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #fff;
    color: #1f1f1f;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid #dadce0;
}

.google-login:hover {
    filter: brightness(0.97);
}

.github-login {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #24292f;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.github-login:hover {
    filter: brightness(1.12);
}

.twitch-login {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #9146ff;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.twitch-login:hover {
    filter: brightness(1.08);
}

.handle-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.handle-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.handle-input {
    min-width: 10rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--line, #3a4258);
    background: var(--panel, #1b2133);
    color: inherit;
    font: inherit;
}

.handle-save {
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    border: 0;
    background: #5865F2;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.handle-error {
    flex-basis: 100%;
    margin: 0;
    color: #f38ba8;
    font-size: 0.85rem;
}

.account-user {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.account-loading {
    pointer-events: none;
    user-select: none;
}

.skeleton-block,
.skeleton-circle {
    display: block;
    background: color-mix(in srgb, var(--muted) 28%, var(--panel-soft));
    border-radius: 6px;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
}

.skeleton-name {
    width: min(10rem, 55%);
    height: 1.2rem;
    margin: 0.15rem 0;
}

.account-loading .stat {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.skeleton-label {
    width: 4.2rem;
    height: 0.65rem;
}

.skeleton-value {
    width: 3.4rem;
    height: 1.2rem;
}

.skeleton-value-wide {
    width: 5.5rem;
}

.skeleton-head {
    pointer-events: none;
    cursor: default;
}

.skeleton-head:hover {
    background: color-mix(in srgb, var(--panel-soft) 88%, #0a0c12);
}

.skeleton-chevron {
    width: 0.55rem;
    height: 0.55rem;
    flex-shrink: 0;
    border-radius: 2px;
}

.skeleton-section-title {
    width: 5.5rem;
    height: 0.75rem;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-block,
    .skeleton-circle {
        animation: none;
    }
}

.account-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
}

.avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.account-user .avatar {
    width: 40px;
    height: 40px;
    display: block;
}

.avatar-upload {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border-radius: 8px;
    background: color-mix(in srgb, #000 45%, transparent);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.avatar-wrap:hover .avatar-upload:not([hidden]),
.avatar-wrap:focus-within .avatar-upload:not([hidden]) {
    opacity: 1;
}

.avatar-upload-hint {
    pointer-events: none;
}

.avatar-reset {
    z-index: 2;
}

.account-heading {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}

.username {
    font-weight: 700;
    font-size: 1.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.username.has-name-gradient,
.lb-name-text.has-name-gradient,
.friends-name.has-name-gradient,
.roll-byline a.has-name-gradient,
.roll-byline span.has-name-gradient {
    color: transparent;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(
            90deg,
            var(--name-color) 0%,
            var(--name-color-2) 108%
    );
    -webkit-background-clip: text;
    background-clip: text;
}

.account-tools {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.account-self-tools,
.account-friend-tools {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.profile-friend-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: block;
}

.profile-friend-mark svg {
    width: 32px;
    height: 32px;
    display: block;
}

.profile-friend-status {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.profile-friend-pref-label {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.profile-friend-toggle {
    margin: 0.2rem 0 0;
    flex-shrink: 0;
}

.profile-friend-pref .friends-hint {
    margin: 0.35rem 0 0 1.45rem;
}

.account-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-row {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.stat-row-summary {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "lifetime average current max";
}

.stat-row-rolls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-lifetime {
    grid-area: lifetime;
}

.stat-average {
    grid-area: average;
}

.stat-current {
    grid-area: current;
}

.stat-max {
    grid-area: max;
}

.stat {
    background: color-mix(in srgb, var(--panel-soft) 88%, #0a0c12);
    /*border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);*/
    border: 0;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    min-width: 0;
    /*box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);*/
}

.stat-lifetime,
.stat-best {
    /*background: color-mix(in srgb, var(--rare) 8%, var(--panel-soft));*/
    border-color: color-mix(in srgb, var(--rare) 22%, var(--line));
}

.stat-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-best {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    column-gap: 0.5rem;
}

.stat-best .personal-best {
    grid-column: 1 / -1;
}

.stat-date {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    justify-self: end;
}

.personal-best,
.today-score,
.this-week-score,
.lifetime,
.stat-value {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.personal-best,
.today-score {
    justify-content: space-between;
}

.today-score.is-empty,
.this-week-score.is-empty {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.personal-best .lb-roll .pip,
.today-score .lb-roll .pip {
    width: 1.45rem;
    height: 1.7rem;
    font-size: 0.85rem;
}

@media (max-width: 520px) {
    .stat-row-summary {
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.85fr);
        grid-template-areas:
      "lifetime current"
      "average max";
    }

    .stat-row-rolls {
        grid-template-columns: 1fr;
    }

    .stat {
        padding: 0.65rem 0.7rem;
    }

    .stat-label {
        letter-spacing: 0.04em;
    }

    .username {
        font-size: 1.2rem;
    }

    #profile-friend-btn {
        padding: var(--stage-pad) 0.5rem;
    }
}

.avatar, .lb-avatar {
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.lb-avatar {
    width: 32px;
    height: 32px;
}

.logout {
    background: color-mix(in srgb, var(--bg) 72%, #06080e);
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    height: 100%;
    width: 100%;
}

.logout:hover {
    border-color: var(--rare);
    color: var(--text);
}

.user-color-wrap {
    position: relative;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
}

.user-color-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    left: auto;
    z-index: 20;
    padding: 0.45rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px color-mix(in srgb, #000 45%, transparent);
}

.user-color-menu[hidden] {
    display: none;
}

.user-color-2-wrap {

    position: relative;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
}

.user-color-2-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    left: auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: calc(4 * 2.1rem + 3 * 0.35rem + 0.9rem);
    padding: 0.45rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px color-mix(in srgb, #000 45%, transparent);
}

.user-color-2-menu.has-store {
    min-width: min(18rem, 78vw);
}

.user-color-2-menu[hidden] {
    display: none;
}

.user-color-2-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, 2rem);
    gap: 0.35rem;
}

.user-color-2-store {
    display: grid;
    gap: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--line);
}

.user-color-2-store[hidden] {
    display: none;
}

.user-color-2-store-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 2rem;
}

.user-color-2-store .store-group {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
}

.user-color-2-swatch {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--swatch, var(--line));
    cursor: pointer;
}

.user-color-2-swatch.is-selected {
    box-shadow: 0 0 0 2px var(--panel),
    0 0 0 3px var(--swatch, var(--rare));
}

.user-color {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    cursor: pointer;
}

.user-color.is-unset {
    background: repeating-conic-gradient(var(--line) 0 25%, var(--panel-soft) 0 50%) 0 0 / 0.7rem 0.7rem;
}

.user-color-2.is-unset {
    background: #e8eaef url("/resources/paint.png") center / 70% no-repeat;
}

.user-color-reset {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel-soft);
    color: var(--muted);
    font: inherit;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
}

.user-color-reset:hover {
    color: var(--text);
    border-color: var(--rare);
}

.leaderboards {
    margin-bottom: 0.85rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    touch-action: pan-y;
}

.lb-head {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.65rem 1.1rem;
    background: var(--panel-soft);
    border-bottom: 1px solid var(--line);
}

.lb-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
}

.lb-tab {
    background: transparent;
    /*border: 1px solid var(--line);*/
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    /*border-radius: 6px;*/
    padding: 0.25rem;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .lb-tab:hover {
        border-color: var(--fabled);
        transform: translateY(-1px);
    }
}

.lb-tab.is-active {
    color: var(--text);
    /*border-color: var(--rare);*/
    border-bottom: 2px solid var(--fabled);
    /*background: rgba(59, 157, 255, 0.12);*/
}

.lb-day-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.55rem 1.1rem;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-soft) 70%, transparent);
}

.lb-day-btn {
    appearance: none;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--text);
    font: inherit;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.lb-day-btn:hover:not(:disabled) {
    border-color: var(--rare);
}

.lb-day-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.lb-day-label {
    min-width: 7.5rem;
    text-align: center;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.lb-list {
    --lb-rank: calc(3ch + 0.7rem);
    font-variant-numeric: tabular-nums;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: var(--lb-rank) minmax(0, 1fr) max-content;
}

.lb-list.is-friends {
    --lb-rank: calc(4ch + 0.7rem);
}

.lb-list.has-detail {
    grid-template-columns: var(--lb-rank) minmax(0, 1fr) max-content max-content;
}

.lb-row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: stretch;
    padding: 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.0rem;
}

.lb-row:last-child {
    border-bottom: none;
}

.lb-row.is-self {
    background: color-mix(in srgb, var(--accent, #6ea8fe) 14%, transparent);
}

.lb-row.is-self .lb-rank {
    box-shadow: inset 3px 0 0 var(--accent, #6ea8fe);
}

.lb-row.is-pinned {
    grid-template-columns: max-content minmax(0, 1fr) max-content;
}

.lb-list.has-detail .lb-row.is-pinned {
    grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
}

.lb-row.is-pinned .lb-rank {
    width: auto;
    min-width: var(--lb-rank);
    white-space: nowrap;
}

.lb-me {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.05em 0.4em;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent, #6ea8fe) 28%, var(--panel-soft));
    color: var(--text);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.lb-gap,
.lb-empty {
    grid-column: 1 / -1;
}

.lb-gap {
    list-style: none;
    height: 0.85rem;
    margin: 0.15rem 1.1rem;
    border: none;
    border-bottom: 1px dotted var(--line);
    opacity: 0.7;
}

.lb-row.is-top-1 {
    background: color-mix(in srgb, var(--gold, #e4c36b) 10%, transparent);
    font-size: 1.05rem;
}

.lb-row.is-top-1 .lb-avatar,
.lb-row.is-top-1 .lb-avatar-fallback {
    width: 36px;
    height: 36px;
}

.lb-row.is-top-1 .lb-who,
.lb-row.is-top-1 .lb-meta,
.lb-row.is-top-1 .lb-score {
    padding-top: 1.05rem;
    padding-bottom: 1.05rem;
}

.lb-row.is-top-1 .lb-score {
    font-size: 1rem;
}

.lb-row.is-top-2 {
    background: color-mix(in srgb, #c5cde0 8%, transparent);
}

.lb-row.is-top-3 {
    background: color-mix(in srgb, #c9956c 7%, transparent);
}

.lb-row.has-banner {
    aspect-ratio: var(--lb-banner-ratio, 700 / 60);
    width: 100%;
    box-sizing: border-box;
    /*background-color: #000;*/
    background-image: var(--lb-banner-url);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    min-height: 2.75rem;
}

.lb-row.has-banner.is-top-1,
.lb-row.has-banner.is-top-2,
.lb-row.has-banner.is-top-3 {
    /*background-color: #000;*/
    background-image: var(--lb-banner-url);
}

.lb-row.has-dark-text {
    --lb-ink: #0b0d12;
    --lb-ink-soft: #2a3142;
}

.lb-row.has-dark-text .lb-score {
    color: var(--lb-ink);
}

.lb-row.has-dark-text .lb-date,
.lb-row.has-dark-text .lb-rolls {
    color: var(--lb-ink-soft);
}

.lb-row.has-dark-text .lb-name-text {
    text-shadow: 0 0 0.35rem rgba(255, 255, 255, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.35);
}

.lb-rank {
    box-sizing: border-box;
    width: var(--lb-rank);
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    padding: 0 0.35rem;
    border-right: 1px solid transparent;
    background: color-mix(in srgb, var(--line) 55%, var(--panel));
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.lb-rank.is-top-1 {
    background: var(--gold, #e4c36b);
    color: #0b0d12;
}

.lb-rank.is-top-2 {
    background: #c5cde0;
    color: #0b0d12;
}

.lb-rank.is-top-3 {
    background: #d4a574;
    color: #0b0d12;
}

.lb-who,
.lb-meta,
.lb-score {
    min-width: 0;
    padding: 0.85rem 0.75rem;
}

.lb-who {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-right: 1px solid transparent;
}

.lb-meta {
    border-right: 1px solid transparent;
}

.lb-name {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    min-width: 0;
}

.account-missing {
    padding: 0;
}

.account-history,
.account-stickers,
.account-news {
    margin: 0 -1.25rem;
    border-top: 1px solid var(--line);
}

.account-body > .account-history:last-child,
.account-body > .account-stickers:last-child,
.account-body > .account-news:last-child,
.account-user > .account-history:last-child,
.account-user > .account-stickers:last-child,
.account-user > .account-news:last-child {
    margin-bottom: 0;
}

.history-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.85rem 1.1rem;
    background: color-mix(in srgb, var(--panel-soft) 88%, #0a0c12);
    border: none;
    border-bottom: 1px solid var(--line);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.history-head:hover {
    background: color-mix(in srgb, var(--panel-soft) 85%, var(--muted));
}

.history-head:focus-visible {
    outline: 2px solid var(--accent, #6cf);
    outline-offset: -2px;
}

.account-history.is-collapsed .history-head {
    border-bottom: none;
}

.account-history.is-collapsed .group-chevron {
    transform: rotate(-45deg);
}

.account-history.is-collapsed .history-body {
    display: none;
}

.history-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
}

.user-rolls {
    list-style: none;
    margin: 0;
    padding: 0;
}

.user-roll-row {
    display: grid;
    grid-template-columns: 7.2rem 1fr auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.65rem 1.1rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.88rem;
    background: var(--panel);
    opacity: 0.9;
}

.user-roll-row:last-child {
    border-bottom: none;
}

.user-roll-row.is-best {
    /*background: color-mix(in srgb, var(--tone, var(--rare)) 14%, transparent);*/
    background: #362c27;
    box-shadow: inset 3px 0 0 var(--tone, var(--rare));
}

.user-roll-row.r-trash,
.user-roll-row.r-common,
.user-roll-row.r-uncommon,
.user-roll-row.r-rare,
.user-roll-row.r-epic,
.user-roll-row.r-legendary,
.user-roll-row.r-fabled,
.user-roll-row.r-mythic,
.user-roll-row.r-godly {
    color: var(--text);
}

.user-roll-row.is-best .user-roll-score {
    color: var(--tone, var(--rare));
}

.user-roll-best {
    display: inline-block;
    margin-left: 0.45rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tone, var(--rare)) 22%, transparent);
    color: var(--tone, var(--rare));
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

.user-roll-date {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}

.user-roll-score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

a.roll-link {
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
}

a.roll-link:hover {
    outline: 1px solid color-mix(in srgb, var(--rare) 55%, var(--line));
    outline-offset: 2px;
}

a.roll-link:focus-visible {
    outline: 2px solid var(--rare);
    outline-offset: 2px;
}

.user-rolls-more {
    display: block;
    width: 100%;
    background: var(--panel-soft);
    color: var(--muted);
    border: none;
    border-top: 1px solid var(--line);
    padding: 0.75rem 1.1rem;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.user-rolls-more:hover {
    color: var(--text);
}

@media (max-width: 520px) {
    .user-roll-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
      "date score"
      "roll roll";
    }

    .user-roll-date {
        grid-area: date;
    }

    .user-roll-score {
        grid-area: score;
    }

    .user-roll-row .lb-roll {
        grid-area: roll;
    }

    .lb-name-text {
        font-weight: 500;
        font-size: 0.8rem;
    }

    .lb-rank {
        font-weight: 500;
        font-size: 0.8rem;
    }

    .lb-score {
        font-weight: 600;
        font-size: 0.8rem;
    }

    .lb-row.is-top-1 .lb-name-text {
        font-weight: 500;
        font-size: 0.8rem;
    }

    .lb-row.is-top-1 .lb-rank {
        font-weight: 600;
        font-size: 0.8rem;
    }

    .lb-row.is-top-1 .lb-score {
        font-weight: 600;
        font-size: 0.8rem;
    }
}

.lb-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

a.lb-name-text:hover {
    text-decoration: underline;
}

html.readable-names .username.is-light-name,
html.readable-names .lb-name-text.is-light-name,
html.readable-names .friends-name.is-light-name,
html.readable-names .roll-byline a.is-light-name,
html.readable-names .roll-byline span.is-light-name {
    padding: 0.08em 0.5em;
    border-radius: 6px;
    color: #e8ecf5 !important;
    -webkit-text-fill-color: #e8ecf5 !important;
    background: #111116;
    background-image: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

html.readable-names .username.has-name-gradient,
html.readable-names .lb-name-text.has-name-gradient,
html.readable-names .friends-name.has-name-gradient,
html.readable-names .roll-byline a.has-name-gradient,
html.readable-names .roll-byline span.has-name-gradient {
    background-image: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: #e8ecf5;
}

.lb-roll {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.1rem;
}

.lb-roll .pip {
    width: 1.45rem;
    height: 1.7rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-color: var(--tone);
    color: var(--tone);
}

.lb-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.lb-score-of {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.84em;
}

.lb-score-line {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    white-space: nowrap;
}

.lb-score::before {
    content: "+8,888,888";
    font-size: 1rem;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}

.lb-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.lb-list.has-groups .lb-meta {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: end;
    align-content: center;
}

.lb-list.has-groups .lb-meta::before {
    content: "20/20 grp";
    grid-area: 1 / 1;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.lb-list.has-groups .lb-meta > * {
    grid-area: 1 / 1;
}

.lb-date {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.lb-streak {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--legendary);
    white-space: nowrap;
    padding-left: 4px;
}

.lb-rolls {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
    padding-left: 4px;
}

.lb-empty {
    padding: 1.25rem 1.1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.lb-avatar-fallback {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: var(--line);
    border-radius: 8px;
}

@media (max-width: 420px) {
    .letter-census {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 580px) {
    .lb-head {
        padding: 0.55rem 0.7rem;
    }

    .lb-tabs {
        width: 100%;
    }

    .lb-tab {
        flex: 1;
        text-align: center;
        padding: 0.52rem 0.35rem;
        font-size: 0.72rem;
    }

    .lb-row.has-banner {
        min-height: 3.5rem;
    }

    .lb-who,
    .lb-meta,
    .lb-score {
        padding: 0.7rem 0.45rem;
    }

    .lb-row.is-top-1 .lb-who,
    .lb-row.is-top-1 .lb-meta,
    .lb-row.is-top-1 .lb-score {
        padding-top: 0.80rem;
        padding-bottom: 0.80rem;
    }

    .lb-score::before {
        content: none;
    }

    .lb-list.has-roll {
        grid-template-columns: var(--lb-rank) minmax(0, 1fr) max-content;
    }

    .lb-list.has-roll .lb-row {
        grid-template-rows: auto auto;
    }

    .lb-list.has-roll .lb-row.is-pinned {
        grid-template-columns: max-content minmax(0, 1fr) max-content;
    }

    .lb-list.has-roll .lb-rank {
        grid-row: 1 / -1;
    }

    .lb-list.has-roll .lb-who,
    .lb-list.has-roll .lb-row.is-top-1 .lb-who {
        grid-column: 2;
        grid-row: 1;
        padding-bottom: 0;
    }

    .lb-list.has-roll .lb-meta,
    .lb-list.has-roll .lb-row.is-top-1 .lb-meta {
        grid-column: 2 / -1;
        grid-row: 2;
        padding-top: 0.2rem;
        padding-bottom: 0.65rem;
    }

    .lb-list.has-roll .lb-score,
    .lb-list.has-roll .lb-row.is-top-1 .lb-score {
        grid-column: 3;
        grid-row: 1;
        padding-bottom: 0;
    }

    .lb-row.is-top-1 .lb-avatar, .lb-row.is-top-1 .lb-avatar-fallback {
        width: 32px;
        height: 32px;
    }

    .lb-avatar {
        width: 28px;
        height: 28px;
    }
}

.stage-btn {
    --stage-pad: 0.3rem;
    --stage-avatar: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    /*background: var(--panel-soft);*/
    background: transparent;
    color: var(--text);
    /*border: 1px solid var(--line);*/
    border: 0;
    border-bottom: 2px solid transparent;
    /*border-radius: 10px;*/
    padding: 0 8px;
    min-height: calc(var(--stage-avatar) + 2 * var(--stage-pad) + 2px);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.stage-icon-btn {
    padding-left: var(--stage-pad);
    padding-right: var(--stage-pad);
    min-width: calc(var(--stage-avatar) + 2 * var(--stage-pad) + 2px);
    justify-content: center;
}

.share-roll-button {
    border: 1px solid var(--muted);
    border-radius: 8px;
    padding: 0.3rem;
    min-height: 3rem;
}

/* Avatar sits with equal space above, below, and to the left. */
#user-toggle,
#friends-view-toggle {
    position: relative;
    /*padding-left: var(--stage-pad);*/
    /*padding-right: 1rem;*/
}

#user-notification-warning,
.user-notification-warning {
    position: absolute;
    top: -5px;
    right: 1px;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.2rem;
    background: #ff4f6d;
    color: #14080c;
    border: 0;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.05rem;
    text-align: center;
}

#user-news-toggle {
    position: relative;
}

#news-notification-warning {
    top: 0.35rem;
    right: 0.55rem;
}

.notification-copy strong {
    display: block;
}

.note-kw-admin {
    color: #ff4f6d;
}

.note-kw-system {
    color: #ff9f3b;
}

.notification-subject {
    display: block;
    margin-top: 0.15rem;
}

.notification-copy time,
.news-item time {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.75rem;
}

.notification-copy p {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    opacity: 0.9;
    white-space: pre-wrap;
}

.account-news.is-collapsed .news-body {
    display: none;
}

.account-news.is-collapsed .group-chevron {
    transform: rotate(-45deg);
}

.news-body {
    /*padding: 0.75rem 1.25rem 1.1rem;*/
}

.store-groups {
    display: grid;
    gap: 0.45rem;
}

.store-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.55rem;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.store-group:disabled {
    cursor: default;
    opacity: 0.72;
}

.store-group.is-pick {
    border-color: color-mix(in srgb, var(--rare) 45%, var(--line));
}

.store-group-swatches {
    display: flex;
    gap: 0.28rem;
}

.store-swatch {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 4px;
    border: 1px solid var(--line);
}

.store-group-state {
    font-size: 0.78rem;
    opacity: 0.8;
}

.news-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /*gap: 0.65rem;*/
}

.news-item {
    display: block;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.news-item.is-unread {
    border-color: color-mix(in srgb, var(--rare) 40%, var(--line));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rare) 18%, transparent);
}

.news-item.is-read {
    border-color: var(--line);
    background: color-mix(in srgb, var(--panel-soft) 70%, var(--bg));
    opacity: 0.9;
}

.news-item p {
    margin: 0.2rem 0 0;
    font-size: 0.88rem;
    opacity: 0.88;
}

.stage-btn .avatar {
    width: var(--stage-avatar);
    height: var(--stage-avatar);
}

.stage-btn .discord-mark {
    width: 1.35rem;
    height: auto;
    flex-shrink: 0;
    display: block;
    margin-left: 0.2rem;
}

.login-menu {
    position: relative;
}

.stage-login {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    font-weight: 600;
    /*background: var(--panel);*/
    /*border-color: var(--line);*/
    color: var(--text);
    gap: 0.35rem;
}

.login-caret {
    font-size: 0.75em;
    opacity: 0.85;
    line-height: 1;
}

.stage-login[aria-expanded="true"] {
    border-color: var(--rare);
}

.login-menu-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 40;
    min-width: 10.5rem;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.login-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.login-menu-discord {
    background: #5865f2;
    color: #fff;
}

.login-menu-discord:hover {
    filter: brightness(1.08);
}

.login-menu-google {
    background: #fff;
    color: #1f1f1f;
    border: 1px solid #dadce0;
}

.login-menu-google:hover {
    filter: brightness(0.97);
}

.login-menu-github {
    background: #24292f;
    color: #fff;
}

.login-menu-github:hover {
    filter: brightness(1.12);
}

.login-menu-twitch {
    background: #9146ff;
    color: #fff;
}

.login-menu-twitch:hover {
    filter: brightness(1.08);
}

.login-menu-item .discord-mark {
    width: 1.15rem;
    height: auto;
    margin: 0;
}

.stage-btn:hover {
    border-color: var(--fabled);
    transform: translateY(-1px);
}

.stage-btn.is-active {
    border-color: var(--fabled);
    /*background: rgba(59, 157, 255, 0.12);*/
}

[hidden] {
    display: none !important;
}

/* ---------- the roll ---------- */

.stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.35s ease, min-height 0.28s ease;
}

.stage.is-revealed {
    border-color: var(--tone);
    color: var(--text);
}

/* Hero spin: slightly larger tiles, more vertically centered in the stage. */
.stage.is-spinning {
    justify-content: center;
    min-height: 16.5rem;
}

.stage.is-spinning .verdict,
.stage.is-spinning .stage-cta {
    max-height: 0;
    margin: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.tiles {
    --tile-cols: 7;
    --tile-gap: clamp(0.2rem, 1.5vw, 0.5rem);
    /* Widest a tile can be and still keep the whole row inside the stage. */
    --tile-fit: calc((100% - (var(--tile-cols) - 1) * var(--tile-gap)) / var(--tile-cols));
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--tile-gap);
    flex-wrap: nowrap;
    margin-bottom: 1.75rem;
    width: 100%;
    max-width: 100%;
    transition: margin 0.28s ease, gap 0.28s ease;
}

.stage.is-spinning .tiles {
    --tile-gap: clamp(0.2rem, 1.5vw, 0.7rem);
    margin-bottom: 0;
}

.tile {
    flex: 0 0 auto;
    width: min(clamp(2.15rem, 11.5vw, 3.25rem), var(--tile-fit));
    height: clamp(2.6rem, 14vw, 3.9rem);
    display: grid;
    place-items: center;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(1.1rem, 5.5vw, 1.85rem);
    color: var(--text);
    transition: border-color 0.3s ease,
    color 0.3s ease,
    width 0.28s ease,
    height 0.28s ease,
    font-size 0.28s ease,
    border-radius 0.28s ease;
}

.stage.is-spinning .tile {
    width: min(clamp(2.7rem, 14.5vw, 4.15rem), var(--tile-fit));
    height: clamp(3.25rem, 17.5vw, 5rem);
    font-size: clamp(1.4rem, 7vw, 2.35rem);
    border-radius: 14px;
}

.stage.is-revealed .tile.is-lit:not(.is-space) {
    border-color: var(--tone);
    color: var(--tone);
}

.tile.is-shiny,
.stage.is-revealed .tile.is-lit.is-shiny:not(.is-space) {
    color: var(--shiny-ink);
    border: 2px solid transparent;
    background: linear-gradient(145deg, #fff6c2 0%, var(--shiny) 42%, #e59a12 100%) padding-box,
    conic-gradient(
            from var(--shiny-from),
            #fffce8,
            var(--shiny),
            var(--shiny-glow),
            #ff8bd1,
            var(--shiny),
            #fffce8
    ) border-box;
    box-shadow: 0 0 14px rgba(255, 210, 74, 0.45),
    0 0 28px rgba(124, 240, 255, 0.18);
    animation: shiny-spin 2.4s linear infinite, shiny-glow 1.8s ease-in-out infinite;
}

.tile.is-shiny.is-locked {
    animation: shiny-land 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4),
    shiny-spin 2.4s linear 0.45s infinite,
    shiny-glow 1.8s ease-in-out 0.45s infinite;
}

.tile.is-foil,
.stage.is-revealed .tile.is-lit.is-foil:not(.is-space) {
    color: var(--foil-ink);
    border: 2px solid transparent;
    background: linear-gradient(145deg, #d8e0ea 0%, var(--foil) 48%, #6d7d92 100%) padding-box,
    conic-gradient(
            from var(--foil-from),
            #cfd8e4,
            var(--foil),
            var(--foil-glow),
            #5c6d82,
            var(--foil),
            #cfd8e4
    ) border-box;
    box-shadow: 0 0 8px rgba(168, 180, 198, 0.28),
    0 0 16px rgba(127, 147, 173, 0.1);
    animation: foil-spin 3.6s linear infinite, foil-glow 2.6s ease-in-out infinite;
}

.tile.is-foil.is-locked {
    animation: foil-land 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4),
    foil-spin 3.6s linear 0.4s infinite,
    foil-glow 2.6s ease-in-out 0.4s infinite;
}

@keyframes shiny-spin {
    to {
        --shiny-from: 360deg;
    }
}

@keyframes shiny-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 210, 74, 0.4),
        0 0 22px rgba(255, 210, 74, 0.15);
    }
    50% {
        box-shadow: 0 0 18px rgba(124, 240, 255, 0.55),
        0 0 32px rgba(255, 139, 209, 0.2);
    }
}

@keyframes shiny-land {
    0% {
        transform: scale(0.72) rotate(-8deg);
        filter: brightness(1.8);
    }
    55% {
        transform: scale(1.1);
    }
    100% {
        transform: none;
        filter: none;
    }
}

@keyframes foil-spin {
    to {
        --foil-from: 360deg;
    }
}

@keyframes foil-glow {
    0%, 100% {
        box-shadow: 0 0 6px rgba(168, 180, 198, 0.22),
        0 0 12px rgba(127, 147, 173, 0.08);
    }
    50% {
        box-shadow: 0 0 10px rgba(200, 210, 224, 0.28),
        0 0 18px rgba(127, 147, 173, 0.14);
    }
}

@keyframes foil-land {
    0% {
        transform: scale(0.86) rotate(4deg);
        filter: brightness(1.2);
    }
    55% {
        transform: scale(1.04);
    }
    100% {
        transform: none;
        filter: none;
    }
}

/* Empty until the letter lands. */
.tile:not(.is-lit) {
    color: transparent;
    background: var(--bg);
}

/* Tumbling letters read as noise, so keep them dim until they lock. */
.tile.is-spinning {
    color: var(--muted);
    opacity: 0.65;
}

.tile.is-locked {
    animation: drop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

/* Last tile lands brighter: drop, then a quick flash that settles. */
.tile.is-final-lock {
    animation: drop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.4),
    final-flash 0.6s ease-out 0.1s;
}

@keyframes final-flash {
    0% {
        filter: brightness(1);
        box-shadow: none;
    }
    30% {
        filter: brightness(1.7);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--text) 55%, transparent),
        0 0 18px color-mix(in srgb, var(--text) 35%, transparent);
    }
    100% {
        filter: brightness(1);
        box-shadow: none;
    }
}

.tile.is-space {
    background: var(--bg);
    border-style: dashed;
    border-color: var(--space);
}

.stage.is-revealed .tile.is-space {
    border-color: var(--space);
}

@keyframes drop {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.85);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.stage-cta {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    transition: max-height 0.28s ease, margin 0.28s ease, opacity 0.2s ease;
}

.verdict {
    width: 100%;
    transition: max-height 0.28s ease, margin 0.28s ease, opacity 0.2s ease;
}

.stage-after {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem 1rem;
}

.stage-countdown {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.countdown {
    font-family: "JetBrains Mono", monospace;
    color: var(--text);
    font-weight: 700;
}

.stage-cta .stage-btn {
    min-width: 8.5rem;
    justify-content: center;
}

.roll {
    padding: 0.8rem 2.6rem;
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    color: #0b0d12;
    background: linear-gradient(95deg, var(--rare), var(--epic));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}

.roll:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.12);
}

.roll:active:not(:disabled) {
    transform: none;
}

.roll:disabled {
    opacity: 0.45;
    cursor: default;
}

.tier {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    max-height: 2.4rem;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
}

.tier.is-waiting {
    opacity: 0;
    max-height: 0;
    transform: translateY(8px);
    pointer-events: none;
}

.tier.is-climbing {
    opacity: 0.75;
}

.tier.is-step {
    animation: tier-step 0.18s ease;
}

@keyframes tier-step {
    from {
        opacity: 0.35;
        transform: translateY(4px);
    }
    to {
        opacity: 0.75;
        transform: none;
    }
}

.tier.is-arriving {
    animation: tier-arrive 0.45s ease;
}

@keyframes tier-arrive {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.stage.is-revealed.is-landing {
    animation: stage-landing 0.7s ease;
}

@keyframes stage-landing {
    from {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone, var(--rare)) 0%, transparent);
    }
    35% {
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--tone, var(--rare)) 55%, transparent),
        0 0 28px color-mix(in srgb, var(--tone, var(--rare)) 28%, transparent),
        inset 0 0 40px color-mix(in srgb, var(--tone, var(--rare)) 10%, transparent);
    }
    to {
        box-shadow: none;
    }
}

.beats {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.total {
    margin: 0.3rem 0 0;
    font-size: 2.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.total.is-empty {
    visibility: hidden;
}

.score-stack {
    display: inline-grid;
    justify-items: end;
    font-family: "JetBrains Mono", monospace;
    font-variant-numeric: tabular-nums;
}

.score-ghost,
.score-value {
    grid-area: 1 / 1;
    white-space: pre;
}

.score-ghost {
    visibility: hidden;
    pointer-events: none;
    user-select: none;
}

.score-value {
    text-align: right;
}

.score-stack .num-sep {
    font-size: 1rem;
    font-weight: 700;
}

.score-unit {
    white-space: pre;
}

/* ---------- sticker results ---------- */

.results {
    margin-top: 0.85rem;
}

.results[hidden] {
    display: none;
}

/* ---------- prefs menu ---------- */

.prefs-menu {
    position: relative;
}

.prefs-cog {
    display: block;
    width: 1.2rem;
    height: 1.2rem;
    background: currentColor;
    -webkit-mask: url("/resources/coggers.png") center / contain no-repeat;
    mask: url("/resources/coggers.png") center / contain no-repeat;
    -webkit-mask-mode: luminance;
    mask-mode: luminance;
}

.prefs-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 40;
    width: min(22rem, calc(100vw - 1.7rem));
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: var(--panel);
    border: 1px solid var(--lighter);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.prefs-panel[hidden] {
    display: none !important;
}

.prefs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
}

.prefs-row:hover {
    background: color-mix(in srgb, var(--panel-soft) 70%, transparent);
}

.prefs-row-label {
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.prefs-segment {
    display: inline-flex;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
    background: var(--panel-soft);
}

.prefs-segment-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
}

.prefs-segment-btn:hover {
    color: var(--text);
}

.prefs-segment-btn.is-selected,
.prefs-segment-btn[aria-checked="true"] {
    color: var(--text);
    background: color-mix(in srgb, var(--fabled) 22%, var(--panel-soft));
}

.prefs-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.prefs-block[hidden] {
    display: none !important;
}

.prefs-row-stack {
    flex-wrap: wrap;
    align-items: center;
}

.prefs-select {
    appearance: none;
    flex-shrink: 0;
    min-width: 5.5rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.prefs-desc {
    margin: 0;
    padding: 0.15rem 0.6rem 0.45rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--muted);
}

.prefs-menu .switch {
    position: relative;
    display: inline-block;
    width: 2.55rem;
    height: 1.45rem;
    flex-shrink: 0;
}

.prefs-menu .switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.prefs-menu .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.prefs-menu .slider:before {
    position: absolute;
    content: "";
    height: 1.05rem;
    width: 1.05rem;
    left: 0.15rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text);
    transition: transform 0.15s ease, background 0.15s ease;
}

.prefs-menu .slider.round {
    border-radius: 999px;
}

.prefs-menu .slider.round:before {
    border-radius: 999px;
}

.prefs-menu .switch input:checked + .slider {
    background: color-mix(in srgb, var(--fabled) 35%, var(--panel-soft));
    border-color: color-mix(in srgb, var(--fabled) 55%, var(--line));
}

.prefs-menu .switch input:checked + .slider:before {
    transform: translate(1.05rem, -50%);
    background: var(--fabled);
}

.prefs-menu .switch input:focus-visible + .slider {
    outline: 2px solid color-mix(in srgb, var(--fabled) 55%, transparent);
    outline-offset: 2px;
}

.friends-tab {
    margin-top: 1.25rem;
    display: grid;
    gap: 1rem;
}

.friends-panel {
    display: grid;
    gap: 1rem;
}

.friends-strip,
.friends-add-form {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.9rem 1rem;
}

/* Code + Copy left, Add friend right; profile opt-in on a full-width row under. */
.friends-strip {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
}

.profile-friend-pref {
    flex: 1 1 100%;
    margin: 0;
    padding-top: 0.65rem;
    border-top: 1px solid var(--line);
}

.friends-code-block {
    min-width: 0;
}

.friends-add-toggle[aria-expanded="true"] {
    border-color: var(--rare);
}

.friends-code-row,
.friends-add-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Friend code as roll tiles. Own code is tinted with the profile color. */
.friend-code-tiles {
    --tone: var(--logo-user, var(--rare));
    --tone-ink: var(--logo-user-2, var(--tone));
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.friend-code-tiles .pip {
    width: 1.75rem;
    height: 2.05rem;
    border-radius: 7px;
    font-size: 1rem;
    font-weight: 700;
    background: var(--panel-soft);
    border-color: var(--tone);
    color: var(--tone-ink);
}

.friend-code-tiles .pip.is-empty {
    border-color: var(--line);
    color: transparent;
}

.friend-code-dash {
    width: 0.55rem;
    text-align: center;
    color: var(--muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-weight: 700;
    user-select: none;
}

/* Input variant: neutral ink; the next empty tile shows where typing lands. */
.friend-code-tiles-input {
    --tone: var(--text);
    --tone-ink: var(--text);
}

.friend-code-tiles-input .pip.is-next {
    border-color: var(--rare);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--rare) 45%, transparent);
}

.friend-code-field {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

/* The real input sits invisibly over the tiles: paste, IME and a11y still work. */
.friend-code-field .friend-code-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    font-size: 1rem; /* >=16px keeps mobile browsers from zooming on focus */
    color: transparent;
    caret-color: transparent;
    background: transparent;
    cursor: text;
}

.friend-code-field:focus-within .friend-code-tiles-input .pip:not(.is-empty) {
    border-color: var(--text);
}

.friends-label {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.friends-hint {
    margin: 0.55rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.friends-guest .friends-hint {
    margin: 0;
}

.friends-error {
    margin: 0.5rem 0 0;
    color: #f88;
    font-size: 0.85rem;
}

/* Sections: Requests, Friends, and a collapsed Ignored list. */
.friends-sections {
    display: grid;
    gap: 1rem;
}

.friends-section {
    display: grid;
    gap: 0.45rem;
}

.friends-section-head {
    margin: 0;
    padding: 0 0.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}

.friends-count {
    color: var(--text);
    font-weight: 700;
}

.friends-section-link {
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}

.friends-section-link:hover {
    color: var(--text);
    text-decoration: underline;
}

.friends-section-ignored > summary {
    cursor: pointer;
    list-style: none;
}

.friends-section-ignored > summary::-webkit-details-marker {
    display: none;
}

.friends-section-ignored > summary::before {
    content: "▸";
    display: inline-block;
    width: 0.9em;
    transition: transform 0.15s ease;
}

.friends-section-ignored[open] > summary::before {
    transform: rotate(90deg);
}

.friends-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

.friends-list:empty {
    display: none;
}

.friends-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.55rem 0.7rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid var(--line);
}

.friends-row:first-child {
    border-top: 0;
}

.friends-row.is-pending,
.friends-row.is-declined,
.friends-row.is-blocked {
    background: color-mix(in srgb, var(--panel-soft) 70%, transparent);
}

/* Accepted friends: a wash of their profile color fading out to the right. */
.friends-row.has-color {
    background: linear-gradient(
            90deg,
            color-mix(in srgb, var(--friend-color) 14%, var(--panel)) 0,
            var(--panel) 60%
    );
}

.friends-row.has-color .friends-avatar {
    box-shadow: 0 0 0 1px color-mix(
            in srgb,
            var(--friend-color-2, var(--friend-color)) 45%,
            var(--line)
    );
}

/* High-contrast mode: name pills sit on a flat panel, no wash. */
html.readable-names .friends-row.has-color {
    background: var(--panel);
}

.friends-row:has([data-friend-action="unfriend"]:hover),
.friends-row:has([data-friend-action="block"]:hover) {
    background: color-mix(in srgb, #ff4f6d 22%, transparent);
}

.friends-actions .stage-btn.is-primary {
    border-color: var(--rare);
    background: color-mix(in srgb, var(--rare) 16%, var(--panel-soft));
}

.friends-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: cover;
}

.friends-avatar-fallback {
    display: inline-block;
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.friends-meta {
    min-width: 0;
    display: grid;
    gap: 0.15rem;
}

.friends-name {
    justify-self: start;
    max-width: 100%;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.friends-name:hover {
    text-decoration: underline;
}

.friends-sub {
    font-size: 0.78rem;
    color: var(--muted);
}

.friends-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
}

.friends-actions .stage-btn, .friends-code-row .stage-btn {
    padding: 0.67rem 0.8rem;
    font-size: 0.78rem;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.friends-code-row .stage-btn:hover {
    border-color: var(--rare);
}

.friends-actions .stage-btn:hover {
    background: #ee3333;
    font-weight: 800;
    color: white;
}

.friends-empty {
    margin: 0;
    padding: 0.9rem 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.groups {
    margin-top: 0;
    display: grid;
    gap: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

.groups:empty {
    display: none;
}

.groups:not(.show-details) .badge .odds,
.groups:not(.show-details) .badge .letter-rarity,
.results:not(.show-details) .badge .odds,
.results:not(.show-details) .badge .letter-rarity {
    display: none;
}

.badge .badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    width: 1.55rem;
    height: 1.55rem;
    font-size: 1.35rem;
    line-height: 1;
    opacity: 0.95;
    flex-shrink: 0;
}

.badge .name:has(.badge-subline) .badge-icon {
    width: 2.55rem;
    height: 2.55rem;
    font-size: 2.15rem;
}

.badge .badge-icon .sticker-art,
.badge .badge-icon .sticker-emoji {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.badge .badge-icon .sticker-emoji {
    width: auto;
    height: auto;
    font-size: 1em;
    line-height: 1;
}

.group {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    animation: rise 0.4s ease backwards;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.group-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.85rem 1.1rem;
    background: var(--panel-soft);
    border: none;
    border-bottom: 1px solid var(--line);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.group-head:hover {
    background: color-mix(in srgb, var(--panel-soft) 85%, var(--muted));
}

.group-head:focus-visible {
    outline: 2px solid var(--accent, #6cf);
    outline-offset: -2px;
}

.group.is-collapsed .group-head {
    border-bottom: none;
}

.group-chevron {
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.group.is-collapsed .group-chevron {
    transform: rotate(-45deg);
}

.group-title {
    flex: 1;
    min-width: 0;
    font-size: 1.0rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.group-icon {
    font-size: 1rem;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
}

.group-head .subtotal {
    flex-shrink: 0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.group-body {
    display: block;
}

.group.is-collapsed .group-body {
    display: none;
}

.badge {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 1rem;
    padding: 0.7rem 1.1rem;
    border-bottom: 1px solid var(--line);
}

.badge.is-entering {
    animation: rise 0.35s ease backwards;
}

.badge:last-child {
    border-bottom: none;
}

.badge .name {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem 0.7rem;
    min-width: 0;
    font-weight: 600;
}

.badge .badge-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.22rem;
    min-width: 0;
}

.badge .badge-headline {
    min-width: 0;
    line-height: 1.35;
    padding-bottom: 4px;
}

.badge .badge-subline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem;
    min-width: 0;
}

.badge .points-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.12rem;
}

.badge .points {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.badge .points-counted {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.badge .points-counted-label {
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    margin-right: 0.2rem;
}

.badge .odds {
    grid-column: 2;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.chip {
    font-style: normal;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.12rem 0.4rem;
    margin-left: 0.5rem;
    border: 1px solid currentColor;
    border-radius: 4px;
    opacity: 0.8;
    vertical-align: 1px;
}

/* The full roll under each badge, with the matched letters lit up. */
.strip {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.22rem;
    margin-top: 0.55rem;
    max-width: 100%;
    overflow-x: auto;
}

.pip {
    flex: 0 0 auto;
    width: clamp(1.1rem, 4.5vw, 1.4rem);
    height: clamp(1.3rem, 5.5vw, 1.65rem);
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: #0e111a;
    border: 1px solid var(--line);
    color: #545c70;
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(0.62rem, 2.8vw, 0.78rem);
}

.pip.is-hit {
    background: var(--tone);
    border-color: var(--tone);
    color: #0b0d12;
    font-weight: 700;
}

.badge.r-base .pip.is-hit {
    background: var(--tone);
    border-color: var(--tone);
    color: #e7eeff;
    font-weight: 600;
}

.pip.is-space {
    border-color: var(--space);
    border-style: dashed;
}

.pip.is-space.is-hit {
    background: var(--space);
    border-color: var(--space);
    border-style: solid;
    color: #0b0d12;
    font-weight: 700;
}

.pip.is-shiny {
    color: color-mix(in srgb, var(--shiny) 78%, var(--text));
    border-color: color-mix(in srgb, var(--shiny) 58%, var(--line));
    background: color-mix(in srgb, var(--shiny) 16%, transparent);
    box-shadow: 0 0 3px rgba(255, 210, 74, 0.22);
}

.pip.is-hit.is-shiny {
    color: color-mix(in srgb, var(--shiny) 88%, var(--text));
    border-color: color-mix(in srgb, var(--shiny) 72%, var(--line));
    background: color-mix(in srgb, var(--shiny) 24%, var(--panel-soft));
    box-shadow: 0 0 4px rgba(255, 210, 74, 0.28);
}

.pip.is-foil {
    color: var(--foil);
    border-color: var(--foil);
    box-shadow: 0 0 4px rgba(168, 180, 198, 0.28);
}

.pip.is-hit.is-foil {
    background: linear-gradient(145deg, #d8e0ea, var(--foil) 55%, #6d7d92);
    border-color: var(--foil-glow);
    color: var(--foil-ink);
    box-shadow: 0 0 5px rgba(168, 180, 198, 0.32);
}

.roll-glyphs .glyph.is-shiny {
    color: var(--shiny);
    text-shadow: 0 0 8px rgba(255, 210, 74, 0.55);
}

.roll-glyphs .glyph.is-foil {
    color: var(--foil);
    text-shadow: 0 0 5px rgba(168, 180, 198, 0.35);
}

/* Rarity drives the tier headline, the badge dot and the highlighted pips. */
.r-trash {
    --tone: var(--trash);
}

.r-common {
    --tone: var(--common);
}

.r-uncommon {
    --tone: var(--uncommon);
}

.r-rare {
    --tone: var(--rare);
}

.r-epic {
    --tone: var(--epic);
}

.r-legendary {
    --tone: var(--legendary);
}

.r-fabled {
    --tone: var(--fabled);
}

.r-mythic {
    --tone: var(--mythic);
}

.r-godly {
    --tone: var(--godly);
}

.r-space {
    --tone: var(--space);
}

.r-creator {
    --tone: var(--creator);
}

.r-recursive {
    --tone: var(--recursive);
}

.r-scrabble {
    --tone: var(--scrabble);
}

.r-shiny {
    --tone: var(--shiny);
}

.r-foil {
    --tone: var(--foil);
}

.r-echo {
    --tone: var(--echo);
}

.r-copied {
    --tone: var(--copied);
}

.r-base {
    --tone: #94a3b8;
}

.r-trash, .r-common, .r-uncommon, .r-rare,
.r-epic, .r-legendary, .r-fabled, .r-mythic, .r-godly,
.r-space, .r-creator, .r-recursive, .r-scrabble, .r-shiny, .r-foil, .r-echo, .r-copied {
    color: var(--tone);
}

.badge.r-legendary, .badge.r-mythic {
    background: rgba(255, 159, 59, 0.05);
}

.badge.r-godly {
    background: rgba(255, 229, 102, 0.08);
}

.stage.is-revealed.r-mythic {
    box-shadow: 0 0 16px color-mix(in srgb, var(--mythic) 22%, transparent),
    0 0 32px color-mix(in srgb, var(--mythic) 10%, transparent);
}

.stage.is-revealed.r-mythic .tiles {
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--mythic) 38%, transparent));
}

.tier.r-mythic {
    text-shadow: 0 0 8px color-mix(in srgb, var(--mythic) 55%, transparent),
    0 0 16px color-mix(in srgb, var(--mythic) 28%, transparent);
}

.lb-roll.r-mythic,
.user-roll-row.r-mythic .lb-roll {
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--mythic) 48%, transparent));
}

.lb-roll.r-mythic .pip:not(.is-shiny):not(.is-foil),
.user-roll-row.r-mythic .lb-roll .pip:not(.is-shiny):not(.is-foil) {
    box-shadow: 0 0 4px color-mix(in srgb, var(--mythic) 35%, transparent),
    0 0 8px color-mix(in srgb, var(--mythic) 14%, transparent);
}

.lb-row.is-top .lb-roll.r-mythic {
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--mythic) 52%, transparent));
}

.stage.is-revealed.r-godly {
    box-shadow: 0 0 28px color-mix(in srgb, var(--godly) 28%, transparent),
    0 0 56px color-mix(in srgb, var(--godly) 14%, transparent),
    0 0 90px color-mix(in srgb, #fff6c2 8%, transparent);
}

.stage.is-revealed.r-godly .tiles {
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--godly) 45%, transparent));
    animation: godly-bloom 2.8s ease-in-out infinite;
}

.tier.r-godly {
    text-shadow: 0 0 12px color-mix(in srgb, var(--godly) 65%, transparent),
    0 0 28px color-mix(in srgb, var(--godly) 35%, transparent);
}

.lb-roll.r-godly,
.user-roll-row.r-godly .lb-roll {
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--godly) 55%, transparent));
}

.lb-roll.r-godly .pip:not(.is-shiny):not(.is-foil),
.user-roll-row.r-godly .lb-roll .pip:not(.is-shiny):not(.is-foil) {
    box-shadow: 0 0 6px color-mix(in srgb, var(--godly) 40%, transparent),
    0 0 12px color-mix(in srgb, var(--godly) 18%, transparent);
}

.lb-row.is-top .lb-roll.r-godly {
    filter: drop-shadow(0 0 7px color-mix(in srgb, var(--godly) 60%, transparent));
}

@keyframes godly-bloom {
    0%, 100% {
        filter: drop-shadow(0 0 8px color-mix(in srgb, var(--godly) 40%, transparent));
    }
    50% {
        filter: drop-shadow(0 0 14px color-mix(in srgb, var(--godly) 58%, transparent));
    }
}

.badge.r-space {
    background: rgba(255, 160, 254, 0.06);
}

.badge.r-creator {
    background: rgba(255, 90, 54, 0.08);
}

.badge.r-recursive {
    background: rgba(62, 207, 122, 0.08);
}

.badge.r-scrabble {
    background: rgba(183, 139, 255, 0.08);
}

.badge.r-shiny {
    background: rgba(255, 210, 74, 0.08);
}

.badge.r-foil {
    background: rgba(197, 208, 224, 0.1);
}

.badge.r-echo {
    background: rgba(124, 240, 255, 0.08);
}

.badge.r-copied {
    background: rgba(201, 182, 255, 0.08);
}

.badge.r-base {
    background: rgba(148, 163, 184, 0.08);
}

.group.g-spaces {
    border-color: color-mix(in srgb, var(--space) 40%, var(--line));
}

.group.g-spaces .group-head {
    border-bottom-color: color-mix(in srgb, var(--space) 30%, var(--line));
}

.group.g-spaces .group-title,
.group.g-spaces .group-head .subtotal {
    color: var(--space);
}

.group.g-creator {
    border-color: color-mix(in srgb, var(--creator) 45%, var(--line));
}

.group.g-creator .group-head {
    border-bottom-color: color-mix(in srgb, var(--creator) 35%, var(--line));
}

.group.g-creator .group-title,
.group.g-creator .group-head .subtotal {
    color: var(--creator);
}

.group.g-recursive {
    border-color: color-mix(in srgb, var(--recursive) 45%, var(--line));
}

.group.g-recursive .group-head {
    border-bottom-color: color-mix(in srgb, var(--recursive) 35%, var(--line));
}

.group.g-recursive .group-title,
.group.g-recursive .group-head .subtotal {
    color: var(--recursive);
}

<!--
.group.g-scrabble {
    border-color: color-mix(in srgb, var(--scrabble) 45%, var(--line));
}

.group.g-scrabble .group-head {
    border-bottom-color: color-mix(in srgb, var(--scrabble) 35%, var(--line));
}

.group.g-scrabble .group-title,
.group.g-scrabble .group-head .subtotal {
    color: var(--scrabble);
}

-->
.group.g-shiny {
    border-color: color-mix(in srgb, var(--shiny) 45%, var(--line));
}

.group.g-shiny .group-head {
    border-bottom-color: color-mix(in srgb, var(--shiny) 35%, var(--line));
}

.group.g-shiny .group-title,
.group.g-shiny .group-head .subtotal {
    color: var(--shiny);
}

.group.g-foil {
    border-color: color-mix(in srgb, var(--foil) 45%, var(--line));
}

.group.g-foil .group-head {
    border-bottom-color: color-mix(in srgb, var(--foil) 35%, var(--line));
}

.group.g-foil .group-title,
.group.g-foil .group-head .subtotal {
    color: var(--foil);
}

.badge .odds {
    color: var(--muted);
}

.negative {
    color: var(--trash);
}

.sticker-line {
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
    color: var(--accent, #6cf);
    font-weight: 600;
}

.badge .chip-sticker {
    margin-left: 0;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    background: var(--accent, #6cf);
    color: #0b0f17;
    font-style: normal;
    font-size: 0.62rem;
    border: 1px solid #6cf;
    font-weight: 800;
    letter-spacing: 0.06em;
    vertical-align: middle;
    box-shadow: 0 0 2px 2px #6cf;
}

.badge .chip-sticker-name {
    margin-left: 0;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent, #6cf) 18%, transparent);
    color: var(--lighter);
    font-style: normal;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
}

/* High-contrast chips: labels carry meaning; hue is only a thin border hint. */
html.readable-names .badge .chip {
    color: #0b0d12;
    background: #f3f5fb;
    border-color: color-mix(in srgb, var(--tone, #8891a8) 50%, #0b0d12);
    opacity: 1;
}

html.readable-names .badge .chip-sticker,
html.readable-names .badge .chip-sticker-name {
    color: #0b0d12;
    background: #f3f5fb;
    border: 1px solid color-mix(in srgb, var(--tone, #8891a8) 45%, #0b0d12);
}

.badge .letter-rarity {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    grid-column: 1 / -1;
    font-size: 0.72rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.badge .letter-rarity-part b {
    color: var(--text);
    font-weight: 700;
    margin-right: 0.15rem;
}

.account-stickers {
    background: transparent;
}

.account-stickers.is-collapsed .history-head {
    border-bottom: none;
}

.account-stickers.is-collapsed .group-chevron {
    transform: rotate(-45deg);
}

.account-stickers.is-collapsed .stickers-body {
    display: none;
}

.account-stickers .history-head {
    background: color-mix(in srgb, var(--panel-soft) 88%, #0a0c12);
}

.account-stickers .history-head:hover {
    background: color-mix(in srgb, var(--panel-soft) 85%, var(--muted));
}

.stickers-head .stickers-sets-complete {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.stickers-summary {
    font-weight: 700;
    color: var(--text);
}

.stickers-body {
    padding: 0;
    background: transparent;
}

.stickers-tagline {
    margin: 0;
    padding: 0.75rem 1rem 0.85rem;
    font-size: 0.84rem;
    color: var(--muted);
}

.stickers-album {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sticker-set {
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.sticker-set.is-complete {
    border: none;
}

.sticker-set.is-collapsed .sticker-set-body {
    display: none;
}

.sticker-set.is-collapsed .sticker-set-chevron {
    transform: rotate(-45deg);
}

.sticker-set-head {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.55rem 0.7rem;
    align-items: center;
    width: 100%;
    padding: 0.55rem 1rem 0.45rem;
    border: none;
    background: color-mix(in srgb, var(--bg) 95%, var(--muted));
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.sticker-set-head:hover {
    background: var(--panel-soft);
    color: var(--text);
}

.sticker-set-head:hover .sticker-set-title {
    color: color-mix(in srgb, var(--text) 88%, var(--rare));
}

.sticker-set-icon {
    font-size: 1.45rem;
    line-height: 1;
    width: 1.7rem;
    text-align: center;
}

.sticker-set-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sticker-set-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.sticker-set-desc {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticker-set-track {
    display: block;
    grid-column: 1 / -1;
    height: 2px;
    margin: 0;
    background: color-mix(in srgb, var(--line) 70%, transparent);
}

.sticker-set-track > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--rare), var(--fabled));
}

.sticker-set.is-complete .sticker-set-track > span {
    background: var(--uncommon);
}

.sticker-set-stats {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
}

.sticker-set-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.sticker-set-of {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.sticker-set-chevron {
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.account-stickers .sticker-set-body {
    padding: 0.45rem 1rem 0.65rem;
    border-top: none;
    background: color-mix(in srgb, var(--panel) 90%, transparent);
}

.sticker-pills {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sticker-pill {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem 0.75rem;
    min-height: 0;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border-style: solid;
    border-color: transparent;
    border-width: 1px 3px;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: left;
    line-height: 1.2;
    word-break: break-word;
    background: transparent;
}

.sticker-pill.is-owned {
    background: var(--bg);
    border-color: color-mix(in srgb, var(--tone, var(--rare)) 62%, transparent);
    color: var(--text);
    box-shadow: none;
}

.sticker-pill.is-locked {
    background: color-mix(in srgb, var(--panel) 70%, transparent);
    border-color: color-mix(in srgb, var(--line) 70%, transparent);
    color: color-mix(in srgb, var(--muted) 48%, transparent);
    font-size: 0.88rem;
    font-weight: 600;
}

.sticker-pill-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sticker-pill-name {
    display: block;
}

.code-gloss {
    font-weight: 600;
    color: color-mix(in srgb, currentColor 72%, var(--muted));
}

.sticker-pill-date {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.sticker-pill-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    color: var(--tone, var(--text));
    white-space: nowrap;
    text-align: right;
}

.sticker-pill .sticker-emoji,
.sticker-pill .sticker-art {
    font-size: 1.45rem;
    line-height: 1;
    width: 1.7rem;
    height: 1.7rem;
    object-fit: contain;
    justify-self: center;
}

.sticker-pill .sticker-emoji {
    width: auto;
    height: auto;
}

.sticker-slot {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 8px;
    border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, transparent);
    background: color-mix(in srgb, var(--muted) 6%, transparent);
    justify-self: center;
}

.stickers-jump-top {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(3.4rem, calc(env(safe-area-inset-bottom, 0px) + 3.1rem));
    z-index: 40;
    width: 2.7rem;
    height: 2.7rem;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--line) 80%, var(--rare));
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 88%, var(--rare));
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.15s ease;
}

.stickers-jump-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.stickers-jump-top:hover {
    border-color: var(--rare);
}

.stickers-jump-chevron {
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.2rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-135deg);
}

html.page-home .stickers-jump-top,
html.page-leaderboard .stickers-jump-top,
html.page-roll .stickers-jump-top {
    display: none;
}

.error {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--mythic);
    border-radius: 12px;
    color: var(--mythic);
    text-align: center;
}

@media (max-width: 480px) {
    body {
        padding: 1.5rem 0.85rem 3rem;
    }

    .footer {
        padding: 0 0.85rem;
    }

    .stage {
        padding: 1.35rem 0.85rem;
    }

    .total {
        font-size: 2.1rem;
    }

    .stage-bar {
        margin-bottom: 0.55rem;
    }

    .stage-actions {
        gap: 1.2rem;
    }
}

@media (max-width: 520px) {
    .code-gloss {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tile, .group, .badge.is-entering, .tile.is-shiny, .tile.is-shiny.is-locked,
    .tile.is-foil, .tile.is-foil.is-locked,
    .tier.is-arriving, .tier.is-step, .tile.is-final-lock,
    .stage.is-revealed.is-landing,
    .stage.is-revealed.r-godly .tiles {
        animation: none;
    }

    .group-chevron, .tier, .stickers-jump-top,
    .stage, .tiles, .tile, .verdict, .stage-cta {
        transition: none;
    }
}

.infotab,
.changelogtab,
.contacttab {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.4rem 1.25rem;
    text-align: left;
}

.contacttab code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.88em;
    color: var(--lighter);
}

.info-tier-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .info-tier-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.75rem 2rem;
        align-items: start;
    }
}

.info-block + .info-block,
.info-tier-grid + .info-block {
    margin-top: 1.8rem;
}

.info-tier-grid .info-block + .info-block {
    margin-top: 0;
}

.info-whatis {
    margin-bottom: 1.8rem;
}

.info-credit {
    margin: 0.85rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.info-credit a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.info-credit a:hover {
    text-decoration: underline;
}

.info-privacy-provider {
    margin-top: 1rem;
}

.info-privacy-provider:first-of-type {
    margin-top: 0.65rem;
}

.info-privacy-provider h3 {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.info-privacy-provider p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.infotab h2,
.changelogtab h2,
.contacttab h2 {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
}

.info-caption {
    margin: 0 0 0.65rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.infotab p,
.contacttab p {
    margin: 0 0 0.75rem;
    max-width: 40rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.55;
    text-align: left;
}

.infotab p:last-child,
.contacttab p:last-child {
    margin-bottom: 0;
}

.contact-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    max-width: 36rem;
}

.contact-anon {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.contact-identity {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.contact-message {
    width: 100%;
    min-height: 8rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--line, #3a4258);
    background: var(--panel, #1b2133);
    color: inherit;
    font: inherit;
    resize: vertical;
}

.contact-done {
    margin: 0;
    color: var(--text);
    font-weight: 600;
}

.infotab code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.88em;
    color: var(--text);
}

.info-tiers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.info-tier {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: clamp(0.95rem, 2.8vw, 1.1rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.35;
}

.info-tier-name {
    text-align: left;
}

.info-tier-metric {
    flex-shrink: 0;
    color: var(--muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0;
    text-align: right;
}

.letter-census {
    list-style: none;
    margin: 0;
    padding: 0.45rem 0.4rem 0.3rem;
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 1.65rem 0.15rem;
    border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    border-radius: 10px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 55%, #0a0c12), var(--panel));
}

.info-letters h2 {
    margin-bottom: 0.2rem;
}

.letter-census-head {
    margin-bottom: 0.85rem;
}

.letter-census-head .info-caption {
    margin: 0;
    max-width: 22rem;
}

.letter-census-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    /*gap: 0.2rem;*/
    min-width: 0;
    padding: 0.15rem 0.1rem;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

.letter-census-glyph {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.letter-census-item.is-space .letter-census-glyph {
    color: var(--space);
}

.letter-census-track {
    position: relative;
    width: 100%;
    height: 2.45rem;
}

.letter-census-track::before {
    content: "";
    position: absolute;
    left: 22%;
    right: 22%;
    top: 50%;
    height: 2px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--text) 42%, var(--line));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--bg) 55%, transparent);
}

.letter-census-track::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: color-mix(in srgb, var(--text) 70%, var(--muted));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 88%, #0a0c12);
}

.letter-census-fill {
    position: absolute;
    left: 50%;
    width: 6px;
    transform: translateX(-50%);
    border-radius: 99px;
    z-index: 1;
}

.letter-census-item.is-hot .letter-census-fill {
    bottom: 50%;
    height: calc(var(--bar, 0) * 50%);
    background: color-mix(in srgb, var(--uncommon) 82%, #9dffc0);
    box-shadow: 0 0 8px color-mix(in srgb, var(--uncommon) 35%, transparent);
}

.letter-census-item.is-cold .letter-census-fill {
    top: 50%;
    height: calc(var(--bar, 0) * 50%);
    background: color-mix(in srgb, #ff4f6d 75%, #ffb0bc);
    box-shadow: 0 0 8px color-mix(in srgb, #ff4f6d 28%, transparent);
}

.letter-census-delta {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.letter-census-item.is-hot .letter-census-delta {
    color: var(--uncommon);
}

.letter-census-item.is-cold .letter-census-delta {
    color: #ff8a9a;
}

.letter-census-legend {
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.01em;
}

@media (max-width: 640px) {
    .letter-census {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

.changelog-body {
    margin: 0;
    padding: 0.85rem 1rem;
    background: color-mix(in srgb, var(--panel-soft) 88%, #0a0c12);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    border-radius: 12px;
    color: var(--muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    text-align: left;
    white-space: pre-wrap;
    overflow-x: auto;
}

.account-session-actions {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: stretch;
}

.logout-section {
    margin: 0;
    /*padding: 0.95rem 1rem;*/
    /*border: 1px solid var(--line);*/
    border-radius: 12px;
    /*background: var(--panel-soft);*/
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-danger {
    margin-top: 0;
    padding: 0.95rem 1rem;
    border: 1px solid color-mix(in srgb, #ff4f6d 35%, var(--line));
    border-radius: 12px;
    background: color-mix(in srgb, #ff4f6d 8%, var(--panel-soft));
}

@media (max-width: 520px) {
    .account-session-actions {
        grid-template-columns: 1fr;
    }
}

.account-danger-hint {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.account-danger-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.admin-report {
    margin-top: 0.85rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
    text-align: left;
}

.admin-report-title {
    margin: 0 0 0.55rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-report-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    color: var(--text);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
    line-height: 1.5;
}

.report-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.report-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

@media (max-width: 520px) {
    .report-pair {
        grid-template-columns: 1fr;
    }
}

.report-section {
    min-width: 0;
}

.report-header {
    margin: 0 0 0.15rem;
    color: #3ecf7a;
    font-size: inherit;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.report-empty {
    margin: 0;
    color: var(--muted);
}

.report-count-row,
.report-user-row,
.report-last-row,
.report-snitch-row {
    display: grid;
    gap: 0.35rem 0.65rem;
    align-items: baseline;
}

.report-count-row {
    grid-template-columns: minmax(0, 1fr) auto;
    border-bottom: thin solid var(--trash);
}

.report-count-label {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-count-value {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.report-user-row,
.report-last-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) auto;
}

.report-user-name,
.report-lastroll-who {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-user-provider,
.report-lastroll-what {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-user-when,
.report-lastroll-when {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.report-snitch-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.report-snitch-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-snitch-streak {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.report-feedback-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 0.05rem 0.55rem;
    align-items: baseline;
    margin-top: 0.2rem;
}

.feedback-header {
    display: flex;
}

.report-when {
    color: var(--godly);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-grow: 0;
}

.is-today {
    color: var(--mythic) !important;
}

.report-who {
    color: #7aa2ff;
    white-space: nowrap;
    flex-grow: 1;
    align-content: flex-start;
}

.report-text {
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
    grid-column: 2 / -1;
}

@media (max-width: 520px) {
    .report-feedback-row {
        grid-template-columns: auto auto;
    }

    .feedback-header {
        display: flex;
    }

    .report-text {
        grid-column: 2 / -1;
    }
}

.admin-notify {
    margin-top: 0.85rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
    text-align: left;
}

.admin-notify-form {
    display: grid;
    gap: 0.45rem;
}

.admin-notify-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-notify-user-pick,
.admin-notify-user-id,
.admin-notify-message {
    width: 100%;
    box-sizing: border-box;
    background: color-mix(in srgb, var(--bg) 72%, #06080e);
    border: 0;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    padding: 0.55rem 0.65rem;
}

.admin-notify-message {
    resize: vertical;
    min-height: 4.5rem;
}

.admin-notify-send {
    justify-self: start;
    margin-top: 0.2rem;
    background: color-mix(in srgb, var(--accent, #7aa2ff) 22%, var(--bg));
    border: 0;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
}

.admin-notify-status {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.admin-notify-status.is-error {
    color: #ff4f6d;
}

.delete-confirm {
    flex: 1 1 10rem;
    min-width: 0;
    background: color-mix(in srgb, var(--bg) 72%, #06080e);
    /*border: 1px solid var(--line);*/
    border: 0;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    padding: 0.55rem 0.65rem;
}

.delete-confirm:focus {
    outline: none;
    border-color: #ff4f6d;
}

.delete-account {
    background: color-mix(in srgb, #ff4f6d 18%, var(--bg));
    /*border: 1px solid color-mix(in srgb, #ff4f6d 45%, var(--line));*/
    border: 0;
    color: #ffb0bc;
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.delete-account:hover:not(:disabled) {
    border-color: #ff4f6d;
    color: #ffe0e5;
}

.delete-account:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.delete-error {
    margin: 0.65rem 0 0;
    color: #ff8a9a;
    font-size: 0.85rem;
}

/* colorjoe primary picker — theme overrides */
#user-color-joe.colorPicker {
    display: grid;
    grid-template-columns: 160px 16px;
    grid-template-rows: 160px auto;
    column-gap: 0.45rem;
    row-gap: 0.45rem;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

#user-color-joe .twod {
    float: none;
    margin: 0;
    grid-column: 1;
    grid-row: 1;
}

#user-color-joe .oned {
    float: none;
    margin: 0;
    grid-column: 2;
    grid-row: 1;
}

#user-color-joe .extras {
    float: none;
    margin: 0;
    width: auto;
    grid-column: 1 / -1;
    grid-row: 2;
}

#user-color-joe .extras .hex {
    float: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

#user-color-joe .extras .hex input {
    width: 5.5rem;
    margin: 0;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-soft);
    color: var(--text);
    font: inherit;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.82rem;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

#user-color-joe .extras .hex input:focus {
    outline: 2px solid var(--accent, #6cf);
    outline-offset: 1px;
}

#user-color-joe .twod,
#user-color-joe .twod .bg {
    width: 160px;
    height: 160px;
}

#user-color-joe .oned,
#user-color-joe .oned .bg {
    height: 160px;
}

#user-color-joe .oned,
#user-color-joe .oned .bg,
#user-color-joe .oned .pointer .shape {
    width: 16px;
}

#user-color-joe .oned .bg {
    border-color: var(--line);
}

/* HSL gradients (vendor CSS hardcodes #hslPicker) */
#user-color-joe .twod .bg1 {
    background: linear-gradient(
            to right,
            #ff0000 0%,
            #ffff00 17%,
            #00ff00 33%,
            #00ffff 50%,
            #0000ff 66%,
            #ff00ff 83%,
            #ff0000 100%
    );
}

#user-color-joe .twod .bg2 {
    background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(127, 127, 127, 1) 100%
    );
}

#user-color-joe .oned .bg {
    z-index: 1;
    background: linear-gradient(
            to bottom,
            rgba(255, 255, 255, 1) 0%,
            rgba(0, 0, 0, 0) 50%,
            rgba(0, 0, 0, 1) 100%
    );
}

.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    justify-content: center;
    padding: 0 1.25rem;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    backdrop-filter: blur(8px);
}

.footer-content {
    max-width: 720px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.55rem 10px max(0.55rem, env(safe-area-inset-bottom, 0px));
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.2rem 8px 2px 8px;
    border-top: 2px solid transparent;
}

.footer-link[aria-current="page"] {
    color: var(--text);
    border-top: 2px solid var(--fabled);
}

.footer-link:hover {
    color: var(--text);
    border-color: var(--fabled);
    transform: translateY(-1px);
}

.request-friend-button {
    padding: 0.64rem;
    border: 1px solid var(--user-color, var(--rare));
    background: color-mix(in srgb, var(--user-color, var(--rare)) 22%, var(--bg));
    border-radius: 8px;
}

.friends-add-toggle {
    padding: 0.67rem 0.8rem;
    font-size: 0.78rem;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}

#friends-add-btn {
    padding: 0.67rem 0.8rem;
    font-size: 0.78rem;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}

#friends-add-btn:hover {
    border-color: var(--rare);
}