/* SF2 colors (1P red / 2P blue, the yellow and red of the life bars) on a neutral dark
   background, with modern shapes. The pixel font is kept for the logo, titles, the verdict and
   numbers; it has no accented capitals (nor had the arcade), so ui/app.js strips accents there. */
:root {
    --bg-1: #1c1c22;
    --bg-2: #0f0f13;
    --ink: #121216;
    --ink-2: #202028;
    --ink-3: #2a2a34;
    --bevel: rgba(255, 255, 255, .09);
    --shade: rgba(0, 0, 0, .55);
    --yellow: #ffd200;
    --red: #e3141b;
    --red-dark: #7d0008;
    --blue: #2a6dff;
    --text: #f4f4f8;
    --muted: #a3a3b2;
    --green: #39e06d;
    --plus: #4be08a;
    --minus: #ff6b70;
    --radius: 6px;
    --pixel: 'Press Start 2P', ui-monospace, monospace;
    --body: 'Barlow Semi Condensed', system-ui, sans-serif;
    --mono: ui-monospace, Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    color: var(--text);
    font: 500 16px/1.4 var(--body);
    background:
        radial-gradient(rgba(255, 255, 255, .025) 1px, transparent 1.5px) 0 0 / 6px 6px,
        linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 100%) fixed;
}
code, .mono { font-family: var(--mono); font-size: .9em; }

/* Arcade lettering: yellow, dark red outline, black shadow */
.sf {
    font-family: var(--pixel);
    font-weight: 400;
    color: var(--yellow);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 0 var(--red-dark), -2px 0 var(--red-dark), 0 2px var(--red-dark), 0 -2px var(--red-dark),
                 2px 2px var(--red-dark), -2px -2px var(--red-dark), 2px -2px var(--red-dark), -2px 2px var(--red-dark), 3px 4px 0 #000;
}
/* Small labels: uppercase, spaced */
.cap { font: 700 12px/1.2 var(--body); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- Layout: the game as big as the window allows, the tab rail, the panel ---- */
.app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px 420px;
    grid-template-rows: 100vh auto;
}
.stage { display: flex; flex-direction: column; min-width: 0; padding: 14px 18px 18px; gap: 12px; }
.topbar { display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.logo { margin: 0; font-size: 18px; }
.vs { margin: 0; display: flex; align-items: center; gap: 10px; font: 400 11px/1 var(--pixel); text-transform: uppercase; text-shadow: 2px 2px 0 #000; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.lang-btn { padding: 5px 8px; font: 400 9px/1 var(--pixel); }
.volume { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.volume svg { width: 18px; height: 18px; flex: none; }
.volume input { width: 84px; margin: 0; accent-color: var(--yellow); cursor: pointer; }
.vs .p1 { color: var(--red); } .vs .p2 { color: var(--blue); } .vs b { color: var(--yellow); font-weight: 400; }

.screen-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.screen-wrap {
    position: relative;
    /* "Taille de l'écran" (ui/app.js): as tall as the window, or a multiple of the native size */
    width: var(--screen-w, min(100%, calc((100vh - 84px) * 4 / 3)));
    max-width: 100%;
    background: #000;
    border: 3px solid #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 0 2px var(--bevel), 6px 6px 0 2px var(--shade);
}
.screen { display: block; width: 100%; aspect-ratio: 4 / 3; image-rendering: pixelated; }
/* light scanlines, as on an arcade CRT */
.screen-wrap::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .09) 0 1px, transparent 1px 3px); }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.rail {
    background: var(--bg-2);
    border-left: 2px solid #000;
    border-right: 2px solid #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
}
.rail button {
    position: relative;
    width: 64px;
    padding: 9px 0 7px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: none;
    box-shadow: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font: 700 11.5px/1.05 var(--body);
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: center;
}
.rail button svg { width: 23px; height: 23px; }
.rail button:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
/* the active tab: framed by the red 1P cursor of the select screen */
.rail button[aria-selected="true"] { color: var(--yellow); border-color: var(--red); background: rgba(227, 20, 27, .1); }
.rail button[aria-selected="true"]::before { content: '1P'; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font: 400 7px/1 var(--pixel); background: var(--red); color: var(--text); padding: 2px 4px; border-radius: 2px; }

