:root {
    --paper: #f2f0e9;
    --paper-deep: #e7e3d9;
    --ink: #11110f;
    --muted: #706e66;
    --line: rgba(17, 17, 15, 0.14);
    --signal-red: #e04435;
    --signal-red-deep: #b92f25;
    --signal-green: #39d178;
    --signal-green-deep: #0c9a4a;
    --lime: #d9ff48;
    --white: #fffef8;
    --display: "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
    --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    color-scheme: light;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 16% 4%, rgba(217, 255, 72, 0.18), transparent 26rem),
        var(--paper);
    font-family: var(--display);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, p {
    margin-top: 0;
}

button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 4px;
}

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

.site-frame {
    position: fixed;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(17, 17, 15, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 15, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 70%);
}

.app-shell {
    min-height: 100vh;
}

.eyebrow {
    margin-bottom: 1rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.live-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--signal-green);
    box-shadow: 0 0 0 5px rgba(57, 209, 120, 0.16);
    animation: breathe 2s ease-in-out infinite;
}

.wordmark {
    display: inline-flex;
    align-items: flex-end;
    gap: 0.2rem;
    font-family: Roboto, Arial, sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.wordmark > span:last-child {
    padding-bottom: 0.18rem;
}

.wordmark-logo {
    width: 3.82rem;
    height: 3.82rem;
    flex: 0 0 auto;
    object-fit: contain;
}

.wordmark-light {
    color: var(--white);
}

.wordmark-light .wordmark-logo {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.7));
}

.button {
    display: inline-flex;
    min-height: 3.4rem;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.85rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-weight: 750;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button-wide {
    width: 100%;
    justify-content: space-between;
}

.button-primary {
    background: var(--ink);
    color: var(--white);
}

.button-primary:hover {
    background: #292925;
}

.button-ghost {
    border-color: var(--ink);
    background: transparent;
}

.button-ghost:hover {
    background: var(--paper-deep);
}

.button-quiet {
    border-color: var(--line);
    background: transparent;
}

.button-light {
    min-width: 14rem;
    justify-content: space-between;
    background: var(--white);
    color: var(--ink);
}

/* Landing */

.landing-page {
    display: flex;
    width: min(100%, 1500px);
    min-height: 100vh;
    margin: 0 auto;
    flex-direction: column;
    padding: 2rem clamp(1.25rem, 4vw, 4.5rem) 1.5rem;
}

.brand-bar, .lobby-header, .result-header, .arena-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.landing-grid {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1.2fr) minmax(22rem, 0.8fr);
    align-items: center;
    gap: clamp(3rem, 8vw, 9rem);
    padding: 5rem 0 4rem;
}

.hero-copy {
    animation: reveal-up 700ms both;
}

.searching-stat {
    margin: clamp(2rem, 5vh, 4rem) 0 clamp(2rem, 5vh, 4rem);
}

.searching-stat strong {
    font-family: var(--mono);
    font-size: clamp(4rem, 8vw, 12rem);
    font-weight: 600;
    letter-spacing: -0.12em;
    line-height: 0.7;
}

.signal-legend {
    display: flex;
    max-width: 31rem;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--line);
}

.signal-legend > div {
    display: grid;
    flex: 1;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.8rem;
    padding: 1.05rem 0;
}

.signal-legend > div + div {
    padding-left: 1.4rem;
    border-left: 1px solid var(--line);
}

.signal {
    grid-row: 1 / 3;
    width: 0.75rem;
    height: 2.5rem;
}

.signal-red { background: var(--signal-red); }
.signal-green { background: var(--signal-green); }

.signal-legend strong {
    font-size: 0.9rem;
}

.signal-legend small {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.66rem;
}

.entry-panel {
    position: relative;
    width: min(100%, 31rem);
    justify-self: end;
    overflow: hidden;
    padding: clamp(1.6rem, 3.5vw, 3.2rem);
    border: 1px solid rgba(17, 17, 15, 0.16);
    border-radius: 1rem;
    background: rgba(255, 254, 248, 0.9);
    box-shadow: 0 24px 65px rgba(17, 17, 15, 0.13);
    animation: reveal-up 700ms 120ms both;
    backdrop-filter: blur(16px);
}

