[hidden]{display:none!important}
body:not([data-screen=play]) main{max-width:1080px}
.welcome,#selection{border:1px solid #50475e;background:#1d192a;overflow:hidden}
.welcome{display:grid;grid-template-columns:1.12fr 1fr;min-height:470px}
.welcome-copy,.select-panel{padding:clamp(22px,4vw,54px)}
.welcome-copy{align-self:center}.welcome-copy h2,#selection h2,.profile h3{margin:0;font-family:var(--arcade-font)}
.welcome-copy h2{font-size:clamp(68px,9vw,132px);line-height:.83;letter-spacing:-.035em;margin:24px 0}
.welcome-copy em{color:#ffa4c7}.welcome-copy>p:not(.eyebrow){color:#ddd5e3;line-height:1.8}
.flow-cta{padding:13px 24px;background:#ffaccc;color:#231728;font-weight:900;border:0;margin-top:12px}.flow-cta:hover{background:#ffd3e5;color:#271a27}.flow-cta:disabled{opacity:.5}
.cover-art,.poster{background-image:url(assets/selection-gallery.png);background-size:300% 200%;background-position:0 0;aspect-ratio:2/3}
.cover-art{align-self:center;width:100%}#selection{display:grid;grid-template-columns:minmax(0,.88fr) minmax(0,1fr);align-items:center}.poster{width:100%;box-shadow:0 0 0 1px #51415f}
.select-panel h2{font-size:clamp(34px,4vw,61px);line-height:.94;margin:20px 0}.text-button{border:none;padding:0;color:#c9bdce}.pick button[aria-pressed=true]{background:#f5c6db;color:#241522}
.profile{margin:20px 0}.profile small{color:#efaaca;letter-spacing:.2em}.profile h3{font:900 36px var(--arcade-font);margin:4px 0}.profile>b{color:#dbd4df}
#kitGuide{white-space:pre-line;font-size:13px;margin:10px 0}.names{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.names button{padding:10px 3px;border-bottom:3px solid var(--member);color:#f8eff7}.names button[aria-pressed=true]{background:var(--member);color:#21182a;font-weight:bold}
.difficulty{display:flex;gap:12px;align-items:center;margin-top:18px}#matchup{color:#f1d2e0;margin-bottom:0}
@media(max-width:650px){.welcome{grid-template-columns:1fr .75fr;min-height:0}.welcome-copy{padding:18px 14px}.welcome-copy h2{font-size:clamp(39px,10vw,65px)}.welcome-copy br{display:none}.welcome-copy h2 br{display:block}.welcome-copy p{font-size:12px}.welcome .flow-cta{padding:10px}.cover-art{align-self:stretch;aspect-ratio:auto;background-size:auto 200%;background-position:0 0}
#selection{display:flex;flex-direction:column}.poster{width:min(100%,240px)}#selection{background:linear-gradient(#f4f1fc 0 250px,#1d192a 250px)}.select-panel{width:100%;padding:18px;background:#1d192a}.select-panel h2{margin:10px 0}.profile{margin:12px 0}}
#selection{display:block;background:#211c2b;--accent:#ff75b5}
.select-head,.setup,.pick{display:flex;align-items:center;gap:8px}.select-head{justify-content:space-between;padding:12px 22px}.select-head h2{font-size:25px;letter-spacing:1px}.select-head button,.pick button{padding:6px 12px}
.studio{position:relative;isolation:isolate;overflow:hidden;height:clamp(360px,48vw,494px);background:#faf8ff}
#poster{position:absolute;inset:0 42% 0 0;touch-action:pan-y;user-select:none}
#slide{position:absolute;inset:0 7% 6%;overflow:hidden;pointer-events:none}
#slide img{position:absolute;width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
#slide img[data-id="3"]{clip-path:polygon(0 0,100% 0,100% 68%,80% 90%,0 100%)}
#poster button{position:absolute;top:48%;border:1px solid #978ea9;border-radius:50%;width:35px;height:35px;background:#fffc;color:#30223e;font:27px/1 sans-serif}#prev{left:3%}#next{right:3%}
.dossier{position:absolute;right:4%;top:50%;transform:translateY(-50%);width:35%;padding:clamp(14px,3vw,32px);color:white;background:#261e36ed;border-top:4px solid var(--accent);box-shadow:5px 5px 0 #35254729}
.dossier small{color:var(--accent);font:bold 11px var(--arcade-font);letter-spacing:.1em}.dossier h3{font-size:clamp(24px,4vw,46px);margin:6px 0}.dossier>b{color:#ded5ee}#stats{margin-top:16px}#stats div{display:grid;grid-template-columns:1fr auto;gap:3px;font-size:12px;margin:8px 0}#stats i{grid-column:span 2;height:4px;background:linear-gradient(to right,var(--accent) var(--fill),#635969 var(--fill))}
#kitGuide{white-space:pre-line;line-height:1.65;border-top:1px solid #665c70;padding-top:8px;margin-bottom:0}
.desk{padding:14px 22px 18px}.names{grid-template-columns:repeat(6,1fr);margin-top:8px}#tip{color:#d5c9dd;margin:12px 0}.setup{flex-wrap:wrap;border-top:1px solid #58485f;padding-top:10px}.setup #matchup{margin:0 auto 0 0}.setup .flow-cta{margin:0}
@media(max-width:600px){.studio{height:320px}#poster{right:44%}#slide{inset:6% 0 7%}.dossier{right:2%;width:42%;padding:10px}.dossier small{font-size:9px}.dossier h3{margin:3px 0}#stats{margin-top:7px}#kitGuide{font-size:11px}#poster button{top:auto;bottom:2%;width:29px;height:29px}.select-head,.desk{padding:10px}.names{gap:3px}.names button{font-size:11px}.setup #matchup{width:100%}.setup{justify-content:space-between}}

/* Cabinet trim and stepped highlights echo the native pixel artwork. */
body {
  background: repeating-linear-gradient(0deg, #181524 0 2px, #151221 2px 4px);
}
.welcome, #selection, .game {
  border: 3px solid #e5b466;
  box-shadow: 0 0 0 2px #482440, inset 0 0 0 2px #664562, 5px 5px #090810;
}
.welcome-copy { min-width: 0; }
.welcome-copy h2 { font-size: clamp(28px, 4.7vw, 62px); line-height: 1.15; text-shadow: 3px 3px #8c3150; }
.welcome-copy h2 em { font-style: normal; }
.select-head, .arena-top {
  background: linear-gradient(#423051 0 3px, #292039 3px 88%, #171124 88%);
  border-bottom: 2px solid #83638a;
}
.select-head h2 { font-size: clamp(13px, 2.4vw, 24px); color: #ffe093; text-shadow: 2px 2px #8d2b4b; }
.dossier { border: 2px solid #4d3353; border-top: 4px solid var(--accent); }
.dossier h3 { text-shadow: 2px 2px #66435a; }
.names button[aria-pressed=true], .pick button[aria-pressed=true] {
  outline: 2px solid #ffe9a9; outline-offset: -2px; box-shadow: inset 0 -4px #0004;
}
button:focus-visible, .names button:focus-visible, .pick button:focus-visible {
  outline: 3px solid #74edff; outline-offset: 2px;
}
.flow-cta, .primary, .touch button, kbd {
  border-radius: 0; border: 2px solid #8d628a;
  box-shadow: inset 0 2px #fffa, inset 0 -3px #0005, 2px 2px #160f24;
}
#poster button { border-radius: 0; border: 0; background: transparent; box-shadow: none; }
.hud { gap: clamp(7px, 2vw, 24px); }
.fighter-hud { min-width: 0; }
.fighter-hud b, .timer b, .center h2 { font-style: normal; }
.fighter-hud small, .arena-top, .arena-bottom, .controls b { letter-spacing: 0; }
.hp, .right .hp {
  transform: none; background: #a62935; border: 2px solid #ffefd0; box-shadow: 2px 2px #29122a;
}
.hp i, .right .hp i {
  background: linear-gradient(#ffef95 0 22%, #ffd44e 22% 72%, #eb941f 72%);
}
.timer { width: auto; min-width: 60px; }
.timer b { font-size: clamp(22px, 3.5vw, 42px); color: #ffd044; text-shadow: 2px 2px #a41f30, 4px 4px #261128; }
.timer small { white-space: nowrap; color: #fff1b9; letter-spacing: 0; text-shadow: 1px 1px #171122; }
.center h2 { font-size: clamp(16px, 3.4vw, 44px); text-shadow: 2px 2px #b83d37, 4px 4px #281526; }
.arena-bottom { gap: 8px; }
.controls { flex-wrap: wrap; }
.controls p, .hint { font-size: 12px; line-height: 1.7; }
@media (max-width: 650px) {
  .welcome { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .welcome-copy h2 { font-size: clamp(20px, 5.1vw, 32px); }
  .select-head, .arena-top { gap: 6px; }
  .arena-top { padding: 8px; font-size: 8px; }
  .arena-top button { font-size: 9px; }
  .fighter-hud > div:first-child { flex-wrap: wrap; gap: 2px; }
  .fighter-hud small { font-size: 8px; }
  .timer { min-width: 46px; }
  .arena-bottom { font-size: 6px; letter-spacing: 0; left: 5px; right: 5px; }
  .dossier small { letter-spacing: 0; }
  #kitGuide { padding: 7px; }
}

body[data-screen="welcome"] {
  background: linear-gradient(180deg, #11172855, #10132160 55%, #12152399),
              url("assets/training-center.png") center center / cover no-repeat, #212435;
}
body[data-screen="welcome"] main { max-width: none; padding: 0 3vw; }
.title-screen {
  --arcade-font: "Kemco Pixel", "Galmuri11", monospace;
  font-family: var(--arcade-font);
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(48px, 12svh) minmax(36px, 10svh);
  justify-items: center;
  align-items: center;
  padding: 3svh 0 2svh;
  box-sizing: border-box;
}
.title-logo { position:relative; isolation:isolate; margin:0; }
.title-lockup { text-align:center; width: min(92%, 152svh, 1240px); align-self: end; margin: 0; }
.title-logo img { image-rendering: pixelated; display: block; width: 100%; height: auto; }
#title-cut { display: none; position: absolute; inset: 0; width: 100%; height: 100%; }
.title-logo.striking img { opacity: 0; }
.title-logo.striking #title-cut { display: block; }
.title-credit, #enter { text-shadow: 2px 2px #231725, 0 0 5px #1a1520; }
.title-credit {
  display: flex;
  align-items: baseline;
  gap: clamp(6px, 1.4vw, 18px);
  margin: 0;
  color: #e9f7f5;
  font-size: clamp(9px, 1.35vw, 15px);
  line-height: 1.4;
  white-space: nowrap;
}
.title-subtitle {
  margin: -.2em 0 0;
  font-size: clamp(16px, min(3.8vw, 5svh), 46px);
  font-family: "Galmuri11", monospace;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .035em;
  color: #ffbd38;
  transform: skewX(-7deg);
  filter: drop-shadow(1px 2px #861e3c) drop-shadow(1px 2px #24152d);
}
@supports (background-clip: text) {
  .title-subtitle {
    background: linear-gradient(#fff6bf 15%, #ffdb65 40%, #ffac22 41% 60%, #ff7025 61% 82%, #ed4037 83%);
    background-clip: text;
    color: transparent;
  }
}
@media (max-aspect-ratio: 1/1) {
  .title-lockup { width: 100%; }
  .title-screen { grid-template-rows: 1fr minmax(54px, 10svh) minmax(42px, 8svh) .65fr; }
}
#enter {
  min-height: 44px;
  padding: 8px 16px;
  color: white;
  background: transparent;
  border: 0;
  font-size: clamp(14px, 2vw, 22px);
}
#select-stage { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }

/* A quiet entrance; the logo stays still after appearing. */
@keyframes title-reveal {
 from { opacity: 0; }
 to { opacity: 1; }
}
@keyframes subtitle-reveal {
 from { opacity: 0; clip-path: inset(-12px 100% -12px -12px); transform: translateX(-18px) skewX(-7deg); }
 to { opacity: 1; clip-path: inset(-12px -12px -12px -12px); transform: translateX(0) skewX(-7deg); }
}
@media (prefers-reduced-motion: no-preference) {
 body[data-screen="welcome"]:not(.title-intro-complete) .title-logo { animation: title-reveal 1.1s ease-out both; }
 body[data-screen="welcome"]:not(.title-intro-complete) .title-subtitle { animation: subtitle-reveal .85s cubic-bezier(.22,.61,.36,1) .65s both; }
 body[data-screen="welcome"] .title-logo.striking { animation: none; opacity: 1; }
}

@media (orientation: landscape) {
  body[data-screen="selection"] main { max-width: none; padding: 0; }
  #selection {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto minmax(0, 1fr);
    column-gap: clamp(18px, 4vw, 90px);
    min-height: 100vh;
    min-height: 100svh;
    padding: clamp(12px, 3vh, 36px) clamp(16px, 5vw, 100px);
    border: 0;
    box-shadow: none;
    background: #f8f5fc;
  }
  #selection .studio { display: contents; }
  #select-stage { z-index: -1; }
  #selection .select-head {
    grid-column: 1 / -1;
    background: none;
    border: 0;
    padding: 0;
  }
  #selection .select-head h2 { color: #392641; text-shadow: 2px 2px #fff; }
  #selection .select-head button { color: #392641; background: #faf7ffed; }
  #poster { position: relative; inset: auto; grid-column: 1; grid-row: 2 / -1; align-self: stretch; }
  #slide { inset: 1% 5% 0; }
  #slide img { object-position: center bottom; }
  #poster button { top: 50%; bottom: auto; }
  #selection .dossier, #selection .desk {
    position: relative;
    inset: auto;
    transform: none;
    grid-column: 2;
    width: min(100%, 550px);
    justify-self: center;
    padding: clamp(12px, 2vw, 26px);
    background: #241c34ed;
  }
  #selection .dossier { grid-row: 3; align-self: end; border-width: 3px 0 0; box-shadow: none; }
  #selection .desk { grid-row: 4; padding-top: 0; }
  #selection .setup { gap: 7px; }
  #selection .setup #matchup { width: 100%; }
  #selection .names button { background: #30283b; }
  #selection .names button[aria-pressed=true] { background: var(--member); }
}
@media (orientation: landscape) and (max-height: 570px) {
  #selection { padding: 6px 2vw; grid-template-rows: auto minmax(0, 1fr) auto auto minmax(0, 1fr); gap: 0 2vw; }
  #selection .dossier, #selection .desk { padding: 6px 10px; }
  #selection .dossier h3 { font-size: 22px; margin: 2px 0; }
  #selection #stats { margin-top: 4px; }
  #selection #stats div { margin: 3px 0; }
  #selection #kitGuide { margin-top: 4px; padding-top: 3px; line-height: 1.25; }
  #selection #tip { margin: 4px 0; }
  #selection .names button, #selection .flow-cta { padding: 5px 3px; }
  #selection .setup { padding-top: 4px; }
}
@media (orientation: landscape) and (max-height: 570px) {
  #selection { grid-template-columns: minmax(0, 1fr) minmax(300px, 1.15fr); }
  #selection .dossier { display: grid; grid-template-columns: 1fr 1.35fr; gap: 2px 12px; }
  #selection .dossier > :is(small,h3,b) { grid-column: 1; }
  #selection #stats { grid-column: 2; grid-row: 1 / 4; }
  #selection #kitGuide { grid-column: 1 / -1; }
}

/* Title spacing and selection details. */
.title-lockup { position:relative; top:-15px; }
.title-subtitle { margin-top:-.45em; -webkit-text-stroke:.45px #ffba48; }
#selection #home { border:0; box-shadow:none; background:transparent; }
#selection .pick button[aria-pressed="false"] { border-color:#ff83bc; }
#kitGuide { white-space:normal; }
#kitGuide p { margin:0 0 8px; font-size:12px; line-height:1.65; }
#kitGuide p:last-child { margin-bottom:0; }
#kitGuide strong { color:var(--accent); margin-right:8px; }
#cpuDifficulty[hidden] { display:none; }
@media(orientation:landscape){
 #selection .setup .flow-cta { margin-left:auto; }
}
@media(max-width:600px), (orientation:landscape) and (max-height:620px){
 #kitGuide p { font-size:10px; line-height:1.45; margin-bottom:5px; }
}

/* Floating neon arrows at the fighter's mid-body height. */
#selection #poster button {
 top:48%; bottom:auto; transform:translateY(-50%);
 width:48px; height:56px; padding:0;
 display:grid; place-items:center;
 font-size:42px; line-height:1;
 color:var(--accent); background:transparent; border:0; box-shadow:none;
 text-shadow:0 0 7px var(--accent),0 0 15px var(--accent);
}
#selection #poster button:hover {
 color:var(--accent);
 text-shadow:0 0 3px var(--accent),0 0 9px var(--accent),0 0 20px var(--accent);
}
/* Keep the fighter-selection arrows balanced, slightly further inward. */
#selection #prev {left:5%;}
#selection #next {right:5%;}
@media(max-width:600px){
 #selection #poster button { width:44px; height:48px; font-size:36px; }
}

#play footer #reset { margin-left:auto; }

/* Reserve screen space for every touch key, including mobile browser safe areas. */
@media(max-width:800px), (pointer:coarse), (orientation:landscape) and (max-height:600px){
 body[data-screen="play"] main {
  padding:8px max(10px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
 }
 #play:not([hidden]) {
  min-height:0; height:calc(100svh - 16px - env(safe-area-inset-bottom));
  height:calc(100dvh - 16px - env(safe-area-inset-bottom));
  display:grid; grid-template-rows:minmax(0,1fr) auto auto; gap:8px;
 }
 #play .controls { display:none; }
 #play .game { width:100%; align-self:center; justify-self:center; min-height:0; }
 #play .touch { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:5px; margin:0; }
 #play .touch button { min-width:0; min-height:44px; padding:8px 2px; font-size:12px; touch-action:none; user-select:none; }
 #play footer { padding:0; min-height:28px; }
 #play footer button { min-height:28px; }
 #play .arena-top { min-height:30px; padding:6px 8px; }
}
@media(orientation:landscape) and (max-height:600px){
 #play .game { width:min(100%,calc((100svh - 184px - env(safe-area-inset-bottom))*2)); width:min(100%,calc((100dvh - 184px - env(safe-area-inset-bottom))*2)); }
 #play .viewport { aspect-ratio:2/1; }
}
@media(orientation:portrait) and (max-width:800px){
 #play .viewport { aspect-ratio:1.6; }
}

/* In-game labels use the arcade face; Korean instructions stay easy to read. */
#play { --arcade-font:"Kemco Pixel","Galmuri11",monospace; font-family:var(--arcade-font); }
#play .controls {
 display:grid; grid-template-columns:1.2fr 1fr 1fr; gap:24px;
 padding:20px 0; margin-top:18px; border-top:1px solid #51435c; border-bottom:0;
}
#play .controls .control-group { min-width:0; }
#play .controls h3 { font:14px "Galmuri11",monospace; color:#f1d5e8; margin:0 0 12px; letter-spacing:0; }
#play .controls h3 small { font-size:11px; color:#b8adc4; margin-left:8px; }
#play .controls p { font:12px/1.8 "Galmuri11",monospace; margin:7px 0; color:#ece4f1; }
#play .controls .control-note { color:#b1a4bd; font-size:11px; }
#play .controls .control-label { display:inline-block; width:44px; }
#play .controls kbd { font-family:var(--arcade-font); min-width:24px; padding:3px 5px; border:1px solid #7a688a; background:#2e263c; box-shadow:none; }
@media(max-width:800px), (pointer:coarse), (orientation:landscape) and (max-height:600px){
 #play .controls { display:none; }
}
@media(max-width:800px), (pointer:coarse), (orientation:landscape) and (max-height:600px){
 #play .arena-top { font-size:8px; gap:8px; white-space:nowrap; }
 #play .arena-top>span:nth-child(2) { display:none; }
 #play .arena-top>button:first-of-type { margin-left:auto; }
 #play .arena-top button { font-size:8px; }
 #play .hud { top:10px; left:12px; right:12px; gap:10px; }
 #play .fighter-hud { min-width:0; }
 #play .fighter-hud b { font-size:14px; white-space:nowrap; }
 #play .fighter-hud small { font-size:6px; letter-spacing:0; }
 #play .fighter-hud>span { font-size:12px; margin-top:3px; }
 #play .hp { height:10px; border-width:1px; }
 #play .meter { height:4px; max-width:75px; margin-top:3px; }
 #play .timer { width:46px; flex:none; }
 #play .timer b { font-size:26px; }
 #play .timer small { font-size:6px; }
 #play .center h2 { font-size:24px; }
 #play .center p,#play .center .eyebrow { display:none; }
 #play .primary { margin-top:0; padding:8px 16px; }
 #play .arena-bottom { font-size:6px; letter-spacing:0; bottom:6px; left:6px; right:6px; }
}
@media(orientation:portrait) and (max-width:800px){
 #play:not([hidden]) { height:auto; grid-template-rows:auto auto auto; align-content:start; }
}

#selection .select-head h2 {
 font-family:"Kemco Pixel","Galmuri11",monospace;
 font-size:clamp(18px,2.5vw,32px); line-height:1.25; letter-spacing:.035em;
 color:#392641; text-shadow:2px 2px #fff,4px 4px #e8c4df;
}
@media(max-width:600px), (orientation:landscape) and (max-height:460px){
 #selection .select-head h2 { font-size:16px; text-shadow:1px 1px #fff,2px 2px #e8c4df; }
}

/* Mobile rotation reminder shown only immediately before a match. */
.rotate-gate[hidden] { display:none !important; }
.rotate-gate {
 position:fixed; inset:0; z-index:1000; display:grid; place-items:center;
 padding:max(24px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));
 background:#130e1ff2; color:#f8eefa; text-align:center; overscroll-behavior:contain;
}
.rotate-gate-panel { width:min(100%,370px); padding:26px 20px; font-family:"Galmuri11",monospace; }
.rotate-gate-phone { width:60px; height:96px; border:4px solid #ffa6d0; border-radius:12px; display:block; margin:4px auto 30px; position:relative; transform:rotate(-90deg); box-shadow:0 0 20px #ff83bc48; }
.rotate-gate-phone::after { content:""; position:absolute; bottom:4px; left:50%; width:15px; height:3px; border-radius:2px; transform:translateX(-50%); background:#ffa6d0; }
.rotate-gate-phone span { display:block; position:absolute; inset:9px 5px 14px; border-radius:3px; background:#3c2a50; }
.rotate-gate-kicker { color:#ffaecc; letter-spacing:2px; font:700 12px "Kemco Pixel","Galmuri11",monospace; }
.rotate-gate h2 { margin:12px 0; font-size:clamp(22px,6vw,32px); line-height:1.35; color:#fff0b8; }
.rotate-gate #rotate-description { font-size:13px; line-height:1.7; color:#e3d8e7; }
.rotate-gate button { min-height:44px; margin-top:16px; padding:12px 20px; border:1px solid #a58cab; border-radius:4px; color:#f6eaf8; background:#30213e; font-size:12px; }
.rotate-gate button:focus-visible { outline:2px solid #ffaecc; outline-offset:3px; }


/* Mobile portrait: long fighter descriptions remain readable instead of being cropped. */
@media (orientation: portrait) and (max-width: 600px) {
  #selection .studio { overflow: hidden; }
  #selection .dossier {
    top: 50%;
    max-height: calc(100% - 12px);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  #selection .dossier #kitGuide { white-space: normal; overflow-wrap: anywhere; }
  #selection .setup .flow-cta { margin-left: auto; }
}
/* Mobile Safari tab: browser chrome shortens the viewport. Reclaim room for the arena. */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 600px) and (display-mode: browser) {
  #play:not([hidden]) { gap: 4px; }
  #play .game { width: min(100%, calc((100dvh - 142px - env(safe-area-inset-bottom)) * 2)); }
  #play .arena-top { min-height: 25px; padding: 4px 8px; }
  #play .touch { gap: 4px; }
  #play .touch button { min-height: 36px; padding: 4px 2px; font-size: 11px; }
  #play footer { min-height: 24px; }
  #play footer button { min-height: 24px; padding: 2px 0; }
}


/* Two-handed landscape pad: supports Safari tabs and installed PWA alike. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
 body[data-screen="play"] { overflow:hidden; }
 body[data-screen="play"] main {
  padding:4px max(7px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left));
  max-width:none;
  min-height:100dvh;
 }
 #play:not([hidden]) {
  position:relative;
  display:block;
  width:100%;
  height:calc(100dvh - 8px - env(safe-area-inset-bottom));
  min-height:0;
 }
 #play .game {
  width:min(100%,calc((100dvh - 44px)*2));
  max-width:100%;
  margin:0 auto;
  min-height:0;
 }
 #play .viewport { aspect-ratio:2/1; }
 #play .arena-top { min-height:25px; padding:3px 7px; }
 #play .touch {
  position:fixed;
  z-index:30;
  left:max(9px,env(safe-area-inset-left));
  right:max(9px,env(safe-area-inset-right));
  bottom:max(12px,calc(env(safe-area-inset-bottom) + 6px));
  width:auto;
  height:auto;
  margin:0;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  pointer-events:none;
  background:none;
 }
 #play .touch-movement, #play .touch-attacks {
  display:grid;
  flex:0 1 auto;
  pointer-events:auto;
  user-select:none;
  -webkit-user-select:none;
  touch-action:none;
 }
 #play .touch-movement {
  grid-template-columns:repeat(3,clamp(34px,9dvh,48px));
  grid-template-rows:repeat(2,clamp(34px,9dvh,48px));
  gap:4px;
 }
 #play .touch .pad-up { grid-column:2; grid-row:1; }
 #play .touch .pad-left { grid-column:1; grid-row:2; }
 #play .touch .pad-down { grid-column:2; grid-row:2; }
 #play .touch .pad-right { grid-column:3; grid-row:2; }
 #play .touch-attacks {
  grid-template-columns:repeat(3,clamp(36px,9dvh,48px));
  grid-template-rows:repeat(2,clamp(34px,9dvh,44px)) minmax(31px,auto);
  gap:4px;
 }
 #play .touch button {
  padding:2px 3px;
  min-width:0;
  min-height:0;
  width:100%;
  height:100%;
  border:1px solid #ffffff70;
  border-radius:8px;
  font:700 clamp(10px,2.8dvh,14px) "Galmuri11",monospace;
  color:#fff;
  touch-action:none;
  -webkit-tap-highlight-color:transparent;
  background:#56445ebd;
  box-shadow:inset 0 1px #fff4,0 2px 4px #0008;
 }
 #play .touch .pad-up, #play .touch .pad-left, #play .touch .pad-down, #play .touch .pad-right { background:#67516ec9; }
 #play .touch .pad-punch { border-radius:50%; background:#c85c9edb; }
 #play .touch .pad-kick { border-radius:50%; background:#7564c7db; }
 #play .touch .pad-special { grid-column:1; grid-row:3; background:#bd9436e8; white-space:nowrap; }
 #play .touch .pad-super { grid-column:2 / 4; grid-row:3; background:#a74776e8; }
 #play .touch button:active { filter:brightness(1.35); transform:translateY(1px); }
 #play footer { position:fixed; z-index:31; top:4px; right:max(8px,env(safe-area-inset-right)); padding:0; min-height:0; }
 #play footer #reset { margin:0; font-size:8px; padding:4px; background:#1a1325d9; }
}
/* On portrait/mobile still expose every action, grouped rather than compressed into one row. */
@media (orientation:portrait) and (pointer:coarse) {
 #play .touch { display:flex; flex-wrap:wrap; gap:12px; }
 #play .touch-movement { display:grid; grid-template-columns:repeat(3,minmax(34px,1fr)); grid-template-rows:repeat(2,44px); gap:4px; flex:1 1 140px; }
 #play .touch-attacks { display:grid; grid-template-columns:repeat(3,minmax(35px,1fr)); gap:4px; flex:2 1 190px; }
 #play .touch .pad-up {grid-column:2;grid-row:1}
 #play .touch .pad-left {grid-column:1;grid-row:2}
 #play .touch .pad-down {grid-column:2;grid-row:2}
 #play .touch .pad-right {grid-column:3;grid-row:2}
 #play .touch button {min-height:40px;min-width:0}
}

/* Fit the full fighter-select layout inside an iPhone-sized landscape viewport.
   The two information cards scroll independently instead of cropping content. */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 650px) {
  body[data-screen="selection"] { overflow: hidden; }
  body[data-screen="selection"] main {
    width: 100%;
    max-width: none;
    min-height: 0;
    padding: 0;
  }
  #selection:not([hidden]) {
    box-sizing: border-box;
    width: 100%;
    height: 100svh;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    padding: max(5px, env(safe-area-inset-top))
             max(10px, env(safe-area-inset-right))
             max(5px, env(safe-area-inset-bottom))
             max(10px, env(safe-area-inset-left));
    grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
    grid-template-rows: auto minmax(0, 0.94fr) minmax(0, 1.06fr);
    gap: 4px clamp(8px, 1.3vw, 18px);
    overflow: hidden;
  }
  #selection .select-head {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    padding: 2px 0;
    align-self: center;
  }
  #selection .select-head h2 { font-size: clamp(15px, 2.7vw, 23px); }
  #selection #home { padding: 4px; font-size: clamp(10px, 1.5vw, 14px); }
  #selection .studio { display: contents; }
  #selection #poster {
    position: relative;
    inset: auto;
    grid-column: 1;
    grid-row: 2 / 4;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    align-self: stretch;
    overflow: hidden;
  }
  #selection #slide { inset: 0 1% 0; }
  #selection #slide img { object-fit: contain; object-position: center bottom; }
  #selection .dossier, #selection .desk {
    grid-column: 2;
    min-width: 0;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 5px 8px;
    box-sizing: border-box;
    align-self: stretch;
    justify-self: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  #selection .dossier {
    display: block;
    grid-row: 2;
    border-top-width: 3px;
  }
  #selection .dossier small { font-size: 9px; }
  #selection .dossier h3 { font-size: clamp(17px, 3vw, 24px); margin: 2px 0; }
  #selection .dossier > b { font-size: 10px; }
  #selection #stats { display: block; margin-top: 4px; }
  #selection #stats div { margin: 3px 0; font-size: 10px; }
  #selection #kitGuide {
    font-size: 10px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    padding-top: 4px;
    margin-bottom: 0;
  }
  #selection #kitGuide p { margin-bottom: 3px; font-size: 10px; line-height: 1.35; }
  #selection .desk {
    grid-row: 3;
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  #selection .pick { flex: none; gap: 5px; }
  #selection .pick button { padding: 4px 7px; font-size: 10px; }
  #selection .names {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 0;
    gap: 3px;
    flex: none;
  }
  #selection .names button { min-width: 0; padding: 5px 2px; font-size: clamp(9px, 1.5vw, 12px); }
  #selection #tip { margin: 2px 0; font-size: 10px; line-height: 1.35; flex: none; }
  #selection .setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding-top: 4px;
    margin-top: auto;
    min-width: 0;
    flex: none;
  }
  #selection .setup #matchup {
    flex: 1 1 140px;
    width: auto;
    min-width: 0;
    font-size: 10px;
  }
  #selection .setup .flow-cta {
    margin-left: auto;
    padding: 5px 9px;
    flex: none;
    font-size: 11px;
  }
}

/* Immersive landscape combat: the arena occupies the usable viewport;
   the existing touch controls sit INSIDE the arena overlay. */
@media (orientation:landscape) and (pointer:coarse) {
 body[data-screen="play"] {
  width:100%; height:100dvh; overflow:hidden;
  overscroll-behavior:none;
 }
 body[data-screen="play"] main {
  position:fixed; inset:0;
  width:100%; max-width:none;
  height:100dvh; min-height:0;
  margin:0; padding:0;
  overflow:hidden;
 }
 #play:not([hidden]) {
  display:block;
  position:absolute; inset:0;
  width:100%; height:100%;
  min-height:0;
  margin:0; padding:0;
 }
 #play .game {
  position:absolute; inset:0;
  width:100%; height:100%;
  min-height:0; max-width:none;
  margin:0; padding:0;
  border:0; box-shadow:none;
  background:#181423;
 }
 #play .viewport {
  position:absolute; inset:0;
  width:100%; height:100%;
  aspect-ratio:auto;
  overflow:hidden;
  touch-action:none;
 }
 #play canvas#arena {
  display:block;
  width:100%; height:100%;
  object-fit:cover;
  image-rendering:pixelated;
 }
 #play .arena-top {
  position:absolute;
  z-index:18;
  top:max(3px,env(safe-area-inset-top));
  left:max(9px,env(safe-area-inset-left));
  right:max(9px,env(safe-area-inset-right));
  display:flex; align-items:center; justify-content:flex-end;
  width:auto; min-height:0;
  margin:0; padding:4px 7px;
  gap:8px;
  background:#1b132ac9;
  border:1px solid #86688a80;
  font-size:8px;
  pointer-events:auto;
 }
 #play .arena-top > span:first-child { margin-right:auto; }
 #play .arena-top > span:nth-child(2) { display:none; }
 #play .arena-top > button:first-of-type { margin-left:0; }
 #play .arena-top button { padding:3px; font-size:9px; }
 #play .hud {
  top:max(35px,calc(env(safe-area-inset-top) + 35px));
  left:max(14px,calc(env(safe-area-inset-left) + 12px));
  right:max(14px,calc(env(safe-area-inset-right) + 12px));
  z-index:5;
  pointer-events:none;
 }
 #play .arena-bottom { bottom:6px; opacity:.65; }
 #play:not([hidden]) .touch {
  position:absolute;
  z-index:25;
  left:max(13px,calc(env(safe-area-inset-left) + 8px));
  right:max(13px,calc(env(safe-area-inset-right) + 8px));
  bottom:max(12px,calc(env(safe-area-inset-bottom) + 7px));
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  width:auto; height:auto;
  margin:0; padding:0;
  gap:clamp(12px,4vw,38px);
  background:transparent;
  pointer-events:none;
 }
 #play .touch-movement, #play .touch-attacks {
  display:grid;
  flex:0 0 auto;
  pointer-events:auto;
  touch-action:none;
 }
 #play .touch-movement {
  grid-template-columns:repeat(3,clamp(37px,10dvh,54px));
  grid-template-rows:repeat(2,clamp(37px,10dvh,54px));
  gap:4px;
 }
 #play .touch-attacks {
  grid-template-columns:repeat(3,clamp(38px,10dvh,54px));
  grid-template-rows:repeat(3,clamp(34px,9dvh,48px));
  gap:4px;
 }
 #play .touch button {
  width:100%; height:100%;
  min-width:0; min-height:0;
  padding:2px;
  border:1px solid #f3dcf47a;
  border-radius:9px;
  color:#fff;
  font:700 clamp(10px,2.8dvh,14px) "Galmuri11",monospace;
  background:#594361a8;
  box-shadow:inset 0 1px #fff5,0 1px 4px #0007;
  -webkit-user-select:none; user-select:none;
  touch-action:none;
 }
 #play .touch .pad-up { grid-column:2;grid-row:1; }
 #play .touch .pad-left { grid-column:1;grid-row:2; }
 #play .touch .pad-down { grid-column:2;grid-row:2; }
 #play .touch .pad-right { grid-column:3;grid-row:2; }
 #play .touch .pad-punch { background:#c75b9ab8; border-radius:50%; }
 #play .touch .pad-kick { background:#7360c2b8; border-radius:50%; }
 #play .touch .pad-special { grid-column:1;grid-row:3; background:#c29235d9; }
 #play .touch .pad-super { grid-column:2/4;grid-row:3; background:#ad4075d9; }
 #play .touch button:active { filter:brightness(1.24); }
 #play .controls { display:none; }
 #play footer {
  position:absolute;
  z-index:26;
  top:auto;
  right:50%;
  bottom:max(2px,env(safe-area-inset-bottom));
  transform:translateX(50%);
  display:flex;
  padding:0; margin:0;
  min-height:0; height:auto;
 }
 #play footer #reset {
  padding:2px 5px;
  font-size:9px;
  line-height:1.2;
  color:#fff;
  background:#171021aa;
 }
}

