:root {
    --bg: #020617;
    --panel: rgba(15, 23, 42, 0.78);
    --text: #e5e7eb;
    --soft: #cbd5f5;
    --muted: #94a3b8;
    --cyan: #38bdf8;
    --green: #22c55e;
    --purple: #a78bfa;
    --amber: #f59e0b;
    --red: #ef4444;
    --border: rgba(56, 189, 248, 0.28);
    --shadow: rgba(56, 189, 248, 0.18);
}

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

body {
    background:
        radial-gradient(circle at 16% 12%, rgba(56, 189, 248, 0.13), transparent 28%),
        radial-gradient(circle at 84% 16%, rgba(167, 139, 250, 0.13), transparent 26%),
        linear-gradient(180deg, #020617 0%, #050816 52%, #020617 100%);
    color: var(--text);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
}

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

.game-shell {
    align-items: center;
    display: flex;
    height: 100dvh;
    min-height: 620px;
    overflow: hidden;
    padding: clamp(8px, 2.2vh, 24px);
    width: 100%;
}

.game-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 0 42px var(--shadow), inset 0 0 36px rgba(2, 6, 23, 0.42);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: calc(100dvh - clamp(16px, 4.4vh, 48px));
    margin: 0 auto;
    max-height: calc(100dvh - clamp(16px, 4.4vh, 48px));
    max-width: 1120px;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

.game-panel:has(.overlay:not(.hidden)) {
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100dvh - clamp(16px, 4.4vh, 48px));
}

.game-panel:has(.overlay:not(.hidden)) .controls {
    display: none;
}

.game-topbar {
    align-items: center;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.86));
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 16px;
    grid-template-columns: auto 1fr auto;
    min-width: 0;
    padding: 14px 18px;
}

.back-link,
.controls button,
.overlay-card button {
    background: rgba(2, 6, 23, 0.78);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--cyan);
    cursor: pointer;
    font: 700 12px/1 Inter, "Segoe UI", system-ui, sans-serif;
    letter-spacing: 0;
    padding: 10px 12px;
    text-decoration: none;
}

.back-link:hover,
.controls button:hover,
.overlay-card button:hover,
.back-link:focus-visible,
.controls button:focus-visible,
.overlay-card button:focus-visible {
    box-shadow: 0 0 16px var(--shadow);
    outline: 1px solid var(--cyan);
}

.game-title {
    min-width: 0;
}

.game-title h1 {
    color: var(--cyan);
    font-size: 22px;
    line-height: 1.1;
    margin: 0;
}

.game-title p {
    color: var(--muted);
    font: 600 12px/1.4 "SFMono-Regular", Consolas, monospace;
    margin: 4px 0 0;
}

.scoreboard {
    display: flex;
    gap: 10px;
    min-width: 0;
}

.scoreboard div {
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 7px;
    min-width: 94px;
    padding: 8px 10px;
    text-align: right;
}

.scoreboard span {
    color: var(--muted);
    display: block;
    font: 700 10px/1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.scoreboard strong {
    color: var(--green);
    display: block;
    font: 800 22px/1.1 "SFMono-Regular", Consolas, monospace;
    margin-top: 4px;
}

.arena-wrap {
    background:
        linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.08) 1px, transparent 1px),
        radial-gradient(circle at 50% 52%, rgba(34, 197, 94, 0.13), transparent 36%),
        #030712;
    background-size: 54px 54px, 54px 54px, auto, auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.game-canvas {
    display: block;
    height: 100%;
    width: 100%;
}

.status-strip {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    max-width: min(132px, calc(100% - 24px));
    pointer-events: none;
    position: absolute;
    right: 12px;
    top: 52px;
    width: 132px;
    z-index: 4;
}

.status-chip {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.84), rgba(2, 6, 23, 0.72)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.14), transparent 60%);
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 7px;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    min-width: 0;
    padding: 7px 10px;
    text-align: center;
}

.status-chip span,
.status-chip strong {
    display: block;
}