.entry-panel::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--lime), var(--signal-green));
    content: "";
}

.entry-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.entry-heading h2, .entry-panel > h2 {
    margin-bottom: 0;
    font-size: clamp(2rem, 3vw, 3rem);
    letter-spacing: -0.06em;
    line-height: 1;
}

.entry-form {
    display: grid;
    gap: 1rem;
}

.entry-form label {
    display: grid;
    gap: 0.4rem;
}

.entry-form label > span {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.entry-form input {
    width: 100%;
    min-height: 3.45rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(17, 17, 15, 0.16);
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink);
    caret-color: var(--ink);
    transition: border 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.entry-form input::placeholder {
    color: rgba(17, 17, 15, 0.34);
}

.entry-form input:focus {
    border-color: var(--ink);
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(217, 255, 72, 0.45);
}

.entry-form .button {
    margin-top: 0.45rem;
}

.landing-page .button {
    min-height: 3.55rem;
    border-radius: 0.65rem;
}

.landing-page .button-primary {
    background: var(--ink);
    box-shadow: 0 10px 24px rgba(17, 17, 15, 0.16);
    color: var(--white);
}

.landing-page .button-primary:hover {
    background: #292925;
    box-shadow: 0 14px 28px rgba(17, 17, 15, 0.2);
}

.landing-page .button-ghost {
    border-color: rgba(17, 17, 15, 0.2);
    background: rgba(255, 255, 255, 0.45);
    color: var(--ink);
}

.landing-page .button-ghost:hover {
    border-color: var(--ink);
    background: white;
}

.landing-page button:focus-visible,
.landing-page a:focus-visible,
.landing-page input:focus-visible {
    outline-color: var(--ink);
}

.account-switch, .text-button {
    display: block;
    margin: 1rem auto 0;
    padding: 0.25rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.78rem;
}

.account-switch:hover, .text-button:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.or-divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.4rem 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.or-divider::before, .or-divider::after {
    height: 1px;
    flex: 1;
    background: var(--line);
    content: "";
}

.guest-note, .panel-copy {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.72rem;
    text-align: center;
}

.panel-copy {
    margin: 1.2rem 0 2rem;
    font-size: 1rem;
    text-align: left;
}

.form-error {
    margin-bottom: 1rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(224, 68, 53, 0.24);
    border-radius: 0.65rem;
    background: rgba(224, 68, 53, 0.09);
    color: #8b241d;
    font-size: 0.78rem;
}

.landing-footer, .lobby-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Lobby */

.lobby-page {
    display: flex;
    width: min(100%, 1500px);
    min-height: 100vh;
    margin: 0 auto;
    flex-direction: column;
    padding: 1.5rem clamp(1.25rem, 4vw, 4.5rem);
}

.lobby-header {
    display: grid;
    grid-template-columns: auto minmax(12rem, 1fr) auto auto auto auto;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem 0.7rem;
    border-bottom: 1px solid var(--line);
}

.player-search {
    position: relative;
    width: min(100%, 24rem);
    justify-self: center;
}

.player-search input {
    width: 100%;
    height: 2.7rem;
    padding: 0.65rem 0.8rem 0.65rem 2.45rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    outline: 0;
    background: rgba(255, 254, 248, 0.56);
    color: var(--ink);
    font-size: 0.78rem;
    transition: border-color 160ms ease, background 160ms ease;
}

.player-search input:focus {
    border-color: var(--ink);
    background: var(--white);
}

.player-search-icon {
    position: absolute;
    z-index: 1;
    top: 0.82rem;
    left: 1rem;
    width: 0.72rem;
    height: 0.72rem;
    border: 1.5px solid var(--muted);
    border-radius: 50%;
    pointer-events: none;
}

.player-search-icon::after {
    position: absolute;
    width: 0.4rem;
    height: 1.5px;
    right: -0.3rem;
    bottom: -0.14rem;
    background: var(--muted);
    content: "";
    transform: rotate(45deg);
}

.player-search-results {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    padding: 0.35rem;
    border: 1px solid var(--ink);
    background: var(--white);
    box-shadow: 8px 8px 0 rgba(17, 17, 15, 0.12);
}

.player-search-results a {
    display: flex;
    min-height: 2.8rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.78rem;
    font-weight: 700;
}

.player-search-results a:last-child {
    border-bottom: 0;
}

.player-search-results a:hover {
    background: var(--lime);
}

.player-search-results small, .player-search-empty {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.58rem;
}

.player-search-empty {
    display: block;
    padding: 0.8rem;
}

.header-link {
    position: relative;
    align-self: center;
    padding: 0.45rem 0 0.45rem 1rem;
    border-left: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.header-link::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 1rem;
    height: 1px;
    background: var(--ink);
    content: "";
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 160ms ease;
}

.header-link:hover {
    color: var(--ink);
}

.header-link:hover::after {
    transform: scaleX(1);
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.player-chip:hover .player-avatar {
    background: var(--ink);
    color: var(--lime);
}

.challenge-hub {
    position: relative;
    align-self: center;
}

.challenge-bell {
    position: relative;
}

.challenge-bell svg {
    width: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.challenge-bell.has-notifications {
    border-color: var(--ink);
    background: var(--lime);
}

.challenge-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    display: grid;
    min-width: 1.15rem;
    height: 1.15rem;
    place-items: center;
    padding: 0 0.22rem;
    border: 2px solid var(--paper);
    border-radius: 999px;
    background: var(--ink);
    color: var(--white);
    font-family: var(--mono);
    font-size: 0.52rem;
    font-weight: 800;
}

.challenge-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 0.7rem);
    right: 0;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(32rem, 72vh);
    overflow-y: auto;
    border: 1px solid var(--ink);
    background: var(--white);
    box-shadow: 8px 8px 0 rgba(17, 17, 15, 0.13);
}