/* Mobile battle control lettering matches physical keyboard; white translucent PUBG-like pad. */
@media (orientation:landscape) and (pointer:coarse) {
 #play .touch-attacks button {
  background:rgba(245,247,251,.19);
  color:rgba(255,255,255,.94);
  border:1px solid rgba(255,255,255,.59);
  box-shadow:inset 0 1px rgba(255,255,255,.14), 0 2px 6px rgba(8,5,15,.2);
  -webkit-backdrop-filter:blur(3px);
  backdrop-filter:blur(3px);
  font-weight:700;
 }
 #play .touch-attacks .pad-punch,
 #play .touch-attacks .pad-kick {
  background:rgba(245,247,251,.19);
  border-radius:50%;
 }
 #play .touch-attacks .pad-special,
 #play .touch-attacks .pad-super {
  background:rgba(245,247,251,.19);
 }
 #play .touch-attacks button:active {
  background:rgba(255,255,255,.34);
  filter:none;
 }
}

/* Safari tab-only viewport compensation: keep HUD and touch controls inside
   the visible area after Safari expands/collapses its address/tab bars. */
@media (orientation: landscape) and (pointer: coarse) {
 body.safari-battle-tab[data-screen="play"] {
  overflow: hidden;
  height: var(--battle-visual-height, 100dvh);
 }
 body.safari-battle-tab[data-screen="play"] main {
  position: fixed;
  inset: auto;
  top: var(--battle-visual-top, 0px);
  left: var(--battle-visual-left, 0px);
  width: var(--battle-visual-width, 100vw);
  height: var(--battle-visual-height, 100dvh);
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
 }
 body.safari-battle-tab[data-screen="play"] #play:not([hidden]) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
 }
 body.safari-battle-tab[data-screen="play"] #play .game,
 body.safari-battle-tab[data-screen="play"] #play .viewport {
  inset: 0;
  width: 100%;
  height: 100%;
 }
 body.safari-battle-tab[data-screen="play"] #play .touch {
  bottom: max(8px, env(safe-area-inset-bottom));
 }
}

/* Mobile gesture controls: four translucent, single-color action buttons. */
@media (orientation:landscape) and (pointer:coarse) {
 #play .touch-attacks {
  grid-template-columns:repeat(2,clamp(53px,15dvh,78px));
  grid-template-rows:repeat(2,clamp(53px,15dvh,78px));
  gap:clamp(6px,2dvh,12px);
 }
 #play .touch-attacks .pad-punch,
 #play .touch-attacks .pad-kick,
 #play .touch-attacks .pad-special,
 #play .touch-attacks .pad-super {
  grid-column:auto;
  grid-row:auto;
  background:rgba(245,247,251,.10);
  border:1px solid rgba(255,255,255,.62);
  border-radius:50%;
 }
 #play .touch-attacks button {
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:1px;
  padding:4px;
  color:rgba(255,255,255,.86);
  touch-action:none;
  -webkit-touch-callout:none;
 }
 #play .touch-attacks button svg {
  width:clamp(19px,6dvh,30px);
  height:clamp(19px,6dvh,30px);
  display:block;
  flex:none;
  opacity:.80;
  pointer-events:none;
 }
 #play .touch-attacks button span {
  pointer-events:none;
  font:600 clamp(8px,2.1dvh,11px) "Galmuri11",monospace;
  line-height:1.1;
 }
 #play .touch-attacks button:active {
  background:rgba(255,255,255,.24);
 }
}
@media (orientation:portrait) and (pointer:coarse) {
 #play .touch-attacks svg { width:20px;height:20px; }
 #play .touch-attacks button { display:flex;align-items:center;justify-content:center;gap:3px; }
 #play .touch-attacks button span { font-size:10px; }
}