.status-chip span {
    color: var(--muted);
    font: 900 9px/1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.status-chip strong {
    color: var(--green);
    font: 900 14px/1 "SFMono-Regular", Consolas, monospace;
    margin-top: 5px;
    text-transform: uppercase;
}

.status-chip.is-warning {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.status-chip.is-warning strong {
    color: var(--amber);
}

.status-chip.is-critical,
.status-chip.is-danger {
    border-color: rgba(239, 68, 68, 0.54);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.status-chip.is-critical strong,
.status-chip.is-danger strong {
    color: var(--red);
}

.countdown-overlay {
    align-items: center;
    background:
        radial-gradient(circle at center, rgba(34, 197, 94, 0.18), transparent 42%),
        rgba(2, 6, 23, 0.26);
    display: flex;
    flex-direction: column;
    gap: 12px;
    inset: 0;
    justify-content: center;
    pointer-events: none;
    position: absolute;
    z-index: 9;
}

.countdown-overlay.hidden {
    display: none;
}

.countdown-ring {
    --countdown-accent: var(--cyan);
    align-items: center;
    aspect-ratio: 1;
    background:
        linear-gradient(#020617, #020617) padding-box,
        conic-gradient(from -90deg, var(--countdown-accent), var(--green), var(--purple), var(--countdown-accent)) border-box;
    border: 4px solid transparent;
    border-radius: 50%;
    box-shadow: 0 0 34px color-mix(in srgb, var(--countdown-accent) 45%, transparent), inset 0 0 24px rgba(2, 6, 23, 0.9);
    display: grid;
    justify-items: center;
    width: clamp(118px, 20vw, 178px);
}

.countdown-ring span {
    color: var(--text);
    font: 950 clamp(48px, 9vw, 86px)/1 "SFMono-Regular", Consolas, monospace;
    text-shadow: 0 0 16px var(--countdown-accent), 0 4px 0 rgba(2, 6, 23, 0.72);
}

.countdown-overlay small {
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(56, 189, 248, 0.26);
    border-radius: 999px;
    color: var(--soft);
    font: 800 11px/1 "SFMono-Regular", Consolas, monospace;
    padding: 9px 13px;
    text-transform: uppercase;
}

.countdown-overlay.pulse .countdown-ring {
    animation: countdownPop 0.7s ease both;
}

.countdown-overlay.go .countdown-ring {
    --countdown-accent: var(--green);
}

.countdown-overlay.go .countdown-ring span {
    color: var(--green);
}

.controls {
    align-items: center;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(2, 6, 23, 0.92)),
        repeating-linear-gradient(90deg, rgba(56, 189, 248, 0.08) 0 1px, transparent 1px 18px);
    border-top: 1px solid rgba(245, 158, 11, 0.24);
    box-shadow: inset 0 1px 0 rgba(56, 189, 248, 0.18), inset 0 14px 28px rgba(2, 6, 23, 0.34);
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(300px, 1fr) minmax(218px, 0.48fr);
    padding: 13px 18px 15px;
}

.chop-controls,
.system-controls {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.chop-controls {
    background:
        linear-gradient(180deg, rgba(56, 189, 248, 0.08), rgba(2, 6, 23, 0.18)),
        linear-gradient(90deg, rgba(167, 139, 250, 0.12), transparent 48%, rgba(34, 197, 94, 0.12));
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px;
}

.system-controls {
    border-left: 1px solid rgba(245, 158, 11, 0.26);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 18px;
}

.control-button {
    align-items: center;
    background:
        radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.2), transparent 28%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.95));
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 8px;
    box-shadow:
        0 9px 0 rgba(2, 6, 23, 0.82),
        0 13px 24px rgba(2, 6, 23, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -12px 22px rgba(2, 6, 23, 0.52);
    color: var(--cyan);
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 58px;
    min-width: 0;
    padding: 9px 12px;
    position: relative;
    text-align: left;
    transform: translateY(0);
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.control-button::before {
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.7), transparent);
    content: "";
    height: 1px;
    left: 12px;
    opacity: 0.72;
    position: absolute;
    right: 12px;
    top: 6px;
}

.control-button:hover,
.control-button:focus-visible {
    border-color: rgba(56, 189, 248, 0.62);
    box-shadow:
        0 9px 0 rgba(2, 6, 23, 0.82),
        0 0 24px rgba(56, 189, 248, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -12px 22px rgba(2, 6, 23, 0.52);
    outline: 1px solid rgba(56, 189, 248, 0.72);
}

.control-button:active {
    box-shadow:
        0 4px 0 rgba(2, 6, 23, 0.84),
        0 0 18px rgba(56, 189, 248, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -8px 18px rgba(2, 6, 23, 0.58);
    transform: translateY(5px);
}

.control-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.control-glyph {
    align-items: center;
    aspect-ratio: 1;
    background:
        radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.34), transparent 22%),
        linear-gradient(145deg, rgba(56, 189, 248, 0.42), rgba(14, 165, 233, 0.12) 48%, rgba(2, 6, 23, 0.74));
    border: 1px solid rgba(56, 189, 248, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.22), inset 0 -8px 14px rgba(2, 6, 23, 0.44);
    color: #e0f2fe;
    display: grid;
    font: 950 18px/1 "SFMono-Regular", Consolas, monospace;
    justify-items: center;
    min-width: 40px;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.72);
    width: 40px;
}