.challenge-menu-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--ink);
}

.challenge-menu-heading strong {
    font-size: 0.85rem;
}

.challenge-menu-heading small,
.challenge-item small {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.challenge-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--line);
}

.challenge-item > a {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.challenge-item > a strong {
    overflow: hidden;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.challenge-incoming {
    background: rgba(217, 255, 72, 0.16);
}

.challenge-actions {
    display: flex;
    gap: 0.35rem;
}

.challenge-item button {
    min-height: 1.9rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--ink);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
}

.challenge-accept {
    background: var(--ink);
    color: var(--white);
}

.challenge-decline,
.challenge-cancel {
    background: transparent;
}

.challenge-item button:hover {
    background: var(--lime);
    color: var(--ink);
}

.challenge-empty {
    margin: 0;
    padding: 1.25rem 1rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
}

.challenge-error {
    display: block;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--line);
    color: var(--signal-red-deep);
    font-family: var(--mono);
    font-size: 0.6rem;
}

.player-avatar {
    display: grid;
    width: 2.6rem;
    height: 2.6rem;
    place-items: center;
    border: 1px solid var(--ink);
    border-radius: 50%;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
}

.player-chip > span:nth-child(2), .chip-rating {
    display: flex;
    flex-direction: column;
}

.player-chip strong {
    font-size: 0.8rem;
}

.player-chip small, .chip-rating small {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chip-rating {
    min-width: 4.2rem;
    margin-left: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--line);
    font-family: var(--mono);
    font-weight: 700;
}

.icon-button {
    display: grid;
    width: 2.6rem;
    height: 2.6rem;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
    border-color: var(--ink);
    transform: translate(2px, -2px);
}

.lobby-grid {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1.35fr) minmax(22rem, 0.65fr);
    gap: clamp(2rem, 6vw, 7rem);
    padding: clamp(3rem, 7vh, 6.5rem) 0;
}

.play-stage {
    align-self: center;
    animation: reveal-up 650ms both;
}