/* Mobile immersive HUD cleanup: desktop and Dynamic Island remain unchanged. */
@media (orientation:landscape) and (pointer:coarse) {
  #play .arena-top {
    top:clamp(4px,1dvh,8px);
    left:auto;
    right:clamp(8px,1.5vw,18px);
    width:auto;
    min-height:0;
    padding:0;
    gap:5px;
    border:0;
    background:transparent;
    z-index:40;
    overflow:visible;
  }
  #play .arena-top > span,
  #play .arena-top #modeLabel,
  #play .arena-top #pause { display:none; }
  #play .arena-top #sound,
  #play .arena-top #mobile-menu-toggle {
    display:grid;
    place-items:center;
    width:clamp(32px,8.4dvh,43px);
    height:clamp(32px,8.4dvh,43px);
    min-width:0;
    border:1px solid rgba(255,255,255,.39);
    border-radius:8px;
    background:rgba(20,17,31,.30);
    box-shadow:0 2px 5px rgba(0,0,0,.15);
    color:rgba(255,255,255,.90);
    font-family:system-ui,sans-serif;
    font-size:0;
    backdrop-filter:blur(3px);
    -webkit-backdrop-filter:blur(3px);
    padding:0;
  }
  #play .arena-top #sound::before {
    content:"♪";
    font-size:21px;
    line-height:1;
    font-weight:600;
  }
  #play .arena-top #sound[aria-label="효과음 켜기"]::before { content:"♪"; opacity:.40; text-decoration:line-through; }
  #play .arena-top #mobile-menu-toggle {
    font-size:21px;
    line-height:1;
    font-weight:700;
  }
  #play .arena-top #mobile-menu-toggle[aria-expanded="true"] { background:rgba(255,255,255,.26); }
  #play .arena-top .mobile-battle-menu[hidden] { display:none !important; }
  #play .arena-top .mobile-battle-menu {
    position:absolute;
    top:calc(100% + 6px);
    right:0;
    width:min(228px,62vw);
    padding:12px;
    display:flex;
    flex-direction:column;
    gap:9px;
    border:1px solid rgba(255,255,255,.4);
    border-radius:9px;
    background:rgba(25,19,39,.94);
    box-shadow:0 8px 18px rgba(0,0,0,.35);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
    z-index:55;
  }
  #play .mobile-battle-menu p {
    margin:0;
    font:11px/1.45 "Galmuri11",sans-serif;
    color:#f3eaf3;
    white-space:normal;
  }
  #play .arena-top .mobile-battle-menu button {
    padding:9px;
    width:100%;
    min-height:36px;
    font:12px "Galmuri11",sans-serif;
    color:#f9eff8;
    border:1px solid #ffffff55;
    border-radius:5px;
    background:#ffffff19;
  }
  #play footer {display:none !important;}
  #play .hud {
    top:clamp(43px,10dvh,58px);
    left:clamp(14px,2.3vw,38px);
    right:clamp(14px,2.3vw,38px);
    gap:clamp(8px,2vw,24px);
    align-items:flex-start;
    z-index:8;
  }
  #play .fighter-hud { min-width:0; flex:1 1 0; padding-top:3px; }
  #play .fighter-hud > div:first-child { margin:0 0 4px; gap:5px; }
  #play .fighter-hud b {
    font-size:clamp(12px,2.9dvh,20px);
    line-height:1.15;
    max-width:65%;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
  }
  #play .fighter-hud small { font-size:clamp(6px,1.45dvh,9px); }
  #play .timer {
    order:0;
    flex:0 0 clamp(40px,8vw,76px);
    width:clamp(40px,8vw,76px);
    min-width:0;
    text-align:center;
    padding-top:1px;
  }
  #play .timer b {
    font-size:clamp(23px,6.5dvh,42px);
    line-height:1;
  }
  #play .timer small { font-size:clamp(6px,1.5dvh,9px); letter-spacing:0; }
  #play .hp { height:clamp(8px,2.3dvh,14px); }
  #play .meter { max-width:clamp(66px,13vw,140px); }
  #play .touch-movement {
    grid-template-columns:repeat(3,clamp(37px,9.3dvh,52px));
    grid-template-rows:repeat(2,clamp(37px,9.3dvh,52px));
  }
  #play .touch-attacks {
    grid-template-columns:repeat(2,clamp(49px,13.8dvh,71px));
    grid-template-rows:repeat(2,clamp(49px,13.8dvh,71px));
    gap:clamp(5px,1.5dvh,9px);
  }
  #play .touch {
    left:clamp(7px,1vw,14px);
    right:clamp(7px,1vw,14px);
    bottom:clamp(7px,1.5dvh,15px);
  }
  #play .touch button,
  #play .touch .pad-up,
  #play .touch .pad-down,
  #play .touch .pad-left,
  #play .touch .pad-right {
    color:rgba(255,255,255,.82);
    background:rgba(255,255,255,.075);
    border:1px solid rgba(255,255,255,.54);
    box-shadow:inset 0 1px rgba(255,255,255,.12),0 2px 5px rgba(0,0,0,.18);
    -webkit-backdrop-filter:blur(2px);
    backdrop-filter:blur(2px);
  }
  #play .touch-attacks button,
  #play .touch-attacks .pad-punch,
  #play .touch-attacks .pad-kick,
  #play .touch-attacks .pad-special,
  #play .touch-attacks .pad-super {
    background:rgba(255,255,255,.075);
    border-color:rgba(255,255,255,.54);
  }
  #play .touch button:active {
    background:rgba(255,255,255,.30);
    border-color:rgba(255,255,255,.90);
    transform:scale(.96);
    filter:none;
  }
  #play .arena-bottom {opacity:.40; pointer-events:none;}
}
/* Keep the pause menu restricted to landscape touch layouts. */
@media not all and (orientation:landscape) {
  #mobile-menu-toggle,.mobile-battle-menu {display:none !important;}
}
@media (pointer:fine) {
  #mobile-menu-toggle,.mobile-battle-menu {display:none !important;}
}


/* Pixel-native fighter selection: flat palette, stepped borders and hard shadows.
   No gradients, blur, rounded corners or soft bevels in selection widgets. */
#selection {
 --pixel-ink:#171021;
 --pixel-edge:#716079;
 --pixel-light:#a18aab;
 --pixel-fill:#292237;
}
#selection .dossier,
#selection .desk {
 border-radius:0;
 border:3px solid var(--pixel-edge);
 background:var(--pixel-fill);
 box-shadow:
  inset 0 0 0 2px #44374f,
  inset 3px 3px 0 2px #9b81a354,
  inset -4px -4px 0 0 #161120,
  4px 0 0 #18101f,0 4px 0 #18101f,4px 4px 0 #100b18;
}
#selection .dossier {
 border-top:4px solid var(--accent);
}
#selection .dossier small {
 display:inline-block;
 padding:3px 6px;
 background:#191323;
 border-left:3px solid var(--accent);
 color:var(--accent);
}
#selection .dossier h3 {
 text-shadow:2px 2px 0 #15101f;
}
#selection #stats i {
 min-height:5px;
 border:1px solid #9c8aa3;
 background:linear-gradient(to right,var(--accent) var(--fill),#514659 var(--fill));
 box-shadow:2px 2px 0 #151021;
}
#selection #kitGuide {
 background:#171322;
 color:#f1e8f3;
 border:3px solid #62536c;
 border-top-color:#94819c;
 padding:8px 10px;
 box-shadow:inset 3px 3px 0 #31263d,inset -3px -3px 0 #100c1b,3px 3px 0 #100b1b;
}
#selection #kitGuide strong { color:var(--accent);text-shadow:1px 1px 0 #120d1c; }
#selection .pick button,
#selection .names button {
 position:relative;
 border-radius:0;
 background:#342a43;
 border:3px solid #78627f;
 border-top-color:#af94af;
 border-left-color:#a68dac;
 color:#f4eaf6;
 text-shadow:none;
 box-shadow:inset -3px -3px 0 #191321,3px 3px 0 #110c1a;
 transition:none;
}
#selection .names button {
 border-bottom:4px solid var(--member);
}
#selection .pick button[aria-pressed="true"],
#selection .names button[aria-pressed="true"] {
 background:var(--member,var(--accent));
 color:#22172d;
 border-color:#ffefc1;
 outline:2px solid #201528;
 outline-offset:-5px;
 box-shadow:inset 3px 3px 0 #ffffff75,inset -3px -3px 0 #25172f85,3px 3px 0 #110b1a;
 text-shadow:none;
}
#selection .pick button[aria-pressed="true"] { background:#f5c5dc; }
#selection .pick button:active,
#selection .names button:active,
#selection .flow-cta:active {
 transform:translate(2px,2px);
 box-shadow:inset 2px 2px 0 #171021;
}
#selection .setup {
 border-top:3px solid #6c5675;
 box-shadow:0 -2px 0 #160f22;
}
#selection .flow-cta {
 border-radius:0;
 border:3px solid #ffedb3;
 background:#f6aacc;
 color:#29182e;
 box-shadow:inset 3px 3px 0 #ffe3f0,inset -4px -4px 0 #bd6a97,4px 4px 0 #130d1b;
 text-shadow:none;
}
#selection .flow-cta:disabled { background:#b58ca4;color:#33283a; }
/* Small displays retain the responsive layout, with hard one-pixel trim. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
 #selection .dossier,#selection .desk {
  border-width:2px;
  box-shadow:inset 0 0 0 1px #4a3a54,inset -2px -2px 0 #171021,2px 2px 0 #140e1c;
 }
 #selection .dossier { border-top-width:3px; }
 #selection #kitGuide { border-width:2px;padding:5px 6px;box-shadow:inset -2px -2px 0 #100c1b; }
 #selection .names button { border-width:2px;border-bottom-width:3px;box-shadow:inset -2px -2px 0 #181221; }
 #selection .pick button {border-width:2px;box-shadow:inset -2px -2px 0 #181221;}
 #selection .flow-cta {border-width:2px;box-shadow:inset -2px -2px 0 #aa648e,2px 2px 0 #130d1b;}
}
@media (orientation:portrait) and (max-width:600px) {
 #selection .dossier,#selection .desk {
  box-shadow:inset 0 0 0 1px #4a3a54,inset -2px -2px 0 #171021,2px 2px 0 #140e1c;
 }
 #selection #kitGuide {padding:5px 6px;}
}

/* Interactive pixel-art character skill archive */
#selection .skill-codex { min-width:0;margin-top:10px; }
#selection .skill-codex-head {
 display:flex;justify-content:space-between;gap:8px;
 margin-bottom:5px;color:#e4cfda;
 font:700 10px/1.3 "Kemco Pixel","Galmuri11",monospace;
 letter-spacing:.4px;
}
#selection .skill-codex-head span:last-child { color:var(--accent); }
#selection .skill-slots {
 display:grid;
 grid-template-columns:repeat(2,minmax(0,1fr));
 gap:6px;
}
#selection .skill-slot {
 display:flex;align-items:center;gap:7px;
 width:100%;min-width:0;min-height:51px;
 padding:5px 6px;text-align:left;border-radius:0;
 color:#f4e8f3;background:#31283e;
 border:2px solid #74637d;
 border-top-color:#ab93ad;
 box-shadow:inset -2px -2px 0 #1a1324,2px 2px 0 #110d1a;
}
#selection .skill-slot[aria-pressed="true"] {
 color:#fff7f1;background:#473452;
 border-color:#f7e5b4;
 outline:2px solid var(--skill-accent);
 outline-offset:-5px;
 box-shadow:inset 2px 2px 0 #ffffff26,inset -2px -2px 0 #1c1126,2px 2px 0 #100b19;
}
#selection .skill-slot:active {transform:translate(1px,1px);}
#selection .skill-slot:focus-visible {outline:2px solid #fff1c8;outline-offset:2px;}
#selection .skill-pixel-icon {
 width:36px;height:36px;flex:none;
 image-rendering:pixelated;image-rendering:crisp-edges;
 background:#100d1a;border:1px solid #a58caa;
}
#selection .skill-slot-meta {display:flex;flex-direction:column;gap:4px;min-width:0;}
#selection .skill-slot-meta small {
 display:block;padding:0;background:none;border:0;
 font:700 9px/1.25 "Galmuri11",monospace;
 color:#d9c5df;
}
#selection .skill-slot-meta strong {
 display:block;min-width:0;overflow-wrap:anywhere;
 font:700 11px/1.25 "Galmuri11",sans-serif;
 color:inherit;
}
#selection #kitGuide.skill-detail {
 margin-top:7px;padding:7px 8px;
 min-width:0;overflow-wrap:anywhere;
 border:2px solid #66536d;background:#171322;
 box-shadow:inset -2px -2px 0 #0d0a15;
}
#selection .skill-detail-heading {
 display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 8px;
 margin-bottom:4px;
}
#selection #kitGuide.skill-detail .skill-detail-heading span {
 color:var(--accent);font:700 10px/1.3 "Galmuri11",sans-serif;
}
#selection #kitGuide.skill-detail .skill-detail-heading strong {
 color:#fff5ed;font:700 12px/1.3 "Galmuri11",sans-serif;
 margin:0;
}
#selection #kitGuide.skill-detail p {
 margin:0;color:#e8dbe8;
 font:400 11px/1.45 "Galmuri11",sans-serif;
}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
 #selection .skill-codex {margin-top:5px;}
 #selection .skill-codex-head {font-size:8px;margin-bottom:3px;}
 #selection .skill-slots {gap:4px;}
 #selection .skill-slot {min-height:38px;padding:3px 4px;gap:4px;border-width:1px;}
 #selection .skill-pixel-icon {width:25px;height:25px;}
 #selection .skill-slot-meta {gap:1px;}
 #selection .skill-slot-meta small {font-size:7px;}
 #selection .skill-slot-meta strong {font-size:9px;line-height:1.15;}
 #selection #kitGuide.skill-detail {margin-top:4px;padding:4px 5px;border-width:1px;}
 #selection #kitGuide.skill-detail .skill-detail-heading {margin-bottom:2px;}
 #selection #kitGuide.skill-detail .skill-detail-heading span {font-size:8px;}
 #selection #kitGuide.skill-detail .skill-detail-heading strong {font-size:9px;}
 #selection #kitGuide.skill-detail p {font-size:9px;line-height:1.3;}
}
@media (orientation:portrait) and (max-width:600px) {
 #selection .skill-slots {gap:4px;}
 #selection .skill-slot {min-height:38px;padding:3px;gap:3px;border-width:1px;}
 #selection .skill-pixel-icon {width:25px;height:25px;}
 #selection .skill-slot-meta small {font-size:7px;}
 #selection .skill-slot-meta strong {font-size:9px;}
 #selection #kitGuide.skill-detail {padding:4px 5px;}
 #selection #kitGuide.skill-detail .skill-detail-heading strong,
 #selection #kitGuide.skill-detail p {font-size:9px;}
}

/* Suppress iOS text magnifier, callout and double-tap zoom only in combat. */
#play, #play * {
 -webkit-user-select:none !important;
 user-select:none !important;
 -webkit-touch-callout:none !important;
 -webkit-tap-highlight-color:transparent;
}
#play, #play .game, #play .viewport, #play #arena, #play .touch,
#play .touch button, #play .arena-top {
 touch-action:none;
 overscroll-behavior:contain;
}
#play button, #play .mobile-battle-menu {
 touch-action:manipulation;
}
#play .touch button { touch-action:none; }


/* Compact fighter selection / three stats preserved / connected pixel panels */
#selection .dossier,#selection .desk{background:#292237;border-color:#716079;box-sizing:border-box}
#selection .dossier{border-bottom:0;padding-bottom:9px;box-shadow:inset 0 0 0 2px #44374f,inset 3px 3px #9b81a354,4px 0 #17101f}
#selection .desk{border-top:2px solid #574964;padding-top:8px;box-shadow:inset 0 0 0 2px #44374f,inset -3px -3px #161120,4px 4px #100b18}
#selection .dossier h3{margin:0 0 2px;line-height:1.15}
#selection .dossier>b{display:block;font-size:clamp(11px,1.4vw,14px);font-weight:500;color:#ded2e3}
#selection #stats{margin-top:8px}
#selection #stats div{margin:4px 0;gap:2px 8px}
#selection #stats i{position:relative;overflow:hidden;min-height:8px;height:8px}
#selection #stats i::after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(to right,transparent 0 11px,#1a1429b0 11px 13px);pointer-events:none}
#selection .skill-codex{margin-top:8px}
#selection .skill-codex-head{margin-bottom:4px}
#selection .skill-slot{min-height:42px;padding:4px 5px;gap:5px}
#selection .skill-pixel-icon{width:29px;height:29px}
#selection .skill-slot-meta{gap:2px}
#selection .skill-slot-meta small{font-size:8px}
#selection .skill-slot-meta strong{font-size:10px;line-height:1.2}
#selection #kitGuide.skill-detail{margin-top:5px;padding:6px 7px}
#selection .skill-detail-heading{margin-bottom:2px}
#selection #kitGuide.skill-detail p{font-size:10px;line-height:1.35}
#selection .names{margin-top:5px}
#selection .setup{margin-top:8px;padding-top:6px}
#selection .setup #matchup{font-size:clamp(9px,1.3vw,12px)}
@media (orientation:landscape) and (min-height:651px){
 #selection .dossier,#selection .desk{justify-self:stretch;width:min(100%,550px)}
 #selection .dossier{align-self:stretch}
 #selection .desk{align-self:start}
}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px){
 #selection .dossier{padding-bottom:3px}
 #selection .desk{padding-top:4px}
 #selection .dossier h3{font-size:clamp(16px,2.8vw,23px)}
 #selection .dossier>b{font-size:9px}
 #selection #stats{margin-top:3px}
 #selection #stats div{margin:2px 0;line-height:1.15}
 #selection #stats i{min-height:5px;height:5px}
 #selection .skill-codex{margin-top:4px}
 #selection .skill-slot{min-height:32px;padding:2px 3px}
 #selection .skill-pixel-icon{width:22px;height:22px}
 #selection .skill-slot-meta small{font-size:7px}
 #selection .skill-slot-meta strong{font-size:8px}
 #selection #kitGuide.skill-detail{padding:3px 5px;margin-top:3px}
 #selection #kitGuide.skill-detail p{font-size:9px;line-height:1.2}
 #selection .setup{margin-top:auto;padding-top:4px}
 #selection .names{margin-top:3px}
}
@media (orientation:portrait) and (max-width:600px){
 #selection .dossier{border-bottom:0}
 #selection .desk{border-top:2px solid #574964}
 #selection .skill-codex{margin-top:5px}
}

/* Lightweight pixel UI: flat inset lines, compact one-line skill tabs.
   Keep the fighter art, all three stat bars, skill details and functionality. */
