:root {
  color-scheme: dark;
  --page: #0c0b14;
  --panel: #131120;
  --ink: #f4eef8;
  --muted: #aaa0b7;
  --line: #332b43;
  --pink: #ff649d;
  --cyan: #6bf2ec;
  --hero: #6bf2ec;
  font-family: "Microsoft JhengHei", "PingFang TC", "Heiti TC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body { margin: 0; min-width: 305px; color: var(--ink); background: radial-gradient(ellipse at 80% 0%, #21152a 0%, transparent 45%), var(--page); }
button { cursor: pointer; font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.app { max-width: 1520px; padding: 0 clamp(16px, 4vw, 64px) 22px; margin: auto; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-icon { width: 34px; height: 32px; display: grid; place-items: center; border: 1px solid #f673a877; color: #ff86aa; background: #3a1d33; clip-path: polygon(0 0, 83% 0, 100% 19%,100% 100%,17% 100%,0 83%); font-weight: 900; font-size: 26px; line-height: 1; }
.brand strong { font-size: 22px; letter-spacing: -.07em; font-weight: 1000; font-style: italic; }
.brand strong span { color: var(--pink); }
.brand-english { border-left: 1px solid #58425c; padding-left: 11px; color: #b4a4bd; font: 700 12px/1 ui-monospace, monospace; letter-spacing: .16em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.small-button { border: 1px solid var(--line); background: #171323; padding: 8px 12px; border-radius: 5px; font-size: 14px; font-weight: 700; color: #e1d8eb; }
.small-button:hover, .small-button:active { border-color: var(--pink); color: white; }
#sound > span:first-child { margin-right: 5px; color: var(--pink); font-family: monospace; }
.help-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid #a08aa9; border-radius: 50%; font: 800 11px/1 system-ui; }

.arena { height: clamp(465px, calc(100svh - 154px), 740px); position: relative; overflow: hidden; border: 1px solid #63506f; background: #1b1329; isolation: isolate; }
.arena::after { position: absolute; pointer-events: none; inset: 0; z-index: 4; content: ""; box-shadow: inset 0 0 65px #07061165; border: 1px solid #cfa9ed19; }
canvas { display: block; width: 100%; height: 100%; }
.menu { position: absolute; inset: 0; z-index: 6; display: grid; align-items: center; overflow: hidden; background: linear-gradient(90deg, #110e1dee 3%, #160e21e3 25%, #170f2394 48%, #1c142400 79%), linear-gradient(0deg,#100c17c9,transparent 40%); }
.menu-copy { padding: 28px clamp(28px, 5.1vw, 86px); width: fit-content; position: relative; z-index: 2; }
h1, h2, p { margin: 0; }
h1 { margin: 13px 0 27px; }
h1 > span { display: block; color: #fff5f9; text-shadow: 4px 5px #1c1230; font-size: clamp(53px, 8.9vw, 146px); font-weight: 1000; line-height: .98; letter-spacing: -.095em; font-style: italic; white-space: nowrap; padding-right: .14em; }
h1 .punct { color: var(--pink); padding-left: .1em; }
h1 small { display: block; margin: 14px 0 0 4px; font: 800 clamp(12px, 1.4vw, 19px)/1 ui-monospace, monospace; letter-spacing: .34em; color: #ffadc9; }
.mission { display: grid; gap: 4px; margin-bottom: 24px; }
.mission strong { font-size: 21px; }
.mission span { color: #d7c6de; font-size: 15px; line-height: 1.55; }
.roster { margin: 0 0 22px; padding: 0; border: 0; }
.roster legend { color: #d0bfd8; font-size: 14px; font-weight: 700; margin: 0 0 8px; padding: 0; }
.roster-options { display: flex; flex-wrap: wrap; gap: 8px; max-width: 420px; }
.fighter-choice { display: flex; gap: 9px; align-items: center; text-align: left; padding: 4px 12px 4px 4px; background: #171323db; border: 1px solid #69546e; border-radius: 4px; min-width: 119px; }
.fighter-choice[aria-pressed="true"] { border-color: var(--hero); background: #262337; box-shadow: inset 0 -2px var(--hero), 0 0 16px #9ddad21a; }
.fighter-choice:hover { background: #30253d; }
.fighter-choice strong, .fighter-choice small { display: block; }
.fighter-choice strong { line-height: 1.2; font-size: 15px; }
.fighter-choice small { line-height: 1.35; font-size: 12px; color: #cdbfd6; white-space: nowrap; }
.face, .status-face { background-color: #302938; background-size: cover; background-position: center; }
.face { display: block; width: 36px; height: 37px; border-radius: 2px; }
.face-gpt { background-image: url(assets/gpt-face.webp); }
.face-claude { background-image: url(assets/claude-face.webp); }
.primary-button { min-height: 54px; min-width: 238px; padding: 10px 17px; display: inline-flex; gap: 20px; justify-content: space-between; align-items: center; border: 0; clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px)); background: linear-gradient(106deg, #ff699d, #ff9ab4); color: #241229; font-size: 18px; font-weight: 950; }
.primary-button:hover { background: #ffc0d3; }
.primary-button:focus-visible { outline-offset: -5px; }
.start-key { border: 1px solid #632a4b73; border-radius: 3px; padding: 4px 5px; font: 800 12px/1 ui-monospace, monospace; }
.menu-image { position: absolute; width: 61%; height: 100%; right: 0; bottom: 0; pointer-events: none; }
.menu-image img { height: 92%; width: 85%; object-fit: contain; object-position: center bottom; position: absolute; bottom: -1%; right: 8%; filter: drop-shadow(0 20px 30px #080510da) drop-shadow(0 0 22px color-mix(in srgb, var(--hero) 22%, transparent)); }
.menu-orbit { position: absolute; top: 14%; left: 16%; width: 66%; aspect-ratio: 1; border-radius: 50%; border: 1px solid #ffd1fc6b; opacity: .45; box-shadow: 0 0 40px #c786f96d, inset 0 0 35px #ec93f257; }
.menu-orbit::before, .menu-orbit::after { position: absolute; inset: -13px; content: ""; border-radius: 50%; border: 1px dashed #dba4f794; }
.menu-orbit::after { inset: 13px; border-style: solid; opacity: .65; }
.menu-ground { position: absolute; bottom: 4%; left: 11%; width: 72%; height: 20%; background: radial-gradient(ellipse, #e28df064, transparent 62%); border-radius: 50%; transform: scaleY(.5); }
.hero-label { position: absolute; right: clamp(19px, 3vw, 54px); bottom: 28px; z-index: 3; text-align: right; text-shadow: 0 2px 10px #090512, 0 0 22px #090512; display: grid; gap: 2px; }
.hero-label span { color: var(--hero); font: 800 14px/1.3 system-ui; letter-spacing: .12em; }
.hero-label strong { font-size: clamp(18px, 2.3vw, 31px); font-style: italic; font-weight: 950; }

.hud { z-index: 3; position: absolute; inset: 0; pointer-events: none; }
.status { display: grid; gap: 12px; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 18px 20px; }
.player-status { display: flex; gap: 10px; align-items: center; min-width: 100px; max-width: 334px; }
.status-face { width: 50px; height: 50px; border: 1px solid var(--hero); border-radius: 4px; flex: none; }
.status-meters { min-width: 0; flex: 1; }
.status-line { display: flex; gap: 7px; justify-content: space-between; align-items: end; text-shadow: 0 2px 7px #11091a; font-size: 14px; margin-bottom: 3px; }
.status-line strong { font-weight: 900; }
.status-line span { font: 700 12px/1.3 ui-monospace, monospace; white-space: nowrap; }
.meter { position: relative; height: 10px; border: 1px solid #644b68; background: #160f24e8; overflow: hidden; border-radius: 2px; }
.meter i { position: absolute; inset: 0; display: block; transform-origin: left; transform: scaleX(var(--meter, 1)); transition: transform 110ms linear; background: linear-gradient(90deg,#7d51d7,#ff719f); }
.energy-line { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.energy { flex: 1; height: 5px; }
.energy i { background: var(--hero); }
.energy-line span { font: 800 11px/1.2 ui-monospace, monospace; color: var(--hero); text-shadow: 0 1px 5px #140a20; min-width: 28px; text-align: right; }
.stage-status { text-align: center; line-height: 1.2; text-shadow: 0 2px 7px #10091a; }
.stage-status strong { font-size: 16px; }
.sector-dots { display: flex; gap: 5px; justify-content: center; margin-top: 7px; }
.sector-dots i { display: block; width: 14px; height: 5px; transform: skewX(-20deg); background: #6a4a72; }
.sector-dots .current { background: var(--pink); box-shadow: 0 0 8px #ff64a788; }
.sector-dots .cleared { background: var(--cyan); }
.pause { pointer-events: auto; justify-self: end; min-width: 36px; min-height: 34px; border: 1px solid #b198c4; color: white; background: #20172bcc; border-radius: 4px; font-weight: 900; }
.pause:hover { border-color: var(--pink); }
.boss-health { position: absolute; width: min(48%, 360px); right: 20px; top: 62px; }
.boss-health .meter i { background: linear-gradient(90deg,#b73673,#ff7c79); }
.combo { position: absolute; top: 30%; right: 7%; display: grid; text-align: right; color: #ffd4e2; font-style: italic; line-height: .92; text-shadow: 3px 4px #381327,0 0 20px #f94c99bb; }
.combo strong { font-size: clamp(26px,6vw,70px); }
.combo span { font-size: 16px; font-weight: 900; }
.notice { position: absolute; top: 25%; width: 100%; display: grid; text-align: center; gap: 4px; color: #fff3f8; text-shadow: 0 2px 3px #1f0e24, 0 0 18px #21082f; }
.notice strong { font-size: clamp(21px,4.2vw,51px); font-style: italic; font-weight: 950; }
.notice span { color: #ffd9ea; font-size: 14px; font-weight: 700; }
.objective { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); border: 1px solid #ac71965e; border-radius: 3px; padding: 5px 12px; background: #1a1128dc; color: #f2dae9; font-size: 13px; white-space: nowrap; }

.overlay { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; background: #110d1bbd; backdrop-filter: blur(4px); }
.overlay-panel { width: min(90%, 360px); display: grid; gap: 14px; padding: 24px; border: 1px solid #8b577d; background: #1a1326; box-shadow: 0 16px 50px #08040cbd; }
.overlay-panel h2 { font-size: clamp(24px, 5vw, 38px); font-weight: 950; }
.overlay-panel p { color: #e0cbe6; line-height: 1.5; }
.overlay-panel button { justify-content: center; min-width: 0; }
.game-controls { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 12px; min-height: 57px; }
.key-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px clamp(9px,1.6vw,24px); color: #b9abc4; font-size: 13px; }
.key-legend > span { white-space: nowrap; }
kbd { display: inline-block; min-width: 21px; padding: 4px 5px; background: #1e1a2b; border: 1px solid #40364d; border-radius: 3px; color: #ede1f4; font: 750 11px/1 ui-monospace, monospace; text-align: center; vertical-align: baseline; margin-right: 3px; }
.touch-controls, .battle-skills { display: none; }
.app.in-battle .battle-skills { display: flex; gap: 6px; }
.app.in-battle .key-legend > span:nth-child(n+5) { display: none; }
.battle-skills button { position: relative; color: #ddcde4; border: 1px solid #53405d; background: #201628; border-radius: 4px; padding: 5px 8px; font-size: 13px; white-space: nowrap; }
.battle-skills button:not(.cooling):hover { border-color: var(--hero); }
.battle-skills button i, .touch-attack button i { display: none; }
.battle-skills .cooling, .touch-attack .cooling { color: #b8a5bf; border-color: #5b4a62; background: #201925; }
.battle-skills [data-action="ultimate"].ready, .touch-attack [data-action="ultimate"].ready { color: #211425; background: #ff9ebf; border-color: #ffcbdf; box-shadow: 0 0 14px #ff649d65; }

dialog { width: min(calc(100% - 28px), 470px); background: #21172d; padding: 22px; color: var(--ink); border: 1px solid #a66a96; box-shadow: 0 18px 60px #08050bd4; border-radius: 6px; }
dialog::backdrop { background: #0d0a16c9; }
.guide-head { display: flex; justify-content: space-between; align-items: center; }
.guide-head h2 { font-size: 26px; }
.guide-head button { font-size: 20px; padding: 3px 9px; }
dialog dl { margin: 13px 0; }
dialog dl > div { display: grid; grid-template-columns: 42% 1fr; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid #493751; }
dialog dd { margin: 0; font-size: 15px; }
dialog p { color: #d7bedb; font-size: 14px; line-height: 1.55; }

@media (pointer: coarse), (max-width: 700px) {
  .app.in-battle .battle-skills, .app.in-battle .key-legend { display: none; }
  .app.in-battle .game-controls { padding-top: 8px; }
  .app.in-battle .touch-controls { display: flex; width: 100%; justify-content: space-between; gap: 9px; }
  .touch-group { display: grid; grid-template-columns: repeat(2,minmax(48px,70px)); gap: 5px; }
  .touch-group button { position: relative; min-height: 42px; border: 1px solid #6a5475; border-radius: 5px; background: #22192e; font-size: 13px; font-weight: 850; user-select: none; touch-action: none; }
  .touch-attack button { background: #44223e; border-color: #9c547d; }
  .touch-group button:active, .touch-group button.pressed { background: #4c375b; border-color: var(--hero); }
}
@media (max-width: 700px) {
  .app { padding: 0 10px 12px; }
  .topbar { min-height: 54px; }
  .brand { gap: 7px; }
  .brand-english, #sound-text { display: none; }
  .brand-icon { width: 27px; height: 27px; font-size: 22px; }
  .brand strong { font-size: 20px; }
  .small-button { font-size: 13px; padding: 6px 8px; }
  #sound > span:first-child { margin: 0; }
  .arena { height: clamp(405px, calc(100svh - 140px), 620px); }
  .menu { align-items: end; background: linear-gradient(0deg, #110e20f8, #160e21e9 27%, #170f2370 58%, transparent 85%); }
  .menu-copy { padding: 15px 16px 18px; width: 100%; }
  h1 { margin: 8px 0 14px; }
  h1 > span { font-size: clamp(47px, 13vw, 80px); }
  h1 small { font-size: 11px; margin-top: 9px; }
  .mission { margin-bottom: 13px; }
  .mission strong { font-size: 17px; }
  .mission span { font-size: 13px; }
  .roster { margin-bottom: 13px; }
  .roster legend { font-size: 12px; margin-bottom: 5px; }
  .primary-button { min-height: 44px; font-size: 16px; }
  .menu-image { width: 100%; height: 70%; bottom: auto; top: 0; }
  .menu-image img { width: 75%; height: 100%; right: 0; object-position: right center; }
  .menu-orbit { width: 64%; top: 9%; left: 31%; }
  .hero-label { display: none; }
  .status { padding: 9px 8px; gap: 8px; grid-template-columns: minmax(120px,1.4fr) 1fr 34px; }
  .player-status { gap: 4px; }
  .status-face { width: 32px; height: 34px; }
  .status-line { font-size: 12px; }
  .status-line span { font-size: 10px; }
  .stage-status strong { font-size: 12px; }
  .pause { min-width: 31px; min-height: 30px; }
  .boss-health { right: 9px; top: 51px; }
  .app.in-battle .arena { height: clamp(280px, calc(100svh - 167px), 590px); }
}
@media (max-height: 540px) and (orientation: landscape) {
  .app { padding: 0 10px 8px; }
  .topbar { min-height: 44px; }
  .arena, .app.in-battle .arena { height: clamp(228px, calc(100svh - 124px), 412px); }
  .menu { align-items: center; background: linear-gradient(90deg,#110e20f6,#160e21b0 48%,transparent 78%); }
  .menu-copy { padding: 11px 25px; }
  .menu-image { width: 58%; height: 100%; bottom: 0; top: auto; }
  .mission { margin-bottom: 6px; }
  .mission span { display: none; }
  h1 { margin: 4px 0 8px; }
  h1 > span { font-size: clamp(40px, 10svh, 64px); }
  h1 small { margin-top: 6px; font-size: 11px; }
  .roster legend { font-size: 12px; }
  .roster { margin-bottom: 8px; }
  .roster legend { margin-bottom: 4px; }
  .primary-button { min-height: 39px; padding: 5px 14px; font-size: 16px; }
  .touch-group { grid-template-columns: repeat(4,minmax(47px,60px)); }
  .game-controls { min-height: 44px; padding-top: 5px; }
  .touch-group button { min-height: 38px; }
}
canvas:focus { outline: 0; }
.battle-skills button i, .touch-attack button i { margin-left: 4px; color: #ffd6e8; font: 800 11px/1 ui-monospace, monospace; }
@media (pointer: coarse) {
  .start-key { display: none; }
}

.shop-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; border-color: #79536f; }
.shop-trigger .currency-icon { color: #ffb5d1; font-size: 17px; line-height: 1; }
.shop-trigger b { color: #ffb5d1; font: 800 13px/1 ui-monospace, monospace; }
.play-modes { display: flex; width: max-content; max-width: 100%; gap: 3px; padding: 3px; border: 1px solid #75536d; background: #100c19c9; border-radius: 5px; }
.mode-button { border-radius: 3px; border: 1px solid transparent; background: transparent; padding: 6px 11px; font-size: 14px; font-weight: 800; white-space: nowrap; color: #d3c0d9; }
.mode-button[aria-pressed="true"] { background: #4d2945; border-color: #b9719f; color: #ffdeee; }
.mode-button:hover { color: #fff; border-color: #c483ae; }
.duel-setup { margin: 0 0 17px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; gap: 7px 10px; max-width: 430px; }
.duel-setup.is-local { grid-template-columns: repeat(2,minmax(0,1fr)); max-width: 380px; }
.duel-setup label { display: grid; min-width: 0; gap: 5px; font-size: 14px; color: #e0cde5; font-weight: 700; }
.duel-setup select { width: 100%; min-height: 37px; padding: 5px 26px 5px 10px; border: 1px solid #775777; border-radius: 4px; color: #fff1fa; background: linear-gradient(45deg,transparent 50%,#dbb1cf 50%) right 15px center/5px 5px no-repeat,linear-gradient(135deg,#dbb1cf 50%,transparent 50%) right 10px center/5px 5px no-repeat,#24192d; appearance: none; font-family: inherit; font-size: 14px; font-weight: 750; line-height: 1.2; cursor: pointer; }
.duel-setup select:focus-visible { outline: 2px solid #ffbad9; outline-offset: 2px; }
.duel-setup p { grid-column: 1 / -1; color: #dbbbd8; font-size: 13px; }
.menu.duel-menu h1 { margin-bottom: 19px; }
.face-gemini { background-image: url(assets/gemini-face.webp); }
.face-deepseek { background-image: url(assets/deepseek-face.webp); }
.face-grok { background-image: url(assets/grok-face.webp); }
.face-qwen { background-image: url(assets/qwen-face.webp); }
.fighter-choice.is-locked .face { filter: saturate(.55); }
.fighter-choice.is-locked small { color: #e4a5cd; }
.fighter-choice.is-locked:hover { border-color: #e4a5cd; }

.hud.duel .status { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: start; }
.hud.duel .status > .pause { position: absolute; top: 88px; right: 20px; }
.hud.duel .status > .player-status .health i { background: linear-gradient(90deg,#3da8ce,#91f1ff); }
.hud.duel .status > .player-status .status-face { border-color: #6be9ff; }
.hud.duel .status > .opponent-status .status-face { border-color: #ff7996; }
.hud.duel .status > .opponent-status .health i { background: linear-gradient(90deg,#ff9fba,#d65380); }
.opponent-status { flex-direction: row-reverse; width: 100%; justify-self: end; --hero: var(--opponent-color, #ff7996); }
.opponent-status .status-line, .opponent-status .energy-line { flex-direction: row-reverse; }
.opponent-status .meter i { transform-origin: right; }
.opponent-status .energy-line span { text-align: left; }
.duel-status { display: grid; justify-items: center; gap: 2px; text-align: center; min-width: 74px; text-shadow: 0 2px 7px #10091a; }
.duel-status > span { color: #e5cde9; font-size: 13px; font-weight: 800; line-height: 1.1; }
#duel-clock { color: #fff0fa; font: italic 950 43px/.95 ui-monospace, monospace; }
#duel-clock.urgent { color: #ff86a8; }
.round-score { display: flex; gap: 9px; align-items: center; color: #6be9ff; font: 850 15px/1.4 ui-monospace, monospace; }
.round-score #duel-score-two { color: #ff9db2; }
.round-score i { width: 4px; height: 4px; transform: rotate(45deg); background: #c6a4ca; }
.hud.duel #combo { right: auto; left: 7%; text-align: left; color: #b8faff; text-shadow: 2px 3px #231836,0 0 14px #6be9ff9c; }
.hud.duel .opponent-combo { color: #ffb9cb; }
.duel-callout { top: 27%; }
.duel-callout strong { letter-spacing: .05em; }
.duel-callout span { color: #f9cfe1; font-size: 19px; }
.local-controls { display: flex; align-items: center; width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.local-controls > div { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; color: #d7c5dd; font-size: 13px; }
.local-controls b { color: #b8faff; }
.local-controls > div:nth-child(2) b { color: #ffb9cb; }
.local-controls span { white-space: nowrap; }
.app.local-duel .key-legend, .app.local-duel .battle-skills, .app.local-duel .touch-controls { display: none; }
dialog { max-height: 92svh; overflow-y: auto; }

@media (max-width: 700px) {
  .top-actions { gap: 4px; }
  .shop-trigger { gap: 4px; }
  .mode-button { font-size: 13px; padding: 4px 9px; }
  .duel-setup { margin-bottom: 11px; gap: 4px 8px; }
  .duel-setup label { font-size: 12px; }
  .duel-setup select { min-height: 33px; font-size: 13px; }
  .duel-setup p { font-size: 12px; }
  .menu.duel-menu h1 { margin-bottom: 13px; }
  .roster-options { display: grid; grid-template-columns: repeat(2,minmax(0,138px)); gap: 5px; }
  .fighter-choice { gap: 5px; padding: 4px; min-width: 0; }
  .fighter-choice strong { font-size: 13px; }
  .fighter-choice small { font-size: 10px; }
  .fighter-choice .face { width: 29px; height: 32px; flex: none; }
  .duel-status { min-width: 44px; }
  .duel-status > span { font-size: 10px; }
  #duel-clock { font-size: 31px; }
  .round-score { font-size: 12px; gap: 6px; }
  .hud.duel .status { gap: 5px; }
  .hud.duel .status > .pause { top: 63px; right: 8px; }
  .hud.duel .status-line { font-size: 10px; gap: 3px; }
  .hud.duel .status-line span { font-size: 9px; }
}
@media (max-width: 360px) {
  .fighter-choice .face { width: 25px; height: 29px; }
  .fighter-choice small { font-size: 9px; }
  .hud.duel .status-face { width: 22px; height: 27px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .mode-button { padding-top: 3px; padding-bottom: 3px; font-size: 12px; }
  .menu.duel-menu .menu-copy { display: grid; grid-template-columns: max-content auto; gap: 5px 10px; align-items: end; padding: 7px 18px; }
  .menu.duel-menu .play-modes, .menu.duel-menu h1 { grid-column: 1 / -1; }
  .menu.duel-menu h1, .menu.duel-menu .roster, .duel-setup { margin: 0; }
  .menu.duel-menu .roster { grid-column: 1; }
  .duel-setup, .duel-setup.is-local { grid-column: 1 / -1; width: 100%; max-width: 405px; }
  .roster-options { display: flex; }
  .duel-setup label { font-size: 12px; gap: 2px; }
  .duel-setup select { min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
  .duel-setup p { display: none; }
  .menu.duel-menu .primary-button { min-height: 35px; min-width: 122px; justify-content: center; }
  .menu.duel-menu .start-key { display: none; }
  .hud.duel .status > .pause { top: 79px; }
}

@media (max-width: 560px) and (max-height: 540px) and (orientation: landscape) {
  .fighter-choice small { display: none; }
  .duel-setup select { padding-left: 5px; padding-right: 19px; background-position: right 10px center, right 5px center, center; }
  .menu.duel-menu .menu-copy { padding-inline: 9px; }
  .menu.duel-menu .fighter-choice { padding-inline: 4px; }
  .menu.duel-menu .primary-button { min-width: 94px; padding-inline: 8px; }
}


.substitute-hud { margin-top: 4px; color: #c2adc7; font: 750 11px/1.2 system-ui,sans-serif; text-shadow: 0 1px 6px #120b20; }
.substitute-hud.available { color: #aef8e5; }
.opponent-status .substitute-hud { text-align: right; }
[data-action="substitute"].ready { border-color: #81daca; color: #d1fff0; background: #253841; }
[data-action="substitute"].ready:hover { border-color: #adf6d8; }

@media (pointer: coarse), (max-width: 700px) {
  .touch-attack { grid-template-columns: repeat(3,minmax(45px,60px)); }
  .touch-attack [data-action="attack"] { grid-column: span 2; }
}
@media (max-width: 700px) {
  .substitute-hud { font-size: 9px; }
}
@media (max-height: 540px) and (orientation: landscape) and (min-width: 600px) {
  .touch-attack { grid-template-columns: repeat(5,minmax(47px,60px)); }
  .touch-attack [data-action="attack"] { grid-column: auto; }
}
@media (max-width: 590px) and (max-height: 540px) and (orientation: landscape) {
  .menu.duel-menu .roster-options { gap: 4px; }
  .menu.duel-menu .fighter-choice { min-width: 63px; column-gap: 3px; }
  .menu.duel-menu .fighter-choice .face { width: 23px; height: 26px; }
  .menu.duel-menu .fighter-choice strong { font-size: 11px; }
  .menu.duel-menu .fighter-choice small { display: none; }
}

@media (max-width: 390px) {
  .topbar { gap: 5px; }
  .top-actions { gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .small-button { padding-inline: 5px; }
  .brand { gap: 4px; }
  .brand-icon { width: 24px; height: 24px; }
  .brand strong { font-size: 18px; }
}