.play-stage h1 {
    margin-bottom: 1.5rem;
    font-size: clamp(4rem, 7.8vw, 8rem);
    font-weight: 800;
    letter-spacing: -0.085em;
    line-height: 0.84;
}

.play-button {
    display: flex;
    width: min(100%, 32rem);
    min-height: 6.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.8rem;
    border: 0;
    background: var(--ink);
    color: var(--white);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.play-button:hover {
    transform: translate(-5px, -5px);
    box-shadow: 10px 10px 0 var(--lime);
}

.play-button-label {
    font-size: 1.55rem;
    font-weight: 750;
    letter-spacing: -0.04em;
}

.play-button-arrow {
    font-size: 2rem;
    transition: transform 180ms ease;
}

.play-button:hover .play-button-arrow {
    transform: translateX(8px);
}

.rule-strip {
    display: flex;
    width: min(100%, 32rem);
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.2rem;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
}

.rule-strip b {
    margin-right: 0.25rem;
    color: var(--ink);
}

.leaderboard-panel {
    align-self: center;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border: 1px solid var(--ink);
    background: rgba(255, 254, 248, 0.7);
    box-shadow: 10px 10px 0 var(--paper-deep);
    animation: reveal-up 650ms 100ms both;
}

.panel-title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    margin-bottom: 1.4rem;
}

.panel-title-row .eyebrow {
    margin-bottom: 0.4rem;
}

.panel-title-row h2 {
    margin: 0;
    font-size: 2.4rem;
    letter-spacing: -0.06em;
}

.season-label {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.58rem;
    text-transform: uppercase;
}

.leaderboard-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.leaderboard-list li {
    display: grid;
    grid-template-columns: 2.2rem 1fr auto;
    align-items: center;
    gap: 0.6rem;
    min-height: 3.5rem;
    border-top: 1px solid var(--line);
}

.leaderboard-list li.is-current {
    margin-inline: -0.7rem;
    padding-inline: 0.7rem;
    background: var(--lime);
}

.full-leaderboard-page {
    width: min(100%, 92rem);
    min-height: 100vh;
    margin: 0 auto;
    padding: 1.5rem clamp(1.25rem, 4vw, 4.5rem) 5rem;
}

.full-leaderboard-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.full-leaderboard-shell {
    width: min(100%, 48rem);
    margin: clamp(3.5rem, 8vh, 7rem) auto 0;
}

.full-leaderboard-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.full-leaderboard-title .eyebrow {
    margin-bottom: 0.45rem;
}

.full-leaderboard-title h1 {
    margin: 0;
    font-size: clamp(3.2rem, 8vw, 6rem);
    letter-spacing: -0.075em;
    line-height: 0.9;
}

.leaderboard-list-full {
    border-bottom: 1px solid var(--line);
}

.leaderboard-list-full li {
    grid-template-columns: 3.2rem 1fr auto;
    min-height: 4.4rem;
    padding-inline: 0.7rem;
}

.leaderboard-list-full li.is-current {
    margin-inline: 0;
}

.leaderboard-list-full .leader-rating {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.leaderboard-list-full .leader-rating small {
    color: var(--muted);
    font-size: 0.52rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Player profile */

.profile-page {
    width: min(100%, 92rem);
    min-height: 100vh;
    margin: 0 auto;
    padding: 1.5rem clamp(1.25rem, 4vw, 4.5rem) 5rem;
}

.profile-shell {
    width: min(100%, 68rem);
    margin: clamp(3rem, 7vh, 6rem) auto 0;
}

.profile-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--ink);
}

.profile-title .eyebrow {
    margin-bottom: 0.55rem;
}

.profile-title h1 {
    max-width: 14ch;
    margin: 0;
    font-size: clamp(3.5rem, 8vw, 7rem);
    letter-spacing: -0.08em;
    line-height: 0.84;
    overflow-wrap: anywhere;
}