#selection .dossier,
#selection .desk {
  background:#292237;
  border:1px solid #675771;
  border-radius:0;
  box-shadow:none;
}
#selection .dossier {border-top:3px solid var(--accent);border-bottom:0;}
#selection .desk {border-top:1px solid #574862;}
#selection #kitGuide.skill-detail {
  background:#211b2e;
  border:1px solid #554760;
  box-shadow:none;
  padding:7px 9px;
}
#selection .skill-codex {margin-top:9px;}
#selection .skill-slots {gap:7px;grid-template-columns:repeat(2,minmax(0,1fr));}
#selection .skill-slot,
#selection .skill-slot[aria-pressed="true"] {
  display:flex;
  align-items:center;
  gap:7px;
  min-width:0;
  min-height:43px;
  padding:5px 8px;
  border-radius:0;
  box-shadow:none;
  text-shadow:none;
}
#selection .skill-slot {
  border:1px solid #655670;
  background:#32293f;
  color:#e4d8e9;
}
#selection .skill-slot[aria-pressed="true"] {
  background:#44334f;
  border:1px solid var(--skill-accent);
  outline:none;
  color:#fff3f8;
  box-shadow:inset 3px 0 0 var(--skill-accent);
}
#selection .skill-pixel-icon {width:29px;height:29px;flex:0 0 29px;border:1px solid #675573;}
#selection .skill-slot-meta {display:block;flex:1 1 auto;min-width:0;}
#selection .skill-slot-meta strong {
  display:block;
  font:700 11px/1.3 "Galmuri11",sans-serif;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  overflow-wrap:normal;
  word-break:keep-all;
}
#selection .skill-detail-heading {gap:5px 7px;}
#selection .skill-detail-heading span {white-space:nowrap;}
#selection .pick button,
#selection .names button,
#selection .flow-cta {
  border-radius:0;
  box-shadow:none;
  text-shadow:none;
  transform:none;
}
#selection .pick button,
#selection .names button {
  background:#352c43;
  border:1px solid #66536f;
  color:#f3e8f5;
}
#selection .names button {border-bottom:3px solid var(--member);}
#selection .pick button[aria-pressed="true"],
#selection .names button[aria-pressed="true"] {
  background:var(--member,var(--accent));
  color:#24172e;
  border:1px solid #f8e6b4;
  outline:none;
  box-shadow:none;
}
#selection .pick button[aria-pressed="true"] {background:#f5c5dc;}
#selection .flow-cta {
  background:#f6aacc;
  border:1px solid #ffe3c3;
  color:#29182e;
}
#selection .pick button:active,
#selection .names button:active,
#selection .flow-cta:active {
  transform:none;
  filter:brightness(1.12);
  box-shadow:none;
}
#selection .setup {border-top:1px solid #584960;box-shadow:none;}
#selection #stats i {box-shadow:none;}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
  #selection .dossier,#selection .desk {border-width:1px;box-shadow:none;}
  #selection .dossier {border-top-width:2px;border-bottom:0;}
  #selection .skill-codex {margin-top:4px;}
  #selection .skill-slots {gap:4px;}
  #selection .skill-slot,#selection .skill-slot[aria-pressed="true"] {
    min-height:32px;padding:3px 4px;gap:4px;
  }
  #selection .skill-pixel-icon {width:22px;height:22px;flex-basis:22px;}
  #selection .skill-slot-meta strong {font-size:9px;line-height:1.2;}
  #selection #kitGuide.skill-detail {padding:3px 5px;}
  #selection .pick button,#selection .names button,#selection .flow-cta {box-shadow:none;border-width:1px;}
  #selection .names button {border-bottom-width:2px;}
}
@media (orientation:portrait) and (max-width:600px) {
  #selection .skill-slots {gap:4px;}
  #selection .skill-slot,#selection .skill-slot[aria-pressed="true"] {
    min-height:32px;padding:3px 4px;gap:4px;
  }
  #selection .skill-pixel-icon {width:23px;height:23px;flex-basis:23px;}
  #selection .skill-slot-meta strong {font-size:9px;}
  #selection .dossier,#selection .desk {box-shadow:none;}
}

/* Final selection polish: no gold cabinet border; readable skill names. */
#selection {
  border:0 !important;
  outline:none;
  box-shadow:none !important;
}
#selection .select-head {
  border-left:0;
  border-right:0;
}
#selection .skill-slots {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
  min-width:0;
}
#selection .skill-slot,
#selection .skill-slot[aria-pressed="true"] {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  min-width:0;
  min-height:66px;
  padding:7px 3px;
}
#selection .skill-slot-meta {
  display:block;
  flex:0 0 auto;
  width:100%;
  min-width:0;
  text-align:center;
}
#selection .skill-slot-meta strong {
  display:block;
  width:100%;
  font:700 11px/1.4 "Galmuri11",sans-serif;
  white-space:nowrap;
  overflow:visible;
  text-overflow:clip;
  word-break:keep-all;
  overflow-wrap:normal;
}
#selection .skill-pixel-icon {
  width:28px;
  height:28px;
  flex:0 0 28px;
}
#selection .names button[aria-pressed="true"],
#selection .pick button[aria-pressed="true"] {
  border-color:var(--member,var(--accent));
}
#selection .pick button[aria-pressed="true"] {border-color:#f5c5dc;}
#selection .flow-cta {border-color:#f2b8d1;}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
  #selection .skill-slots {gap:4px;}
  #selection .skill-slot,
  #selection .skill-slot[aria-pressed="true"] {
    flex-direction:row;
    gap:5px;
    min-height:36px;
    padding:3px 4px;
  }
  #selection .skill-slot-meta {
    flex:1 1 auto;
    width:auto;
    text-align:center;
  }
  #selection .skill-slot-meta strong {font-size:9px;}
  #selection .skill-pixel-icon {
    width:20px;
    height:20px;
    flex:0 0 20px;
  }
}
@media (orientation:portrait) and (max-width:600px) {
  #selection .skill-slot,
  #selection .skill-slot[aria-pressed="true"] {
    min-height:61px;
    flex-direction:column;
    gap:4px;
    padding:5px 3px;
  }
  #selection .skill-slot-meta {width:100%;text-align:center;}
  #selection .skill-slot-meta strong {font-size:10px;}
  #selection .skill-pixel-icon {
    width:26px;
    height:26px;
    flex:0 0 26px;
  }
}

/* Edge-to-edge stage with a consistent inset for the header, selection panels,
   and device safe areas. Keep the compact landscape layout scrollable. */
/* Full-bleed fighter select: use the screen as the game canvas, not a centered cabinet. */
body[data-screen="selection"] {
  width:100%;
  margin:0;
  background:#f8f5fc;
}
body[data-screen="selection"] main {
  width:100%;
  max-width:none !important;
  min-width:0;
  margin:0;
  padding:0 !important;
}
#selection:not([hidden]) {
  width:100%;
  max-width:none;
  min-width:0;
  box-sizing:border-box;
  margin:0;
  padding:0;
  border:0 !important;
  box-shadow:none !important;
  background:#f8f5fc;
}
@media (orientation:landscape) {
  body[data-screen="selection"] {overflow:hidden;}
  #selection:not([hidden]) {
    display:grid;
    box-sizing:border-box;
    height:100dvh;
    min-height:0;
    max-height:100dvh;
    overflow:hidden;
    grid-template-columns:minmax(0,54%) minmax(0,46%);
    grid-template-rows:auto minmax(0,1fr) minmax(0,1fr);
    column-gap:clamp(8px,1.5vw,22px);
    row-gap:0;
    padding:0 max(clamp(16px,1.5vw,26px),env(safe-area-inset-right))
            0 max(clamp(16px,1.5vw,26px),env(safe-area-inset-left));
  }
  #selection .studio {display:contents;}
  #selection .select-head {
    grid-column:1/-1;
    grid-row:1;
    margin:0;
    padding:clamp(8px,1.5dvh,17px) clamp(8px,.9vw,14px);
    min-height:0;
  }
  #selection #poster {
    grid-column:1;
    grid-row:2 / 4;
    width:100%;
    height:100%;
    min-height:0;
    min-width:0;
    margin:0;
    overflow:hidden;
  }
  #selection #slide {inset:0 3% 0;}
  #selection #slide img {object-fit:contain;object-position:center bottom;}
  #selection .dossier, #selection .desk {
    grid-column:2;
    width:100%;
    max-width:none;
    min-width:0;
    min-height:0;
    margin:0;
    justify-self:stretch;
    box-sizing:border-box;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  #selection .dossier {
    grid-row:2;
    align-self:stretch;
    padding:clamp(8px,1.35dvh,18px) clamp(9px,1.4vw,20px);
  }
  #selection .desk {
    grid-row:3;
    align-self:stretch;
    display:flex;
    flex-direction:column;
    padding:clamp(7px,1dvh,14px) clamp(9px,1.4vw,20px);
    gap:clamp(3px,.7dvh,8px);
  }
  #selection .setup {margin-top:auto;}
  #selection .names {grid-template-columns:repeat(6,minmax(0,1fr));}
  #selection .names button {min-width:0;}
}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
  #selection:not([hidden]) {
    grid-template-columns:minmax(0,47%) minmax(0,53%);
    grid-template-rows:auto minmax(0,1fr) minmax(0,1fr);
    padding:0 max(clamp(12px,1.6vw,20px),env(safe-area-inset-right))
            0 max(clamp(12px,1.6vw,20px),env(safe-area-inset-left));
    gap:0 clamp(6px,1.1vw,13px);
  }
  #selection .select-head {padding:4px clamp(5px,.75vw,10px);}
  #selection .dossier {grid-row:2;padding:5px 7px;overflow-y:auto;}
  #selection .desk {grid-row:3;padding:4px 7px;overflow-y:auto;}
  #selection .skill-codex {margin-top:4px;}
  #selection .skill-slot,#selection .skill-slot[aria-pressed="true"] {
    min-height:31px;
  }
  #selection .setup {margin-top:auto;}
}
@media (orientation:portrait) {
  body[data-screen="selection"] {overflow-x:hidden;overflow-y:auto;}
  #selection:not([hidden]) {
    display:flex;
    flex-direction:column;
    min-height:100dvh;
    height:auto;
    overflow:visible;
    padding-inline:clamp(12px,3vw,22px);
  }
  #selection .select-head {
    width:100%;
    margin:0;
    padding-inline:clamp(10px,1.5vw,16px);
  }
  #selection .studio {
    display:block;
    width:100%;
    height:clamp(340px,57dvh,700px);
    flex:none;
    position:relative;
    overflow:hidden;
  }
  #selection #poster {position:absolute;inset:0 44% 0 0;width:auto;height:auto;}
  #selection .dossier {
    position:absolute;
    top:50%;
    right:1.5%;
    transform:translateY(-50%);
    width:42%;
    max-height:calc(100% - 12px);
    overflow-y:auto;
    margin:0;
  }
  #selection .desk {
    width:100%;
    margin:0;
    flex:1 0 auto;
    box-sizing:border-box;
  }
}

/* Skill details: preserve fighter color and make the change visibly transparent.
   The light tint sits over the panel, rather than opaque dark-on-dark. */
#selection #kitGuide.skill-detail {
  background:rgba(245,232,255,.10) !important;
  border-color:rgba(189,164,200,.55);
}
#selection #kitGuide.skill-detail .skill-detail-heading strong {
  color:var(--accent) !important;
}

/* Standalone mobile landscape selection: breathable rhythm without empty spacer rows. */
@media (orientation:landscape) and (pointer:coarse) and (display-mode:standalone) and (max-height:650px) {
  #selection:not([hidden]) {
    grid-template-columns:minmax(0,47%) minmax(0,53%);
    grid-template-rows:auto minmax(0,1fr) minmax(0,1fr);
    column-gap:clamp(12px,2vw,24px);
    row-gap:clamp(6px,1.4dvh,12px);
    padding:clamp(6px,1.2dvh,12px) max(12px,env(safe-area-inset-right)) clamp(6px,1.2dvh,12px) max(12px,env(safe-area-inset-left));
  }
  #selection .select-head {padding:2px clamp(6px,.8vw,10px) 5px;}
  #selection #poster {grid-row:2 / 4;}
  #selection #slide {inset:1% 3% 1%;}
  #selection .dossier,
  #selection .desk {
    width:100%;
    margin:0;
    padding:clamp(8px,1.65dvh,14px) clamp(10px,1.6vw,17px);
    overflow-x:hidden;
    overflow-y:auto;
  }
  #selection .dossier {
    grid-row:2;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:clamp(3px,.9dvh,7px);
  }
  #selection .dossier h3 {flex:none;margin:0;}
  #selection .dossier > b {flex:none;}
  #selection #stats {flex:none;margin-top:3px;}
  #selection #stats div {margin:clamp(3px,.7dvh,6px) 0;}
  #selection .skill-codex {flex:none;margin-top:clamp(4px,1dvh,9px);}
  #selection .desk {
    grid-row:3;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:clamp(7px,1.6dvh,13px);
  }
  #selection .pick {flex:none;}
  #selection .names {flex:none;margin:0;}
  #selection .setup {
    flex:none;
    margin-top:clamp(3px,.8dvh,8px);
    padding-top:clamp(5px,1dvh,9px);
  }
}

/* One more gentle spacing pass: balanced, content-led, no blank spacer bands. */
@media (orientation:landscape) and (pointer:coarse) and (display-mode:standalone) and (max-height:650px) {
  #selection:not([hidden]) {
    column-gap:clamp(15px,2.3vw,27px);
    row-gap:clamp(7px,1.65dvh,14px);
    padding:clamp(7px,1.45dvh,13px) max(15px,env(safe-area-inset-right))
            clamp(7px,1.45dvh,13px) max(15px,env(safe-area-inset-left));
  }
  #selection .dossier,
  #selection .desk {
    padding:clamp(9px,1.9dvh,16px) clamp(12px,1.9vw,20px);
  }
  #selection .dossier { gap:clamp(4px,1.05dvh,8px); }
  #selection #stats div { margin:clamp(4px,.85dvh,7px) 0; }
  #selection .skill-codex { margin-top:clamp(5px,1.2dvh,10px); }
  #selection .desk { gap:clamp(8px,1.85dvh,15px); }
  #selection .setup {
    margin-top:clamp(4px,1dvh,9px);
    padding-top:clamp(6px,1.15dvh,10px);
  }
}

/* Rounded D-pad: exactly the same diameter and translucent treatment as
   the right-hand attack pad; thicker arrows fade gently toward their tips. */
@media (orientation:landscape) and (pointer:coarse) {
 #play .touch-movement {
  grid-template-columns:repeat(3,clamp(49px,13.8dvh,71px));
  grid-template-rows:repeat(2,clamp(49px,13.8dvh,71px));
  gap:clamp(5px,1.5dvh,9px);
 }
 #play .touch-movement .pad-direction {
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  padding:0;
  border-radius:50%;
  background:rgba(255,255,255,.075);
  border:1px solid rgba(255,255,255,.54);
  box-shadow:inset 0 1px rgba(255,255,255,.12),0 2px 5px rgba(0,0,0,.18);
  -webkit-backdrop-filter:blur(2px);
  backdrop-filter:blur(2px);
  touch-action:none;
 }
 #play .touch-movement .pad-arrow-icon {
  display:block;
  width:clamp(23px,6.8dvh,33px);
  height:clamp(23px,6.8dvh,33px);
  pointer-events:none;
  overflow:visible;
 }
 #play .touch-movement .pad-arrow-icon.arrow-left { transform:rotate(-90deg); }
 #play .touch-movement .pad-arrow-icon.arrow-down { transform:rotate(180deg); }
 #play .touch-movement .pad-arrow-icon.arrow-right { transform:rotate(90deg); }
 #play .touch-movement .pad-direction:active {
  background:rgba(255,255,255,.30);
  border-color:rgba(255,255,255,.90);
  transform:scale(.96);
 }
}
@media (orientation:portrait) and (pointer:coarse) {
 #play .touch-movement .pad-direction {
  border-radius:50%;
  aspect-ratio:1;
  display:grid;
  place-items:center;
  padding:0;
  background:rgba(255,255,255,.075);
  border:1px solid rgba(255,255,255,.54);
 }
 #play .touch-movement .pad-arrow-icon {
  width:24px;height:24px;pointer-events:none;
 }
 #play .touch-movement .pad-arrow-icon.arrow-left {transform:rotate(-90deg);}
 #play .touch-movement .pad-arrow-icon.arrow-down {transform:rotate(180deg);}
 #play .touch-movement .pad-arrow-icon.arrow-right {transform:rotate(90deg);}
}

/* Skill names stay regular weight and slightly larger than their descriptions. */
#selection #kitGuide.skill-detail .skill-detail-heading strong {
  font-size:14px;
  font-weight:400;
}
#selection #kitGuide.skill-detail p {font-size:11px;}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
  #selection #kitGuide.skill-detail .skill-detail-heading strong {font-size:11px;}
  #selection #kitGuide.skill-detail p {font-size:10px;}
}
@media (orientation:portrait) and (max-width:600px) {
  #selection #kitGuide.skill-detail .skill-detail-heading strong {font-size:12px;}
  #selection #kitGuide.skill-detail p {font-size:10px;}
}
/* Portrait selection uses a dark header; landscape keeps its dark-on-light text. */
@media (orientation:portrait) and (max-width:800px) {
  #selection .select-head h2 {
    color:#f8f5fc;
    text-shadow:2px 2px #5b3f67;
  }
}

/* Preserve text contrast but reveal a subtle amount of the stage behind
   the complete fighter information panel (rather than only its tooltip). */
#selection .dossier {
 background:rgba(36,29,50,.89);
}
#selection .desk {
 background:rgba(36,29,50,.91);
}

/* Fighter selection overflow fix: flex centering may hide the beginning of
   scrollable content when skill panels grow taller than their grid cells. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
  #selection .dossier,
  #selection .desk {
    justify-content:flex-start;
    justify-content:safe center;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior-y:contain;
  }
  #selection .dossier .skill-codex,
  #selection .desk .pick,
  #selection .desk .names,
  #selection .desk .setup { flex-shrink:0; }
}

/* Minimal match-up strip: names lead; P1/CPU labels stay secondary. */
#selection .desk .setup #matchup.matchup-bar {
 display:flex;
 align-items:center;
 gap:clamp(5px,.9vw,11px);
 flex:1 1 230px;
 width:auto;
 min-width:0;
 max-width:100%;
 margin:0 auto 0 0;
 padding:clamp(6px,.7vw,9px) clamp(7px,1vw,12px);
 background:rgba(255,255,255,.035);
 border:1px solid rgba(203,181,214,.25);
 box-sizing:border-box;
 line-height:1.3;
 font-weight:400;
}
#selection #matchup .match-side {
 display:inline-flex;
 align-items:center;
 min-width:0;
 gap:clamp(4px,.5vw,7px);
}
#selection #matchup .match-side-opponent {margin-left:auto;}
/* P1 label reads optically tighter than CPU: add a subtle 2px offset. */
#selection #matchup .match-side:not(.match-side-opponent) {gap:clamp(6px, calc(.5vw + 2px), 9px);}
#selection #matchup .match-role {
 flex:none;
 padding:3px 5px;
 border:1px solid rgba(220,197,224,.32);
 background:rgba(17,13,25,.18);
 color:#d8cadb;
 font-size:clamp(9px,.8vw,10px);
 line-height:1.2;
 letter-spacing:0;
}
#selection #matchup .match-name {
 min-width:0;
 overflow:hidden;
 text-overflow:ellipsis;
 white-space:nowrap;
 font-size:clamp(12px,1.25vw,15px);
 font-weight:400;
 line-height:1.4;
}
#selection #matchup .match-vs {
 flex:none;
 color:#c0aec8;
 font-size:clamp(9px,.9vw,11px);
 letter-spacing:.04em;
}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
 #selection .desk .setup #matchup.matchup-bar {padding:4px 6px;gap:5px;flex-basis:180px;}
 #selection #matchup .match-role {padding:2px 3px;font-size:9px;}
 #selection #matchup .match-name {font-size:clamp(10px,1.5vw,12px);}
 #selection #matchup .match-vs {font-size:9px;}
}
@media (orientation:portrait) and (max-width:600px) {
 #selection .desk .setup #matchup.matchup-bar {flex:1 0 100%;width:100%;padding:7px 9px;}
 #selection #matchup .match-name {font-size:13px;}
}