.control-copy {
    min-width: 0;
}

.control-copy strong,
.control-copy small {
    display: block;
}

.control-copy strong {
    color: var(--text);
    font: 900 13px/1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.control-copy small {
    color: var(--muted);
    font: 800 10px/1.2 Inter, "Segoe UI", system-ui, sans-serif;
    margin-top: 6px;
}

.control-button-left .control-glyph {
    background:
        radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.32), transparent 22%),
        linear-gradient(145deg, rgba(167, 139, 250, 0.56), rgba(56, 189, 248, 0.16) 52%, rgba(2, 6, 23, 0.76));
    border-color: rgba(167, 139, 250, 0.58);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.24), inset 0 -8px 14px rgba(2, 6, 23, 0.44);
}

.control-button-right .control-glyph {
    background:
        radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.32), transparent 22%),
        linear-gradient(145deg, rgba(34, 197, 94, 0.55), rgba(56, 189, 248, 0.15) 52%, rgba(2, 6, 23, 0.76));
    border-color: rgba(34, 197, 94, 0.58);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.22), inset 0 -8px 14px rgba(2, 6, 23, 0.44);
}

.control-button-reset {
    border-color: rgba(245, 158, 11, 0.38);
    color: var(--amber);
}

.control-button-reset::before {
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.78), transparent);
}

.control-button-reset .control-glyph {
    background:
        radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.32), transparent 22%),
        linear-gradient(145deg, rgba(245, 158, 11, 0.58), rgba(56, 189, 248, 0.12) 54%, rgba(2, 6, 23, 0.76));
    border-color: rgba(245, 158, 11, 0.62);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2), inset 0 -8px 14px rgba(2, 6, 23, 0.44);
    color: #fef3c7;
    font-size: 20px;
}

.control-button-system {
    border-color: rgba(34, 197, 94, 0.28);
}

.control-button-system .control-glyph {
    min-width: 34px;
    width: 34px;
}

.overlay {
    align-items: stretch;
    background:
        radial-gradient(circle at 28% 28%, rgba(34, 197, 94, 0.18), transparent 30%),
        radial-gradient(circle at 72% 64%, rgba(167, 139, 250, 0.16), transparent 28%),
        linear-gradient(135deg, rgba(2, 6, 23, 0.92), rgba(2, 6, 23, 0.64));
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: absolute;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay::before,
.overlay::after {
    content: "";
    pointer-events: none;
    position: absolute;
}

.overlay::before {
    background:
        linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.2), transparent),
        repeating-linear-gradient(180deg, rgba(226, 232, 240, 0.06) 0 1px, transparent 1px 7px);
    inset: 0;
    opacity: 0.5;
}

.overlay::after {
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 14px;
    box-shadow: inset 0 0 36px rgba(56, 189, 248, 0.13);
    inset: 18px;
}

.overlay-card {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.82)),
        radial-gradient(circle at 12% 16%, rgba(34, 197, 94, 0.16), transparent 34%);
    border: 1px solid rgba(56, 189, 248, 0.38);
    border-radius: 10px;
    box-shadow: 0 0 34px rgba(56, 189, 248, 0.22), inset 0 0 28px rgba(2, 6, 23, 0.62);
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(120px, 0.26fr) minmax(0, 1fr);
    height: 100%;
    max-height: 100%;
    max-width: 980px;
    overflow: hidden;
    padding: 16px;
    position: relative;
    width: min(96vw, 980px);
    z-index: 1;
}

.overlay-end .overlay-card {
    border-color: rgba(245, 158, 11, 0.42);
    box-shadow: 0 0 36px rgba(245, 158, 11, 0.2), inset 0 0 30px rgba(127, 29, 29, 0.16);
}

