/* ==========================================================================
   Игровая страница: лобби, настройки, трасса, HUD, результаты
   ========================================================================== */

.game-page {
    padding-bottom: 10px;
}

/* ---------- Лобби ---------- */

.lobby {
    display: grid;
    grid-template-columns: minmax(0, 1.03fr) minmax(410px, 0.97fr);
    gap: clamp(32px, 5vw, 76px);
    align-items: start;
}

.lobby__intro {
    padding-top: 26px;
}

.lobby__intro h1 {
    margin: 18px 0 22px;
    font-size: clamp(2.6rem, 5.1vw, 4.7rem);
    line-height: 0.96;
    letter-spacing: -0.05em;
}

.lobby__lead {
    max-width: 565px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.perks {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.perk {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.perk__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 43px;
    height: 43px;
    border: 1px solid rgba(255, 176, 32, 0.18);
    border-radius: 12px;
    color: var(--accent);
    background: rgba(255, 176, 32, 0.06);
}

.perk__icon svg {
    width: 22px;
    height: 22px;
}

.perk strong {
    display: block;
    margin-bottom: 3px;
    color: #e6edfc;
    font-size: 0.9rem;
    font-weight: 700;
}

.perk span {
    display: block;
    color: var(--muted-2);
    font-size: 0.79rem;
    line-height: 1.5;
}

.lobby__facts {
    display: flex;
    gap: 34px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.fact strong {
    display: block;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.fact span {
    display: block;
    margin-top: 5px;
    color: var(--muted-2);
    font-size: 0.7rem;
    line-height: 1.35;
}

/* ---------- Карточка настроек ---------- */

.setup {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    border-color: rgba(255, 176, 32, 0.13);
}

.setup__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.setup__eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--muted-2);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.setup__head h2 {
    font-size: 1.5rem;
}

.setup__badge {
    padding: 5px 9px;
    border: 1px solid rgba(255, 176, 32, 0.22);
    border-radius: 7px;
    background: rgba(255, 176, 32, 0.07);
    color: var(--accent);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.picker-filter {
    display: flex;
    gap: 5px;
    padding: 4px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.018);
}

.picker-filter__btn {
    flex: 1 1 0;
    min-height: 30px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease;
}

.picker-filter__btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
}

.picker-filter__btn.is-active {
    color: #1b1105;
    background: linear-gradient(135deg, #ffd15c, #ffa134 58%, #ff7240);
    box-shadow: 0 6px 14px rgba(255, 128, 45, 0.18);
}

.text-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 224px;
    padding-right: 4px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 170, 220, 0.25) transparent;
}

.text-picker::-webkit-scrollbar {
    width: 5px;
}

.text-picker::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 170, 220, 0.22);
}

.text-option {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.018);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.text-option:hover {
    border-color: rgba(255, 176, 32, 0.28);
    background: rgba(255, 176, 32, 0.04);
}

.text-option.is-selected {
    border-color: rgba(255, 176, 32, 0.55);
    background: rgba(255, 176, 32, 0.08);
    box-shadow: 0 0 0 1px rgba(255, 176, 32, 0.14);
}

.text-option__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.text-option__title {
    overflow: hidden;
    color: #e9effc;
    font-size: 0.84rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-option__meta {
    color: var(--muted-2);
    font-size: 0.66rem;
    font-weight: 600;
}

.text-option.is-selected .text-option__meta {
    color: #d8b268;
}

.text-picker__empty {
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted);
    font-size: 0.76rem;
    text-align: center;
}

.custom-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px dashed rgba(148, 170, 220, 0.24);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.custom-toggle:hover {
    color: var(--accent);
    border-color: rgba(255, 176, 32, 0.4);
    background: rgba(255, 176, 32, 0.04);
}

.custom-toggle.is-active {
    color: var(--accent);
    border-color: rgba(255, 176, 32, 0.45);
    background: rgba(255, 176, 32, 0.06);
}

.custom-toggle__plus {
    font-size: 1rem;
    line-height: 1;
}

.custom-editor {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-top: 2px;
}

.custom-editor__textarea {
    min-height: 112px !important;
    font-size: 0.82rem !important;
}

.custom-editor__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted-2);
    font-size: 0.67rem;
    font-variant-numeric: tabular-nums;
}

.custom-editor__meta button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 0.67rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.custom-editor__meta button:hover {
    color: var(--accent);
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 18px;
}

.track-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(3, 8, 17, 0.34);
}

.track-summary__main {
    min-width: 0;
}