/* Title layout: credits anchored near the bottom on every aspect ratio. */
body[data-screen="welcome"] .title-screen {
 display:grid;
 grid-template-columns:minmax(0,1fr);
 grid-template-rows:minmax(0,1fr) auto minmax(12px,.28fr) auto;
 min-height:100svh;
 padding-top:max(18px,env(safe-area-inset-top));
 padding-bottom:max(clamp(17px,4svh,43px),env(safe-area-inset-bottom));
}
body[data-screen="welcome"] .title-lockup {grid-row:1;align-self:end;}
body[data-screen="welcome"] .mode-menu {grid-row:2;}
body[data-screen="welcome"] .title-credit {
 grid-row:4;align-self:end;
 justify-content:center;
 flex-wrap:wrap;
 gap:4px clamp(10px,1.7vw,22px);
 margin:0;
 text-align:center;
 font-size:clamp(10px,1.2vw,13px);
 color:rgba(247,242,249,.83);
 white-space:normal;
}
body[data-screen="welcome"] .title-credit > span {
 font:inherit;
 line-height:inherit;
 color:inherit;
}
body[data-screen="welcome"] .title-credit-author {
 color:inherit;
}
body[data-screen="welcome"] .title-subtitle {
 margin-top:-.66em;
}
@media (max-aspect-ratio:1/1) {
 body[data-screen="welcome"] .title-screen {
  grid-template-rows:minmax(0,1fr) auto minmax(12px,.48fr) auto;
 }
}
/* Desktop game controls share the title's understated pixel button system. */
#play .arena-top #sound,
#play .arena-top #pause {
 display:inline-grid;
 place-items:center;
 position:relative;
 width:34px;height:34px;
 min-width:34px;min-height:34px;
 padding:0;
 border:1px solid rgba(250,237,248,.40);
 border-radius:3px;
 background:rgba(24,17,35,.28);
 color:#fff4fb;
 box-shadow:none;
 font-size:0;
}
#play .arena-top .hud-pixel-icon {
 width:18px;height:18px;
 display:block;
 fill:currentColor;
 shape-rendering:crispEdges;
 pointer-events:none;
}
#play .arena-top #sound.is-muted svg {opacity:.5;}
#play .arena-top #sound.is-muted::after {
 content:"";
 position:absolute;
 width:23px;height:2px;
 transform:rotate(-45deg);
 background:currentColor;
 opacity:.8;
}
#play .arena-top #sound:hover,
#play .arena-top #pause:hover,
#play .arena-top #mobile-menu-toggle:hover {
 background:rgba(255,255,255,.14);
 border-color:rgba(255,255,255,.67);
 color:#fff;
}
#play .arena-top #sound:focus-visible,
#play .arena-top #pause:focus-visible,
#play .arena-top #mobile-menu-toggle:focus-visible {
 outline:2px solid #ffe3a4;
 outline-offset:2px;
}
/* Mobile battle: one low-profile menu button; audio lives inside its menu. */
@media (orientation:landscape) and (pointer:coarse) {
 #play .arena-top {
  top:max(6px,env(safe-area-inset-top));
  right:max(9px,env(safe-area-inset-right));
  left:auto;
  padding:0;
  background:transparent;
  border:0;
  box-shadow:none;
 }
 #play .arena-top #sound,
 #play .arena-top #pause {display:none !important;}
 #play .arena-top #mobile-menu-toggle {
  display:grid;
  place-items:center;
  width:36px;height:36px;
  min-width:36px;min-height:36px;
  padding:0;
  font-size:0;
  color:#fff4fb;
  border:1px solid rgba(250,237,248,.33);
  border-radius:3px;
  background:rgba(24,17,35,.24);
  box-shadow:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
  opacity:.82;
 }
 #play .arena-top #mobile-menu-toggle[aria-expanded="true"] {
  background:rgba(24,17,35,.55);
  opacity:1;
 }
 #play .arena-top #mobile-menu-toggle .menu-open-icon {display:none;}
 #play .arena-top #mobile-menu-toggle[aria-expanded="true"] .menu-closed-icon {display:none;}
 #play .arena-top #mobile-menu-toggle[aria-expanded="true"] .menu-open-icon {display:block;}
 #play .arena-top .mobile-battle-menu {
  border-radius:3px;
  background:rgba(24,17,35,.94);
 }
 #play .arena-top .mobile-battle-menu button {border-radius:2px;}
}

/* Desktop fighter select: keep matchup controls directly under the roster.
   The launch button gets its own row and a subtle physical pixel press. */
@media (orientation:landscape) and (pointer:fine) and (min-width:900px) {
  body:not([data-mode="duo"]) #selection .desk {
    justify-content:flex-start;
  }
  body:not([data-mode="duo"]) #selection .desk .setup {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-rows:auto auto;
    align-items:center;
    column-gap:clamp(9px,1vw,16px);
    row-gap:0;
    margin-top:0;
    padding-top:clamp(8px,1vw,12px);
  }
  body:not([data-mode="duo"]) #selection .desk .setup #matchup.matchup-bar {
    grid-column:1;
    grid-row:1;
    width:100%;
    min-width:0;
    margin:0;
  }
  body:not([data-mode="duo"]) #selection .desk .setup #cpuDifficulty {
    grid-column:2;
    grid-row:1;
    margin:0;
    justify-self:end;
  }
  body:not([data-mode="duo"]) #selection .desk .setup #launch {
    grid-column:1 / -1;
    grid-row:2;
    justify-self:end;
    margin:clamp(12px,1.4vw,20px) 3px 3px 0;
    padding:clamp(10px,1vw,14px) clamp(18px,1.7vw,25px);
    border:2px solid #fce0ed;
    border-radius:0;
    background:#f6aacc;
    color:#29182e;
    box-shadow:inset 2px 2px 0 #ffe7f2,inset -2px -2px 0 #c5779d,3px 3px 0 #201427;
    transition:transform .08s ease,box-shadow .08s ease,background .12s ease;
  }
  body:not([data-mode="duo"]) #selection .desk .setup #launch:hover:not(:disabled) {
    background:#ffc0dc;
  }
  body:not([data-mode="duo"]) #selection .desk .setup #launch:active:not(:disabled) {
    transform:translate(2px,2px);
    filter:none;
    box-shadow:inset 2px 2px 0 #b96c93,inset -1px -1px 0 #ffe0ee,1px 1px 0 #201427;
  }
}

/* On desktop, end fighter selection shortly after the start button.
   Do not split the right panel into equal-height viewport rows. */
@media (orientation:landscape) and (pointer:fine) and (min-width:900px) {
  body[data-screen="selection"] {
    overflow-x:hidden;
    overflow-y:auto;
  }
  #selection:not([hidden]) {
    height:auto;
    min-height:0;
    max-height:none;
    grid-template-rows:auto auto auto;
    overflow:visible;
    padding-bottom:clamp(12px,1.5vw,22px);
  }
  #selection .dossier,
  #selection .desk {
    height:auto;
    max-height:none;
    overflow-y:visible;
  }
  #selection .desk {
    align-self:start;
    justify-content:flex-start;
  }
  body:not([data-mode="duo"]) #selection .desk .setup {
    margin-top:0;
  }
}

/* Desktop immersive battle viewport and controls dialog.
   Keep the real HUD but remove outer banners and keyboard instruction strips. */
@media (pointer:fine), (min-width:900px) and (hover:hover) {
  body[data-screen="play"] {
    width:100%;
    height:100dvh;
    margin:0;
    overflow:hidden;
    overscroll-behavior:none;
  }
  body[data-screen="play"] main {
    position:fixed;
    inset:0;
    width:100%;
    max-width:none;
    min-width:0;
    height:100dvh;
    min-height:0;
    margin:0;
    padding:0 !important;
    overflow:hidden;
  }
  #play:not([hidden]) {
    display:block;
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    min-height:0;
    margin:0;
    padding:0;
  }
  #play .game {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    max-width:none;
    margin:0;
    padding:0;
    border:0;
    box-shadow:none;
    background:#171526;
  }
  #play .viewport {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    aspect-ratio:auto;
    overflow:hidden;
  }
  #play canvas#arena {
    display:block;
    width:100%;
    height:100%;
    image-rendering:pixelated;
  }
  #play > .controls,
  #play > footer { display:none !important; }
  #play .arena-top {
    position:absolute;
    z-index:40;
    top:clamp(10px,1.7dvh,20px);
    right:clamp(12px,1.8vw,28px);
    left:auto;
    display:flex;
    align-items:center;
    justify-content:flex-end;
    width:auto;
    min-height:0;
    padding:0;
    gap:7px;
    background:transparent;
    border:0;
    box-shadow:none;
  }
  #play .arena-top > span,
  #play .arena-top #modeLabel { display:none; }
  #play .arena-top #sound,
  #play .arena-top #pause,
  #play .arena-top #battle-back,
  #play .arena-top #combat-help-toggle,
  #play .arena-top #fullscreen-toggle {
    display:inline-grid;
    place-items:center;
    width:clamp(34px,2.8vw,40px);
    height:clamp(34px,2.8vw,40px);
    min-width:34px;
    min-height:34px;
    padding:0;
    margin:0;
    color:#f9efff;
    border:1px solid rgba(255,239,252,.45);
    border-radius:2px;
    background:rgba(25,19,39,.68);
    box-shadow:none;
    backdrop-filter:none;
    cursor:pointer;
  }
  #play .arena-top #battle-back {
    font:700 clamp(19px,1.7vw,25px)/1 "Galmuri11",monospace;
  }
  #play .arena-top #combat-help-toggle {
    font:700 clamp(17px,1.6vw,23px)/1 "Kemco Pixel","Galmuri11",monospace;
  }
  #play .arena-top #fullscreen-toggle .hud-pixel-icon {
    width:19px;
    height:19px;
  }
  #play .arena-top #battle-back:hover,
  #play .arena-top #combat-help-toggle:hover,
  #play .arena-top #fullscreen-toggle:hover,
  #play .arena-top #sound:hover,
  #play .arena-top #pause:hover {
    border-color:#fbd69b;
    background:rgba(64,43,73,.86);
  }
  #play .hud {
    top:clamp(65px,9dvh,96px);
    left:clamp(18px,2.7vw,46px);
    right:clamp(18px,2.7vw,46px);
    z-index:10;
  }
}

/* Desktop HUD alignment: compact round pips, right-aligned rival,
   and legible Galmuri stage labels inside the full-screen arena. */
#play .arena-bottom,
#play .arena-bottom span {
  font-family:"Galmuri11",monospace;
}
@media (pointer:fine), (min-width:900px) and (hover:hover) {
  body[data-screen="play"]:fullscreen,
  body[data-screen="play"] main:fullscreen {
    width:100vw;
    height:100dvh;
  }
  #play .fighter-hud > span[id^="wins"] {
    letter-spacing:0;
    word-spacing:-.2em;
  }
  #play .fighter-hud.right > div:first-child {
    display:flex;
    flex-direction:row-reverse;
    justify-content:flex-start;
    align-items:center;
    gap:clamp(8px,.9vw,14px);
  }
  #play .fighter-hud.right > div:first-child b,
  #play .fighter-hud.right > div:first-child small {
    flex:none;
  }
  #play .arena-bottom {
    display:flex !important;
    position:absolute;
    z-index:8;
    bottom:clamp(7px,1.3dvh,17px);
    left:clamp(12px,2vw,30px);
    right:clamp(12px,2vw,30px);
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin:0;
    padding:5px 8px;
    opacity:.94;
    background:rgba(20,14,34,.38);
    color:#f0e4f4;
    font:500 clamp(10px,.9vw,13px)/1.35 "Galmuri11",monospace;
    letter-spacing:0;
    text-shadow:1px 1px 0 #171124;
    pointer-events:none;
  }
}

/* This guide uses the existing keyboard explanations without occupying game space. */
#play .combat-help-panel[hidden] {display:none !important;}
#play .combat-help-panel {
  position:fixed;
  z-index:120;
  inset:0;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:clamp(12px,3vw,36px);
  background:rgba(12,9,23,.88);
  color:#f5ebf6;
}
#play .combat-help-card {
  width:min(100%,910px);
  max-height:calc(100dvh - 36px);
  padding:clamp(18px,3vw,38px);
  overflow-y:auto;
  box-sizing:border-box;
  background:#211a30;
  border:2px solid #9276a0;
  border-radius:0;
  box-shadow:6px 6px 0 #0d0919;
}
#play .combat-help-heading-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  border-bottom:2px solid #e5aa67;
  padding-bottom:14px;
}
#play .combat-help-heading-row h2 {
  margin:0;
  color:#ffca74;
  font:700 clamp(20px,4vw,38px)/1.2 "Kemco Pixel","Galmuri11",monospace;
}
#play .combat-help-heading-row #combat-help-close {
  min-height:38px;
  padding:6px 12px;
  border:1px solid #a38aa9;
  color:#ffe6f5;
  background:#342641;
  border-radius:0;
}
#play .combat-help-intro {
  font:12px/1.5 "Galmuri11",monospace;
  color:#c9bad6;
  margin:15px 0 6px;
}
#play .combat-help-panel .controls {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:clamp(12px,2vw,26px);
  width:100%;
  margin:0;
  padding:12px 0 0;
  border:0;
}
#play .combat-help-panel .controls .control-group {min-width:0;}
#play .combat-help-panel .controls p {line-height:1.8;}
@media (max-width:680px) {
  #play .combat-help-panel .controls {grid-template-columns:1fr;gap:10px;}
}

/* Mobile already has an immersive battlefield and a compact menu. */
@media (pointer:coarse) {
  #play .arena-top #battle-back,
  #play .arena-top #combat-help-toggle,
  #play .arena-top #fullscreen-toggle {display:none !important;}
}

/* Selection heading tools now contain only the return button. */
#selection .select-head-actions {display:flex;align-items:center;justify-content:flex-end;min-width:0;}

/* Selection hierarchy v2: independent status, dossier, roster and launch.
   This also keeps the online READY control alongside the external CTA. */
#selection .selection-status {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:clamp(6px,.85vw,12px);
  min-width:0;
  padding:clamp(8px,1vw,12px) clamp(10px,1.25vw,17px);
  border:1px solid #8d7996;
  border-left:4px solid #dab17f;
  border-radius:0;
  background:#30263e;
  box-shadow:3px 3px 0 rgba(39,27,52,.25);
  color:#f7eefa;
  box-sizing:border-box;
}
#selection .selection-status-title {
  flex:none;
  white-space:nowrap;
  font:500 clamp(11px,.9vw,13px)/1.5 "Galmuri11",monospace;
  color:#f6d7ac;
}
#selection .selection-status #matchup.matchup-bar {
  display:flex;
  align-items:center;
  flex:1 1 230px;
  min-width:0;
  width:auto;
  max-width:none;
  margin:0;
  padding:3px 0;
  border:0;
  background:transparent;
  box-shadow:none;
  font-size:clamp(11px,1.1vw,14px);
}
#selection .selection-status #cpuDifficulty {
  display:flex;
  align-items:center;
  gap:7px;
  margin:0 0 0 auto;
  flex:none;
  font:400 clamp(10px,.8vw,12px)/1.3 "Galmuri11",monospace;
  color:#e7d6ed;
  white-space:nowrap;
}
#selection .selection-status #cpuDifficulty[hidden] {display:none;}
#selection .selection-status #difficulty {
  min-height:31px;
  padding:4px 7px;
  border:1px solid #a38bac;
  color:#f5e8ff;
  background:#241c31;
  border-radius:0;
}
#selection .dossier,
#selection .desk {
  border:1px solid #786684;
  border-radius:0;
  box-shadow:2px 2px 0 rgba(25,18,37,.30);
  background:rgba(36,29,50,.92);
}
#selection .dossier {
  border-top:3px solid var(--accent);
  border-bottom:1px solid #786684;
}
#selection .desk {
  border-top:2px solid #ae8cae;
}
#selection .desk::before {
  content:"캐릭터 선택";
  display:block;
  flex:none;
  margin-bottom:clamp(5px,.75vw,10px);
  color:#d8c4e2;
  font:400 clamp(11px,.9vw,13px)/1.4 "Galmuri11",monospace;
}
#selection .selection-action-bar {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:clamp(8px,1vw,13px);
  width:100%;
  min-width:0;
  margin:0;
  padding:clamp(4px,.8vw,10px) 3px 5px;
  background:transparent;
  border:0;
  box-shadow:none;
  box-sizing:border-box;
}
#selection .selection-action-bar .flow-cta {
  width:auto;
  min-width:clamp(154px,17vw,215px);
  min-height:48px;
  margin:0;
  padding:clamp(10px,1vw,14px) clamp(17px,1.7vw,25px);
  flex:none;
  border:2px solid #fce0ed;
  background:#f6aacc;
  color:#29182e;
  box-shadow:inset 2px 2px 0 #ffe7f2,inset -2px -2px 0 #c5779d,3px 3px 0 #201427;
  transition:transform .08s ease,box-shadow .08s ease,background .12s ease;
}
#selection .selection-action-bar .flow-cta:hover:not(:disabled) {
  background:#ffc0dc;
}
#selection .selection-action-bar .flow-cta:active:not(:disabled) {
  transform:translate(2px,2px);
  filter:none;
  box-shadow:inset 2px 2px 0 #b96c93,inset -1px -1px 0 #ffe0ee,1px 1px 0 #201427;
}
#selection .selection-action-bar #online-selection-info {
  flex:1 1 190px;
  min-width:0;
  margin:0;
  color:#5a4665;
  font-size:clamp(10px,.95vw,12px);
  line-height:1.4;
}

@media (orientation:landscape) {
  body[data-screen="selection"] {overflow-x:hidden;overflow-y:auto;}
  #selection:not([hidden]) {
    display:grid;
    grid-template-columns:minmax(0,1.14fr) minmax(0,1fr);
    grid-template-rows:repeat(5,auto);
    align-items:start;
    align-content:start;
    gap:clamp(7px,1vw,13px) clamp(10px,1.6vw,24px);
    height:auto;
    max-height:none;
    min-height:100dvh;
    overflow:visible;
    padding:0 max(clamp(16px,1.5vw,26px),env(safe-area-inset-right))
            clamp(15px,2vw,26px) max(clamp(16px,1.5vw,26px),env(safe-area-inset-left));
  }
  #selection .select-head {grid-column:1 / -1;grid-row:1;margin:0;}
  #selection .studio {display:contents;}
  #selection .selection-status {
    grid-column:2;grid-row:2;
    align-self:start;
  }
  #selection #poster {
    grid-column:1;grid-row:2 / 6;
    height:100%;
    min-height:0;
    align-self:stretch;
  }
  #selection .dossier {
    grid-column:2;grid-row:3;
    position:relative;
    inset:auto;
    transform:none;
    align-self:start;
    justify-self:stretch;
    width:100%;
    height:auto;
    max-height:none;
    overflow-y:visible;
  }
  #selection .desk {
    grid-column:2;grid-row:4;
    position:relative;
    align-self:start;
    justify-self:stretch;
    width:100%;
    height:auto;
    max-height:none;
    margin:0;
    overflow-y:visible;
    padding:clamp(9px,1.1vw,17px) clamp(10px,1.4vw,20px);
    gap:clamp(5px,.75vw,9px);
    justify-content:flex-start;
  }
  #selection .selection-action-bar {
    grid-column:2;grid-row:5;
    justify-self:stretch;
  }
}
@media (orientation:portrait) {
  #selection:not([hidden]) {
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:clamp(9px,1.8vw,15px);
    height:auto;
    min-height:100dvh;
    padding-bottom:clamp(18px,4vw,30px);
    overflow:visible;
  }
  #selection .select-head {flex:none;}
  #selection .selection-status {flex:none;width:100%;}
  #selection .studio {flex:none;}
  #selection .desk {
    flex:none;
    min-height:0;
    width:100%;
    margin:0;
    padding:clamp(11px,2.4vw,19px);
  }
  #selection .selection-action-bar {flex:none;}
  #selection .selection-action-bar .flow-cta {min-height:45px;}
}
@media (orientation:landscape) and (pointer:coarse) and (max-height:650px) {
  body[data-screen="selection"] {overflow-y:auto;}
  #selection:not([hidden]) {
    grid-template-columns:minmax(0,.88fr) minmax(0,1.12fr);
    grid-template-rows:auto auto minmax(125px,1fr) auto auto;
    align-content:start;
    min-height:100dvh;
    height:auto;
    max-height:none;
    overflow:visible;
    gap:4px clamp(7px,1.1vw,13px);
    padding:max(5px,env(safe-area-inset-top))
            max(10px,env(safe-area-inset-right))
            max(7px,env(safe-area-inset-bottom))
            max(10px,env(safe-area-inset-left));
  }
  #selection .selection-status {
    grid-column:2;grid-row:2;
    gap:3px 7px;
    padding:4px 7px;
  }
  #selection .selection-status-title {font-size:9px;}
  #selection .selection-status #matchup.matchup-bar {
    flex:1 1 170px;
    padding:0;
    font-size:10px;
    gap:4px;
  }
  #selection .selection-status #cpuDifficulty {font-size:9px;}
  #selection .selection-status #difficulty {min-height:25px;padding:2px 4px;}
  #selection #poster {grid-row:2 / 6;height:100%;min-height:0;}
  #selection .dossier {
    grid-row:3;
    align-self:stretch;
    min-height:125px;
    max-height:clamp(132px,43dvh,265px);
    overflow-y:auto;
    padding:5px 8px;
  }
  #selection .desk {
    grid-row:4;
    align-self:start;
    min-height:0;
    max-height:none;
    padding:5px 8px;
    overflow:visible;
  }
  #selection .desk::before {font-size:9px;margin-bottom:3px;}
  #selection .selection-action-bar {
    grid-row:5;
    padding:4px 2px 6px;
  }
  #selection .selection-action-bar .flow-cta {
    min-width:120px;
    min-height:35px;
    padding:6px 11px;
    font-size:11px;
  }
  #selection .selection-action-bar #online-selection-info {font-size:9px;}
}
@media (orientation:portrait) and (max-width:600px) {
  #selection .selection-status {padding:8px 10px;}
  #selection .selection-status-title {font-size:11px;}
  #selection .selection-status #matchup.matchup-bar {flex:1 1 100%;width:100%;}
  #selection .desk::before {font-size:12px;}
  #selection .selection-action-bar .flow-cta {min-width:150px;}
}