.profile-title > span {
    display: block;
    margin-top: 1rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.profile-challenge-action {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 0.65rem;
}

.challenge-button {
    display: inline-flex;
    min-width: 13.5rem;
    min-height: 3.7rem;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--white);
    cursor: pointer;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.challenge-button:hover:not(:disabled) {
    transform: translate(-3px, -3px);
    box-shadow: 6px 6px 0 var(--lime);
}

.challenge-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.profile-challenge-action small {
    max-width: 20rem;
    color: var(--muted);
    font-size: 0.68rem;
    text-align: right;
}

.profile-challenge-action small.is-error {
    color: var(--signal-red-deep);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-bottom: 1px solid var(--line);
}

.profile-stats article {
    min-height: 8.5rem;
    padding: 1.4rem 1.2rem;
    border-right: 1px solid var(--line);
}

.profile-stats article:last-child {
    border-right: 0;
}

.profile-stats span {
    display: block;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-stats strong {
    display: block;
    margin-top: 0.7rem;
    font-size: clamp(2.2rem, 5vw, 3.7rem);
    letter-spacing: -0.07em;
    line-height: 1;
}

.head-to-head-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0.7rem 2rem;
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: var(--ink);
    color: var(--white);
}

.head-to-head-card h2 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: -0.05em;
}

.head-to-head-score {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--mono);
    font-size: 0.7rem;
}

.head-to-head-score b {
    color: var(--lime);
    font-size: 2.2rem;
}

.head-to-head-score i {
    color: var(--muted);
    font-size: 1.4rem;
    font-style: normal;
}

.head-to-head-card > small {
    grid-column: 1 / -1;
    color: rgba(255, 254, 248, 0.6);
    font-family: var(--mono);
    font-size: 0.58rem;
    text-transform: uppercase;
}

.match-history-section {
    margin-top: 4rem;
}

.match-history-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.match-history-heading .eyebrow {
    margin-bottom: 0.3rem;
}

.match-history-heading h2 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    letter-spacing: -0.065em;
}

.match-history-heading > span {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
}

.match-history-list {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--line);
    list-style: none;
}

.match-history-list li {
    display: grid;
    grid-template-columns: 4rem minmax(10rem, 1fr) 8rem 5rem 6.5rem;
    align-items: center;
    gap: 1rem;
    min-height: 4.7rem;
    border-top: 1px solid var(--line);
}

