@font-face {
    font-family: 'Press Start 2P';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/PressStart2P-latin.woff2') format('woff2');
}

:root {
    --ink: #f5e9d2;
    --blood: #c22a33;
    --blood-dark: #7c1218;
    --gold: #e8b13a;
    --gold-dark: #9a6b14;
    --bg: #0b0710;
    --panel: #16101f;
    --edge: #2c2138;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.skip { position: absolute; left: -9999px; }
.skip:focus {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 50;
    background: var(--gold);
    color: #1a1206;
    padding: 10px 14px;
    font-size: 11px;
    text-decoration: none;
}

.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;
}

/* ---------- Full-page arena ---------- */
.stage {
    position: relative;
    width: min(100%, calc(78vh * 16 / 9));   /* fallback */
    width: min(100%, calc(78dvh * 16 / 9));
    margin: 0 auto;
}
canvas#game {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}
.scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 2px,
        rgba(0, 0, 0, 0.13) 3px
    );
}
.vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(120% 120% at 50% 45%, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
}

/* DOM overlay screens */
.ui {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    background: rgba(5, 3, 9, 0.72);
}
.ui[hidden] { display: none; }
.scr { width: 100%; padding: 1rem; }
.scr h2 {
    font-size: clamp(14px, 3vw, 24px);
    color: var(--gold);
    text-shadow: 0 2px 0 var(--gold-dark), 0 0 18px rgba(232, 177, 58, 0.35);
    margin: 0 0 1.2rem;
    letter-spacing: 0.06em;
    line-height: 1.6;
}
.scr p {
    font-size: clamp(8px, 1.6vw, 11px);
    color: #cbbda5;
    line-height: 1.9;
    margin: 0.4rem 0;
}
.scr .rec { color: var(--gold); }
.scr .hint { color: #a99b80; font-size: clamp(8px, 1.4vw, 10px); }

.btn {
    font-family: inherit;
    font-size: clamp(10px, 2vw, 14px);
    color: #1a1206;
    background: linear-gradient(180deg, #f3c95c, var(--gold) 55%, #c8901f);
    border: 3px solid #4a3208;
    border-radius: 6px;
    padding: 0.9em 1.6em;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 0 #4a3208, 0 8px 20px rgba(0, 0, 0, 0.5);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #4a3208; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn.ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--edge);
    box-shadow: 0 4px 0 #0a0612;
}

/* choose your fighter */
.roster {
    display: flex;
    gap: clamp(8px, 2vw, 18px);
    justify-content: center;
    margin: 0.4rem 0 1rem;
    flex-wrap: wrap;
}
.slot {
    font-family: inherit;
    width: clamp(84px, 17vw, 132px);
    min-width: 116px; /* the 96px portrait + padding must always fit */
    padding: 10px 6px 8px;
    background: var(--panel);
    border: 3px solid var(--edge);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
}
.slot:hover:not(:disabled), .slot:focus-visible { border-color: var(--gold); outline: none; }
.slot .face {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto 8px;
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-size: 768px 1440px; /* 256x480 sheet at 3x */
    background-position: 0 0;      /* idle frame 0 */
}
.slot .nm { display: block; font-size: clamp(8px, 1.6vw, 11px); letter-spacing: 0.08em; }
.slot .rl { display: block; font-size: 7px; color: #8d7f68; margin-top: 6px; line-height: 1.6; }
.slot.locked { opacity: 0.55; cursor: not-allowed; }
.slot.locked .face {
    background: none;
    display: grid;
    place-items: center;
    color: var(--blood);
    font-size: 34px;
}

/* toast for the Konami unlock */
.toast {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    background: var(--panel);
    border: 3px solid var(--gold);
    border-radius: 8px;
    color: var(--gold);
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 12px 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.toast.on { opacity: 1; }

/* console: controls under the fight */
.console {
    width: min(96vw, 900px);
    padding: 12px 8px 0;
}
.deck {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.deck .keys { font-size: 8px; color: #8d7f68; line-height: 1.9; }
.deck .keys b { color: var(--ink); font-weight: 400; }
.iconbtn {
    font-family: inherit;
    font-size: 9px;
    background: var(--panel);
    color: var(--ink);
    border: 2px solid var(--edge);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
}
.iconbtn:hover, .iconbtn:focus-visible { border-color: var(--gold); outline: none; }

.touchpad {
    display: none;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    user-select: none;
    -webkit-user-select: none;
}
@media (pointer: coarse) {
    .touchpad { display: flex; }
    .deck .keys { display: none; }
}
.tgroup { display: flex; gap: 10px; }
.tbtn {
    font-family: inherit;
    font-size: 10px;
    min-width: 64px;
    height: 64px;
    padding: 0 8px;
    border-radius: 12px;
    border: 3px solid var(--edge);
    background: var(--panel);
    color: var(--ink);
    touch-action: none;
}
.tbtn:active { border-color: var(--gold); background: #241a33; }

/* exit + credits */
.exitwrap { margin: 1.6rem 0 0.6rem; text-align: center; }
.exit {
    display: inline-block;
    font-size: clamp(10px, 2vw, 13px);
    color: #1a1206;
    text-decoration: none;
    background: linear-gradient(180deg, #f3c95c, var(--gold) 55%, #c8901f);
    border: 3px solid #4a3208;
    border-radius: 6px;
    padding: 0.9em 1.6em;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 0 #4a3208, 0 8px 20px rgba(0, 0, 0, 0.5);
}
.exit:hover { filter: brightness(1.08); }
.exit:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.credits {
    margin: 1.4rem 1rem 2rem;
    font-size: 7px;
    line-height: 2.1;
    color: #6f6552;
    text-align: center;
    max-width: 70ch;
}
.credits a { color: #9d8f74; }

@media (prefers-reduced-motion: reduce) {
    .scanlines { display: none; }
    .toast { transition: none; }
}

/* On phones the 16:9 stage is a short strip, so menu screens take the
   whole viewport instead of squeezing into it. */
@media (max-width: 640px) {
    .ui { position: fixed; z-index: 30; background: rgba(7, 4, 12, 0.97); }
}

@media (max-width: 480px) {
    .touchpad { gap: 8px; }
    .tgroup { gap: 6px; flex: 1; }
    .tgroup:last-child { flex: 2.1; }
    .tbtn { flex: 1; min-width: 0; height: 60px; font-size: 8px; padding: 0 3px; }
}