.overlay-pause .overlay-card {
    border-color: rgba(34, 197, 94, 0.42);
    box-shadow: 0 0 36px rgba(34, 197, 94, 0.18), inset 0 0 30px rgba(14, 116, 144, 0.14);
}

.overlay-card::before {
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.75), transparent);
    content: "";
    height: 1px;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.overlay-end .overlay-card::before {
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.82), transparent);
}

.overlay-pause .overlay-card::before {
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.82), transparent);
}

.overlay-visual {
    aspect-ratio: 1;
    align-self: center;
    min-width: 0;
    position: relative;
}

.overlay-visual img {
    display: block;
    filter: drop-shadow(0 0 22px rgba(56, 189, 248, 0.28));
    height: 100%;
    width: 100%;
}

.overlay-content {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.overlay-mode {
    color: var(--green);
    display: block;
    font: 800 11px/1.2 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.overlay-end .overlay-mode {
    color: var(--amber);
}

.overlay-pause .overlay-mode {
    color: var(--green);
}

.overlay-card h2 {
    color: var(--cyan);
    font-size: clamp(27px, 4vw, 42px);
    line-height: 1;
    margin: -4px 0 0;
}

.overlay-card p {
    color: var(--soft);
    line-height: 1.36;
    margin: 0;
    max-width: 470px;
}

.overlay-stats {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}

.overlay-stats div {
    background: rgba(2, 6, 23, 0.62);
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 7px;
    min-width: 0;
    padding: 7px 8px;
}

.overlay-end .overlay-stats div {
    border-color: rgba(245, 158, 11, 0.24);
}

.overlay-stats span {
    color: var(--muted);
    display: block;
    font: 800 10px/1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.overlay-stats strong {
    color: var(--green);
    display: block;
    font: 800 15px/1.1 "SFMono-Regular", Consolas, monospace;
    margin-top: 5px;
    overflow-wrap: anywhere;
}

.settings-block {
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.6), rgba(15, 23, 42, 0.42)),
        radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.12), transparent 48%);
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    padding: 7px;
}

.settings-block[hidden] {
    display: none;
}

.settings-heading {
    align-items: baseline;
    border-bottom: 1px solid rgba(56, 189, 248, 0.14);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    min-width: 0;
    padding: 0 2px 6px;
}

.settings-heading span {
    color: var(--cyan);
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.settings-heading small {
    color: var(--muted);
    font: 700 10px/1.2 Inter, "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mode-selector {
    display: grid;
    gap: 5px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0;
}

.mode-selector[hidden] {
    display: none;
}

.mode-selector button {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.86)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.14), transparent 58%);
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 7px;
    box-shadow: inset 0 0 18px rgba(2, 6, 23, 0.52);
    color: var(--soft);
    cursor: pointer;
    min-height: 40px;
    min-width: 0;
    padding: 6px;
    text-align: left;
}

.mode-selector button:hover,
.mode-selector button:focus-visible {
    border-color: rgba(56, 189, 248, 0.56);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.14), inset 0 0 18px rgba(2, 6, 23, 0.52);
    outline: 1px solid rgba(56, 189, 248, 0.66);
}

.mode-selector button[aria-pressed="true"] {
    background:
        linear-gradient(180deg, rgba(20, 184, 166, 0.2), rgba(2, 6, 23, 0.9)),
        radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.22), transparent 62%);
    border-color: rgba(245, 158, 11, 0.54);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.14), inset 0 0 20px rgba(56, 189, 248, 0.1);
}

.mode-selector span,
.mode-selector small {
    display: block;
}

.mode-selector span {
    color: var(--cyan);
    font: 900 10px/1.1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.mode-selector button[aria-pressed="true"] span {
    color: var(--amber);
}

.mode-selector small {
    color: var(--muted);
    font: 700 9px/1.2 Inter, "Segoe UI", system-ui, sans-serif;
    margin-top: 4px;
}

.difficulty-selector {
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 4px;
}

.difficulty-selector[hidden] {
    display: none;
}

.difficulty-selector button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    min-width: 0;
    padding: 7px 5px;
    text-transform: uppercase;
}

.difficulty-selector button:hover,
.difficulty-selector button:focus-visible {
    border-color: rgba(56, 189, 248, 0.5);
    color: var(--cyan);
    outline: 1px solid rgba(56, 189, 248, 0.58);
}