.panel { overflow-y: auto; max-height: 100vh; padding: 20px 18px 30px; background: rgba(0, 0, 0, .18); }
/* a line between the sections of a tab (not above its first one) */
.panel > section:not(.tab-hidden) ~ section:not(.tab-hidden) { margin-top: 26px; padding-top: 22px; border-top: 2px solid #000; box-shadow: 0 -1px 0 var(--bevel); }
.panel > section.tab-hidden { display: none; }
.panel h2 { margin: 0 0 16px; font-size: 14px; line-height: 1.4; }
.panel p { margin: 10px 0 0; }

.debug { grid-column: 1 / -1; margin: 0 18px 18px; padding: 14px; min-width: 0; container-type: inline-size; }

/* ---- Boxes, buttons, fields ---- */
.box, .debug {
    background: var(--ink);
    border: 2px solid #000;
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--bevel), 4px 4px 0 var(--shade);
}

button, .btn-like {
    font: 700 15px/1 var(--body);
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text);
    padding: 10px 14px;
    background: var(--ink-2);
    border: 2px solid #000;
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 3px 3px 0 var(--shade);
    cursor: pointer;
}
button:hover:not(:disabled) { background: var(--ink-3); }
button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shade); }
button:disabled { opacity: .4; cursor: default; }
button.go { background: var(--yellow); color: #1a1000; }
button.go:hover:not(:disabled) { background: #ffdc33; }
button.stop { background: var(--red); }
button.stop:hover:not(:disabled) { background: #f12a31; }
button.on { color: var(--yellow); box-shadow: inset 0 0 0 2px var(--yellow), 3px 3px 0 var(--shade); }
.small-btn, .tiny-btn { font-size: 13px; padding: 7px 10px; }
.tiny-btn { padding: 5px 8px; font-size: 12px; box-shadow: 2px 2px 0 var(--shade); }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.panel section > button { margin-top: 12px; }

select, input[type="search"], .debug input {
    font: 600 16px/1.1 var(--body);
    color: var(--text);
    background: var(--ink);
    border: 2px solid #000;
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--bevel);
    padding: 7px 10px;
}
select {
    appearance: none;
    padding-right: 30px;
    background: var(--ink) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="7"><path d="M0 0h10L5 7z" fill="%23ffd200"/></svg>') no-repeat right 11px center;
}
select:disabled { opacity: .5; }

.match-pick { display: grid; gap: 8px; margin-bottom: 14px; }
.match-pick label, .zoom {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font: 700 12px/1.2 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.match-pick select, .zoom select { min-width: 210px; max-width: 250px; }
.zoom { margin-top: 14px; }

.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-weight: 600; cursor: pointer; }
.check input {
    appearance: none; flex: none; margin: 0;
    width: 20px; height: 20px;
    border: 2px solid #000; border-radius: 4px;
    background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--bevel);
    cursor: pointer;
}
.check input:checked { background: var(--yellow) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path d="M2 6l3 3 5-6" stroke="%231a1000" stroke-width="2" fill="none"/></svg>') center / 12px no-repeat; }
.check input:disabled { opacity: .5; }

/* ---- Home screen (boot) ---- */
.boot {
    position: absolute; inset: 0; z-index: 3;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    padding: 24px; text-align: center;
    background: radial-gradient(rgba(255, 255, 255, .03) 1px, transparent 1.5px) 0 0 / 6px 6px, linear-gradient(180deg, var(--bg-1), var(--bg-2));
}
.boot-title { margin: 0; font-size: clamp(24px, 3.6vw, 44px); line-height: 1.2; }
.boot-title em { display: block; margin-top: 16px; font: 700 16px/1 var(--body); font-style: normal; letter-spacing: .4em; text-transform: uppercase; color: var(--text); }
.boot-intro { margin: 0; max-width: 460px; color: var(--muted); font-size: 18px; }
.rom-picker {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: min(460px, 100%); padding: 22px;
    border: 2px dashed rgba(255, 210, 0, .7); border-radius: 10px; background: rgba(0, 0, 0, .3);
    cursor: pointer;
}
.rom-picker.over { background: rgba(255, 210, 0, .08); }
.rom-picker input { display: none; }
.rom-big { font: 700 20px/1.2 var(--body); text-transform: uppercase; letter-spacing: .06em; }
.rom-small { color: var(--muted); }
.rom-picker .btn-like { margin-top: 6px; }
.press-start {
    background: none; border: 0; box-shadow: none;
    font: 400 14px/1 var(--pixel); text-transform: uppercase; color: var(--yellow); text-shadow: 2px 2px 0 #000;
    animation: blink 1.2s steps(1) infinite;
}
.press-start:hover:not(:disabled) { background: none; }
.press-start:disabled { animation: none; opacity: .5; }
.boot-status { margin: 0; min-height: 1.4em; color: var(--muted); }

/* ---- Situations ---- */
/* the list: one block per family, one line per situation (opponent, then what it does) */
.sit-picker { display: flex; flex-direction: column; gap: 8px; }
.sit-family { background: var(--ink); border: 2px solid #000; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--bevel), 3px 3px 0 var(--shade); }
.sit-family summary {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none;
    font: 800 italic 19px/1 var(--body); text-transform: uppercase; color: var(--yellow);
}
.sit-family summary::-webkit-details-marker { display: none; }
.sit-family summary::before { content: '▸'; font-style: normal; color: var(--muted); transition: transform .1s; }
.sit-family[open] summary::before { transform: rotate(90deg); }
.sit-family .count { margin-left: auto; font: 400 9px/1 var(--pixel); color: var(--muted); font-style: normal; }
.sit-family ul { list-style: none; margin: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 3px; }
.sit-face { width: 30px; height: 30px; object-fit: cover; object-position: top; border: 2px solid #000; border-radius: 3px; image-rendering: pixelated; font-style: normal; }
.sit-kind { margin: 4px 14px 4px; font: 700 11px/1.2 var(--body); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.sit-pick {
    width: 100%; display: flex; align-items: baseline; gap: 10px; text-align: left;
    padding: 9px 10px; background: none; border: 0; box-shadow: none;
    font: 600 16px/1.2 var(--body); text-transform: none; letter-spacing: 0;
}
.sit-pick:hover:not(:disabled) { background: var(--ink-2); }
.sit-pick[aria-current] { box-shadow: inset 3px 0 0 var(--red); background: rgba(227, 20, 27, .08); }
.sit-pick.loading::after { content: 'Préparation…'; margin-left: auto; color: var(--yellow); font-size: 14px; animation: blink 1s steps(1) infinite; }

/* the situation being played */
.sit-now { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.sit-now strong { font: 800 italic 24px/1.05 var(--body); text-transform: uppercase; }
.sit-active .buttons { margin-top: 14px; }
.sit-steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sit-step {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 14px;
    background: var(--ink); border: 2px solid #000; border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--bevel), 4px 4px 0 var(--shade);
}
.sit-step.active { box-shadow: inset 0 0 0 2px var(--yellow), 4px 4px 0 var(--shade); }
.sit-step-text { display: flex; flex-direction: column; font: 800 italic 23px/1.05 var(--body); text-transform: uppercase; color: var(--yellow); }
.sit-step-text small { font: 500 15px/1.3 var(--body); font-style: normal; text-transform: none; color: var(--muted); margin-top: 3px; }
.sit-sep { font: 700 12px/1 var(--body); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding-left: 16px; }
/* arcade stick seen from above: the red ball leans the way to push */
.stick { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; background: #050506; box-shadow: inset 0 0 0 2px var(--ink-3); }
.stick::before {
    content: ''; position: absolute; width: 24px; height: 24px; left: 12px; top: 12px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ff8a8e, var(--red) 45%, var(--red-dark));
    box-shadow: 1px 2px 0 rgba(0, 0, 0, .7);
    transform: translate(calc(var(--dx, 0) * 11px), calc(var(--dy, 0) * 11px));
}
/* six buttons as on the cabinet: punches above, kicks below, light / medium / heavy */
.pad { display: grid; grid-template-columns: repeat(3, 16px); gap: 4px; flex: none; }
.pad i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #000; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3); }
.pad i:nth-child(3n + 1) { background: var(--blue); }
.pad i:nth-child(3n + 2) { background: var(--yellow); }
.pad i:nth-child(3n) { background: var(--red); }

.sit-verdict { margin: 16px 0 0; min-height: 1.4em; font: 800 italic 22px/1.1 var(--body); text-transform: uppercase; }
.sit-verdict.plus, .sit-banner.plus .sf { color: var(--plus); }
.sit-verdict.minus { color: var(--minus); }
/* score like the arcade HUD */
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.hud > div { padding: 11px 8px 10px; text-align: center; }
.hud b { display: block; font: 400 15px/1 var(--pixel); color: var(--text); }
.hud .good b { color: var(--yellow); }
.hud span { display: block; margin-top: 8px; font: 700 11px/1 var(--body); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

/* verdict of an attempt, written on the game like "YOU WIN" */
.sit-banner { position: absolute; left: 0; right: 0; top: 28%; z-index: 2; text-align: center; pointer-events: none; padding: 0 16px; }
.sit-banner .sf { display: block; font-size: clamp(14px, 2.6vw, 32px); line-height: 1.3; }
.sit-banner.minus .sf { color: var(--text); text-shadow: 2px 0 var(--red), -2px 0 var(--red), 0 2px var(--red), 0 -2px var(--red), 2px 2px var(--red), -2px -2px var(--red), 2px -2px var(--red), -2px 2px var(--red), 3px 4px 0 #000; }
.sit-banner.plus .sf { text-shadow: 2px 0 #064d22, -2px 0 #064d22, 0 2px #064d22, 0 -2px #064d22, 2px 2px #064d22, -2px -2px #064d22, 2px -2px #064d22, -2px 2px #064d22, 3px 4px 0 #000; }
.sit-banner small { display: inline-block; margin-top: 12px; font: 700 15px/1.2 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--text); text-shadow: 2px 2px 0 #000; }
.sit-banner small.again { animation: blink 1s steps(1) infinite; }

.sit-punish-box { margin-top: 20px; }
.sit-punish-box .cap { margin-bottom: 10px; }
.sit-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sit-chips:empty { display: none; }
.sit-chip, .combo-chip {
    display: inline-flex; align-items: baseline; gap: 8px;
    padding: 5px 10px;
    background: var(--ink-2); border: 2px solid #000; border-radius: var(--radius);
    box-shadow: 2px 2px 0 var(--shade);
    font-weight: 700; white-space: nowrap;
}
.sit-chip b { font: 400 9px/1 var(--pixel); color: var(--yellow); }
.sit-why { margin-top: 20px; color: var(--muted); }
.sit-why summary { cursor: pointer; font: 700 13px/1 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--text); }
.panel section p.sit-source { font-style: italic; }
.co-legend dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0 0; font-size: 13px; }
.co-legend dt { white-space: nowrap; }
.co-legend dt code { color: var(--yellow); font-weight: 700; }
.co-legend dd { margin: 0; }

/* ---- Specials, combos ---- */
.sp-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sp-move {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 10px;
    padding: 9px 12px;
    background: var(--ink); border: 2px solid #000; border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--bevel), 3px 3px 0 var(--shade);
}
.sp-move.flash { animation: sp-flash .7s ease-out; }
@keyframes sp-flash { from { background: #1d5a35; } to { background: var(--ink); } }
/* not uppercased: move notation (cr.MK, j.HK) needs its case */
.sp-name { grid-column: 1 / -1; font: 800 italic 19px/1.1 var(--body); }
.sp-name small { margin-left: 6px; font: 500 14px/1 var(--body); font-style: normal; text-transform: none; color: var(--muted); }
.sp-command { font-size: 18px; letter-spacing: .04em; color: var(--yellow); font-weight: 700; }
.sp-count { font: 400 10px/1 var(--pixel); color: var(--plus); min-width: 2.5em; text-align: right; }
.panel section p.sp-status { min-height: 1.3em; color: var(--plus); }
.sp-history { font-family: var(--mono); color: var(--text); }
.combo-steps { font-size: 15px; color: var(--yellow); font-weight: 600; }
.combo-buttons { grid-column: 2 / -1; display: flex; gap: 6px; }
.combo-progress { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.combo-progress:empty { display: none; }
.combo-chip.hit { color: #062b14; background: var(--plus); }

/* ---- Character sheet: the select grid, then the card ---- */
.roster { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 6px; }
.roster-cell { position: relative; padding: 0; aspect-ratio: 96 / 100; border: 0; border-radius: 3px; background: var(--ink-2); box-shadow: none; overflow: visible; }
.roster-cell:hover:not(:disabled) { background: var(--ink-3); }
.roster-cell:active:not(:disabled) { transform: none; box-shadow: none; }
.roster-cell img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; border-radius: 3px; opacity: .75; transition: opacity .1s; }
.roster-cell:hover img, .roster-cell[aria-current] img { opacity: 1; }
.roster-name { display: grid; place-items: center; height: 100%; padding: 2px; font: 700 10px/1.1 var(--body); text-transform: uppercase; color: var(--muted); }
/* the chosen one: the red 1P cursor */
.roster-cell[aria-current] { outline: 3px solid var(--red); outline-offset: -1px; z-index: 1; }
.roster-cell[aria-current]::before { content: '1P'; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); font: 400 6px/1 var(--pixel); color: var(--text); background: var(--red); padding: 2px 3px; border-radius: 2px; }
#shStatus:empty { display: none; }

.hero { display: grid; grid-template-columns: 128px 1fr; gap: 16px; align-items: end; margin-top: 18px; }
.hero-face { display: block; width: 128px; aspect-ratio: 96 / 100; image-rendering: pixelated; border: 2px solid #000; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--bevel), 4px 4px 0 var(--shade); background: var(--ink-2); }
.hero-name h3 { margin: 0 0 12px; font-size: 19px; line-height: 1.3; }
.tag { display: inline-block; font: 700 12px/1 var(--body); text-transform: uppercase; letter-spacing: .1em; padding: 5px 9px; border-radius: 99px; }
.tag.easy { background: rgba(57, 224, 109, .16); color: var(--plus); }
.tag.hard { background: rgba(227, 20, 27, .2); color: var(--minus); }
.tag-src { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }

/* stat bars drawn like the life bars: yellow on red, thin white then black frame */
.bars { display: flex; flex-direction: column; gap: 13px; margin-top: 18px; padding: 15px; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.bar-name { font: 700 13px/1 var(--body); text-transform: uppercase; letter-spacing: .1em; }
.bar-value { font: 400 9px/1 var(--pixel); color: var(--yellow); text-transform: uppercase; }
.bar-track { height: 12px; background: #b9121a; border: 2px solid var(--text); outline: 2px solid #000; border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(180deg, #fff27a 0 30%, var(--yellow) 30% 78%, #d39e00 78%); }

.sheet-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.sheet-col { padding: 12px 13px; }
.sheet-col h4 { margin: 0 0 8px; font: 700 13px/1 var(--body); text-transform: uppercase; letter-spacing: .12em; }
.sheet-col.plus h4 { color: var(--plus); }
.sheet-col.minus h4 { color: var(--minus); }
.sheet-col ul { margin: 0; padding: 0; list-style: none; font-size: 15px; }
.sheet-col li { position: relative; padding-left: 14px; }
.sheet-col li + li { margin-top: 6px; }
.sheet-col li::before { content: ''; position: absolute; left: 0; top: .5em; width: 6px; height: 6px; background: var(--yellow); }
.sheet-mu-title { margin: 20px 0 10px; }
.sheet-mu-row { display: grid; grid-template-columns: 104px 1fr; gap: 8px; align-items: start; margin: 6px 0; }
.sheet-mu-tier { font: 700 12px/1.3 var(--body); text-transform: uppercase; letter-spacing: .08em; padding-top: 5px; }
.sheet-mu-tier.plus { color: var(--plus); }
.sheet-mu-tier.even { color: var(--muted); }
.sheet-mu-tier.minus { color: var(--minus); }
.sheet-mu-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.sheet-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; font-size: 14px; font-weight: 600; background: var(--ink-2); border: 2px solid #000; border-radius: 4px; }
.sheet-chip img { width: 20px; height: 21px; image-rendering: pixelated; border-radius: 2px; }

/* ---- Tools ---- */
.fd-last { display: flex; align-items: baseline; gap: 12px; margin-top: 14px; }
.fd-value { font: 400 24px/1 var(--pixel); min-width: 3ch; }
.fd-value.plus, .fd-small.plus { color: var(--plus); }
.fd-value.minus, .fd-small.minus { color: var(--minus); }
.fd-value.even, .fd-small.even { color: var(--muted); }
.fd-history { list-style: none; margin: 10px 0 0; padding: 0; color: var(--muted); }
.fd-history li { padding: 4px 0; border-top: 1px solid var(--ink-3); }
.fd-small { display: inline-block; min-width: 3ch; font-family: var(--mono); font-weight: 600; }
.error-text { color: var(--minus); }
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { width: 12px; height: 12px; flex: none; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
#recordSection.recording #recStatus { color: var(--minus); }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.slot {
    display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px;
    background: var(--ink); border: 2px solid #000; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--bevel);
}
.slot.flash { animation: slot-flash .6s ease-out; }
@keyframes slot-flash { from { box-shadow: inset 0 0 0 2px var(--yellow); } }
.slot-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.slot-head kbd { font-family: var(--mono); font-size: 12px; }
.slot-shot { position: relative; aspect-ratio: 4 / 3; background: #000; border-radius: 3px; overflow: hidden; }
.slot-shot img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.slot:not(.filled) .slot-shot img { display: none; }
.slot-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.slot.filled .slot-empty { display: none; }
.slot-label { min-height: 2.9em; overflow: hidden; text-overflow: ellipsis; white-space: pre; color: var(--muted); font-size: 13px; }
.slot-label.error { white-space: normal; color: var(--minus); }
.slot-buttons { display: flex; gap: 6px; }
.slot-buttons button { flex: 1; padding: 6px 4px; font-size: 12px; }
.slots-note { color: var(--minus); }

/* ---- Settings ---- */
.keys, .players { width: 100%; border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; }
.keys td { padding: 3px 0; }
.keys td:not(:first-child), .keys th { text-align: right; }
.keys th, .players thead th { color: var(--muted); font-weight: 700; padding-bottom: 4px; }
.keys kbd {
    display: inline-block; min-width: 28px; padding: 2px 7px;
    background: var(--ink-2); border: 2px solid #000; border-radius: 4px; box-shadow: 0 2px 0 #000;
    text-align: center; font-family: var(--mono); font-size: 13px;
}
.keys + .small-btn { margin-top: 12px; }
.key-btn { background: none; border: none; box-shadow: none; padding: 0; }
.key-btn:hover:not(:disabled) { background: none; }
.key-btn:hover:not(:disabled) kbd { color: var(--yellow); }
.key-btn:disabled { opacity: 1; }
.key-btn.waiting kbd { color: var(--yellow); animation: blink .8s steps(2) infinite; }
.pad-pick td { padding-bottom: 6px; }
.pad-pick select { width: 118px; font-size: 13px; padding: 5px 24px 5px 8px; background-position: right 8px center; }
.players th, .players td { padding: 3px 4px; text-align: right; }
.players th:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.players td { font-family: var(--mono); }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-family: var(--mono); }

/* ---- RAM debug (developer tool, under the game) ---- */
.debug-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.debug-head h2 { margin: 0 8px 0 0; font-size: 13px; }
#ramFilter { flex: 1 1 220px; }
.watch-form { display: flex; gap: 6px; }
.table-scroll { max-height: calc(100vh - 220px); min-height: 240px; overflow: auto; margin-top: 10px; }
.ram { width: 100%; border-collapse: collapse; font-size: 14px; }
.ram th { position: sticky; top: 0; background: var(--ink); text-align: left; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 2px solid #000; }
.ram td { padding: 3px 8px; border-bottom: 1px solid var(--ink-3); white-space: nowrap; }
.ram td.id { font-family: var(--mono); }
.ram td.sources a { color: var(--muted); }
.ram td.value { min-width: 150px; }
@container (max-width: 680px) {
    .ram th:nth-child(5), .ram td:nth-child(5) { display: none; }
    .ram th, .ram td { padding-left: 5px; padding-right: 5px; }
    .ram td.value { min-width: 120px; }
}
.ram tr.changed td.value { color: var(--yellow); }
.ram select.status-verified { color: var(--plus); }
.ram select.status-wrong { color: var(--minus); }

/* ---- Narrow windows: game, then a row of tabs, then the panel ---- */
@media (max-width: 1100px) {
    .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
    .screen-wrap { width: var(--screen-w, 100%); }
    .rail { flex-direction: row; overflow-x: auto; padding: 12px; border: 0; border-top: 2px solid #000; border-bottom: 2px solid #000; justify-content: flex-start; }
    .panel { max-height: none; }
    .match-pick select, .zoom select { min-width: 0; max-width: 60%; }
    .volume input { width: 56px; }
}

/* ---- Progression: run badges, bars, the Perso tab's block ---- */
.run { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; font-style: normal; }
.run i { width: 8px; height: 8px; background: var(--ink-2); border: 1px solid #000; box-shadow: inset 0 0 0 1px var(--bevel); }
.run i.best { background: #2e6b45; }
.run i.now { background: var(--plus); }
.run.done b { color: var(--yellow); font-size: 15px; line-height: 1; text-shadow: 1px 1px 0 #000; }
.sp-run { margin-left: 10px; }
.sp-move.target { box-shadow: inset 4px 0 0 var(--yellow), inset 0 0 0 1px var(--bevel), 3px 3px 0 var(--shade); }
.sp-move { cursor: pointer; }
.sit-run { flex: none; align-self: center; }
#sitRun:empty { display: none; }
.prog-track { display: block; flex: 1; height: 8px; min-width: 40px; background: var(--ink-2); border: 2px solid #000; border-radius: 2px; overflow: hidden; }
.prog-fill { display: block; height: 100%; background: linear-gradient(180deg, #7dffa8 0 35%, var(--plus) 35%); }
.prog { margin-top: 20px; padding: 14px; }
.prog-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.prog-head h4 { margin: 0; }
.prog-pct { font-size: 14px; color: var(--yellow); }
.prog > .prog-track { height: 12px; }
.prog p { margin: 8px 0 12px; }
.prog-group { border-top: 1px solid var(--bevel); }
.prog-group summary { display: flex; align-items: center; gap: 10px; padding: 9px 2px; cursor: pointer; list-style: none; }
.prog-group summary::-webkit-details-marker { display: none; }
.prog-group summary::before { content: '▸'; color: var(--muted); transition: transform .1s; }
.prog-group[open] summary::before { transform: rotate(90deg); }
.prog-name { flex: 0 0 9.5em; font: 700 13px/1.2 var(--body); text-transform: uppercase; letter-spacing: .06em; }
.prog-count { flex: none; min-width: 3.2em; text-align: right; font: 400 9px/1 var(--pixel); color: var(--muted); }
.prog-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.prog-item {
    width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
    padding: 7px 8px; background: none; border: 0; box-shadow: none;
    font: 600 15px/1.2 var(--body); text-transform: none; letter-spacing: 0;
}
.prog-item:hover:not(:disabled) { background: var(--ink-2); }
.prog-label small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.prog-next { margin-left: auto; flex: none; padding: 2px 6px; font: 400 7px/1.4 var(--pixel); text-transform: uppercase; color: #000; background: var(--yellow); border-radius: 2px; }
@media (max-width: 520px) { .prog-name { flex-basis: 7em; } }

/* ---- Entraînement: who plays, and its three parts ---- */
.train-who { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.train-who label { display: flex; align-items: center; gap: 10px; font: 700 12px/1.2 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.train-who select { min-width: 190px; }
.train-who .sit-face { width: 40px; height: 40px; }
.seg { display: flex; border: 2px solid #000; border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--bevel); }
.seg button { flex: 1; padding: 9px 6px; border: 0; border-radius: 0; box-shadow: none; background: var(--ink); color: var(--muted); font: 700 13px/1.1 var(--body); text-transform: uppercase; letter-spacing: .06em; }
.seg button + button { border-left: 2px solid #000; }
.seg button[aria-selected="true"] { color: #000; background: var(--yellow); }
.seg button:hover:not([aria-selected="true"]) { color: var(--text); background: var(--ink-2); }
.panel > section[data-tab][data-sub]:not(.tab-hidden) { margin-top: 16px; padding-top: 0; border-top: 0; box-shadow: none; }

.input-pane { margin-top: 12px; }
#inputNav { margin-top: 4px; }

/* ---- Pause in the top bar, its key; Enter on the start screen ---- */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; padding: 0; }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn .ic-play, .icon-btn.paused .ic-pause { display: none; }
.icon-btn.paused .ic-play { display: block; }
.icon-btn.paused { color: #000; background: var(--yellow); }
.lab-key { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-weight: 700; }
.lab-key kbd {
    display: inline-block; min-width: 28px; padding: 2px 7px;
    background: var(--ink-2); border: 2px solid #000; border-radius: 4px; box-shadow: 0 2px 0 #000;
    text-align: center; font-family: var(--mono); font-size: 13px;
}
.lab-key .key-btn.waiting kbd { color: var(--yellow); animation: blink .8s steps(2) infinite; }
.boot-hint { margin: -4px 0 0; color: var(--muted); font-size: 14px; }
.boot-hint[hidden] { display: none; }

/* ---- Loading, over the game: a match being prepared, a combo searched... ---- */
.loading {
    position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: rgba(8, 8, 12, .72); text-align: center; padding: 16px;
}
.loading[hidden] { display: none; }
.loading .sf { font-size: clamp(14px, 2.4vw, 26px); color: var(--yellow); text-shadow: 3px 3px 0 #000; }
.loading .sf::after { content: '...'; display: inline-block; width: 3ch; text-align: left; animation: loading-dots 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes loading-dots { from { width: 0; } to { width: 4ch; } }
.loading small { font: 700 15px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--text); text-shadow: 2px 2px 0 #000; }

.match-pick input[type="number"] { width: 90px; font: 600 16px/1.1 var(--body); color: var(--text); background: var(--ink); border: 2px solid #000; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--bevel); padding: 7px 10px; }

/* ---- Online: rooms ---- */
.room-join { display: flex; gap: 8px; margin-top: 12px; }
.room-join input, .room-link input {
    font: 600 16px/1.1 var(--body); color: var(--text); background: var(--ink); border: 2px solid #000;
    border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--bevel); padding: 7px 10px; min-width: 0;
}
.room-join input { width: 9ch; text-transform: uppercase; letter-spacing: .2em; font-family: var(--mono); }
.room-info { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 12px 14px; }
.room-info strong { font-size: 22px; color: var(--yellow); letter-spacing: .1em; }
.room-link { display: flex; gap: 8px; }
.room-link input { flex: 1; font-size: 13px; }


.online-score { margin: 12px 0 0; font: 800 italic 22px/1.1 var(--body); color: var(--yellow); text-transform: uppercase; }

/* ---- During an online game: what would touch the emulator is off ---- */
.online-notice { display: none; margin: 0 0 12px; padding: 8px 12px; border: 2px solid var(--yellow); border-radius: var(--radius); color: var(--yellow); font-weight: 700; font-size: 14px; }
.online-playing .online-notice { display: block; }
.online-playing section[data-sub] button, .online-playing .sp-move, .online-playing .prog-item,
.online-playing #matchBtn, .online-playing #savestates button, .online-playing #pauseBtn, .online-playing #stepBtn,
.online-playing #resetBtn, .online-playing #testMenuBtn, .online-playing #netStart {
    pointer-events: none; opacity: .4;
}
.online-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 16px; padding: 12px 14px; border-color: var(--yellow); }
.online-bar strong { flex: 1; min-width: 12em; font: 800 italic 18px/1.2 var(--body); color: var(--yellow); }
.online-bar .buttons { margin: 0; }
