@font-face {
    font-family: "ADJMN Arcade";
    src: url("/games/fonts/PressStart2P-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --red: #ef3049;
    --gold: #ffe17b;
    --cyan: #4ce8ff;
    --violet: #d776ff;
    --ink: #f5f0ff;
    --muted: #c4bfd6;
    --panel: #171333;
    --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-pixel: "ADJMN Arcade", "Courier New", monospace;
}

* { box-sizing: border-box; }
body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(ellipse at 50% 8%, rgba(105, 54, 174, .32), transparent 38rem),
        radial-gradient(ellipse at 8% 70%, rgba(125, 28, 92, .12), transparent 34rem),
        linear-gradient(180deg, #130d2b, #100b21 54%, #190b23);
    font: 500 1rem/1.55 var(--font-ui);
    -webkit-font-smoothing: antialiased;
}
body::before {
    position: fixed;
    z-index: 10;
    inset: 0;
    pointer-events: none;
    opacity: .12;
    background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(205, 226, 255, .11) 4px, transparent 5px);
    content: "";
}
a { color: inherit; }
.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px clamp(16px, 5vw, 68px);
    border-bottom: 1px solid #35294b;
    background: rgba(12, 8, 25, .86);
}
.brand { display: inline-flex; min-height: 42px; align-items: center; }
.brand img { display: block; width: 132px; height: auto; }
.topbar nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.top-link {
    color: #d8d0eb;
    font: 700 .875rem/1.2 var(--font-ui);
    letter-spacing: .02em;
    text-decoration: none;
    text-transform: uppercase;
}
.top-link:hover { color: var(--cyan); }
.availability-link { color: #fff; border-bottom: 2px solid var(--red); padding: 7px 0; }
main { width: min(100% - 40px, 920px); margin: 0 auto; }
.intro { padding: clamp(28px, 5vw, 50px) 0 20px; }
.eyebrow {
    margin: 0 0 9px;
    color: var(--cyan);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.intro h1 {
    margin: 0;
    color: #fff1c2;
    font: 400 clamp(1.25rem, 4vw, 2rem)/1.5 var(--font-pixel);
    letter-spacing: -.06em;
    text-shadow: 2px 3px 0 #82325f, 0 0 18px rgba(255, 225, 123, .17);
    text-transform: uppercase;
}
.intro h1 span { color: var(--red); }
.intro > p:last-child { max-width: 58ch; margin: 12px 0 0; color: #d4cde3; }

.runner-cabinet {
    position: relative;
    isolation: isolate;
    width: min(100%, 760px);
    margin: 0 auto;
    padding: clamp(14px, 3vw, 24px);
    border: 5px solid var(--red);
    border-radius: 10px;
    background:
        repeating-linear-gradient(0deg, rgba(120, 113, 155, .04) 0, rgba(120, 113, 155, .04) 1px, transparent 1px, transparent 4px),
        linear-gradient(145deg, rgba(32, 24, 61, .98), rgba(13, 11, 31, .98));
    box-shadow: 0 0 0 4px #372352, 0 0 30px rgba(239, 48, 73, .22), inset 0 0 25px rgba(0, 0, 0, .5);
}
.cabinet-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.cabinet-label { color: var(--cyan); font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.sound-toggle {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #8066bf;
    border-radius: 5px;
    color: #e4dcf7;
    background: #21163d;
    font: 700 .9rem/1.2 var(--font-ui);
    cursor: pointer;
}
.sound-toggle:hover { border-color: var(--cyan); }
.runner-cabinet > h2 {
    margin: 0;
    color: var(--gold);
    font: 400 clamp(.9rem, 2.8vw, 1.3rem)/1.7 var(--font-pixel);
    text-align: center;
    text-shadow: 2px 2px #8d3c90;
    text-transform: uppercase;
}
.subtitle {
    margin: 3px 0 17px;
    color: var(--cyan);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-align: center;
}
.start-panel, .game-screen, .result-panel { max-width: 620px; margin: 0 auto; }
.start-copy { margin: 0 0 15px; color: #d4cde3; text-align: center; }
.start-panel h3 {
    margin: 0;
    color: #f0e7ff;
    font: 700 .95rem/1.5 var(--font-ui);
    text-align: center;
}
.char-select-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 12px 0 18px; }
.char-choice {
    min-width: 0;
    min-height: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 4px;
    border: 2px solid #554574;
    border-radius: 6px;
    color: #e4dcf7;
    background: #1b1530;
    font: 600 .875rem/1.25 var(--font-ui);
    cursor: pointer;
}
.char-choice > span:first-child { font-size: 1.65rem; line-height: 1; }
.char-choice:hover { border-color: var(--cyan); }
.char-choice.is-selected { border-color: var(--gold); color: #fff7d2; background: #35233f; box-shadow: 0 0 13px rgba(255, 225, 123, .22); }
.arcade-button {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 17px;
    border: 2px solid #ff829e;
    border-radius: 6px;
    color: #fff8f1;
    font: 800 1rem/1.25 var(--font-ui);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 0 #64142f, 0 0 16px rgba(239, 48, 73, .18), inset 0 0 10px rgba(255,255,255,.1);
    transition: transform .12s ease, filter .12s ease;
    touch-action: manipulation;
}
.arcade-button:hover:not(:disabled) { filter: brightness(1.13); transform: translateY(-1px); }
.arcade-button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #64142f; }
.arcade-button:disabled { opacity: .58; cursor: not-allowed; }
.primary-button { background: linear-gradient(180deg, #f34163, #bc1c48); }
.secondary-button, .other-games { border-color: #8066bf; background: #30225a; box-shadow: 0 4px 0 #1a1032; }
.start-panel > .primary-button { width: min(100%, 330px); display: flex; margin: 0 auto; }
.hud {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #655586;
    border-radius: 5px;
    background: #090817;
}
.hud > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.hud > div + div { border-left: 1px solid #42365b; padding-left: 10px; }
.hud span { color: #c5badb; font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.hud strong { color: var(--gold); font: 800 1rem/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
#lives-display { color: #ff6b83; white-space: nowrap; }
.canvas-container {
    overflow: hidden;
    border: 2px solid #5a467d;
    border-radius: 5px;
    background: #090817;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, .6), 0 0 12px rgba(76, 232, 255, .08);
}
#runner-canvas { display: block; width: 100%; height: auto; touch-action: none; }
.run-controls { display: flex; flex-direction: column; align-items: center; gap: 7px; margin-top: 13px; }
.jump-button { min-width: 180px; }
.controls-hint { margin: 0; color: #c4bfd6; font-size: .9rem; text-align: center; }
.result-panel {
    padding: clamp(14px, 3vw, 20px);
    border: 1px solid #655586;
    border-radius: 6px;
    background: rgba(7, 6, 19, .75);
    text-align: center;
}
.result-panel h3 { margin: 0; color: var(--gold); font: 400 clamp(.8rem, 2vw, 1rem)/1.7 var(--font-pixel); }
.final-distance { margin: 7px 0; color: var(--cyan); font: 900 clamp(2.8rem, 12vw, 4rem)/1.1 var(--font-ui); font-variant-numeric: tabular-nums; text-shadow: 2px 2px #13545b; }
.result-copy { margin: 8px 0 18px; color: #d4cde3; }
.result-panel form { max-width: 460px; margin: 0 auto; text-align: left; }
.result-panel label { display: block; margin-bottom: 7px; color: #eee7fa; font-weight: 800; }
.result-panel label span { color: #c4bfd6; font-weight: 500; }
.score-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.score-entry input {
    min-width: 0;
    min-height: 50px;
    padding: 9px 12px;
    border: 1px solid #8066bf;
    border-radius: 5px;
    color: #fff;
    background: #100d20;
    font: 800 1rem/1.2 var(--font-ui);
    text-transform: uppercase;
}
.form-help, .score-status { margin: 8px 0 0; color: #c4bfd6; font-size: .86rem; line-height: 1.45; }
.score-status { min-height: 1.4em; color: var(--gold); }
.score-status.is-error { color: #ff9eb3; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.result-actions.is-locked { opacity: .58; pointer-events: none; }
.game-note { margin: 20px 0 0; color: #c4bfd6; font-size: .9rem; text-align: center; }
.game-note strong { color: #fff1c2; }
.game-scoreboards[data-score-game="runner"] {
    --scores-mint: var(--cyan);
    --scores-mint-dim: #b7a0ef;
    --scores-black: #080817;
    --scores-line: rgba(76, 232, 255, .34);
    border-color: #59407b;
    color: var(--cyan);
    background:
        repeating-linear-gradient(0deg, rgba(76, 232, 255, .018) 0, rgba(76, 232, 255, .018) 1px, transparent 1px, transparent 4px),
        linear-gradient(145deg, rgba(32, 24, 61, .98), rgba(13, 11, 31, .98));
    box-shadow: 0 13px 35px rgba(0, 0, 0, .28), 0 0 20px rgba(76, 232, 255, .08);
}
.game-scoreboards[data-score-game="runner"] .scoreboards-note { color: #d4cde3; }
.game-scoreboards[data-score-game="runner"] .scoreboard-period {
    border-color: #5e4c9c;
    background:
        repeating-linear-gradient(0deg, rgba(76, 232, 255, .022) 0, rgba(76, 232, 255, .022) 1px, transparent 1px, transparent 4px),
        #080817;
}
.runner-cabinet :focus-visible, .topbar a:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}
footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
    margin-top: 34px;
    padding: 17px clamp(20px, 5vw, 68px);
    border-top: 1px solid #35294b;
    color: #c4bfd6;
    background: rgba(12, 8, 25, .72);
    font-size: .82rem;
}
footer p { margin: 0; }
footer a { color: #cbc2d7; text-decoration: none; }
footer a:hover { color: var(--cyan); }
[hidden] { display: none !important; }

@media (max-width: 520px) {
    .topbar { min-height: 62px; padding-right: 14px; padding-left: 14px; }
    .brand img { width: 116px; }
    .topbar nav { gap: 12px; }
    .top-link { font-size: .8rem; }
    main { width: min(100% - 28px, 440px); }
    .char-select-grid { gap: 6px; }
    .char-choice { min-height: 76px; font-size: .875rem; }
    .hud { padding: 9px 7px; gap: 4px; }
    .hud > div { flex-direction: column; align-items: flex-start; gap: 3px; }
    .hud > div + div { padding-left: 7px; }
    .hud span { font-size: .68rem; }
    .hud strong { font-size: .9rem; }
    .score-entry { grid-template-columns: 1fr; }
    .score-entry .arcade-button { width: 100%; }
    footer { padding-right: 16px; padding-left: 16px; }
}