.difficulty-selector button[aria-pressed="true"] {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(56, 189, 248, 0.12));
    border-color: rgba(245, 158, 11, 0.46);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.1);
    color: var(--amber);
}

.unlock-panel {
    background:
        linear-gradient(135deg, rgba(2, 6, 23, 0.72), rgba(15, 23, 42, 0.64)),
        radial-gradient(circle at 12% 0%, rgba(245, 158, 11, 0.16), transparent 56%);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 8px;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 7px;
}

.unlock-button {
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(2, 6, 23, 0.82)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 62%);
    border: 1px solid rgba(245, 158, 11, 0.42);
    border-radius: 7px;
    color: var(--amber);
    cursor: pointer;
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    grid-column: 1 / -1;
    padding: 8px 10px;
    text-transform: uppercase;
}

.unlock-button:hover,
.unlock-button:focus-visible {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.16);
    outline: 1px solid rgba(245, 158, 11, 0.72);
}

.unlock-panel[hidden] {
    display: none;
}

.unlock-panel div {
    background: rgba(2, 6, 23, 0.54);
    border: 1px solid rgba(56, 189, 248, 0.16);
    border-radius: 7px;
    min-width: 0;
    padding: 7px 8px;
}

.unlock-panel span,
.unlock-panel strong {
    display: block;
}

.unlock-panel span {
    color: var(--muted);
    font: 900 9px/1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.unlock-panel strong {
    color: var(--amber);
    font: 900 11px/1.15 "SFMono-Regular", Consolas, monospace;
    margin-top: 5px;
    overflow-wrap: anywhere;
    text-transform: uppercase;
}

.overlay-end .overlay-card h2,
.overlay-end .overlay-stats strong {
    color: var(--amber);
}

.overlay-pause .overlay-card h2,
.overlay-pause .overlay-stats strong {
    color: var(--green);
}

.overlay-card button {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(2, 6, 23, 0.88));
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.12);
    min-width: 0;
}

.overlay-actions {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
}

.overlay-actions .back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.overlay-card .button-secondary {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(2, 6, 23, 0.88));
    border-color: rgba(245, 158, 11, 0.38);
    color: var(--amber);
}

.howto-overlay {
    align-items: center;
    background:
        radial-gradient(circle at 50% 36%, rgba(56, 189, 248, 0.2), transparent 42%),
        rgba(2, 6, 23, 0.78);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: absolute;
    z-index: 14;
}

.unlock-overlay {
    align-items: center;
    background:
        radial-gradient(circle at 52% 38%, rgba(245, 158, 11, 0.16), transparent 42%),
        rgba(2, 6, 23, 0.78);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: absolute;
    z-index: 15;
}

.unlock-overlay.hidden {
    display: none;
}

.unlock-card {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.9)),
        radial-gradient(circle at 14% 0%, rgba(56, 189, 248, 0.14), transparent 44%);
    border: 1px solid rgba(245, 158, 11, 0.34);
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.16), inset 0 0 30px rgba(2, 6, 23, 0.66);
    max-height: calc(100% - 16px);
    max-width: 860px;
    overflow: auto;
    padding: 16px;
    width: min(94vw, 860px);
}

.unlock-header {
    align-items: start;
    border-bottom: 1px solid rgba(56, 189, 248, 0.16);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding-bottom: 12px;
}

.unlock-header span {
    color: var(--amber);
    display: block;
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.unlock-header h2 {
    color: var(--cyan);
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1;
    margin: 0;
}

.unlock-close {
    align-items: center;
    aspect-ratio: 1;
    background:
        radial-gradient(circle at 38% 24%, rgba(255, 255, 255, 0.28), transparent 24%),
        linear-gradient(145deg, rgba(245, 158, 11, 0.46), rgba(2, 6, 23, 0.9));
    border: 1px solid rgba(245, 158, 11, 0.54);
    border-radius: 50%;
    color: #fef3c7;
    cursor: pointer;
    display: grid;
    font: 900 23px/1 "SFMono-Regular", Consolas, monospace;
    min-width: 44px;
    width: 44px;
}

.unlock-card p {
    color: var(--soft);
    line-height: 1.38;
    margin: 12px 0;
}

.unlock-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.unlock-option {
    align-items: stretch;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.76)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 58%);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: 150px minmax(0, 1fr);
    min-width: 0;
    padding: 9px;
    text-align: left;
}

