:root {
  --bg: #0b0b14; --panel: rgba(10, 10, 24, 0.86); --yellow: #ffd166; --red: #e63946; --blue: #3fa9f5; --text: #f4f1ea;
  --font: "Press Start 2P", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
body { display: flex; align-items: center; justify-content: center; }
#stage { position: relative; width: min(100vw, calc(100vh * 16 / 9)); height: min(100vh, calc(100vw * 9 / 16)); background: #000; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2.2vmin; padding: 3vmin; text-align: center; background: var(--panel); }
.screen.active { display: flex; }
.screen.transparent { background: transparent; pointer-events: none; }
.screen.transparent > * { pointer-events: auto; }
h2 { font-size: clamp(14px, 3vmin, 28px); color: var(--yellow); text-shadow: 3px 3px 0 #7a1010; margin: 0 0 1vmin; letter-spacing: 2px; }
h3 { font-size: clamp(14px, 2.8vmin, 26px); color: var(--yellow); margin: 0 0 2vmin; }
h4 { font-size: clamp(8px, 1.5vmin, 13px); color: var(--blue); margin: 1.6vmin 0 0.8vmin; }
.hidden { display: none !important; }
.small { font-size: clamp(7px, 1.3vmin, 12px); color: #c9c4b8; line-height: 1.8; max-width: 70ch; }
.hint { position: absolute; bottom: 2.5vmin; font-size: clamp(6px, 1.2vmin, 11px); color: #9a95a8; }
/* title */
.logo { display: flex; flex-direction: column; align-items: center; line-height: 1; transform: skewX(-6deg); }
.logo-top { font-size: clamp(30px, 9vmin, 92px); color: var(--red); text-shadow: 0.08em 0.08em 0 #4a0a0a, -0.03em -0.03em 0 #fff2; letter-spacing: 0.1em; }
.logo-bottom { font-size: clamp(34px, 10vmin, 104px); color: var(--yellow); text-shadow: 0.08em 0.08em 0 #7a4a00, 0 0 24px #ffd16680; letter-spacing: 0.08em; margin-top: -0.1em; }
.logo-sub { margin-top: 2vmin; font-size: clamp(7px, 1.4vmin, 13px); color: var(--blue); letter-spacing: 0.3em; }
.blink { margin-top: 3vmin; font-size: clamp(10px, 2vmin, 18px); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.footer-note { position: absolute; bottom: 3vmin; font-size: clamp(6px, 1.1vmin, 10px); color: #7a7590; letter-spacing: 0.15em; }
/* menus */
.menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.6vmin; }
.menu li { font-size: clamp(10px, 2.2vmin, 20px); padding: 0.6em 1.4em; color: #d8d3c8; cursor: pointer; position: relative; transition: transform 0.08s; }
.menu li.sel { color: var(--yellow); transform: translateX(0.5em) scale(1.05); text-shadow: 2px 2px 0 #7a1010; }
.menu li.sel::before { content: "▶"; position: absolute; left: -0.4em; color: var(--red); }
.menu li.disabled { opacity: 0.4; }
.btn { font-family: var(--font); font-size: clamp(8px, 1.6vmin, 14px); background: var(--red); color: #fff; border: 0; border-bottom: 4px solid #7a1010; padding: 0.9em 1.4em; cursor: pointer; letter-spacing: 1px; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.ghost { background: transparent; border: 2px solid #555; color: #ccc; }
input { font-family: var(--font); font-size: clamp(9px, 1.8vmin, 16px); background: #111120; color: var(--yellow); border: 2px solid #444; padding: 0.7em; text-transform: uppercase; width: 8em; text-align: center; }
input#nick { width: 11em; }
input#room-link { width: 26em; max-width: 60vw; font-size: clamp(7px, 1.2vmin, 11px); text-transform: none; color: #cfe; }
label { display: flex; gap: 1em; align-items: center; justify-content: center; font-size: clamp(7px, 1.4vmin, 12px); color: #c9c4b8; }
.online-box { display: flex; flex-direction: column; gap: 2vmin; align-items: center; }
.row { display: flex; gap: 1.2vmin; align-items: center; flex-wrap: wrap; justify-content: center; }
.or { font-size: clamp(7px, 1.3vmin, 12px); color: #888; }
.code { font-size: clamp(28px, 8vmin, 80px); color: var(--yellow); letter-spacing: 0.3em; text-shadow: 4px 4px 0 #7a4a00; }
.status { font-size: clamp(9px, 1.8vmin, 16px); color: var(--blue); min-height: 1.5em; }
/* character select */
.roster { display: flex; gap: 1.5vmin; }
.slot { position: relative; width: clamp(64px, 14vmin, 150px); border: 3px solid #333; background: linear-gradient(#1a1a2e, #0d0d18); padding: 0.6vmin; transition: transform 0.1s; }
.slot canvas { width: 100%; aspect-ratio: 4 / 5; display: block; image-rendering: pixelated; }
.slot .name { font-size: clamp(6px, 1.2vmin, 11px); padding: 0.5em 0 0.2em; color: #ddd; }
.slot.cur-p1 { border-color: var(--red); box-shadow: 0 0 0 3px #e6394655, 0 0 18px #e6394688; transform: translateY(-4px); }
.slot.cur-p2 { border-color: var(--blue); box-shadow: 0 0 0 3px #3fa9f555, 0 0 18px #3fa9f588; transform: translateY(-4px); }
.slot.cur-p1.cur-p2 { border-image: linear-gradient(90deg, var(--red), var(--blue)) 1; }
.slot .tag { position: absolute; top: -1.2em; font-size: clamp(6px, 1.1vmin, 10px); padding: 0.2em 0.5em; color: #fff; }
.slot .tag.t1 { left: -3px; background: var(--red); } .slot .tag.t2 { right: -3px; background: var(--blue); }
.slot.lock-p1 .tag.t1::after, .slot.lock-p2 .tag.t2::after { content: " ✓"; }
.panels { display: flex; gap: 3vmin; align-items: flex-start; width: min(90%, 900px); justify-content: space-between; }
.panel { flex: 1; text-align: left; background: #00000066; padding: 1.2vmin 1.6vmin; border-left: 4px solid var(--red); min-height: 10vmin; }
.panel.p2 { border-left: 0; border-right: 4px solid var(--blue); text-align: right; }
.pname { font-size: clamp(10px, 2vmin, 18px); color: var(--yellow); }
.ptitle { font-size: clamp(6px, 1.1vmin, 10px); color: #9ad; margin: 0.6em 0 0.8em; }
.moves { list-style: none; padding: 0; margin: 0; font-size: clamp(6px, 1.05vmin, 10px); color: #cfc9bd; line-height: 1.9; }
.vs { font-size: clamp(18px, 5vmin, 48px); color: var(--red); text-shadow: 3px 3px 0 #000; align-self: center; font-style: italic; }
/* fight overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); }
.dialog { background: #0d0d18; border: 3px solid var(--yellow); padding: 3vmin 5vmin; text-align: center; box-shadow: 0 0 40px #000; }
.toast { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); background: #000c; color: var(--yellow); padding: 0.8em 1.4em; font-size: clamp(8px, 1.5vmin, 13px); border: 2px solid var(--yellow); }
/* controls */
.controls-grid { display: flex; gap: 4vmin; justify-content: center; flex-wrap: wrap; }
table { border-collapse: collapse; font-size: clamp(6px, 1.2vmin, 11px); }
td { padding: 0.35em 0.9em; text-align: left; color: #d8d3c8; border-bottom: 1px solid #222; }
td:first-child { color: var(--yellow); }
.movelists { display: flex; gap: 3vmin; flex-wrap: wrap; justify-content: center; max-width: 95%; }
.movelists div { font-size: clamp(5.5px, 1vmin, 9px); color: #bbb; text-align: left; line-height: 1.8; }
.movelists b { color: var(--blue); display: block; margin-bottom: 0.3em; }
@media (max-width: 700px) { .panels { flex-direction: column; align-items: stretch; } .vs { display: none; } .hint { display: none; } }

.arr { font-family: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", sans-serif; font-size: 1.35em; line-height: 0; vertical-align: -0.1em; color: var(--yellow); }
