:root {
  color-scheme: dark;
  --bg: #15121b; --surface: #201c27; --line: #3b3444; --faint: #aaa1b2;
  --ink: #fff7eb; --orange: #ffab80; --violet: #c7a9fe; --green: #9cddab; --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg);
}
*, *::after, *::before { box-sizing: border-box }
body { margin: 0; min-width: 260px; background: radial-gradient(ellipse at 15% 0, #28202a, transparent 49rem), var(--bg) }
button, a { font: inherit }
button { cursor: pointer; color: inherit }
button:disabled { cursor: default }
button:focus-visible, a:focus-visible, iframe:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px }
[hidden] { display: none !important }
h1, h2, p { margin: 0 }
.topbar, main { width: min(1100px, 100%); margin: 0 auto; padding-inline: clamp(14px, 4vw, 44px) }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 70px }
.brand { display: flex; align-items: center; gap: 10px }
.brand-mark { color: var(--orange); width: 33px; height: 33px; flex: none }
.brand b { font-size: 16px; letter-spacing: -.025em; line-height: 1; display: block }
.brand small { display: block; margin-top: 4px; font: 9px/1.05 var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .15em }
.connection, .counter { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 5px; background: #201b25; padding: 5px 9px; color: #d5cbd9; font: 11px/1.25 var(--mono); white-space: nowrap }
.connection::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--orange) }
.connection[data-state="live"]::before { background: var(--green); box-shadow: 0 0 8px #95dbad55 }
.connection[data-state="offline"]::before { background: #ad9fac }
main { padding-bottom: 20px }
.hero { min-height: clamp(155px, 24vh, 250px); display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: clamp(21px, 3.2vw, 40px); border: 1px solid #634858; border-radius: 10px; position: relative; isolation: isolate; overflow: hidden; background: #28202b }
.hero::before, .hero::after { position: absolute; content: ''; inset: 0; z-index: -1 }
.hero::before { left: 19%; background: url('./art/neon-den.png') right 52%/cover no-repeat; image-rendering: pixelated }
.hero::after { background: linear-gradient(90deg, #27202b 9%, #27202bf7 29%, #27202bcb 43%, #21172438 66%, transparent 92%), linear-gradient(0deg, #211424ba, transparent 52%) }
.hero-copy { max-width: 56% }
.eyebrow, .stage-tag small { color: var(--faint); font: 700 10px/1.35 var(--mono); letter-spacing: .13em; text-transform: uppercase }
.warm { color: var(--orange) }
.short-line { display: inline-block; width: 19px; height: 2px; vertical-align: middle; margin-right: 5px; background: currentColor }
h1, h2 { letter-spacing: -.046em; line-height: 1.08 }
h1 { font-size: clamp(36px, 5.65vw, 64px); margin: 8px 0 9px }
h1 span { color: var(--orange) }
h2 { font-size: clamp(21px, 2.7vw, 30px); margin-top: 4px }
.hero p { max-width: 345px; color: #e0d4dd; font-size: 14px; line-height: 1.5 }
.stage-tag { flex: none; padding: 5px 11px 4px; border-left: 2px solid var(--orange); background: #211924ba; text-shadow: 0 1px 2px #221926 }
.stage-tag small { display: block; font-size: 9px; color: #fee4c5 }
.stage-tag strong { display: block; font-size: 16px }
.room-grid { display: grid; grid-template-columns: minmax(0, .91fr) minmax(0, 1.1fr); gap: 16px; margin-top: 16px }
.room-grid > section { padding: clamp(15px, 2.2vw, 26px); background: var(--surface); border: 1px solid var(--line); border-radius: 9px }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px }
.counter { background: transparent; color: var(--faint); font-size: 10px }
.seat { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line) }
.seat-code { width: 36px; height: 36px; flex: none; display: grid; place-items: center; color: var(--orange); background: #38292a; border: 1px solid #65463e; border-radius: 4px; font: 700 14px/1 var(--mono) }
.seat[data-seat="1"] .seat-code { color: var(--violet); background: #302735; border-color: #534264 }
.seat-info, .fighter-copy { min-width: 0 }
.seat-name, .seat-detail, .fighter-copy b, .fighter-copy small { display: block; overflow: hidden; text-overflow: ellipsis }
.seat-name { font-size: 15px; white-space: nowrap }
.seat-detail { font-size: 12px; color: var(--faint) }
.seat-state { margin-left: auto; font: 10px/1.4 var(--mono); color: var(--faint); white-space: nowrap }
.seat-state[data-ready="true"] { color: var(--green) }
.seat-footer, .lobby-footer, .match-footer, .ready-line { display: flex; align-items: center; justify-content: space-between; gap: 10px }
.seat-footer { border-top: 1px solid var(--line); padding-top: 14px; color: var(--faint); font-size: 12px; flex-wrap: wrap }
.text-btn { border: none; background: transparent; color: var(--violet); padding: 2px 0; font-size: 12px; font-weight: 650; text-underline-offset: 3px }
.text-btn:hover { text-decoration: underline }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.fighter { position: relative; padding: 9px; display: flex; align-items: center; gap: 9px; text-align: left; border: 1px solid #4c4050; background: #29222e; border-radius: 6px; transition: border-color .12s ease, background .12s ease }
.fighter:hover:not(:disabled) { border-color: #897585 }
.fighter[aria-pressed="true"] { border-color: var(--orange); background: #392b30 }
.portrait { flex: none; width: clamp(42px, 4.5vw, 57px); aspect-ratio: 1; overflow: hidden; border-radius: 3px; background: #382a44 }
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated }
.fighter-copy { padding-right: 3px }
.fighter-copy b { font-size: 16px; color: var(--ink) }
.fighter-copy small { color: #c4b8c6; font-size: 10px; line-height: 1.3 }
.choice-indicator { position: absolute; right: 5px; top: 5px; border: 1px solid #756176; background: #211a25; width: 8px; height: 8px; border-radius: 50% }
.fighter[aria-pressed="true"] .choice-indicator { border-color: var(--orange); background: var(--orange) }
.ready-line { margin-top: 20px; justify-content: flex-start; gap: 14px }
.primary, .secondary { border: 1px solid transparent; border-radius: 5px; padding: 9px 15px; font-size: 14px; font-weight: 750; line-height: 1.35 }
.primary { background: var(--orange); color: #261a1b }
.primary:hover:not(:disabled) { background: #ffc4a3 }
.primary:disabled { background: #68525a; color: #cfbfc4 }
.primary span { margin-left: 8px }
.ready-hint { color: var(--faint); font-size: 12px; max-width: 230px }
.secondary { color: var(--ink); background: #302835; border-color: #645468 }
.secondary:hover { background: #403347 }
.lobby-footer, .match-footer { color: var(--faint); font-size: 12px; padding: 13px 3px 0 }
.lobby-footer i, .match-footer i { font-style: normal; color: #8e768b; margin: 0 3px }
.notice { margin: 0 0 12px; padding: 12px 15px; background: #38282d; border: 1px solid #7c5148; border-radius: 6px; font-size: 13px; display: flex; align-items: center; gap: 10px; justify-content: space-between }
#local-entry { margin-top: 12px; text-align: center }
.match-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 0 9px }
.match-label { display: flex; align-items: baseline; gap: 12px; min-width: 0 }
.match-label strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.match-tools { display: flex; gap: 16px; flex-shrink: 0 }
#arena { position: relative; width: 100%; aspect-ratio: 16/9; max-height: calc(100vh - 158px); max-height: calc(100dvh - 158px); min-height: 140px; margin: auto; background: #070608; border: 1px solid #493a48; border-radius: 6px; overflow: hidden }
#game-host, #game { display: block; border: 0; width: 100%; height: 100%; background: #070608 }
#game-host:empty { background: linear-gradient(#17111caa, #17111cbb), url('./art/neon-den.png') center/cover; image-rendering: pixelated }
.arena-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; background: #15101ddd; overflow-y: auto }
.load-card, .result-card { padding: clamp(17px, 4vw, 38px); max-width: 440px; background: #241c29; border: 1px solid #66515c; box-shadow: 0 9px 30px #09060b88; border-radius: 8px }
.load-card h2, .result-card h2 { margin: 8px 0; font-size: clamp(26px, 4vw, 40px) }
.load-card p, .result-card p { color: #c3b7c8; font-size: 14px }
.load-track { width: 110px; height: 3px; background: #493d4c; overflow: hidden; margin: 17px auto 0 }
.load-track i { display: block; width: 45%; height: 100%; background: var(--orange); animation: load 1.5s ease alternate infinite }
@keyframes load { from { transform: translateX(-10%) } to { transform: translateX(130%) } }
.result-actions { display: flex; justify-content: center; gap: 9px; margin-top: 21px }
.result-card small { display: block; margin-top: 10px; color: var(--faint) }
.match-footer { gap: 6px; flex-wrap: wrap }
#guide { width: min(510px, calc(100% - 28px)); max-height: calc(100% - 28px); border: 1px solid #6d586d; border-radius: 10px; background: #231d29; color: var(--ink); padding: clamp(16px, 3.5vw, 30px); box-shadow: 0 16px 70px #050407b3; overflow: auto }
#guide::backdrop { background: #100b16c7 }
.guide-top { display: flex; align-items: start; justify-content: space-between; gap: 12px }
.close-btn { border: 1px solid var(--line); padding: 0; width: 28px; height: 28px; line-height: 1; font-size: 20px; background: #302635; border-radius: 4px }
.guide-intro, .guide-notes, .guide-live { font-size: 13px; color: #c3b7c8; margin: 12px 0 }
.moves { width: 100%; border-collapse: collapse; font-size: 12px; margin: 17px 0 }
.moves th, .moves td { text-align: left; padding: 7px 5px 7px 0; border-bottom: 1px solid var(--line) }
.moves thead th { color: var(--faint); font: 10px/1.4 var(--mono); text-transform: uppercase }
.moves tbody th { font-weight: 600 }
.moves td { color: #dfd6e1 }
.signatures { display: flex; gap: 8px 20px; flex-wrap: wrap; font-size: 12px }
.signatures b { color: var(--orange); margin-right: 4px }
.guide-live { color: var(--orange); margin-bottom: 0 }
@media (max-width: 920px) and (min-width: 651px) {
  .fighter { align-items: flex-start; flex-direction: column }
  .fighter-copy small { display: none }
  .ready-line { margin-top: 13px }
}
@media (max-width: 650px) {
  .topbar { height: 57px }
  .brand-mark { width: 29px; height: 29px }
  .hero { min-height: 143px; padding: 17px }
  .hero-copy { max-width: 72% }
  .stage-tag { align-self: flex-end; font-size: 12px; padding: 4px 7px }
  .stage-tag strong { font-size: 13px }
  .hero p { font-size: 12px }
  .room-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 10px }
  .room-grid > section { padding: 14px }
  .section-title { margin-bottom: 10px }
  .seat { padding: 7px 0 }
  .seat-code { width: 31px; height: 31px }
  .seat-footer { padding-top: 9px }
  .ready-line { margin-top: 12px }
  .lobby-footer, .match-footer { font-size: 10px }
  .controls-btn { font-size: 11px }
  .match-label { flex-direction: column; gap: 0 }
  .match-tools { gap: 10px }
  #arena { max-height: calc(100dvh - 139px) }
}
@media (max-height: 470px) {
  body.in-match .topbar { height: 34px }
  body.in-match .brand small, body.in-match .brand-mark { display: none }
  body.in-match .match-footer { padding-top: 3px }
  #arena { max-height: calc(100dvh - 105px) }
  .match-heading { padding-bottom: 4px }
}
@media (prefers-reduced-motion: reduce) { *, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important } }