/* PWA / mobile Safari landscape notch clearance.
   Later compact-HUD styles previously replaced safe-area-aware offsets with
   fixed 14–38px insets, hiding the left fighter's meter and win markers. */
@media (orientation:landscape) and (pointer:coarse) {
  #play .hud {
    box-sizing:border-box;
    left:max(18px,calc(env(safe-area-inset-left, 0px) + 13px));
    right:max(18px,calc(env(safe-area-inset-right, 0px) + 13px));
    gap:clamp(9px,1.6vw,22px);
    min-width:0;
  }
  #play .fighter-hud,
  #play .fighter-hud > div:first-child {
    min-width:0;
  }
  /* Put the rival name at the right edge, rather than beside the timer. */
  #play .fighter-hud.right > div:first-child {
    display:flex;
    flex-direction:row-reverse;
    justify-content:flex-start;
    flex-wrap:nowrap;
    align-items:center;
    gap:clamp(5px,.9vw,12px);
  }
  #play .fighter-hud.right > div:first-child b {
    flex:0 1 auto;
    max-width:70%;
    min-width:0;
    text-align:right;
  }
  #play .fighter-hud.right > div:first-child small {
    flex:none;
    white-space:nowrap;
  }
  #play .arena-top {
    left:max(12px,calc(env(safe-area-inset-left, 0px) + 9px));
    right:max(12px,calc(env(safe-area-inset-right, 0px) + 9px));
  }
  #play .arena-bottom {
    left:max(14px,calc(env(safe-area-inset-left, 0px) + 10px));
    right:max(14px,calc(env(safe-area-inset-right, 0px) + 10px));
  }
  #play:not([hidden]) .touch {
    left:max(9px,calc(env(safe-area-inset-left, 0px) + 8px));
    right:max(9px,calc(env(safe-area-inset-right, 0px) + 8px));
  }
}


/* Mobile fighter selection v3 — one hero fighter, compact matchup and controls.
   PC keeps the six-name roster and permanently visible stats. */
#selection .mobile-fighter-info {display:none;}
#selection .mobile-details-backdrop[hidden] {display:none !important;}
@media (pointer:coarse) {
  body[data-screen="selection"] main {
    max-width:none;
    margin:0;
    padding:0 !important;
    overflow-x:hidden;
  }
  #selection:not([hidden]) {
    box-sizing:border-box;
    isolation:isolate;
    border:0;
    box-shadow:none;
    min-width:0;
    min-height:100dvh;
    overflow:visible;
    background:#f8f5fc;
    color:#38283f;
  }
  #selection .select-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%;
    min-width:0;
    min-height:0;
    margin:0;
    border:0;
    border-bottom:1px solid #cdbed4;
    background:transparent;
    box-shadow:none;
  }
  #selection .select-head h2 {
    font:700 clamp(15px,2.8vw,26px)/1.2 "Kemco Pixel","Galmuri11",monospace;
    color:#432b4b;
    text-shadow:1px 2px 0 #dfc6e0;
    white-space:nowrap;
    letter-spacing:0;
  }
  #selection #home {
    padding:6px 1px 6px 8px;
    color:#50365c;
    font:400 clamp(11px,1.6vw,14px)/1.3 "Galmuri11",monospace;
    white-space:nowrap;
  }
  #selection .selection-status {
    box-sizing:border-box;
    min-width:0;
    padding:5px 3px 6px;
    border:0;
    border-bottom:1px solid #d5c6dc;
    background:transparent;
    box-shadow:none;
    gap:4px 9px;
    color:#45334b;
  }
  #selection .selection-status-title {display:none;}
  #selection .selection-status #matchup.matchup-bar {
    display:flex;
    flex:1 1 100%;
    align-items:center;
    justify-content:space-between;
    width:100%;
    gap:clamp(5px,1.4vw,15px);
    padding:0;
    margin:0;
    font:400 clamp(12px,1.7vw,15px)/1.3 "Galmuri11",monospace;
  }
  #selection .selection-status .match-side {
    display:inline-flex;
    align-items:center;
    gap:5px;
    min-width:0;
    white-space:nowrap;
  }
  #selection .selection-status .match-side-opponent {
    justify-content:flex-end;
    margin-left:auto;
  }
  #selection .selection-status .match-vs {flex:none;opacity:.62;}
  #selection .selection-status .match-role {
    font-size:clamp(10px,1.5vw,12px);
    color:#67566e;
  }
  #selection .selection-status #cpuDifficulty {
    gap:5px;
    color:#685474;
    font-size:11px;
  }
  #selection .selection-status #difficulty {
    min-height:28px;
    border-color:#baabc7;
    background:#f4ecf7;
    color:#4d3c54;
  }
  #selection .desk,
  #selection .selection-action-bar {
    box-sizing:border-box;
    position:relative;
    width:100%;
    min-width:0;
    height:auto;
    min-height:0;
    max-height:none;
    margin:0;
    border:0;
    background:transparent;
    box-shadow:none;
    align-self:start;
  }
  #selection .desk {
    display:flex;
    flex-direction:column;
    justify-content:center;
    overflow:visible;
    gap:0;
    padding:0;
  }
  #selection .desk::before,
  #selection .desk .names {display:none !important;}
  #selection .desk .pick {
    display:flex;
    flex-wrap:nowrap;
    justify-content:flex-start;
    gap:7px;
    margin:0;
    width:100%;
  }
  #selection .desk .pick button {
    flex:1 1 0;
    min-width:0;
    padding:clamp(8px,1.1vw,12px) clamp(7px,1.2vw,12px);
    border:1px solid #9b83a5;
    background:#f1eaf6;
    color:#514056;
    text-align:center;
    box-shadow:2px 2px 0 #c1afc8;
    font:500 clamp(11px,1.5vw,14px)/1.35 "Galmuri11",monospace;
  }
  #selection .desk .pick button[aria-pressed="true"] {
    border-color:#da92bd;
    background:#f5bdd6;
    color:#352438;
    outline:none;
    box-shadow:2px 2px 0 #ba85ad;
  }
  #selection .mobile-fighter-info {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:clamp(7px,1.1vw,12px);
    width:100%;
    min-width:0;
    padding:4px 0;
    color:#4f3a57;
    align-content:start;
  }
  #selection .mobile-fighter-copy {
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    justify-content:center;
    min-width:0;
    gap:3px;
  }
  #selection #mobile-fighter-name {
    font:700 clamp(18px,2.9vw,24px)/1.2 "Galmuri11",monospace;
    text-shadow:1px 1px #f7e8ff;
  }
  #selection #mobile-fighter-summary {
    color:#63576d;
    font:400 clamp(10px,1.45vw,13px)/1.45 "Galmuri11",monospace;
    overflow-wrap:anywhere;
  }
  /* All three stats and both skills are visible without opening a dialog. */
  #selection .mobile-fighter-stats {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:clamp(5px,1vw,11px);
    width:100%;
    min-width:0;
  }
  #selection .mobile-stat {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:3px 5px;
    align-items:center;
    min-width:0;
    padding:4px 0 5px;
    border-bottom:1px solid #d2bed8;
    color:#4b3955;
  }
  #selection .mobile-stat span {
    font:400 clamp(9px,1.15vw,12px)/1.35 "Galmuri11",monospace;
    white-space:nowrap;
  }
  #selection .mobile-stat strong {
    font:700 clamp(11px,1.4vw,14px)/1.2 "Galmuri11",monospace;
    font-variant-numeric:tabular-nums;
  }
  #selection .mobile-stat i {
    display:block;
    position:relative;
    grid-column:1 / -1;
    height:5px;
    overflow:hidden;
    background:#e4d8e9;
  }
  #selection .mobile-stat i::before {
    content:"";
    position:absolute;
    inset:0 auto 0 0;
    width:var(--fill);
    background:var(--accent);
  }
  #selection .mobile-fighter-skills {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:clamp(5px,.9vw,10px);
    width:100%;
    min-width:0;
  }
  #selection .mobile-skill {
    display:flex;
    align-items:flex-start;
    gap:6px;
    min-width:0;
    padding:clamp(6px,.8vw,10px);
    border:1px solid #d6c3d9;
    border-top:2px solid var(--accent);
    background:rgba(255,255,255,.74);
    color:#43344c;
  }
  #selection .mobile-skill-icon {
    flex:0 0 25px;
    width:25px;
    height:25px;
    border:1px solid #96819d;
    image-rendering:pixelated;
    background:#21172a;
  }
  #selection .mobile-skill > div {min-width:0;}
  #selection .mobile-skill small {
    display:block;
    margin-bottom:3px;
    color:#786780;
    font:400 clamp(9px,1.2vw,11px)/1.25 "Galmuri11",monospace;
  }
  #selection .mobile-skill strong {
    display:block;
    color:#362741;
    font:700 clamp(11px,1.5vw,14px)/1.25 "Galmuri11",monospace;
    overflow-wrap:anywhere;
  }
  #selection .mobile-skill p {
    margin:4px 0 0;
    color:#625468;
    font:400 clamp(9px,1.15vw,11px)/1.35 "Galmuri11",monospace;
    overflow-wrap:anywhere;
    word-break:keep-all;
  }
  #selection .selection-action-bar {
    display:flex;
    justify-content:flex-end;
    align-items:center;
    flex-wrap:wrap;
    gap:5px;
    padding:4px 0 0;
  }
  #selection .selection-action-bar .flow-cta {
    width:auto;
    min-width:clamp(144px,28vw,200px);
    min-height:43px;
    padding:8px 16px;
    font-size:clamp(13px,1.6vw,16px);
    margin:0;
    flex:none;
  }
  #selection .selection-action-bar #online-selection-info {
    color:#58465e;
    font-size:10px;
    flex:1 1 100%;
    line-height:1.3;
  }
  #selection .dossier {
    display:none !important;
  }
}
@media (orientation:portrait) and (pointer:coarse) {
  #selection:not([hidden]) {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto auto auto auto auto;
    align-content:start;
    align-items:start;
    gap:clamp(7px,1dvh,12px);
    padding:max(10px,env(safe-area-inset-top))
       max(12px,env(safe-area-inset-right))
       max(18px,env(safe-area-inset-bottom))
       max(12px,env(safe-area-inset-left));
  }
  #selection .select-head {grid-column:1;grid-row:1;padding:7px 1px 9px;}
  #selection .selection-status {grid-column:1;grid-row:2;}
  #selection .studio {
    display:block;
    grid-column:1;
    grid-row:3;
    position:relative;
    isolation:auto;
    width:100%;
    height:clamp(285px,46dvh,490px);
    margin:0;
    padding:0;
    overflow:visible;
  }
  #selection #poster {
    display:block;
    position:absolute;
    inset:0 !important;
    width:100%;
    height:100%;
    margin:0;
  }
  #selection #slide {inset:2% 12% 2%;}
  #selection #poster button {top:50%;bottom:auto;}
  #selection .mobile-fighter-info {grid-column:1;grid-row:4;}
  #selection .desk {grid-column:1;grid-row:5;}
  #selection .selection-action-bar {grid-column:1;grid-row:6;}
}
@media (orientation:landscape) and (pointer:coarse) {
  #selection:not([hidden]) {
    display:grid;
    grid-template-columns:minmax(0,54%) minmax(0,1fr);
    grid-template-rows:auto auto auto auto auto;
    justify-content:stretch;
    align-content:start;
    align-items:start;
    column-gap:clamp(9px,2vw,20px);
    row-gap:clamp(5px,1dvh,9px);
    height:auto;
    max-height:none;
    min-height:100dvh;
    padding:max(5px,env(safe-area-inset-top))
      max(12px,calc(env(safe-area-inset-right) + 9px))
      max(9px,env(safe-area-inset-bottom))
      max(12px,calc(env(safe-area-inset-left) + 9px));
  }
  #selection .select-head {
    grid-column:1 / -1;
    grid-row:1;
    padding:3px 0 7px;
  }
  #selection .selection-status {
    grid-column:2;
    grid-row:2;
    padding:3px 0 5px;
  }
  #selection .studio {display:contents;}
  #selection #poster {
    grid-column:1;
    grid-row:2 / 6;
    position:relative;
    width:100%;
    height:100%;
    min-height:clamp(205px,66dvh,410px);
    margin:0;
    inset:auto;
    align-self:stretch;
  }
  #selection #slide {inset:0 5% 0;}
  #selection .mobile-fighter-info {
    grid-column:2;
    grid-row:3;
    gap:4px;
    padding:2px 0;
  }
  #selection #mobile-fighter-name {font-size:clamp(15px,3.3dvh,23px);}
  #selection #mobile-fighter-summary {font-size:clamp(9px,2dvh,12px);}
  #selection .mobile-fighter-info {gap:clamp(4px,.8dvh,7px);}
  #selection .mobile-fighter-stats {gap:5px;}
  #selection .mobile-stat {padding:2px 0 3px;gap:2px 3px;}
  #selection .mobile-stat span {font-size:clamp(8px,1.8dvh,10px);}
  #selection .mobile-stat strong {font-size:clamp(9px,2dvh,12px);}
  #selection .mobile-stat i {height:4px;}
  #selection .mobile-fighter-skills {gap:5px;}
  #selection .mobile-skill {padding:5px 4px;gap:4px;}
  #selection .mobile-skill-icon {width:21px;height:21px;flex-basis:21px;}
  #selection .mobile-skill small {font-size:clamp(8px,1.6dvh,10px);}
  #selection .mobile-skill strong {font-size:clamp(9px,2dvh,12px);}
  #selection .mobile-skill p {font-size:clamp(8px,1.7dvh,10px);line-height:1.3;}
  #selection .desk {
    grid-column:2;
    grid-row:4;
    padding:0;
  }
  #selection .desk .pick button {
    min-height:33px;
    padding:5px 6px;
    font-size:clamp(10px,2.1dvh,13px);
  }
  #selection .selection-action-bar {
    grid-column:2;
    grid-row:5;
    padding:2px 0;
  }
  #selection .selection-action-bar .flow-cta {
    min-width:clamp(125px,20vw,185px);
    min-height:36px;
    padding:6px 12px;
    font-size:clamp(11px,2.4dvh,14px);
  }
}


/* Mobile selection v4: my fighter is the hero; CPU is a secondary setting.
   Desktop selection and online READY keep their existing interactions. */
#selection .mobile-cpu-chooser {display:none;}
@media (pointer:coarse) {
  /* The 6-name grid and MY/CPU switch remain available on desktop only. */
  #selection .desk {display:none !important;}
  body[data-mode="duo"] #selection .mobile-cpu-chooser {display:none !important;}
  #selection .mobile-cpu-chooser {
    display:flex;
    flex-direction:column;
    box-sizing:border-box;
    gap:8px;
    min-width:0;
    width:100%;
    padding:9px 11px;
    border:1px solid #ddcde1;
    border-left:3px solid #c992b8;
    background:rgba(251,248,254,.88);
    color:#3e3049;
  }
  #selection .mobile-cpu-heading {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:7px;
    min-width:0;
  }
  #selection .mobile-cpu-heading > span {
    font:700 clamp(10px,1.3vw,12px)/1.3 "Galmuri11",monospace;
    color:#65516f;
    white-space:nowrap;
  }
  #selection .mobile-cpu-heading label {
    display:flex;
    align-items:center;
    flex:none;
    gap:6px;
    font:400 clamp(10px,1.3vw,12px)/1.3 "Galmuri11",monospace;
    color:#6f5a79;
  }
  #selection #mobile-difficulty {
    min-height:30px;
    padding:3px 8px;
    background:#f6f0f9;
    color:#3c2d48;
    border:1px solid #b5a2bd;
    font:500 12px/1.2 "Galmuri11",monospace;
  }
  #selection .mobile-cpu-controls {
    display:flex;
    align-items:center;
    gap:clamp(7px,1.3vw,12px);
    min-width:0;
  }
  #selection .mobile-cpu-controls button {
    flex:0 0 auto;
    display:grid;
    place-items:center;
    min-width:36px;
    min-height:38px;
    padding:3px 7px;
    border:1px solid #b9a4c2;
    border-radius:0;
    box-shadow:2px 2px 0 #d9c5dc;
    background:#f2eaf6;
    color:#5a3f63;
    font:700 24px/1 "Galmuri11",monospace;
  }
  #selection .mobile-cpu-controls button:active {transform:translate(1px,1px);box-shadow:1px 1px 0 #d9c5dc;}
  #selection .mobile-cpu-controls #mobile-cpu-random {
    min-width:0;
    padding:8px 10px;
    color:#654a70;
    font-size:clamp(10px,1.4vw,12px);
    font-weight:500;
  }
  #selection #mobile-cpu-image {
    box-sizing:border-box;
    flex:0 0 43px;
    width:43px;
    height:43px;
    padding:1px;
    object-fit:cover;
    object-position:50% 16%;
    image-rendering:pixelated;
    border:1px solid #d2c4d8;
    background:#f7f1fa;
  }
  #selection #mobile-cpu-name {
    min-width:0;
    flex:1 1 auto;
    border-bottom:2px solid var(--cpu-accent,#e0a3c4);
    font:700 clamp(14px,1.9vw,18px)/1.4 "Galmuri11",monospace;
    white-space:nowrap;
    text-align:left;
  }
  /* Fighter identity stays readable even when its accent is bright yellow. */
  #selection .selection-status .match-name {
    color:#392a42 !important;
    text-shadow:none;
    font-weight:700;
  }
  #selection #mobile-fighter-name {
    color:#392a42 !important;
    text-shadow:none;
    border-bottom:2px solid var(--accent);
  }
  /* Accessible neutral role chips instead of washed-out low contrast P1/CPU. */
  #selection .selection-status .match-role {
    display:inline-block;
    flex:none;
    padding:2px 5px;
    border:1px solid #baabc2;
    background:#e8dfed;
    color:#45314e !important;
    opacity:1;
    font:700 clamp(10px,1.25vw,12px)/1.25 "Galmuri11",monospace;
  }
  #selection .selection-status .match-vs {
    color:#675670;
    opacity:1;
  }
  /* Each stat is now label / number / bar, not one uninterrupted text line. */
  #selection .mobile-fighter-stats {
    gap:clamp(7px,1vw,13px);
  }
  #selection .mobile-stat {
    display:flex;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    gap:4px;
    padding:6px 7px 7px;
    border:1px solid #e4d8e8;
    background:rgba(255,255,255,.66);
  }
  #selection .mobile-stat span {
    display:block;
    color:#6d5c74;
    font-size:clamp(10px,1.2vw,12px);
    white-space:nowrap;
    line-height:1.4;
  }
  #selection .mobile-stat strong {
    display:block;
    color:#392640;
    font-size:clamp(15px,2vw,20px);
    line-height:1.2;
  }
  #selection .mobile-stat i {
    display:block;
    flex:none;
    width:100%;
    height:5px;
  }
  #selection .mobile-skill {
    background:rgba(255,255,255,.91);
    border-top-color:var(--accent);
    box-shadow:none;
  }
  #selection .mobile-fighter-info {
    box-sizing:border-box;
    background:rgba(251,248,254,.87);
    border-left:3px solid var(--accent);
    padding:clamp(9px,1.3vw,15px);
    color:#372744;
  }
  #selection .selection-action-bar .flow-cta {
    flex:none;
    box-shadow:inset 2px 2px 0 #ffe7f2,inset -2px -2px 0 #c5779d,3px 3px 0 #201427;
  }
}
@media (orientation:portrait) and (pointer:coarse) {
  #selection:not([hidden]) {
    grid-template-rows:repeat(6,auto);
    row-gap:clamp(8px,1.1dvh,13px);
    padding-bottom:max(23px,calc(env(safe-area-inset-bottom) + 16px));
  }
  #selection .studio {
    height:clamp(260px,41dvh,440px); /* ~10% less room, keeping the fighter prominent */
  }
  #selection .mobile-fighter-info {
    gap:9px;
  }
  #selection .mobile-fighter-skills {
    grid-template-columns:minmax(0,1fr);
    gap:7px;
  }
  #selection .mobile-skill {
    padding:8px 10px;
    gap:9px;
    align-items:center;
  }
  #selection .mobile-skill-icon {width:29px;height:29px;flex-basis:29px;}
  #selection .mobile-skill p {font-size:11px;}
  #selection .mobile-cpu-chooser {
    grid-column:1;
    grid-row:5;
  }
  #selection .selection-action-bar {
    grid-column:1;
    grid-row:6;
    width:100%;
    padding:5px 0 0;
  }
  #selection .selection-action-bar .flow-cta {
    width:100%;
    min-height:48px;
    text-align:center;
    font-size:clamp(14px,3vw,17px);
  }
}
@media (orientation:landscape) and (pointer:coarse) {
  #selection:not([hidden]) {
    grid-template-rows:auto auto auto auto auto;
    row-gap:clamp(5px,1dvh,9px);
  }
  #selection #poster {
    height:clamp(220px,70dvh,410px);
    min-height:0;
    align-self:start;
  }
  #selection .mobile-fighter-info {
    padding:8px 10px;
    gap:clamp(5px,.85dvh,9px);
  }
  #selection .mobile-fighter-copy {gap:2px;}
  #selection .mobile-fighter-stats {gap:5px;}
  #selection .mobile-stat {padding:4px 5px;gap:2px;}
  #selection .mobile-stat span {font-size:clamp(8px,1.7dvh,11px);}
  #selection .mobile-stat strong {font-size:clamp(11px,2.7dvh,15px);}
  #selection .mobile-stat i {height:4px;}
  #selection .mobile-fighter-skills {
    grid-template-columns:minmax(0,1fr);
    gap:5px;
  }
  #selection .mobile-skill {
    display:flex;
    padding:5px 7px;
    gap:7px;
    align-items:center;
  }
  #selection .mobile-skill-icon {width:25px;height:25px;flex-basis:25px;}
  #selection .mobile-skill small {margin-bottom:1px;font-size:clamp(8px,1.7dvh,10px);}
  #selection .mobile-skill strong {font-size:clamp(10px,2.4dvh,13px);}
  #selection .mobile-skill p {margin-top:2px;font-size:clamp(9px,1.95dvh,11px);line-height:1.3;}
  #selection .mobile-cpu-chooser {
    grid-column:2;
    grid-row:4;
    padding:5px 9px;
    gap:4px;
  }
  #selection .mobile-cpu-heading > span {font-size:10px;}
  #selection .mobile-cpu-heading label {font-size:10px;}
  #selection #mobile-difficulty {min-height:26px;font-size:10px;}
  #selection .mobile-cpu-controls {gap:6px;}
  #selection .mobile-cpu-controls button {min-height:30px;min-width:32px;font-size:21px;}
  #selection #mobile-cpu-image {width:35px;height:35px;flex-basis:35px;}
  #selection #mobile-cpu-name {font-size:clamp(12px,2.6dvh,16px);}
  #selection .selection-action-bar {
    grid-column:2;
    grid-row:5;
    justify-content:flex-end;
    padding:3px 0 0;
  }
  #selection .selection-action-bar .flow-cta {
    min-height:38px;
    min-width:clamp(132px,20vw,186px);
  }
}