.track-summary__label {
    display: block;
    overflow: hidden;
    color: #e9effc;
    font-size: 0.83rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-summary__meta {
    display: block;
    margin-top: 2px;
    color: var(--muted-2);
    font-size: 0.66rem;
}

.start-btn {
    justify-content: space-between;
    min-height: 54px;
    padding-inline: 20px;
}

.start-btn kbd {
    padding: 3px 7px;
    border: 1px solid rgba(20, 12, 3, 0.18);
    border-radius: 5px;
    background: rgba(20, 12, 3, 0.13);
    color: rgba(27, 17, 5, 0.72);
    font-size: 0.61rem;
    font-weight: 800;
}

.setup__auth-hint {
    margin-top: -5px;
}

.setup__auth-hint a {
    font-weight: 700;
}

.mini-board {
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.mini-board__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    color: var(--muted-2);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mini-board__head a {
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.mini-board__head a:hover {
    color: var(--accent);
}

.mini-board__list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mini-board__empty {
    padding: 7px 4px;
    color: var(--muted-2);
    font-size: 0.69rem;
}

.mini-board__place {
    margin-top: 3px;
    padding: 6px 5px;
    border-top: 1px solid var(--line);
    color: var(--accent);
    font-size: 0.69rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mini-entry {
    display: grid;
    grid-template-columns: 15px 24px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    min-height: 29px;
    padding: 2px 5px;
    border-radius: 7px;
    font-size: 0.7rem;
}

.mini-entry.is-me {
    background: rgba(255, 176, 32, 0.08);
}

.mini-entry__rank {
    color: var(--muted-2);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mini-entry__nick {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-entry__score {
    color: var(--accent);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mini-entry__speed {
    color: var(--muted-2);
    font-size: 0.63rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- Арена ---------- */

.arena {
    padding: 14px;
    border: 1px solid rgba(255, 176, 32, 0.12);
    border-radius: 21px;
    background:
        radial-gradient(800px 250px at 50% -20%, rgba(255, 176, 32, 0.07), transparent 65%),
        linear-gradient(180deg, rgba(15, 24, 43, 0.92), rgba(7, 12, 22, 0.98));
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.arena__top {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 2px 3px 12px;
}

.arena__title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.arena__title > div {
    min-width: 0;
}

.arena__label {
    display: block;
    color: var(--muted-2);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.arena__title strong {
    display: block;
    overflow: hidden;
    max-width: 250px;
    font-size: 0.9rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arena__progress {
    flex: 1;
    max-width: 390px;
    margin-inline: auto;
}

.progress__labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    color: var(--muted-2);
    font-size: 0.63rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
}

.progress__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffb020, #ff7a3d);
    box-shadow: 0 0 12px rgba(255, 150, 40, 0.35);
    transition: width 0.18s ease;
}

.arena__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud {
    display: grid;
    grid-template-columns: minmax(150px, 1.35fr) repeat(3, minmax(80px, 0.75fr)) minmax(88px, 0.8fr);
    gap: 1px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--line-soft);
}

.hud__item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 54px;
    padding: 8px 13px;
    background: #0a1220;
}

.hud__label {
    color: var(--muted-2);
    font-size: 0.57rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.hud__item strong {
    overflow: hidden;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.hud__item strong small {
    color: var(--muted-2);
    font-size: 0.59rem;
    font-weight: 600;
}

.hud__item--health {
    gap: 7px;
}

.hud__item--key {
    align-items: flex-start;
}

.health-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 13px;
}

.health-bar__segment {
    flex: 1;
    height: 9px;
    border-radius: 3px;
    background: linear-gradient(90deg, #59e8a9, #a4f4cb);
    box-shadow: 0 0 8px rgba(88, 230, 162, 0.18);
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.health-bar__segment.is-damaged {
    background: linear-gradient(90deg, #ff415f, #ff835f);
    box-shadow: 0 0 9px rgba(255, 84, 112, 0.35);
}

.health-bar.is-critical {
    animation: health-pulse 1s ease-in-out infinite;
}

@keyframes health-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.55;
    }
}

.keycap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid rgba(255, 176, 32, 0.4);
    border-radius: 7px;
    background: linear-gradient(180deg, #1b2942, #0d1728);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.keycap--space {
    padding-inline: 10px;
    font-family: var(--font-sans);
    font-size: 0.56rem;
    letter-spacing: 0.08em;
}

#hud-combo.is-pulse {
    animation: combo-pop 0.26s ease-out;
}

@keyframes combo-pop {
    0% {
        color: #fff;
        transform: scale(1.25);
    }
    100% {
        color: var(--text);
        transform: scale(1);
    }
}

.canvas-wrap {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    background: #040812;
}

#road {
    display: block;
    width: 100%;
    height: clamp(430px, 60vh, 700px);
    touch-action: none;
}

.stage-vignette {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(2, 5, 12, 0.32), transparent 18%, transparent 72%, rgba(2, 5, 12, 0.42)),
        radial-gradient(ellipse at center, transparent 55%, rgba(2, 5, 12, 0.4) 100%);
    box-shadow: inset 0 0 70px 12px rgba(0, 0, 0, 0.28);
}

.countdown {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(3, 7, 15, 0.32), rgba(3, 7, 15, 0.06) 58%, transparent 70%);
}

.countdown span {
    color: #fff8e8;
    font-family: var(--font-display);
    font-size: clamp(5.5rem, 14vw, 9.5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.06em;
    text-shadow: 0 0 55px rgba(255, 176, 32, 0.5), 0 8px 40px rgba(0, 0, 0, 0.6);
}

.countdown.is-go span {
    color: var(--accent);
    font-size: clamp(2rem, 6vw, 4.2rem);
    letter-spacing: 0.06em;
}

.countdown span.is-pop {
    animation: countdown-pop 0.36s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

@keyframes countdown-pop {
    from {
        opacity: 0;
        transform: scale(0.55);
    }
    55% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pause-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 7, 15, 0.68);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.pause-overlay__inner {
    width: min(390px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(11, 18, 33, 0.97);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    text-align: center;
}

.pause-overlay__eyebrow {
    color: var(--accent);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.pause-overlay h2 {
    margin: 8px 0 8px;
    font-size: 1.8rem;
}

.pause-overlay p {
    color: var(--muted);
    font-size: 0.82rem;
}

.pause-overlay .pause-overlay__hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--muted-2);
    font-size: 0.74rem;
}

.pause-overlay__hint .keycap {
    min-width: 28px;
    height: 24px;
    font-size: 0.72rem;
}

.pause-overlay__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.damage-flash {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(ellipse at center, rgba(255, 40, 60, 0.03) 38%, rgba(255, 40, 60, 0.2) 100%);
    box-shadow: inset 0 0 100px 26px rgba(255, 45, 65, 0.55);
}

.damage-flash.is-active {
    animation: damage-flash 0.34s ease-out;
}

@keyframes damage-flash {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ---------- Панель ввода ---------- */

.typing-panel {
    margin: 0 0 12px;
    padding: 9px 20px 12px;
    border: 1px solid rgba(255, 176, 32, 0.18);
    border-radius: 13px;
    background:
        radial-gradient(600px 80px at 50% 0%, rgba(255, 176, 32, 0.06), transparent 75%),
        #080f1b;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.typing-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.typing-panel__hint {
    color: var(--muted-2);
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.typing-panel__timer {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.typing-panel__timer small {
    color: var(--muted-2);
    font-size: 0.6rem;
}

.char-strip-wrap {
    position: relative;
    height: clamp(64px, 9vh, 92px);
    margin: 3px 0 8px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.char-strip {
    position: relative;
    display: flex;
    align-items: center;
    width: max-content;
    min-width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: clamp(2.1rem, 3.4vw, 2.9rem);
    line-height: 1;
    white-space: pre;
    will-change: transform;
    transition: transform 0.2s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.char {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0.6em;
    height: 100%;
    padding: 0 1px;
    border-radius: 6px;
    color: #5c6c89;
    transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease, opacity 0.12s ease;
}

.char--space {
    color: #3c4964;
}

.char.is-correct {
    color: #61efb9;
}

.char.is-missed {
    color: #ff7a8d;
    background: rgba(255, 84, 112, 0.1);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.char.is-current {
    z-index: 2;
    color: #fff;
    background: rgba(255, 176, 32, 0.2);
    box-shadow: 0 0 0 1px rgba(255, 176, 32, 0.42), 0 0 24px rgba(255, 176, 32, 0.18);
    font-weight: 800;
    text-shadow: 0 0 16px rgba(255, 210, 122, 0.35);
    transform: translateY(-1px);
}

.char--space.is-current {
    color: #ffd27a;
}

.time-bar {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.065);
}

.time-bar__fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffb020, #ff6a3d);
    transition: width 0.08s linear, background 0.2s ease;
}

.time-bar.is-low .time-bar__fill {
    background: linear-gradient(90deg, #ff5470, #ff8a5b);
    box-shadow: 0 0 12px rgba(255, 84, 112, 0.45);
}

/* ---------- Модальное окно результатов ---------- */

.modal {
    width: min(560px, calc(100vw - 28px));
    max-height: calc(100vh - 32px);
    padding: 0;
    overflow: auto;
    border: 1px solid rgba(255, 176, 32, 0.2);
    border-radius: 22px;
    color: var(--text);
    background:
        radial-gradient(600px 220px at 50% -10%, rgba(255, 176, 32, 0.09), transparent 65%),
        linear-gradient(180deg, #121d32, #09101e);
    box-shadow: 0 40px 110px rgba(0, 0, 0, 0.72);
}

.modal::backdrop {
    background: rgba(3, 6, 13, 0.76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal__inner {
    padding: 30px;
    text-align: center;
}

.modal__eyebrow {
    display: block;
    color: var(--accent);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.modal__title {
    margin: 8px 0 8px;
    font-size: clamp(1.9rem, 5vw, 2.6rem);
}

.modal__subtitle {
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.55;
}

.result-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 9px;
    margin: 22px 0 18px;
}

.result-score strong {
    color: var(--accent);
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 8vw, 4rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.05em;
    text-shadow: 0 0 35px rgba(255, 176, 32, 0.25);
    font-variant-numeric: tabular-nums;
}

.result-score span {
    color: var(--muted-2);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--line-soft);
}

.result-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 8px;
    background: #0b1322;
}

.result-stat span {
    color: var(--muted-2);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-stat strong {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.result-stat strong small {
    color: var(--muted-2);
    font-size: 0.56rem;
    font-weight: 600;
}

.result-note {
    margin-top: 14px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 0.77rem;
    line-height: 1.5;
}

.result-note--success {
    color: #9cffd0;
    border-color: rgba(88, 230, 162, 0.2);
    background: rgba(88, 230, 162, 0.065);
}

.result-note--error {
    color: #ffb3be;
    border-color: rgba(255, 84, 112, 0.22);
    background: rgba(255, 84, 112, 0.06);
}

.result-note a {
    color: var(--accent);
    font-weight: 700;
}

.result-note .link-button {
    margin-left: 4px;
}

.modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1120px) {
    .lobby {
        grid-template-columns: minmax(0, 1fr) minmax(380px, 0.92fr);
        gap: 36px;
    }

    .lobby__intro h1 {
        font-size: clamp(2.5rem, 5vw, 3.7rem);
    }

    .hud {
        grid-template-columns: minmax(140px, 1.3fr) repeat(3, minmax(74px, 0.7fr)) minmax(84px, 0.75fr);
    }

    .hud__item {
        padding-inline: 10px;
    }
}

@media (max-width: 960px) {
    .lobby {
        grid-template-columns: minmax(0, 1fr);
        gap: 34px;
    }

    .lobby__intro {
        padding-top: 0;
    }

    .lobby__intro h1 {
        font-size: clamp(2.7rem, 8vw, 4rem);
    }

    .lobby__lead {
        max-width: 720px;
    }

    .setup {
        width: min(720px, 100%);
    }

    .lobby__facts {
        max-width: 620px;
    }
}

@media (max-width: 820px) {
    .arena {
        padding: 10px;
        border-radius: 17px;
    }

    .arena__top {
        flex-wrap: wrap;
        gap: 10px 14px;
    }

    .arena__progress {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }

    .arena__actions {
        margin-left: auto;
    }

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

    .hud__item--health {
        grid-column: 1 / -1;
    }

    .hud__item--key {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    #road {
        height: clamp(380px, 56vh, 620px);
    }

    .typing-panel {
        padding-inline: 14px;
    }

    .char-strip {
        font-size: clamp(1.9rem, 4.8vw, 2.5rem);
    }
}

@media (max-width: 620px) {
    .lobby__intro h1 {
        font-size: clamp(2.3rem, 11vw, 3.2rem);
    }

    .lobby__lead {
        font-size: 0.92rem;
    }

    .perks {
        gap: 13px;
        margin-top: 26px;
    }

    .perk__icon {
        width: 38px;
        height: 38px;
    }

    .lobby__facts {
        gap: 18px;
        margin-top: 28px;
    }

    .fact strong {
        font-size: 1.35rem;
    }

    .fact span {
        font-size: 0.63rem;
    }

    .setup {
        padding: 18px;
        gap: 17px;
    }

    .setup__head h2 {
        font-size: 1.3rem;
    }

    .settings-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .text-picker {
        max-height: 196px;
    }

    .mini-entry {
        grid-template-columns: 15px 24px minmax(0, 1fr) auto;
    }

    .mini-entry__speed {
        display: none;
    }

    .arena__title strong {
        max-width: 145px;
    }

    .arena__actions .btn {
        display: none;
    }

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

    .hud__item {
        min-height: 50px;
        padding: 7px 11px;
    }

    #road {
        height: clamp(330px, 50vh, 500px);
    }

    .typing-panel {
        padding-inline: 12px;
    }

    .typing-panel__hint {
        font-size: 0.6rem;
    }

    .char-strip {
        font-size: clamp(1.85rem, 7.4vw, 2.35rem);
    }

    .modal__inner {
        padding: 22px 16px;
    }

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

    .pause-overlay__inner {
        padding: 22px 18px;
    }
}