.history-result {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.history-win {
    color: var(--signal-green-deep);
}

.history-loss {
    color: var(--signal-red-deep);
}

.history-opponent, .history-reaction {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.history-opponent small, .history-reaction small {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.55rem;
    text-transform: uppercase;
}

.history-opponent a {
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-opponent a:hover {
    text-decoration: underline;
}

.history-reaction b, .history-rating, .match-history-list time {
    font-family: var(--mono);
    font-size: 0.66rem;
}

.history-rating.positive {
    color: var(--signal-green-deep);
}

.history-rating.negative {
    color: var(--signal-red-deep);
}

.match-history-list time {
    color: var(--muted);
    text-align: right;
}

.match-history-empty {
    padding: 2.5rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}

.history-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 1.5rem;
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
}

.history-pagination a:last-child {
    text-align: right;
}

.history-pagination a:hover {
    text-decoration: underline;
}


.rank, .leader-rating {
    font-family: var(--mono);
    font-size: 0.75rem;
}

.leader-rating {
    font-weight: 700;
}

.leader-name {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.leader-name strong {
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leader-name small {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.56rem;
    text-transform: uppercase;
}

.empty-board {
    display: flex;
    min-height: 16rem;
    align-items: end;
    justify-content: space-between;
    border-top: 1px solid var(--line);
}

.empty-board > span {
    color: var(--paper-deep);
    font-family: var(--mono);
    font-size: 7rem;
    font-weight: 800;
    line-height: 0.8;
}

.empty-board p {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
    text-align: right;
}

.queue-visual {
    display: flex;
    gap: 0.55rem;
    margin-bottom: 2.5rem;
}

.queue-visual span {
    width: 1.25rem;
    height: 4.2rem;
    background: var(--ink);
    animation: queue-bars 1.2s ease-in-out infinite;
}

.queue-visual span:nth-child(2) { animation-delay: 140ms; }
.queue-visual span:nth-child(3) { animation-delay: 280ms; }

.queue-status {
    margin: 0 0 2rem;
    color: var(--muted);
    font-size: 1rem;
}

.queue-status strong {
    color: var(--ink);
}

.queue-status span {
    font-family: var(--mono);
    font-size: 0.72rem;
}

.search-dots {
    display: inline-block;
    width: 1ch;
    overflow: hidden;
    vertical-align: bottom;
    animation: search-dots 1.3s steps(4, end) infinite;
}

/* Game */

.game-arena, .result-page {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: flex;
    min-width: 320px;
    flex-direction: column;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    transition: background-color 70ms linear;
}

.game-arena {
    background: #181817;
    color: var(--white);
    cursor: crosshair;
}

.game-arena::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 5vw 5vw;
    content: "";
}

.game-arena[data-phase="wait"], .game-arena[data-phase="false-start"] {
    background: var(--signal-red);
}

.game-arena[data-phase="press"] {
    background: var(--signal-green-deep);
}

.game-arena[data-phase="locked"] {
    background: #141b17;
}

.arena-header, .arena-footer, .result-header {
    position: relative;
    z-index: 1;
    min-height: 5.2rem;
    padding: 1.35rem clamp(1.25rem, 4vw, 4rem);
    border-color: rgba(255, 255, 255, 0.22);
    color: var(--white);
}

.arena-header, .result-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.versus-chip {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    text-transform: uppercase;
}

.versus-chip i {
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-style: normal;
    font-size: 0.55rem;
}

.match-id {
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.arena-center {
    position: relative;
    z-index: 1;
    display: grid;
    flex: 1;
    place-content: center;
    padding: 2rem;
    text-align: center;
}

.arena-message {
    margin: 0;
    font-family: var(--mono);
    font-size: clamp(5.5rem, 18vw, 15rem);
    font-weight: 800;
    letter-spacing: -0.09em;
    line-height: 0.75;
}

.game-arena[data-phase="countdown"] .arena-message {
    animation: count-pop 1s ease-out infinite;
}

.game-arena[data-phase="press"] .arena-message {
    animation: press-in 140ms ease-out both;
}

.arena-footer {
    display: flex;
    min-height: auto;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.62);
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* Result */

.result-page {
    background: #11110f;
    color: var(--white);
    user-select: auto;
}

.result-page::before {
    position: absolute;
    top: 14%;
    right: -10vw;
    width: 52vw;
    height: 52vw;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    box-shadow: 0 0 0 7vw rgba(255, 255, 255, 0.02), 0 0 0 14vw rgba(255, 255, 255, 0.015);
    content: "";
}

.result-win::after, .result-loss::after, .result-draw::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 0.65rem;
    height: 100%;
    background: var(--signal-green);
    content: "";
}

.result-loss::after { background: var(--signal-red); }
.result-draw::after { background: var(--lime); }

.result-header > span:last-child {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.result-main {
    position: relative;
    z-index: 1;
    width: min(100%, 70rem);
    margin: auto;
    padding: 3rem clamp(1.5rem, 5vw, 5rem);
    animation: reveal-up 600ms both;
}

.result-main .eyebrow {
    color: rgba(255, 255, 255, 0.55);
}

.result-main h1 {
    margin-bottom: 1rem;
    font-size: clamp(4rem, 9vw, 9rem);
    letter-spacing: -0.085em;
    line-height: 0.85;
}

.reaction-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
    margin: 3rem 0;
    padding: 1.4rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.reaction-player {
    display: flex;
    flex-direction: column;
}

.reaction-player:last-child {
    text-align: right;
}

.reaction-player > span, .reaction-player small {
    color: rgba(255, 255, 255, 0.52);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reaction-player strong {
    font-family: var(--mono);
    font-size: clamp(1.8rem, 4vw, 3.6rem);
    letter-spacing: -0.07em;
}

.reaction-player.is-winner strong {
    color: var(--signal-green);
}

.versus {
    color: rgba(255, 255, 255, 0.35);
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.rating-result {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.rating-result > span {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.rating-result strong {
    font-family: var(--mono);
    font-size: 2rem;
}

.rating-result em {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-style: normal;
}

.challenge-result-record em {
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
}

.positive { color: var(--signal-green); }
.negative { color: var(--signal-red); }

.result-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.rematch-button:disabled {
    cursor: default;
    opacity: 0.72;
    transform: none;
}

.rematch-status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 1rem 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.rematch-status span {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 0 0 rgba(217, 255, 72, 0.45);
    animation: rematch-pulse 1.6s infinite;
}

@keyframes rematch-pulse {
    70% { box-shadow: 0 0 0 0.45rem rgba(217, 255, 72, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 255, 72, 0); }
}

.text-link-light {
    padding: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
}

.loading-screen, .route-message {
    display: grid;
    min-height: 100vh;
    place-content: center;
    padding: 2rem;
    text-align: center;
}

.loading-pulse {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--ink);
    animation: breathe 1s ease-in-out infinite;
}

.route-message h1 {
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: -0.07em;
}

#blazor-error-ui {
    position: fixed;
    z-index: 1000;
    right: 1rem;
    bottom: 1rem;
    display: none;
    max-width: 28rem;
    padding: 0.9rem 3rem 0.9rem 1rem;
    background: var(--ink);
    box-shadow: 7px 7px 0 var(--signal-red);
    color: var(--white);
    font-size: 0.78rem;
}

#blazor-error-ui .reload {
    margin-left: 0.6rem;
    border-bottom: 1px solid currentColor;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 0.55rem;
    right: 0.65rem;
    border: 0;
    background: none;
    color: var(--white);
    cursor: pointer;
    font-size: 1.2rem;
}

.blazor-error-boundary {
    padding: 1rem;
    background: var(--signal-red);
    color: white;
}

.validation-message {
    color: var(--signal-red-deep);
    font-size: 0.75rem;
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes breathe {
    0%, 100% { opacity: 0.55; transform: scale(0.86); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes queue-bars {
    0%, 100% { transform: scaleY(0.45); transform-origin: bottom; }
    50% { transform: scaleY(1); transform-origin: bottom; }
}

@keyframes search-dots {
    from { width: 0; }
    to { width: 1.2em; }
}

@keyframes count-pop {
    0% { opacity: 0; transform: scale(0.7); }
    20% { opacity: 1; transform: scale(1); }
    85% { opacity: 1; }
    100% { opacity: 0; transform: scale(1.06); }
}

@keyframes press-in {
    from { transform: scale(0.72); }
    to { transform: scale(1); }
}

@media (max-width: 1100px) {
    .lobby-header {
        grid-template-columns: auto minmax(12rem, 1fr) auto auto auto;
    }

    .lobby-header > .wordmark {
        grid-column: 1;
        grid-row: 1;
    }

    .lobby-header > .player-search {
        grid-column: 2;
        grid-row: 1;
    }

    .lobby-header > .player-chip {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-end;
        padding-top: 0.7rem;
        border-top: 1px solid var(--line);
    }

    .lobby-header > .challenge-hub {
        grid-column: 3;
        grid-row: 1;
    }

    .lobby-header > .header-link {
        grid-column: 4;
        grid-row: 1;
    }

    .lobby-header > form {
        grid-column: 5;
        grid-row: 1;
    }
}

@media (max-width: 900px) {
    .landing-grid, .lobby-grid {
        grid-template-columns: 1fr;
    }

    .landing-grid {
        gap: 3.5rem;
        padding: 4rem 0;
    }

    .entry-panel {
        width: min(100%, 34rem);
        margin-inline: auto;
    }

    .lobby-grid {
        padding: 4rem 0;
    }

    .play-stage h1 {
        font-size: clamp(4rem, 14vw, 7rem);
    }

    .play-button, .rule-strip {
        width: 100%;
    }

    .leaderboard-panel {
        width: 100%;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-stats article:nth-child(even) {
        border-right: 0;
    }

    .profile-stats article:not(:last-child) {
        border-bottom: 1px solid var(--line);
    }

    .match-history-list li {
        grid-template-columns: 3.5rem minmax(9rem, 1fr) 7rem 4rem;
    }

    .match-history-list time {
        display: none;
    }
}

@media (max-width: 600px) {
    .landing-page, .lobby-page, .profile-page {
        padding: 1.1rem;
    }

    .match-id {
        display: none;
    }

    .landing-grid {
        align-items: start;
        padding: 3.5rem 0 3rem;
    }

    .searching-stat {
        margin-bottom: 2.5rem;
    }

    .searching-stat strong {
        font-size: clamp(6rem, 34vw, 10rem);
    }

    .signal-legend {
        flex-direction: column;
    }

    .signal-legend > div + div {
        padding-left: 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .entry-panel {
        padding: 1.4rem;
        border-radius: 0.85rem;
        box-shadow: 0 18px 45px rgba(17, 17, 15, 0.13);
    }

    .landing-footer, .lobby-footer {
        display: block;
    }

    .lobby-header {
        grid-template-columns: 1fr auto auto auto;
        padding-inline: 0;
    }

    .lobby-header .wordmark > span:last-child {
        display: none;
    }

    .lobby-header > .player-search {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }

    .lobby-header > .player-chip {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-content: space-between;
        padding-top: 1rem;
        border-top: 1px solid var(--line);
    }

    .lobby-header > .challenge-hub {
        grid-column: 2;
        grid-row: 1;
    }

    .lobby-header .header-link {
        grid-column: 3;
        grid-row: 1;
    }

    .lobby-header form {
        grid-column: 4;
        grid-row: 1;
    }

    .challenge-menu {
        position: fixed;
        top: 5.25rem;
        right: 1rem;
        left: 1rem;
        width: auto;
    }

    .full-leaderboard-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

    .leaderboard-list-full li {
        grid-template-columns: 2.7rem 1fr auto;
        padding-inline: 0.35rem;
    }

    .profile-shell {
        margin-top: 3rem;
    }

    .profile-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-title h1 {
        font-size: clamp(3.3rem, 18vw, 5.5rem);
    }

    .profile-challenge-action {
        align-items: stretch;
    }

    .profile-challenge-action small {
        text-align: left;
    }

    .profile-stats article {
        min-height: 7rem;
        padding: 1.1rem 0.8rem;
    }

    .head-to-head-card {
        grid-template-columns: 1fr;
    }

    .head-to-head-score {
        justify-content: space-between;
    }

    .match-history-list li {
        grid-template-columns: 3.2rem minmax(0, 1fr) auto;
        gap: 0.65rem;
        padding-block: 0.75rem;
    }

    .history-reaction {
        align-items: end;
    }

    .history-rating {
        grid-column: 2 / -1;
        grid-row: 2;
    }

    .history-pagination {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .history-pagination b {
        grid-column: 1 / -1;
        grid-row: 1;
        text-align: center;
    }

    .play-stage h1 {
        font-size: 4rem;
    }

    .rule-strip {
        display: grid;
    }

    .arena-header {
        align-items: start;
    }

    .arena-header .wordmark > span:last-child {
        display: none;
    }

    .versus-chip {
        flex-direction: column;
        align-items: end;
        gap: 0.1rem;
    }

    .versus-chip i {
        display: none;
    }

    .arena-message {
        font-size: clamp(4.3rem, 23vw, 8rem);
    }

    .arena-footer {
        gap: 1rem;
    }

    .arena-footer span:last-child {
        text-align: right;
    }

    .reaction-comparison {
        gap: 0.8rem;
    }

    .reaction-player strong {
        font-size: 1.3rem;
    }

    .result-main h1 {
        font-size: 3.7rem;
    }

    .result-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .button-light {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}