/* Mobile selection v5 — viewport-fitting portrait layout.
   Keep the complete fighter kit, CPU controls and launch CTA in view.
   Only the touch portrait layout is altered; landscape/desktop stay intact. */
@media (orientation:portrait) and (pointer:coarse) {
  body[data-screen="selection"] {overflow-y:hidden;}
  #selection:not([hidden]) {
    height:100dvh;
    min-height:0;
    max-height:100dvh;
    overflow:hidden;
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto minmax(120px,1fr) auto auto auto;
    align-content:stretch;
    align-items:stretch;
    row-gap:clamp(3px,.65dvh,6px);
    padding:max(5px,env(safe-area-inset-top))
            max(10px,env(safe-area-inset-right))
            max(7px,calc(env(safe-area-inset-bottom) + 4px))
            max(10px,env(safe-area-inset-left));
  }
  #selection .select-head {
    padding:3px 0 5px;
    align-self:start;
  }
  #selection .selection-status {
    padding:3px 0 4px;
    align-self:start;
  }
  #selection .selection-status #matchup.matchup-bar {
    font-size:clamp(11px,2.9vw,14px);
    line-height:1.2;
  }
  #selection .studio {
    display:block;
    grid-column:1;
    grid-row:3;
    height:100%;
    min-height:0;
    max-height:none;
    overflow:hidden;
  }
  #selection #poster {
    inset:0 !important;
    width:100%;
    height:100%;
    overflow:hidden;
  }
  #selection #slide {inset:1% 12% 0;}
  #selection .mobile-fighter-info {
    grid-column:1;
    grid-row:4;
    gap:5px;
    padding:6px 8px;
    align-self:start;
  }
  #selection .mobile-fighter-copy {
    flex-direction:row;
    flex-wrap:wrap;
    align-items:baseline;
    justify-content:flex-start;
    gap:1px 8px;
  }
  #selection #mobile-fighter-name {
    font-size:clamp(15px,4vw,19px);
    line-height:1.2;
  }
  #selection #mobile-fighter-summary {
    font-size:clamp(9px,2.65vw,11px);
    line-height:1.32;
  }
  #selection .mobile-fighter-stats {gap:5px;}
  #selection .mobile-stat {
    padding:4px 5px 5px;
    gap:2px;
  }
  #selection .mobile-stat span {
    font-size:clamp(9px,2.6vw,11px);
    line-height:1.25;
  }
  #selection .mobile-stat strong {
    font-size:clamp(13px,3.7vw,17px);
    line-height:1.13;
  }
  #selection .mobile-stat i {height:3px;}
  #selection .mobile-fighter-skills {
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:5px;
  }
  #selection .mobile-skill {
    display:flex;
    align-items:flex-start;
    gap:5px;
    padding:5px;
  }
  #selection .mobile-skill-icon {
    flex:0 0 21px;
    width:21px;
    height:21px;
  }
  #selection .mobile-skill small {
    font-size:9px;
    line-height:1.15;
    margin-bottom:2px;
  }
  #selection .mobile-skill strong {
    font-size:clamp(10px,2.75vw,12px);
    line-height:1.24;
  }
  #selection .mobile-skill p {
    margin:2px 0 0;
    font-size:clamp(9px,2.55vw,10.5px);
    line-height:1.3;
    word-break:keep-all;
  }
  #selection .mobile-cpu-chooser {
    grid-column:1;
    grid-row:5;
    gap:3px;
    padding:5px 7px;
    align-self:start;
  }
  #selection .mobile-cpu-heading > span {font-size:9px;}
  #selection .mobile-cpu-heading label {font-size:9px;}
  #selection #mobile-difficulty {
    min-height:24px;
    padding:1px 5px;
    font-size:10px;
  }
  #selection .mobile-cpu-controls {gap:5px;}
  #selection .mobile-cpu-controls button {
    min-width:30px;
    min-height:31px;
    padding:1px 5px;
    font-size:19px;
  }
  #selection .mobile-cpu-controls #mobile-cpu-random {
    padding:5px 7px;
    font-size:10px;
  }
  #selection #mobile-cpu-image {
    flex-basis:31px;
    width:31px;
    height:31px;
  }
  #selection #mobile-cpu-name {font-size:clamp(12px,3.5vw,15px);}
  #selection .selection-action-bar {
    grid-column:1;
    grid-row:6;
    align-self:end;
    padding:0;
    min-height:0;
  }
  #selection .selection-action-bar .flow-cta {
    width:100%;
    min-height:40px;
    padding:7px 12px;
    font-size:clamp(12px,3.2vw,15px);
  }
}
/* On exceptionally short phones, preserve readable text and allow
   vertical overflow instead of clipping essential controls. */
@media (orientation:portrait) and (pointer:coarse) and (max-height:550px) {
  body[data-screen="selection"] {overflow-y:auto;}
  #selection:not([hidden]) {
    height:auto;
    max-height:none;
    min-height:100dvh;
    overflow:visible;
    grid-template-rows:auto auto minmax(150px,26dvh) auto auto auto;
  }
  #selection .studio {height:clamp(150px,26dvh,215px);}
}
/* Online READY can introduce additional controls: don't crop them. */
@media (orientation:portrait) and (pointer:coarse) {
  body[data-mode="duo"][data-screen="selection"] {overflow-y:auto;}
  body[data-mode="duo"] #selection:not([hidden]) {
    height:auto;
    max-height:none;
    min-height:100dvh;
    overflow:visible;
    grid-template-rows:auto auto minmax(165px,30dvh) auto auto auto;
  }
  body[data-mode="duo"] #selection .studio {
    height:clamp(165px,30dvh,290px);
  }
}


/* Mobile selection v6 — compact landscape fitting.
   Small touch landscapes need both the full fighter kit AND the start button.
   Treat the right panel as a short control stack, not a scrolling article. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:700px) {
  body[data-screen="selection"] {overflow-x:hidden;overflow-y:hidden;}
  #selection:not([hidden]) {
    box-sizing:border-box;
    height:100dvh;
    min-height:0;
    max-height:100dvh;
    overflow:hidden;
    grid-template-columns:minmax(0,53%) minmax(0,1fr);
    grid-template-rows:auto auto minmax(0,1fr) auto auto;
    align-content:stretch;
    align-items:stretch;
    column-gap:clamp(8px,1.45vw,16px);
    row-gap:clamp(2px,.55dvh,5px);
    padding:max(3px,env(safe-area-inset-top))
            max(9px,env(safe-area-inset-right))
            max(4px,env(safe-area-inset-bottom))
            max(9px,env(safe-area-inset-left));
  }
  #selection .select-head {
    padding:1px 0 4px;
    align-self:start;
    min-height:0;
  }
  #selection .select-head h2 {
    font-size:clamp(16px,5dvh,24px);
    line-height:1.12;
  }
  #selection #home {padding:3px 0 3px 7px;font-size:clamp(10px,2.7dvh,12px);}
  #selection .selection-status {
    grid-column:2;
    grid-row:2;
    padding:2px 0 3px;
    align-self:start;
  }
  #selection .selection-status #matchup.matchup-bar {
    font-size:clamp(10px,2.7dvh,12px);
    line-height:1.2;
    gap:3px;
  }
  #selection .selection-status .match-role {
    padding:1px 4px;
    font-size:clamp(9px,2.2dvh,11px);
  }
  #selection .studio {display:contents;}
  #selection #poster {
    grid-column:1;
    grid-row:2 / 6;
    width:100%;
    height:100%;
    min-height:0;
    max-height:none;
    align-self:stretch;
    overflow:hidden;
  }
  #selection #slide {inset:0 4% 0;}
  #selection .mobile-fighter-info {
    grid-column:2;
    grid-row:3;
    align-self:start;
    min-height:0;
    padding:5px 7px;
    gap:4px;
  }
  #selection .mobile-fighter-copy {
    display:flex;
    flex-direction:row;
    align-items:baseline;
    justify-content:flex-start;
    flex-wrap:wrap;
    gap:1px 7px;
  }
  #selection #mobile-fighter-name {
    font-size:clamp(13px,3.4dvh,17px);
    line-height:1.15;
  }
  #selection #mobile-fighter-summary {
    font-size:clamp(9px,2.35dvh,10.5px);
    line-height:1.23;
  }
  #selection .mobile-fighter-stats {gap:4px;}
  #selection .mobile-stat {padding:3px 4px;gap:2px;}
  #selection .mobile-stat span {font-size:clamp(8px,2.15dvh,10px);line-height:1.15;}
  #selection .mobile-stat strong {font-size:clamp(11px,2.9dvh,14px);line-height:1.1;}
  #selection .mobile-stat i {height:3px;}
  /* Side-by-side skill cards save an entire row without hiding descriptions. */
  #selection .mobile-fighter-skills {
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:4px;
  }
  #selection .mobile-skill {
    display:flex;
    align-items:flex-start;
    gap:4px;
    padding:4px;
  }
  #selection .mobile-skill-icon {
    flex:0 0 18px;
    width:18px;
    height:18px;
  }
  #selection .mobile-skill small {
    margin-bottom:1px;
    font-size:clamp(8px,2dvh,9px);
    line-height:1.15;
  }
  #selection .mobile-skill strong {
    font-size:clamp(9px,2.45dvh,11px);
    line-height:1.15;
  }
  #selection .mobile-skill p {
    margin:2px 0 0;
    font-size:clamp(8px,2.12dvh,10px);
    line-height:1.2;
    word-break:keep-all;
  }
  /* Single-line CPU picker: name and difficulty don't consume two rows. */
  #selection .mobile-cpu-chooser {
    grid-column:2;
    grid-row:4;
    display:flex;
    flex-direction:row;
    align-items:center;
    flex-wrap:nowrap;
    min-height:0;
    padding:3px 6px;
    gap:6px;
    align-self:end;
  }
  #selection .mobile-cpu-heading {
    flex:0 0 auto;
    gap:0;
  }
  #selection .mobile-cpu-heading > span {display:none;}
  #selection .mobile-cpu-heading label {gap:3px;font-size:9px;}
  #selection #mobile-difficulty {
    min-height:25px;
    padding:2px 3px;
    font-size:10px;
  }
  #selection .mobile-cpu-controls {
    flex:1 1 0;
    width:auto;
    min-width:0;
    gap:4px;
  }
  #selection .mobile-cpu-controls button {
    min-width:26px;
    min-height:28px;
    padding:1px 4px;
    font-size:18px;
    box-shadow:1px 1px 0 #d9c5dc;
  }
  #selection #mobile-cpu-image {
    flex:0 0 28px;
    width:28px;
    height:28px;
  }
  #selection #mobile-cpu-name {
    font-size:clamp(11px,2.8dvh,14px);
    line-height:1.2;
  }
  #selection .mobile-cpu-controls #mobile-cpu-random {
    min-width:0;
    padding:5px;
    font-size:9px;
  }
  #selection .selection-action-bar {
    grid-column:2;
    grid-row:5;
    width:100%;
    align-self:end;
    justify-content:stretch;
    padding:0;
    gap:2px;
  }
  #selection .selection-action-bar .flow-cta {
    width:100%;
    min-width:0;
    min-height:34px;
    padding:5px 8px;
    font-size:clamp(11px,2.8dvh,13px);
    line-height:1.2;
  }
}
/* Respect browser UI and larger text on ultra-short landscape viewports:
   scrolling is preferable to hiding the CPU picker or match controls. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:310px) {
  body[data-screen="selection"] {overflow-y:auto;}
  #selection:not([hidden]) {
    height:auto;
    min-height:100dvh;
    max-height:none;
    overflow:visible;
    grid-template-rows:auto auto auto auto auto;
  }
  #selection #poster {
    height:100%;
    min-height:180px;
  }
}
/* Online READY has different controls, so avoid clipping them at any height. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:700px) {
  body[data-mode="duo"][data-screen="selection"] {overflow-y:auto;}
  body[data-mode="duo"] #selection:not([hidden]) {
    height:auto;
    min-height:100dvh;
    max-height:none;
    overflow:visible;
    grid-template-rows:auto auto auto auto auto;
  }
  body[data-mode="duo"] #selection #poster {min-height:200px;}
}


/* Mobile and desktop landscape v7: keep the stage in the fighter column
   and restore the dark arcade information panels. Portrait is unchanged. */
@media (orientation:landscape) {
  /* The studio is display:contents in landscape, so an absolutely
     positioned canvas otherwise uses #selection as its containing block.
     Place it in the SAME grid cell as #poster instead. */
  #selection .studio {display:contents;}
  #selection #select-stage {
    display:block;
    position:relative;
    inset:auto;
    grid-column:1;
    grid-row:2 / 6;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    max-width:100%;
    align-self:stretch;
    justify-self:stretch;
    z-index:0;
    pointer-events:none;
    image-rendering:pixelated;
  }
  #selection #poster {
    position:relative;
    inset:auto;
    grid-column:1;
    grid-row:2 / 6;
    width:100%;
    height:100%;
    min-width:0;
    min-height:0;
    max-width:100%;
    margin:0;
    align-self:stretch;
    justify-self:stretch;
    overflow:hidden;
    z-index:1;
  }
  #selection #slide {
    position:absolute;
    inset:4% 10% 8%;
    overflow:hidden;
  }
  #selection #slide img {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    max-width:100%;
    max-height:100%;
    object-fit:contain;
    object-position:center bottom;
    image-rendering:pixelated;
  }

  /* Keep the bright stage artwork but use the older dark cabinet
     surfaces for ALL information controls in landscape and on PCs. */
  #selection .selection-status,
  #selection .mobile-fighter-info,
  #selection .mobile-cpu-chooser,
  #selection .dossier,
  #selection .desk {
    background:#292237;
    border-color:#766481;
    color:#f5eefa;
    box-shadow:none;
  }
  #selection .selection-status {border-left:3px solid #d6ac7a;}
  #selection .mobile-fighter-info {border-left:3px solid var(--accent);}
  #selection .mobile-cpu-chooser {border-left:3px solid #bd84ad;}
  #selection .selection-status .match-name,
  #selection #mobile-fighter-name,
  #selection #mobile-cpu-name {
    color:#faf5ff !important;
    text-shadow:none;
  }
  #selection .selection-status .match-vs,
  #selection .selection-status-title,
  #selection #mobile-fighter-summary,
  #selection .mobile-stat span,
  #selection .mobile-skill small,
  #selection .mobile-skill p,
  #selection .mobile-cpu-heading > span,
  #selection .mobile-cpu-heading label {
    color:#d4c8df !important;
  }
  #selection .selection-status .match-role {
    color:#f6edfc !important;
    border-color:#8b7898;
    background:#4c3d5a;
  }
  #selection .mobile-stat {
    color:#f9efff;
    border-color:#6a5a79;
    background:#382e47;
  }
  #selection .mobile-stat strong {color:#fff9ff;}
  #selection .mobile-stat i {background:#67576f;}
  #selection .mobile-skill {
    background:#382e47;
    border-color:#6a5a79;
    border-top-color:var(--accent);
    color:#f7edf9;
  }
  #selection .mobile-skill strong {color:#fff8ff;}
  #selection #mobile-difficulty,
  #selection .selection-status #difficulty {
    color:#f7edf9;
    background:#342a43;
    border-color:#8b7898;
  }
  #selection .mobile-cpu-controls button {
    color:#f5eafa;
    background:#40324e;
    border-color:#857092;
    box-shadow:1px 1px 0 #1e1629;
  }
  #selection .mobile-cpu-controls #mobile-cpu-random {
    color:#f5eafa;
  }
  #selection #mobile-cpu-image {
    border-color:#8b7898;
    background:#211a2d;
  }
  #selection .dossier h3,
  #selection .dossier > b,
  #selection .dossier #kitGuide,
  #selection .desk .pick,
  #selection .desk .names {
    color:#f5eafa;
  }
}