.unlock-option:hover,
.unlock-option:focus-visible {
    border-color: rgba(245, 158, 11, 0.58);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.14);
    outline: 1px solid rgba(245, 158, 11, 0.68);
}

.unlock-option[aria-pressed="true"] {
    border-color: rgba(34, 197, 94, 0.58);
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.14), inset 0 0 20px rgba(56, 189, 248, 0.08);
}

.unlock-option:disabled {
    cursor: not-allowed;
    filter: grayscale(0.72);
    opacity: 0.48;
}

.unlock-option-media {
    align-items: center;
    background:
        linear-gradient(rgba(56, 189, 248, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.09) 1px, transparent 1px),
        rgba(2, 6, 23, 0.74);
    background-size: 16px 16px;
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 7px;
    display: grid;
    gap: 6px;
    grid-template-columns: 44px 42px 1fr;
    min-height: 78px;
    padding: 7px;
}

.unlock-option-media img {
    display: block;
    max-height: 60px;
    max-width: 100%;
    object-fit: contain;
}

.unlock-option-copy {
    align-self: center;
    min-width: 0;
}

.unlock-option-copy strong,
.unlock-option-copy small,
.unlock-option-copy em {
    display: block;
}

.unlock-option-copy strong {
    color: var(--green);
    font: 900 12px/1.1 "SFMono-Regular", Consolas, monospace;
    text-transform: uppercase;
}

.unlock-option[aria-pressed="true"] .unlock-option-copy strong {
    color: var(--amber);
}

.unlock-option-copy small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    margin-top: 6px;
}

.unlock-option-copy em {
    color: var(--cyan);
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    font-style: normal;
    margin-top: 8px;
    text-transform: uppercase;
}

.unlock-option:disabled .unlock-option-copy em {
    color: var(--red);
}

.howto-overlay.hidden {
    display: none;
}

.howto-card {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.9)),
        radial-gradient(circle at 12% 0%, rgba(245, 158, 11, 0.16), transparent 42%);
    border: 1px solid rgba(245, 158, 11, 0.36);
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(56, 189, 248, 0.2), inset 0 0 30px rgba(2, 6, 23, 0.66);
    max-height: calc(100% - 16px);
    max-width: 720px;
    overflow: auto;
    padding: 16px;
    width: min(94vw, 720px);
}

.howto-header {
    align-items: start;
    border-bottom: 1px solid rgba(56, 189, 248, 0.16);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding-bottom: 12px;
}

.howto-header span {
    color: var(--amber);
    display: block;
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.howto-header h2 {
    color: var(--cyan);
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1;
    margin: 0;
}

.howto-close {
    align-items: center;
    aspect-ratio: 1;
    background:
        radial-gradient(circle at 38% 24%, rgba(255, 255, 255, 0.28), transparent 24%),
        linear-gradient(145deg, rgba(245, 158, 11, 0.46), rgba(2, 6, 23, 0.9));
    border: 1px solid rgba(245, 158, 11, 0.54);
    border-radius: 50%;
    color: #fef3c7;
    cursor: pointer;
    display: grid;
    font: 900 23px/1 "SFMono-Regular", Consolas, monospace;
    min-width: 44px;
    width: 44px;
}

.howto-card p {
    color: var(--soft);
    line-height: 1.38;
    margin: 12px 0;
}

.howto-grid {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.howto-tile {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(2, 6, 23, 0.72)),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 58%);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 138px minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 9px;
}

.howto-tile strong,
.howto-tile small {
    display: block;
}

.howto-copy {
    align-self: center;
    min-width: 0;
}

.howto-tile strong {
    color: var(--green);
    font: 900 12px/1.1 "SFMono-Regular", Consolas, monospace;
    margin-top: 4px;
    text-transform: uppercase;
}

.howto-tile small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    margin-top: 6px;
}

.howto-diagram {
    background:
        linear-gradient(rgba(56, 189, 248, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.1) 1px, transparent 1px),
        #020617;
    background-size: 18px 18px;
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 7px;
    height: 96px;
    overflow: hidden;
    position: relative;
}

.diagram-trunk {
    background:
        linear-gradient(90deg, rgba(56, 189, 248, 0.32), rgba(2, 6, 23, 0.9), rgba(34, 197, 94, 0.24));
    border: 1px solid rgba(56, 189, 248, 0.56);
    border-radius: 7px;
    bottom: 12px;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.22);
    left: 50%;
    position: absolute;
    top: 12px;
    transform: translateX(-50%);
    width: 36px;
}