/* Keep sprite proportions balanced inside the left stage, even on a
   short landscape phone. The image must never grow into the header. */
@media (orientation:landscape) and (pointer:coarse) {
  #selection #slide {inset:6% 12% 9%;}
  #selection #poster button {top:50%;bottom:auto;}
  #selection #prev {left:2%;}
  #selection #next {right:2%;}
}

/* Very short displays and online READY must remain accessible rather
   than clipping the final control. This does not affect portrait. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:340px) {
  body[data-screen="selection"] {overflow-y:auto;}
  #selection:not([hidden]) {
    height:auto;
    max-height:none;
    min-height:100dvh;
    overflow:visible;
    grid-template-rows:auto auto minmax(110px,auto) auto auto;
  }
  #selection #select-stage,
  #selection #poster {min-height:200px;}
}


/* Fighter stats v8: comparative five-step visual treatment.
   Presentation only; the game continues to use its original raw stats. */
#selection .mobile-stat {
  min-width:0;
}
#selection .mobile-stat strong {
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:1px 5px;
  min-width:0;
  font-size:clamp(11px,2.8vw,15px);
  line-height:1.2;
}
#selection .mobile-stat strong small {
  display:inline-block;
  font:400 clamp(8px,2.1vw,10px)/1.2 "Galmuri11",monospace;
  color:#74687e;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
#selection .mobile-stat i,
#selection #stats i {
  height:6px;
  min-height:0;
  border-radius:0;
  -webkit-mask-image:repeating-linear-gradient(to right,#000 0 calc(20% - 2px),transparent calc(20% - 2px) 20%);
  mask-image:repeating-linear-gradient(to right,#000 0 calc(20% - 2px),transparent calc(20% - 2px) 20%);
}
#selection #stats i {
  background:linear-gradient(to right,var(--accent) 0 var(--fill),#6d6075 var(--fill) 100%);
}
#selection .mobile-fighter-stats::after {
  content:"6명 기준 상대평가 리치는 일반 공격 기준";
  display:block;
  grid-column:1 / -1;
  margin-top:0;
  font:400 9px/1.2 "Galmuri11",monospace;
  color:#74687e;
  letter-spacing:-.025em;
}
#selection #stats::after {
  content:"6명 기준 상대평가 리치는 일반 공격 기준";
  display:block;
  margin-top:5px;
  font:400 10px/1.3 "Galmuri11",monospace;
  color:#d1c4da;
}
@media (orientation:landscape) {
  #selection .mobile-stat strong small,
  #selection .mobile-fighter-stats::after {color:#cbbbd7;}
}
@media (orientation:landscape) and (pointer:coarse) and (max-height:700px) {
  #selection .mobile-stat strong {font-size:clamp(10px,2.5dvh,13px);gap:0 4px;}
  #selection .mobile-stat strong small {font-size:clamp(8px,1.9dvh,9px);}
  #selection .mobile-stat i {height:4px;}
  #selection .mobile-fighter-stats::after {font-size:8px;line-height:1;}
}
@media (orientation:portrait) and (pointer:coarse) {
  #selection .mobile-stat strong {font-size:clamp(11px,3.1vw,14px);}
  #selection .mobile-stat strong small {font-size:clamp(8px,2.15vw,10px);}
  #selection .mobile-stat i {height:4px;}
  #selection .mobile-fighter-stats::after {font-size:8px;line-height:1.1;}
}


/* Full-bleed shoji room v9: same existing room artwork across the
   entire landscape selection viewport, not a boxed left-side canvas.
   The portrait layout and artwork are deliberately unchanged. */
@media (orientation:landscape) {
  body[data-screen="selection"] #selection:not([hidden]) {
    background-color:#f7f8fc;
    background-image:url("assets/selection-training-center-hanja.webp?v=hanja-dojo-20261118");
    background-repeat:no-repeat;
    background-position:center bottom;
    background-size:cover;
    /* Original low-resolution artwork is pixel art, not a blurred texture. */
    image-rendering:pixelated;
  }
  /* The transparent canvas draws only the player's circular mat. */
  #selection #select-stage {background:transparent;}
  #selection #poster {background:transparent;}
  /* Preserve legibility on top of the full-room image. */
  #selection .selection-status,
  #selection .mobile-fighter-info,
  #selection .mobile-cpu-chooser,
  #selection .dossier,
  #selection .desk {
    background-color:#292237;
  }
}


/* Selection viewport repair v11 — desktop/fullscreen layout.
   Keep the shoji background fullscreen, but don't force the information card
   to consume all available height. This replaces the stretched v10 layout.
   Portrait and short touch-landscape views are intentionally untouched. */
@media (orientation:landscape) and (pointer:fine) and (min-width:900px) {
  body[data-screen="selection"] {overflow:hidden;}
  body:not([data-mode="duo"]) #selection:not([hidden]) {
    box-sizing:border-box;
    display:grid;
    width:100%;
    height:100dvh;
    min-height:100dvh;
    max-height:100dvh;
    overflow:hidden;
    grid-template-columns:minmax(0,52%) minmax(0,1fr);
    /* Natural-height content + empty space beneath it, NOT a stretched dossier. */
    grid-template-rows:auto auto auto auto auto minmax(0,1fr);
    align-content:stretch;
    align-items:start;
    column-gap:clamp(14px,1.5vw,24px);
    row-gap:clamp(7px,.95dvh,11px);
    padding:max(10px,env(safe-area-inset-top))
            max(18px,env(safe-area-inset-right))
            max(14px,env(safe-area-inset-bottom))
            max(18px,env(safe-area-inset-left));
  }
  #selection .select-head {
    grid-column:1 / -1;
    grid-row:1;
    align-self:start;
    min-height:0;
    margin:0;
    padding:0 3px 8px;
  }
  #selection .select-head h2 {
    font-size:clamp(25px,2.7vw,40px);
    line-height:1.15;
  }
  #selection .selection-status {
    grid-column:2;
    grid-row:2;
    align-self:start;
    height:auto;
    min-height:42px;
    padding:clamp(8px,1dvh,12px) clamp(11px,1.15vw,18px);
  }
  /* Independent fighter and mat rendering share the same whole-height stage. */
  #selection #select-stage,
  #selection #poster {
    grid-column:1;
    grid-row:2 / 7;
    align-self:stretch;
    justify-self:stretch;
    width:100%;
    height:100%;
    min-height:0;
    max-height:none;
  }
  #selection #select-stage {position:relative;z-index:0;}
  #selection #poster {
    position:relative;
    inset:auto;
    z-index:1;
    overflow:hidden;
    touch-action:pan-y;
  }
  /* Slightly smaller sprite so kicks don't overwhelm the whole stage. */
  #selection #slide {inset:11% 11% 10%;}
  #selection #slide img {
    object-fit:contain;
    object-position:center bottom;
    image-rendering:pixelated;
  }
  #selection #prev {left:3%;}
  #selection #next {right:3%;}
  /* A content-led panel: no space-evenly (which caused huge voids). */
  #selection .dossier {
    display:flex;
    grid-column:2;
    grid-row:3;
    flex-direction:column;
    justify-content:flex-start;
    align-self:start;
    justify-self:stretch;
    gap:clamp(5px,.85dvh,10px);
    box-sizing:border-box;
    width:100%;
    height:auto;
    min-height:0;
    max-height:none;
    padding:clamp(14px,1.55vw,24px);
    overflow-x:hidden;
    overflow-y:visible;
  }
  #selection .dossier h3 {
    flex:none;
    font-size:clamp(28px,2.5vw,40px);
    line-height:1.1;
    margin:0;
  }
  #selection .dossier > b {flex:none;}
  #selection #stats {flex:none;margin-top:3px;}
  #selection #stats div {
    font-size:clamp(12px,.86vw,14px);
    margin:5px 0;
    line-height:1.2;
  }
  #selection .skill-codex {
    flex:none;
    margin-top:clamp(4px,.7dvh,8px);
  }
  #selection .skill-slot {
    min-height:45px;
  }
  #selection .skill-pixel-icon {width:29px;height:29px;flex-basis:29px;}
  #selection .skill-slot-meta small {font-size:10px;}
  #selection .skill-slot-meta strong {font-size:12px;}
  #selection #kitGuide.skill-detail .skill-detail-heading strong {font-size:14px;}
  #selection #kitGuide.skill-detail p {font-size:12px;line-height:1.4;}
  #selection .desk {
    display:flex;
    grid-column:2;
    grid-row:4;
    flex-direction:column;
    justify-content:flex-start;
    align-self:start;
    justify-self:stretch;
    box-sizing:border-box;
    width:100%;
    height:auto;
    min-height:0;
    max-height:none;
    padding:clamp(12px,1.2vw,18px);
    overflow:visible;
    gap:clamp(7px,.95dvh,12px);
  }
  #selection .desk .pick {flex:none;}
  #selection .desk .names {
    display:grid !important;
    flex:none;
    margin-top:0;
    gap:clamp(4px,.6vw,10px);
  }
  #selection .selection-action-bar {
    grid-column:2;
    grid-row:5;
    display:flex;
    align-self:start;
    justify-content:flex-end;
    width:100%;
    min-height:0;
    padding:0 2px;
  }
  #selection .selection-action-bar .flow-cta {
    min-width:clamp(178px,16vw,230px);
    min-height:clamp(43px,5.5dvh,52px);
    padding:9px 16px;
  }
}
/* Prefer scrolling to clipping on short desktop browser windows. */
@media (orientation:landscape) and (pointer:fine) and (min-width:900px) and (max-height:750px) {
  body[data-screen="selection"] {overflow-y:auto;}
  body:not([data-mode="duo"]) #selection:not([hidden]) {
    height:auto;
    min-height:100dvh;
    max-height:none;
    overflow:visible;
    grid-template-rows:auto auto auto auto auto minmax(100px,1fr);
  }
  #selection #select-stage,
  #selection #poster {min-height:clamp(310px,74dvh,525px);}
}
/* iPad/tablet landscape can be tall enough to use the desktop stage
   proportions, while retaining touch-specific fighter/CPU controls. */
@media (orientation:landscape) and (pointer:coarse) and (min-height:701px) {
  body[data-screen="selection"] {overflow:hidden;}
  #selection:not([hidden]) {
    height:100dvh;
    min-height:100dvh;
    max-height:100dvh;
    overflow:hidden;
    grid-template-rows:auto auto minmax(0,1fr) auto auto;
    align-content:stretch;
    align-items:stretch;
  }
  #selection #select-stage,
  #selection #poster {
    grid-column:1;
    grid-row:2 / 6;
    height:100%;
    min-height:0;
    max-height:none;
    align-self:stretch;
  }
  #selection .mobile-fighter-info {
    grid-column:2;
    grid-row:3;
    align-self:stretch;
    justify-content:space-evenly;
  }
  #selection .mobile-cpu-chooser {grid-column:2;grid-row:4;}
  #selection .selection-action-bar {grid-column:2;grid-row:5;}
}

/* Mobile/PWA fighter-name glyph safety (2026-11-18).
   Galmuri's ascenders can extend beyond the short inline B line box.
   Keep horizontal ellipsis, but pad the glyph inside its clipped box. */
@media (orientation:landscape) and (pointer:coarse),
       (orientation:landscape) and (max-height:650px) and (max-width:1100px){
  #play .fighter-hud > div:first-child {
    align-items:center;
    overflow:visible;
  }
  #play .fighter-hud > div:first-child > b {
    box-sizing:border-box;
    display:inline-block;
    line-height:1.5!important;
    padding-block:.20em .10em!important;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    vertical-align:middle;
  }
}


/* 2026-11-18 • Pause controls and battle feedback polish.
   Large PAUSED / K.O. headlines intentionally retain their original shadow. */
#play #overlay .eyebrow,
#play #overlay > p{
  text-shadow:
    0 1px 4px rgba(18,14,29,.42),
    0 0 11px rgba(18,14,29,.22)!important;
}
#play #overlay.is-paused .eyebrow,
#play #overlay.is-paused > p{
  display:block!important;
  color:#f6eee0!important;
  letter-spacing:normal!important;
}
#play #overlay.is-paused #start.primary{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:clamp(8px,1vw,16px)!important;
  width:auto!important;
  min-height:42px!important;
  margin:clamp(9px,1.6dvh,15px) auto 0!important;
  padding:9px 17px!important;
  border:2px solid #a9618e!important;
  border-radius:0!important;
  background:#fa84bc!important; /* Preserve the current pause button color. */
  color:#271729!important;
  box-shadow:
    inset 0 2px #ffd4e5,
    inset 0 -2px #c45d91,
    2px 2px #342437!important;
  font:700 clamp(12px,1.04vw,15px)/1.25 "Galmuri11",monospace!important;
  text-shadow:none!important;
  white-space:nowrap!important;
  cursor:pointer;
}
#play #overlay.is-paused #start.primary span{
  margin-left:clamp(7px,1vw,14px)!important;
  font-size:1em!important;
}
#play #overlay.is-paused #start.primary:hover{
  background:#ff9bca!important;
  border-color:#c67aaa!important;
}
#play #overlay.is-paused #start.primary:active{
  transform:translate(1px,1px)!important;
  box-shadow:inset 1px 2px #a75a81!important;
}
#play .arena-top .mobile-battle-menu #mobile-menu-resume{
  background:#fa84bc!important;
  color:#271729!important;
  border:2px solid #a9618e!important;
  border-radius:0!important;
  box-shadow:inset 0 1px #ffd4e5,inset 0 -2px #c45d91,2px 2px #342437!important;
  font:700 12px/1.25 "Galmuri11",monospace!important;
}
#play .arena-top .mobile-battle-menu #mobile-menu-resume:active{
  transform:translate(1px,1px);
  box-shadow:inset 0 1px #a75a81!important;
}
/* #status sits at true 50% of arena width regardless of the length of the
   left stage label or right stage number. Ordinary HUD side labels stay put. */
#play .arena-bottom{position:absolute!important}
#play .arena-bottom #status{
  position:absolute!important;
  left:50%!important;
  right:auto!important;
  bottom:0!important;
  width:max-content!important;
  max-width:min(48vw,480px)!important;
  margin:0!important;
  transform:translateX(-50%)!important;
  text-align:center!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  pointer-events:none!important;
  text-shadow:0 1px 5px rgba(13,12,25,.48)!important;
}


/* Combat HUD identity: P1 / CPU (or P2) flank the clock. Names are kept
   fighter-only, with a small optional authenticated nickname beside the
   corresponding local fighter. All rules work without a signed-in account. */
#play .hud .fighter-hud .hud-name-row{
  position:relative!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  flex-wrap:nowrap!important;
  gap:clamp(5px,.7vw,10px)!important;
  min-width:0!important;
}
#play .hud .fighter-hud.right .hud-name-row{
  flex-direction:row-reverse!important;
}
#play .hud .fighter-hud .hud-name-row > b{
  flex:0 1 auto!important;
  min-width:0!important;
}
#play .hud .hud-account-nickname{
  display:inline-flex!important;
  flex:0 1 auto!important;
  min-width:0!important;
  max-width:min(44%,175px)!important;
  padding:2px 5px!important;
  margin:0!important;
  border-left:2px solid rgba(254,220,156,.68);
  background:rgba(16,17,31,.35);
  color:#f1e6cc!important;
  opacity:.88;
  font:600 clamp(9px,.83vw,12px)/1.3 "Galmuri11",monospace!important;
  letter-spacing:0!important;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap!important;
}
#play .hud .hud-account-nickname[hidden]{
  display:none!important;
}
#play .hud .timer{
  box-sizing:border-box;
  flex:0 0 auto!important;
  width:auto!important;
  min-width:0!important;
}
#play .hud .timer .timer-role-row{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:clamp(3px,.6vw,9px)!important;
  width:100%;
}
#play .hud .timer .timer-role-row > b{
  display:block!important;
  flex:0 0 auto!important;
  text-align:center!important;
}
#play .hud .fighter-hud .hud-role-tag{
  box-sizing:border-box;
  display:inline-flex!important;
  position:absolute!important;
  top:50%!important;
  right:0!important;
  left:auto!important;
  transform:translateY(-50%)!important;
  justify-content:center!important;
  align-items:center!important;
  flex:0 0 auto!important;
  min-width:24px!important;
  max-width:46px!important;
  height:auto!important;
  min-height:20px!important;
  margin:0!important;
  padding:2px 4px!important;
  border:1px solid rgba(255,234,190,.35);
  background:rgba(22,20,38,.40);
  color:#f5e7ce!important;
  font:700 clamp(8px,.8vw,11px)/1.2 "Galmuri11",monospace!important;
  letter-spacing:0!important;
  white-space:nowrap!important;
  text-shadow:0 1px 3px rgba(8,7,20,.3)!important;
}
/* 1P and CPU/P2 tags follow the inner ends of the two health bars. */
#play .hud .fighter-hud.right .hud-role-tag{
  left:0!important;
  right:auto!important;
}
#arcade .key-guide .guide-space{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:5px 7% 0;
}
#arcade .key-guide .guide-space .guide-cap{
  flex:0 1 52%!important;
  width:52%!important;
  min-height:24px!important;
  height:24px!important;
  font:700 10px/1.1 "Galmuri11",monospace!important;
}
@media (orientation:landscape) and (pointer:coarse),
       (orientation:landscape) and (max-height:650px) and (max-width:1100px){
  #play .hud .timer{
    flex:0 0 clamp(84px,15vw,123px)!important;
    width:clamp(84px,15vw,123px)!important;
  }
  #play .hud .timer .timer-role-row{
    gap:2px!important;
  }
  #play .hud .fighter-hud .hud-role-tag{
    min-width:17px!important;
    min-height:16px!important;
    padding:1px 2px!important;
    font-size:clamp(7px,1.4dvh,9px)!important;
  }
  #play .hud .hud-account-nickname{
    max-width:36%!important;
    padding:1px 3px!important;
    font-size:clamp(7px,1.5dvh,10px)!important;
  }
}
@media (orientation:portrait) and (max-width:600px){
  #play .hud .timer{
    min-width:85px!important;
    width:auto!important;
  }
  #play .hud .timer .timer-role-row{
    gap:2px!important;
  }
  #play .hud .fighter-hud .hud-role-tag{
    min-width:16px!important;
    min-height:15px!important;
    padding:1px 2px!important;
    font-size:7px!important;
  }
  #play .hud .hud-account-nickname{
    max-width:37%!important;
    font-size:7px!important;
    padding:1px 2px!important;
  }
}

/* A fighting game uses fast, simultaneous taps. 'manipulation' disables
   double-tap zoom but keeps ordinary one-finger menu scrolling. During a fight,
   all on-screen touches are gameplay input, never browser gestures. */
@media (pointer:coarse){
 html,body,main{touch-action:manipulation;}
 #play,#play .game,#play .viewport,#play #arena,#play .touch,#play .touch *{
  touch-action:none!important;
 }
}

/* 2026-11-20 • Standalone/mobile landscape title alignment.
   The large logo was raised by the desktop -15px offset. On short touch
   landscapes this made the whole hero sit visibly above its PC counterpart.
   Shift only the logo/subtitle and mode choices down; the top tool keys and
   bottom-anchored credits keep their existing safe-area positions. */
@media (orientation:landscape) and (pointer:coarse) and (max-height:780px){
 #welcome .title-lockup{
  top:0;
 }
 #welcome .title-lockup,
 #welcome .mode-menu{
  transform:translateY(clamp(12px,3.4dvh,24px));
 }
}

/* Installed iOS PWA: translucent status-bar content must share the actual
   title image, not expose a solid band above the training-center backdrop. */
@media (display-mode:standalone){
 body[data-screen="welcome"]{
  min-height:100dvh;
  background-position:center center;
  background-size:cover;
 }
 body[data-screen="welcome"] main,
 body[data-screen="welcome"] #welcome{
  min-height:100dvh;
 }
 /* In translucent mode the title's tools must clear the notch/status bar. */
 body[data-screen="welcome"] #welcome .tools{
  top:max(clamp(9px,1.8svh,20px),calc(env(safe-area-inset-top) + 8px))!important;
 }
}