.diagram-button {
    align-items: center;
    background:
        radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.35), transparent 22%),
        linear-gradient(145deg, rgba(245, 158, 11, 0.58), rgba(2, 6, 23, 0.78));
    border: 1px solid rgba(245, 158, 11, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.24);
    color: #fef3c7;
    display: grid;
    font: 900 17px/1 "SFMono-Regular", Consolas, monospace;
    height: 42px;
    left: 10px;
    position: absolute;
    top: 10px;
    width: 42px;
    z-index: 2;
}

.howto-right .diagram-button {
    left: auto;
    right: 10px;
}

.diagram-player {
    background:
        radial-gradient(circle at 50% 22%, var(--cyan) 0 8px, transparent 9px),
        linear-gradient(180deg, rgba(34, 197, 94, 0.75), rgba(2, 6, 23, 0.9));
    border: 1px solid rgba(34, 197, 94, 0.6);
    border-radius: 13px 13px 8px 8px;
    bottom: 12px;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.24);
    height: 50px;
    left: 20px;
    position: absolute;
    width: 32px;
}

.howto-right .diagram-player {
    left: auto;
    right: 20px;
}

.diagram-strike {
    background: var(--amber);
    border-radius: 999px;
    bottom: 42px;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.68);
    height: 5px;
    left: 47px;
    position: absolute;
    transform: rotate(-8deg);
    width: 52px;
}

.howto-right .diagram-strike {
    left: auto;
    right: 47px;
    transform: rotate(8deg);
}

.diagram-branch {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.84), rgba(245, 158, 11, 0.42));
    border: 1px solid rgba(239, 68, 68, 0.76);
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.32);
    height: 24px;
    left: calc(50% - 8px);
    position: absolute;
    top: 34px;
    width: 74px;
}

.diagram-danger {
    align-items: center;
    background: rgba(239, 68, 68, 0.22);
    border: 1px solid rgba(239, 68, 68, 0.72);
    border-radius: 50%;
    color: #fecaca;
    display: grid;
    font: 950 18px/1 "SFMono-Regular", Consolas, monospace;
    height: 34px;
    position: absolute;
    right: 16px;
    top: 18px;
    width: 34px;
}

.diagram-safe {
    background: rgba(34, 197, 94, 0.16);
    border: 1px solid rgba(34, 197, 94, 0.5);
    border-radius: 999px;
    bottom: 18px;
    color: var(--green);
    font: 900 10px/1 "SFMono-Regular", Consolas, monospace;
    left: 12px;
    padding: 7px 9px;
    position: absolute;
}

.diagram-meter {
    background: rgba(2, 6, 23, 0.78);
    border: 1px solid rgba(56, 189, 248, 0.44);
    border-radius: 999px;
    box-shadow: inset 0 0 12px rgba(2, 6, 23, 0.72);
    height: 20px;
    left: 16px;
    overflow: hidden;
    position: absolute;
    right: 16px;
    top: 30px;
}

.diagram-meter::before {
    background: linear-gradient(90deg, var(--green), var(--amber));
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.45);
    content: "";
    display: block;
    height: 100%;
    width: 76%;
}

.diagram-refill {
    color: var(--amber);
    font: 950 18px/1 "SFMono-Regular", Consolas, monospace;
    left: 50%;
    position: absolute;
    text-shadow: 0 0 14px rgba(245, 158, 11, 0.55);
    top: 62px;
    transform: translateX(-50%);
}

.diagram-pulse {
    border: 2px solid rgba(245, 158, 11, 0.62);
    border-radius: 999px;
    inset: 18px 9px 18px;
    position: absolute;
}

.overlay-end .overlay-card button {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(2, 6, 23, 0.9));
    border-color: rgba(245, 158, 11, 0.44);
    color: var(--amber);
}

.overlay-pause .overlay-card button {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(2, 6, 23, 0.9));
    border-color: rgba(34, 197, 94, 0.44);
    color: var(--green);
}

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

@keyframes countdownPop {
    0% {
        opacity: 0;
        transform: scale(0.72) rotate(-5deg);
    }

    55% {
        opacity: 1;
        transform: scale(1.08) rotate(2deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}
