:root {
  --bg: #07080d;
  --panel: #12141c;
  --panel-2: #1a1d28;
  --line: rgba(255, 255, 255, 0.08);
  --pink: #ff2d6a;
  --pink-2: #ff5c8a;
  --text: #f4f6fb;
  --muted: #9aa3b5;
  --good: #1faa62;
  --bad: #e23b4a;
  --gold: #f0c14a;
  --font: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  --display: "Noto Sans Display", Impact, "Arial Black", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body { user-select: none; touch-action: manipulation; }
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
textarea, input { user-select: text; }
.hidden, [hidden] { display: none !important; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

#world { position: fixed; inset: 0; z-index: 0; }
#fx-layer { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#dock {
  position: fixed; z-index: 40; top: 10px; right: 10px; display: flex; flex-flow: row nowrap; gap: 6px;
}
#dock button { flex: 0 0 auto; white-space: nowrap; }
#dock button, .ghost, .row-actions button, .hp-presets button, .victory-actions button, .modal-actions button, .slot-toggle button {
  border: 1px solid var(--line);
  background: rgba(10, 12, 18, 0.82);
  color: var(--text);
  border-radius: 4px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
}
#dock button.on, .hp-presets button.on { background: var(--pink); border-color: var(--pink); color: white; }
#portrait-lock {
  display: none; position: fixed; inset: 0; z-index: 80; background: #07080d;
  place-items: center; text-align: center; font-size: 28px;
}
@media (max-aspect-ratio: 3/4) { #portrait-lock { display: grid; } }

.brand-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 22px 8px;
}
.logo { flex: 0 0 auto; width: 120px; height: 72px; }
.logo img { display: block; width: 100%; height: 100%; object-fit: contain; filter: brightness(0) invert(1); }
.brand-sub { margin: 0; color: var(--muted); letter-spacing: 0.08em; font-size: 13px; }

#screen-setup {
  position: relative; z-index: 2; height: 100%; overflow: auto; padding: 0 8vw 32px;
}
.panel {
  background: linear-gradient(180deg, #141824, #0e1118);
  border: 1px solid rgba(255, 45, 106, 0.28);
  border-radius: 10px;
  padding: 18px 18px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
#screen-setup .editor-panel > .panel-head,
#screen-setup .editor-panel > .row-actions,
#screen-setup .editor-panel > #bank-text,
#screen-setup .editor-panel > #parse-error,
#screen-setup .editor-panel > .preview,
#screen-setup .editor-panel > #btn-go-select { display: none; }
.bank-picker { display: grid; gap: 10px; }
.bank-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bank-picker-head h2 { margin: 0 0 4px; font-size: 22px; }
.bank-picker-head p { margin: 0; color: var(--muted); font-size: 14px; }
.bank-count { flex: 0 0 auto; color: var(--gold); font-weight: 800; }
.bank-book-label { font-size: 13px; font-weight: 800; color: var(--muted); }
.bank-book {
  width: 100%; padding: 10px 44px 10px 12px; border: 1px solid rgba(216,182,108,.4); border-radius: 4px;
  appearance: none; -webkit-appearance: none;
  background: #211f1b; color: var(--text); font: inherit; font-weight: 700;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f3ead7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.bank-units { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.bank-unit {
  display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 8px 10px;
  border: 1px solid rgba(216,182,108,.22); background: rgba(38,36,33,.78); color: var(--text);
  font-size: 14px; cursor: pointer;
}
.bank-unit input { width: 17px; height: 17px; margin: 0; accent-color: var(--gold); }
.bank-return { justify-self: end; width: min(320px, 100%); }
.panel h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0.08em; }
.panel-head p, .hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.row-actions, .hp-presets, .victory-actions, .modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions { margin: 12px 0; }
textarea {
  width: 100%; min-height: 140px; resize: vertical; border-radius: 8px;
  border: 1px solid rgba(255, 45, 106, 0.35); background: #07080f; color: #e8edf8;
  padding: 12px; font-size: 16px; line-height: 1.45;
}
.error { color: #ff8aa2; font-weight: 700; }
.preview { margin-top: 12px; }
.preview-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 14px; }
#preview-note.ok {
  background: #123628; color: #b6ffd4; border-radius: 6px; padding: 6px 10px; font-weight: 700;
}
.table-wrap { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: #1c2230; color: var(--pink-2); letter-spacing: 0.06em; }
.go {
  width: 100%; margin-top: 14px; border: none; border-radius: 6px;
  background: var(--pink); color: white; font-weight: 800; font-size: 18px;
  letter-spacing: 0.12em; padding: 12px 16px;
}
.go:disabled { opacity: 0.4; }
.label { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.14em; color: var(--muted); font-weight: 800; }

#screen-select {
  position: absolute; inset: 0; z-index: 2; display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto auto;
  background: linear-gradient(180deg, #0b0d14 0%, #07080d 40%);
  overflow: auto;
}
#screen-solo-saves {
  position: absolute; inset: 0; z-index: 3; overflow: auto;
  background: linear-gradient(180deg, #292723, #151515 72%);
}
.solo-saves-panel { width: min(920px, calc(100% - 36px)); margin: clamp(12px, 4vh, 40px) auto 36px; }
.solo-saves-kicker { margin: 0 0 6px; color: var(--gold); letter-spacing: .22em; font-size: 12px; font-weight: 800; }
.solo-saves-panel h1 { margin: 0; color: #f4e9d3; font-size: clamp(26px, 4vw, 42px); }
.solo-saves-intro { margin: 24px 0 10px; color: #d5c69f; font-weight: 800; }
.story-save-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.story-save-slot, .free-mode-slot {
  min-height: 94px; padding: 14px 16px; border: 1px solid rgba(216,182,108,.24); border-radius: 2px;
  background: rgba(38,36,33,.94); color: var(--text); text-align: left;
}
.story-save-slot { display: grid; gap: 4px; opacity: .62; cursor: default; }
.story-save-slot span, .free-mode-slot span { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.story-save-slot strong, .free-mode-slot strong { font-size: 18px; }
.story-save-slot small, .free-mode-slot small { color: #bdb49d; font-size: 13px; }
.free-mode-slot { display: grid; gap: 5px; width: 100%; min-height: 104px; margin-top: 14px; border-color: var(--gold); cursor: pointer; }
.free-mode-slot:hover, .free-mode-slot:focus-visible { background: #302b25; box-shadow: inset 3px 0 0 var(--pink); }
.hero-banner {
  position: relative; min-height: 0; margin: 0 18px;
  background:
    linear-gradient(100deg, rgba(0,0,0,.2), rgba(0,0,0,.55)),
    linear-gradient(90deg, #ff3b78, #d10d48 55%, #7a1238);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch;
  overflow: hidden; border-radius: 2px;
}
.hero-side { min-width: 0; display: flex; align-items: end; gap: 10px; }
.hero-side.p2 { justify-content: flex-end; }
.hero-side img { flex: 0 0 auto; height: clamp(220px, 42vh, 340px); width: clamp(140px, 19vw, 220px); object-fit: contain; object-position: center bottom; filter: drop-shadow(0 10px 16px rgba(0,0,0,.6)); }
.hero-side > img { transform: translateY(-8px); }
.hero-side.p2 > img { transform: translateY(-8px) scaleX(-1); }
.hero-side .plate { min-width: 0; align-self: center; }
.kicker { letter-spacing: 0.22em; font-size: 12px; color: rgba(255,255,255,.75); }
.ready-mark { align-self: center; text-align: center; font-family: var(--display); font-size: 42px; line-height: .8; padding: 0 10px; }
.ready-mark div { font-family: var(--font); font-size: 12px; letter-spacing: 0.2em; margin-top: 6px; }
.plate { padding: 12px; }
.plate-placeholder { padding: 16px; color: #e2c88d; text-align: center; font-weight: 800; letter-spacing: .08em; }
.plate.p2 { text-align: right; }
.plate-kicker { letter-spacing: 0.16em; font-size: 12px; color: rgba(255,255,255,.8); }
.plate-name { font-size: clamp(22px, 3vw, 40px); font-weight: 800; line-height: 1; }
.plate-en { font-family: var(--display); letter-spacing: 0.16em; }
.plate-ult { color: #fff; font-weight: 800; margin-top: 6px; }
.plate-blurb { margin: 4px 0; font-size: 12px; color: rgba(255,255,255,.82); }
.plate-moves { font-size: 12px; color: #ffe0a6; }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 18px 0; }
.mode-tile {
  text-align: left; background: #12141c; border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 10px 12px; min-height: 72px;
}
.mode-tile span { display: block; color: var(--pink); font-family: var(--display); letter-spacing: 0.12em; }
.mode-tile strong { display: block; font-size: 18px; }
.mode-tile small { color: var(--muted); }
.mode-tile.on { border-color: var(--pink); box-shadow: inset 3px 0 0 var(--pink); background: #1a1020; }
.choose-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 18px 0; gap: 12px; }
.choose-actions { display: flex; align-items: center; gap: 8px; }
.mode-toggle { flex: 0 0 auto; border: 1px solid rgba(216,182,108,.5); border-radius: 2px; padding: 8px 12px; background: rgba(48,43,37,.94); color: #f0d99d; font: inherit; font-weight: 800; }
.wrong-rule-toggle { padding-inline: 9px; font-size: 12px; white-space: nowrap; }
.mode-toggle:hover { border-color: var(--gold); background: #393126; }
.choose-label { font-family: var(--display); letter-spacing: 0.18em; font-size: 18px; }
.slot-toggle { display: flex; gap: 8px; }
.slot-toggle button.on { background: white; color: #111; }
.roster {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
  padding: 8px 18px 4px; min-height: 0;
}
.fighter-card {
  position: relative; overflow: hidden; background: #10131b; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); text-align: left; padding: 0; min-height: 0; aspect-ratio: 16 / 9;
}
.fighter-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; background: radial-gradient(circle at 50% 80%, rgba(255,45,106,.25), transparent 70%); }
.fighter-card[data-id="rime"] img { object-position: center 8%; }
.fighter-card strong { position: absolute; z-index: 1; top: 8px; left: 8px; display: block; padding: 3px 8px; font-size: 18px; background: rgba(24,23,21,.78); text-shadow: 0 1px 4px #000; }
.fighter-card.p1 { outline: 2px solid var(--pink); }
.fighter-card.p2 { outline: 2px solid var(--gold); }
.match-settings {
  display: grid; grid-template-columns: 1.2fr 1fr .9fr .8fr; gap: 12px;
  padding: 8px 18px 14px; align-items: end;
}
.match-settings > div { min-width: 0; }
.choices { display: grid; gap: 6px; }
.choice {
  text-align: left; background: #10131b; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; color: var(--text);
}
.choice strong { display: block; }
.choice span { color: var(--muted); font-size: 12px; }
.choice.on { border-color: var(--pink); background: #241018; }
input[type="range"] { width: 100%; accent-color: var(--pink); }
#alias-input {
  width: 100%; background: #07080f; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}

#screen-battle {
  --dock-button-height: 34px;
  position: absolute; inset: 0; z-index: 2; display: grid;
  grid-template-rows: auto minmax(28vh, 1fr) minmax(30.4vh, 36.8vh);
  pointer-events: none; padding: calc(var(--dock-button-height) + 18px) 12px 10px;
}
.topbar, .consoles { pointer-events: auto; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.who { display: flex; align-items: baseline; gap: 8px; }
.fighter-name { display: flex; align-items: baseline; gap: 8px; margin-top: 3px; }
.side.p2 .fighter-name { flex-direction: row-reverse; justify-content: flex-start; }
.side.p2 .who, .side.p2 .meter, .console.p2 .console-top { flex-direction: row-reverse; }
.fname { font-size: 28px; font-weight: 800; }
.fen { font-style: normal; letter-spacing: 0.16em; color: var(--muted); font-size: 13px; }
.badge { display: inline-grid; place-items: center; min-width: 34px; height: 20px; border-radius: 2px; font-size: 11px; font-weight: 800; background: #222; }
.badge.p1 { background: var(--pink); }
.badge.p2 { background: #3a4258; }
.hp { position: relative; height: 18px; margin-top: 6px; background: #1a1d27; overflow: hidden; border: 1px solid rgba(255,255,255,.12); }
.hp-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #ff7aa0, var(--pink)); transition: width .28s ease; }
.side.p2 .hp-fill { left: auto; right: 0; background: linear-gradient(270deg, #fff, #d7deee); }
.hp-num { position: relative; z-index: 1; display: block; text-align: center; font-family: var(--display); font-size: 16px; line-height: 16px; text-shadow: 0 1px 2px #000; }
.hp.low .hp-fill { background: #ff2a2a; }
.meter { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 36px; height: 8px; background: #2a3142; display: block; }
.pips[data-combo="1"] i:nth-child(1),
.pips[data-combo="2"] i:nth-child(-n+2) { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.pips[data-combo="2"] i:nth-child(3) { animation: blink .4s steps(2) infinite; background: #ffd0dc; }
.pip-label { font-size: 12px; letter-spacing: 0.08em; color: var(--pink-2); font-weight: 800; }
.vs { font-family: var(--display); font-size: 42px; letter-spacing: 0.08em; text-align: center; transform: translateY(-7px); }
.banner { text-align: center; color: var(--muted); letter-spacing: 0.14em; font-size: 12px; }

.arena-spacer { position: relative; min-height: 0; overflow: hidden; }
#screen-battle .arena-spacer.hit-shake { animation: arenaHitShake .32s cubic-bezier(.18,.72,.28,1); }
#screen-battle .arena-spacer.hit-flash::after {
  content: ""; position: absolute; z-index: 4; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,246,224,.78), rgba(255,255,255,.22) 24%, transparent 70%);
  mix-blend-mode: screen; animation: arenaHitFlash .2s steps(2, end) both;
}
.fighter-art {
  position: absolute; bottom: 8px; height: calc(100% - 40px); width: 46%; object-fit: contain; object-position: center bottom;
  pointer-events: none; z-index: 2; filter: drop-shadow(0 16px 18px rgba(0,0,0,.45));
}
.fighter-art.p1 { left: 10%; transition: left .24s cubic-bezier(.2,.75,.25,1), width .24s cubic-bezier(.2,.75,.25,1); }
.fighter-art.p2 { right: 10%; transform: scaleX(-1); transition: right .24s cubic-bezier(.2,.75,.25,1), width .24s cubic-bezier(.2,.75,.25,1); }
.fighter-art.advancing.p1,
.fighter-art.advancing.p2 { transition: left .24s cubic-bezier(.2,.75,.25,1), right .24s cubic-bezier(.2,.75,.25,1), width .24s cubic-bezier(.2,.75,.25,1); }
.fighter-art.flash { filter: brightness(2.2) drop-shadow(0 0 18px white); }
.fighter-art[data-anim="attack"].p1 { animation: lunge1 .52s ease; }
.fighter-art[data-anim="attack"].p2 { animation: lunge2 .52s ease; }
.fighter-art[data-anim="hit"].p1 { animation: hit1 .42s ease; }
.fighter-art[data-anim="hit"].p2 { animation: hit2 .42s ease; }
.fighter-art[data-anim="brace"].p1 { animation: brace1 .42s cubic-bezier(.2,.8,.25,1); }
.fighter-art[data-anim="brace"].p2 { animation: brace2 .42s cubic-bezier(.2,.8,.25,1); }
.fighter-art[data-anim="whiff"].p1 { animation: whiff1 .36s ease; }
.fighter-art[data-anim="whiff"].p2 { animation: whiff2 .36s ease; }
.fighter-art[data-anim="ko"].p1 { animation: ko1 .7s ease forwards; }
.fighter-art[data-anim="ko"].p2 { animation: ko2 .7s ease forwards; }
.fighter-art[data-anim="ultimate"].p1 { animation: none; transform: none; }
.fighter-art[data-anim="ultimate"].p2 { animation: none; transform: scaleX(-1); }
.fighter-art[data-anim="attack"].ult-rush.p1 { animation: ultRush1 .52s cubic-bezier(.18,.82,.24,1); }
.fighter-art[data-anim="attack"].ult-rush.p2 { animation: ultRush2 .52s cubic-bezier(.18,.82,.24,1); }
.beam {
}
.callout {
  position: absolute; left: 50%; top: 18%; transform: scale(.8);
  opacity: 0; z-index: 1; max-width: 28%; font-family: var(--display); font-size: clamp(20px, 2.6vw, 34px);
  letter-spacing: 0.04em; color: white; -webkit-text-stroke: 2px #14080c; paint-order: stroke fill;
  text-align: center; white-space: normal; pointer-events: none;
}
.callout.p1 { text-align: right; }
.callout.p2 { text-align: left; }
.callout.show { animation: callout .72s ease forwards; }
.callout::after { display: block; font-family: var(--font); font-size: 14px; letter-spacing: .18em; -webkit-text-stroke: 0; color: var(--pink-2); }
.callout[data-kind="hit"]::after,
.callout[data-kind="clean"]::after { display: none; }
.callout[data-kind="block"] { display: none; }
.callout[data-kind="miss"]::after { content: "失误"; }
.callout[data-kind="counter"]::after { content: "反击"; }
.guard-sigil {
  position: absolute; width: 82px; height: 96px; pointer-events: none; z-index: 6;
  transform: translate(-50%, -50%) scale(.55); opacity: 0;
  background: var(--guard-color); clip-path: polygon(50% 0, 94% 14%, 88% 70%, 50% 100%, 12% 70%, 6% 14%);
  filter: drop-shadow(0 0 12px var(--guard-color));
  animation: guardSigil .46s cubic-bezier(.16,.85,.28,1) forwards;
}
.guard-sigil::before {
  content: ""; position: absolute; inset: 4px;
  background: linear-gradient(145deg, rgba(255,246,221,.68), rgba(255,255,255,.08) 48%, rgba(14,17,24,.44));
  clip-path: inherit;
}
.guard-sigil::after {
  content: ""; position: absolute; left: 50%; top: 16%; height: 67%;
  border-left: 2px solid rgba(255,247,223,.9); transform: rotate(22deg);
  filter: drop-shadow(0 0 4px #fff1d4);
}
.damage-layer { position: absolute; pointer-events: none; }
.damage-slash {
  --slash-color: #fff1d4;
  position: absolute; width: var(--slash-length); height: 3px; margin: -1.5px 0 0 0;
  pointer-events: none; opacity: 0; border-radius: 999px; transition: opacity .16s ease, transform .16s cubic-bezier(.12,.78,.2,1);
  transform: translate(-50%, -50%) rotate(var(--slash-angle)) scaleX(.08);
  transform-origin: center;
  background: linear-gradient(90deg, transparent, var(--slash-color) 17%, #fff 46%, #fff 58%, var(--slash-color) 84%, transparent);
  box-shadow: 0 0 5px #fff, 0 0 12px var(--slash-color);
}
.damage-slash.visible { opacity: 1; transform: translate(-50%, -50%) rotate(var(--slash-angle)) scaleX(1); }
.damage-slash::after {
  content: ""; position: absolute; inset: 1px 14% 1px 14%;
  border-radius: inherit; background: #fff; box-shadow: 0 0 8px #fff;
}
.damage-slash.heavy { height: 4px; margin-top: -2px; box-shadow: 0 0 8px #fff, 0 0 18px var(--slash-color); }

.consoles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; }
.consoles.solo { grid-template-columns: 1fr; }
.console {
  position: relative; min-height: 0; display: flex; flex-direction: column;
  background: #10131a; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; overflow: hidden;
}
.console.p1 { box-shadow: inset 3px 0 0 var(--pink); }
.console.p2 { box-shadow: inset -3px 0 0 #d7deee; }
.console.live { border-color: rgba(255,45,106,.7); }
.console.dim { filter: saturate(.5) brightness(.78); }
.console-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; font-weight: 800; }
.clock { margin-left: auto; color: var(--gold); font-family: var(--display); }
.console.p2 .clock { margin-left: 0; margin-right: auto; }
.prompt { text-align: center; font-weight: 800; font-size: clamp(30px, calc(4.6vh - 2px), 54px); padding: 4px 12px 0; }
.prompt[data-len="sm"] { font-size: clamp(20px, calc(3vh - 2px), 34px); }
.prompt[data-len="xs"] { font-size: clamp(14px, calc(2.2vh - 2px), 24px); }
.options { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 8px; padding: 8px; }
.options.spelling {
  display: flex; flex: 1; align-content: center; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: clamp(3px, .8vw, 10px); padding: 18px 10px; overflow: auto;
}
.options.spelling::after {
  content: "输入英文拼写 · 单词空格自动补全"; flex: 0 0 100%; margin-top: 10px;
  color: var(--muted); text-align: center; font-size: 13px; font-weight: 600;
}
.spelling-cell {
  display: inline-grid; place-items: center; min-width: clamp(20px, 3.2vw, 42px); height: clamp(34px, 5vh, 54px);
  border-bottom: 3px solid var(--accent, var(--pink)); color: var(--text); font-size: clamp(22px, 4vh, 42px);
  line-height: 1; font-family: var(--display); text-transform: uppercase;
}
.spelling-cell.is-filled { border-bottom-color: var(--gold); }
.spelling-cell.is-right { color: #e6c778; border-bottom-color: #d8b66c; }
.spelling-cell.is-wrong { color: var(--bad); border-bottom-color: var(--bad); }
.spelling-gap { width: clamp(12px, 1.8vw, 24px); height: 2px; }
.spelling-punctuation { font-size: clamp(22px, 4vh, 42px); color: var(--text); }
.opt {
  background: #181c27; border: 1px solid rgba(255,255,255,.1); border-radius: 6px; color: var(--text);
  font-weight: 800; font-size: clamp(20px, calc(2.3vh + 4px), 30px); padding: 8px;
}
.opt:active { transform: translateY(2px); }
.opt.is-right { background: var(--good); border-color: #0d5a30; }
.opt.is-wrong { background: var(--bad); }
.opt.is-dim { opacity: .35; }
.wait {
  position: absolute; inset: 36px 10px 10px; display: grid; place-items: center;
  font-size: clamp(22px, 3vh, 36px); letter-spacing: .16em; color: var(--muted); font-weight: 800;
}

#intro, #ult { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
#intro { display: grid; place-items: center; }
.intro-word {
  font-family: var(--display); font-size: clamp(84px, 14vw, 180px); letter-spacing: .08em;
  color: white; -webkit-text-stroke: 8px #14080c; paint-order: stroke fill;
}
.intro-word.pop { animation: slam .35s cubic-bezier(.2,1.4,.3,1); }
#ult { pointer-events: auto; background: rgba(5,6,10,.72); }
#ult-art {
  position: absolute; z-index: 1; left: 4%; bottom: 0; height: 92%; width: 42%; object-fit: contain; object-position: left bottom;
  filter: drop-shadow(0 0 24px rgba(255,45,106,.45));
}
#ult-art.face-left { transform: scaleX(-1); object-position: right bottom; }
.ult-fx { position: absolute; z-index: 0; inset: 0; }
.ult-copy { position: relative; z-index: 2; text-align: right; padding: 12vh 6vw 0 40%; }
.ult-kicker { letter-spacing: .28em; color: var(--pink-2); font-size: 14px; }
.ult-name {
  font-family: var(--display); font-size: clamp(48px, 7vw, 108px); line-height: .9; color: white;
  -webkit-text-stroke: 7px #14080c; paint-order: stroke fill; animation: slam .35s ease;
}
.ult-zh { font-size: clamp(22px, 3vw, 36px); font-weight: 800; letter-spacing: .2em; color: var(--pink-2); }
#ult[data-fighter="scarlet"] .ult-fx { background: repeating-linear-gradient(115deg, transparent 0 18px, rgba(255,45,80,.35) 18px 22px); }
#ult[data-fighter="volt"] .ult-fx { background: radial-gradient(circle at 70% 40%, rgba(255,220,80,.35), transparent 28%), repeating-linear-gradient(90deg, transparent 0 36px, rgba(255,220,80,.25) 36px 38px); }
#ult[data-fighter="rime"] .ult-fx { background: radial-gradient(circle at 30% 60%, rgba(140,210,255,.4), transparent 26%); }
#ult[data-fighter="gale"] .ult-fx { background: repeating-linear-gradient(100deg, transparent 0 16px, rgba(80,220,140,.3) 16px 18px); }
#ult[data-fighter="astra"] .ult-fx { background: radial-gradient(circle at 20% 30%, #fff 0 2px, transparent 3px), radial-gradient(circle at 60% 20%, #ffe9a0 0 2px, transparent 3px), radial-gradient(circle at 40% 50%, rgba(255,230,160,.25), transparent 30%); }

#screen-victory {
  position: absolute; inset: 0; z-index: 7; display: grid; place-items: center;
  background: rgba(0,0,0,.45);
}
.victory-card {
  width: min(640px, calc(100% - 40px)); max-height: 92vh; overflow: auto; text-align: center; color: white;
  background: radial-gradient(circle at 50% 0, #ff4d78, #c4123e 46%, #6c0c28);
  border-radius: 8px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.victory-kicker { letter-spacing: .4em; margin: 0; font-size: 12px; }
.victory-card h2 { margin: 4px 0; font-family: var(--display); font-size: clamp(56px, 8vw, 88px); }
#victory-sub { margin: 0 0 12px; }
.scoreline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scoreline div { background: rgba(0,0,0,.22); border-radius: 6px; padding: 10px; }
.scoreline strong, .scoreline b, .scoreline span { display: block; }
.scoreline b { font-family: var(--display); font-size: 36px; }
.scoreline .winner { outline: 2px solid white; }
.victory-actions { margin-top: 12px; }
.victory-actions .go { margin-top: 0; }
.victory-actions button:disabled { opacity: .48; cursor: not-allowed; filter: grayscale(.35); }
.solo-wrong-review { margin-top: 12px; padding: 10px 12px; max-height: 26vh; overflow: auto; background: rgba(0,0,0,.2); text-align: left; }
.solo-wrong-review h3 { margin: 0 0 6px; color: #f0dfbc; font-size: 15px; }
.solo-wrong-review ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.solo-wrong-review li { display: grid; gap: 2px; padding: 7px 9px; background: rgba(0,0,0,.18); }
.solo-wrong-review li strong { overflow-wrap: anywhere; }
.solo-wrong-review li span { color: #e6dcc5; font-size: 15px; overflow-wrap: anywhere; }

#modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.modal-card { width: min(420px, calc(100% - 32px)); background: #141820; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(8px);
  background: #141820; border: 1px solid var(--pink); border-radius: 999px; padding: 8px 14px;
  opacity: 0; z-index: 70; transition: .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

.float-num {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--display); font-size: 64px; color: white;
  -webkit-text-stroke: 6px #14080c; paint-order: stroke fill;
  animation: floatUp .75s ease forwards; pointer-events: none;
}
.float-num.ult { font-size: 84px; color: var(--gold); }
.float-num.heal { color: #b6ffb0; font-size: 48px; }

@keyframes lunge1 {
  0%, 100% { transform: none; }
  20% { transform: translateX(-4px) translateY(7px); }
  48% { transform: translateX(7px) translateY(-5px); }
  64% { transform: translateX(2px); }
}
@keyframes lunge2 {
  0%, 100% { transform: scaleX(-1); }
  20% { transform: scaleX(-1) translateX(-4px) translateY(7px); }
  48% { transform: scaleX(-1) translateX(7px) translateY(-5px); }
  64% { transform: scaleX(-1) translateX(2px); }
}
@keyframes hit1 {
  0%, 100% { transform: none; }
  12% { filter: brightness(2.5); transform: translateX(10px); }
  38% { filter: brightness(1.35); transform: translateX(-38px) rotate(-7deg); }
  62% { transform: translateX(8px) rotate(3deg); }
}
@keyframes hit2 {
  0%, 100% { transform: scaleX(-1); }
  12% { filter: brightness(2.5); transform: scaleX(-1) translateX(-10px); }
  38% { filter: brightness(1.35); transform: scaleX(-1) translateX(-38px) rotate(-7deg); }
  62% { transform: scaleX(-1) translateX(8px) rotate(3deg); }
}
@keyframes brace1 {
  0%, 100% { transform: none; }
  18% { transform: translateX(-14px) translateY(8px) scale(.92); }
  42% { filter: brightness(1.6); transform: translateX(-8px) translateY(2px) scale(.96); }
  68% { transform: translateX(3px) scale(1.03); }
}
@keyframes brace2 {
  0%, 100% { transform: scaleX(-1); }
  18% { transform: scaleX(-1) translateX(-14px) translateY(8px) scale(.92); }
  42% { filter: brightness(1.6); transform: scaleX(-1) translateX(-8px) translateY(2px) scale(.96); }
  68% { transform: scaleX(-1) translateX(3px) scale(1.03); }
}
@keyframes whiff1 {
  0%, 100% { transform: none; }
  28% { transform: translateX(14px) rotate(3deg) scale(1.04); }
  54% { transform: translateX(32px) rotate(-4deg) scale(.96); }
}
@keyframes whiff2 {
  0%, 100% { transform: scaleX(-1); }
  28% { transform: scaleX(-1) translateX(14px) rotate(3deg) scale(1.04); }
  54% { transform: scaleX(-1) translateX(32px) rotate(-4deg) scale(.96); }
}
@keyframes guardSigil {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.48) rotate(-8deg); }
  24% { opacity: .96; transform: translate(-50%, -50%) scale(1.06) rotate(3deg); }
  72% { opacity: .8; transform: translate(-50%, -50%) scale(.98) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.16) rotate(5deg); }
}
@keyframes ko1 { to { transform: translateY(24px) rotate(-12deg); opacity: .7; filter: grayscale(.35); } }
@keyframes ko2 { to { transform: scaleX(-1) translateY(24px) rotate(-12deg); opacity: .7; filter: grayscale(.35); } }
@keyframes ultRush1 {
  0%, 100% { transform: none; }
  35% { transform: translateX(8px) translateY(-2px); }
  78% { transform: translateX(24px) translateY(-4px); }
}
@keyframes ultRush2 {
  0%, 100% { transform: scaleX(-1); }
  35% { transform: scaleX(-1) translateX(8px) translateY(-2px); }
  78% { transform: scaleX(-1) translateX(24px) translateY(-4px); }
}
@keyframes callout {
  0% { opacity: 0; transform: translateY(8px) scale(.7); }
  18% { opacity: 1; transform: translateY(0) scale(1.05); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px) scale(.92); }
}
@keyframes arenaHitShake {
  0%, 100% { transform: translate(0, 0); }
  16% { transform: translate(-10px, 3px); }
  34% { transform: translate(12px, -3px); }
  52% { transform: translate(-7px, 2px); }
  72% { transform: translate(4px, -1px); }
}
@keyframes arenaHitFlash {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes slam { from { transform: scale(1.25); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes floatUp { to { transform: translate(-50%, -140%); opacity: 0; } }
@keyframes blink { 50% { opacity: .35; } }
body.frozen .fighter-art,
body.frozen .callout,
body.frozen .ult-name,
body.frozen .intro-word { animation-play-state: paused !important; }

/* Ink, cinnabar, and indigo: a martial-arts register for the classroom duel. */
:root {
  --bg: #151515;
  --panel: #211f1c;
  --panel-2: #2b2925;
  --line: rgba(208, 180, 119, .24);
  --pink: #a83c32;
  --pink-2: #d36b50;
  --blue: #3d68a1;
  --blue-2: #83a9dc;
  --text: #f0e7d3;
  --muted: #b1a78f;
  --good: #927642;
  --bad: #a83c32;
  --gold: #d8b66c;
  --font: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  background: var(--bg);
}
html, body { background: #151515; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .42;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(151, 128, 79, .17), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(219, 202, 161, .018) 5px 6px);
}
#world { opacity: .68; }
#dock button, .ghost, .row-actions button, .hp-presets button, .victory-actions button, .modal-actions button, .slot-toggle button {
  background: rgba(30, 29, 27, .94); border-color: var(--line); border-radius: 2px;
  color: var(--text); box-shadow: inset 0 0 0 1px rgba(0,0,0,.24);
}
#dock button.on, .hp-presets button.on { background: var(--pink); border-color: var(--gold); color: #fff5e5; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline-color: var(--gold); }
.brand-bar { border-bottom: 1px solid var(--line); margin: 0 0 14px; padding-top: 18px; }

.brand-sub { color: #c3b89e; }
#screen-setup { background: linear-gradient(180deg, rgba(28,27,25,.78), rgba(15,15,15,.9)); }
.panel {
  position: relative; background: linear-gradient(145deg, rgba(43,40,35,.97), rgba(24,23,21,.99));
  border: 1px solid rgba(216,182,108,.46); border-radius: 2px; box-shadow: 0 22px 64px rgba(0,0,0,.38);
}
.panel::before, .victory-card::before {
  content: ""; position: absolute; inset: 5px; border: 1px solid rgba(216,182,108,.17); pointer-events: none;
}
.panel h2 { color: #f0dfbc; letter-spacing: .14em; }
.panel-head p, .hint { color: #c2b99f; }
textarea, #alias-input { background: rgba(16,16,16,.94); border-color: rgba(216,182,108,.34); border-radius: 2px; color: #f3ead7; }
textarea::placeholder, #alias-input::placeholder { color: #857e6c; }
.table-wrap { border-color: var(--line); border-radius: 2px; }
th { background: #302d28; color: var(--gold); }
th, td { border-bottom-color: rgba(216,182,108,.13); }
#preview-note.ok { background: #392f20; color: #f0dfbc; border-radius: 2px; }
.go {
  position: relative; border: 1px solid #dfb86d; border-radius: 2px;
  background: linear-gradient(135deg, #b84a37, #8e2e28); color: #fff2dc;
  box-shadow: inset 0 0 0 2px rgba(66,21,17,.25), 0 5px 18px rgba(0,0,0,.2);
  letter-spacing: .2em;
}
.go:disabled { border-color: var(--line); }
.label { color: #d5c69f; }
#screen-select { background: linear-gradient(180deg, #292723, #151515 72%); }
#screen-setup .bank-return { background: linear-gradient(135deg, #a04435, #7f3029); color: #fff2dc; }
.hero-banner {
  border: 1px solid rgba(216,182,108,.56); border-radius: 2px;
  background: linear-gradient(100deg, rgba(20,18,18,.16), rgba(16,16,16,.62)), linear-gradient(100deg, #844039, #34312c 54%, #222221);
}
.hero-banner::after { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(240,220,171,.2); pointer-events: none; }
.kicker, .plate-kicker { color: #e2c88d; }
.ready-mark { color: #e4c47b; }
.ready-mark div { color: #e7ddc5; font-family: var(--font); }
.plate-name { color: #f4e9d3; text-shadow: 0 2px 12px rgba(0,0,0,.45); }
.plate-en { color: #e6c778; }
.plate-ult { color: #f0cf84; }
.plate-blurb { color: #e1d7c2; }
.plate-moves { color: #e1c88d; }
.mode-tile, .choice {
  border-color: var(--line); border-radius: 2px; background: rgba(38,36,33,.94); color: var(--text);
}
.mode-tile span { color: var(--gold); }
.mode-tile small, .choice span { color: #bdb49d; }
.mode-tile.on, .choice.on { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--pink); background: #302b25; }
.choose-label { color: #e7d6af; font-family: var(--font); letter-spacing: .24em; }
.slot-toggle button.on { background: #8f372f; border-color: var(--gold); }
#slot-p1.on { background: #8f372f; border-color: var(--pink-2); color: #fff2dc; }
#slot-p2.on { background: #345783; border-color: var(--blue-2); color: #f2f6ff; }
.fighter-card {
  border-color: rgba(216,182,108,.24); border-radius: 2px;
  background: linear-gradient(155deg, rgba(43,41,37,.97), rgba(23,23,22,.99));
}
.fighter-card:hover { border-color: rgba(216,182,108,.75); }
.fighter-card.p1 { outline: 2px solid var(--pink-2); border-color: var(--pink-2); box-shadow: inset 0 0 0 1px rgba(211,107,80,.38), 0 0 20px rgba(168,60,50,.16); }
.fighter-card.p2 { outline: 2px solid var(--blue-2); border-color: var(--blue-2); box-shadow: inset 0 0 0 1px rgba(131,169,220,.38), 0 0 20px rgba(61,104,161,.18); }
.match-settings { border-top-color: var(--line); }
input[type="range"] { accent-color: var(--gold); }
#screen-battle { background: linear-gradient(180deg, rgba(20,19,18,.5), transparent 48%, rgba(16,16,16,.48)); }
.badge { border-radius: 2px; border: 1px solid rgba(240,220,171,.3); color: #f8ecd2; }
.badge.p1 { background: #9f3a31; }
.badge.p2 { background: var(--blue); }
.side.p1 .badge.p1, .console.p1 .badge.p1 { background: #9f3a31; }
.side.p2 .badge.p2, .console.p2 .badge.p2 { background: var(--blue); }
.hp { background: #292725; border-color: rgba(216,182,108,.35); }
.hp-fill { background: linear-gradient(90deg, #db7b50, #a83c32); }
.side.p2 .hp-fill { background: linear-gradient(270deg, #a9c5ed, #3d68a1); }
.pips i { background: #393631; }
.pips[data-combo="1"] i:nth-child(1), .pips[data-combo="2"] i:nth-child(-n+2) { background: var(--gold); box-shadow: 0 0 8px rgba(216,182,108,.62); }
.side.p1 .pips[data-combo="1"] i:nth-child(1), .side.p1 .pips[data-combo="2"] i:nth-child(-n+2) { background: var(--pink-2); box-shadow: 0 0 8px rgba(211,107,80,.56); }
.side.p2 .pips[data-combo="1"] i:nth-child(1), .side.p2 .pips[data-combo="2"] i:nth-child(-n+2) { background: var(--blue-2); box-shadow: 0 0 8px rgba(131,169,220,.58); }
.pips[data-combo="2"] i:nth-child(3) { background: #fff0be; }
.pip-label { color: var(--gold); }
.side.p1 .pip-label { color: var(--pink-2); }
.side.p2 .pip-label { color: var(--blue-2); }
.banner { color: #ddc990; }
.console {
  background: linear-gradient(150deg, rgba(40,38,34,.98), rgba(23,23,22,.99));
  border-color: rgba(216,182,108,.28); border-radius: 2px;
}
.console.p1 { box-shadow: inset 3px 0 0 #a83c32; }
.console.p2 { box-shadow: inset -3px 0 0 var(--blue); }
.console.p1.live { border-color: rgba(211,107,80,.88); }
.console.p2.live { border-color: rgba(131,169,220,.9); }
.console.live { border-color: rgba(216,182,108,.82); }
.opt { background: rgba(48,46,42,.98); border-color: rgba(216,182,108,.24); border-radius: 2px; }
.opt.is-right { background: rgba(216,182,108,.16); border-color: #d8b66c; color: #e6c778; }
.opt.is-wrong { background: rgba(226,59,74,.16); border-color: #ef6874; color: #ff9ca5; }
.callout::after { color: #e7c878; }
.intro-word { -webkit-text-stroke-color: #1b1d16; }
#ult { background: rgba(16,16,16,.84); }
.ult-kicker, .ult-zh { color: #e3bf69; }
#screen-victory { background: rgba(7,12,9,.72); }
.victory-card {
  position: relative; border: 1px solid #d4b46e; border-radius: 2px;
  background: radial-gradient(ellipse at 50% 0, #754238, #36312b 58%, #201f1c);
}
.victory-kicker { color: #e2c783; }
.scoreline div { background: rgba(8,14,10,.4); border: 1px solid rgba(216,182,108,.18); border-radius: 2px; }
.scoreline .winner { outline-color: var(--gold); }
.modal-card { background: #282622; border-color: rgba(216,182,108,.46); border-radius: 2px; }
#toast { background: #282622; border-color: var(--gold); border-radius: 2px; }
#portrait-lock { background: #151515; }
.float-num.heal { color: #e5c87c; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

@media (max-height: 760px) {
  #screen-select { grid-template-rows: auto minmax(120px, 1fr) auto auto auto; }
  #screen-select > .brand-bar { padding: 6px 14px 2px; }
  #screen-select .logo { width: 100px; height: 48px; }
  .hero-banner { min-height: 0; }
  .hero-side img { height: clamp(170px, 35vh, 250px); }
  .choose-row { padding-top: 4px; }
  .roster { gap: 6px; padding-top: 4px; }
  .fighter-card { min-height: 0; }
  .fighter-card img { height: 100%; }
  .match-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding-top: 6px; padding-bottom: 8px; }
  .match-settings .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .hero-banner { margin-inline: 12px; }
  .hero-side { gap: 4px; }
  .hero-side img { width: clamp(120px, 17vw, 190px); }
  .plate { padding: 8px; }
  .plate-name { font-size: clamp(20px, 2.8vw, 30px); }
  .plate-blurb, .plate-moves { font-size: 11px; }
  .match-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
  .match-settings .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .solo-saves-panel { width: calc(100% - 24px); margin-top: 10px; }
  .story-save-slots { gap: 7px; }
  .story-save-slot, .free-mode-slot { min-height: 86px; padding: 10px; }
  .story-save-slot strong, .free-mode-slot strong { font-size: 16px; }
  .choose-label { display: none; }
  .slot-toggle { flex-wrap: wrap; justify-content: flex-end; }
  .hero-banner { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); margin-inline: 8px; }
  .hero-side { flex-direction: column; justify-content: end; align-items: center; gap: 0; }
  .hero-side.p2 { flex-direction: column-reverse; }
  .hero-side img { height: clamp(128px, 26vh, 185px); width: clamp(92px, 28vw, 150px); }
  .hero-side .plate { align-self: stretch; text-align: center; padding: 4px; }
  .plate-kicker { font-size: 9px; }
  .plate-name { font-size: 18px; }
  .plate-en, .plate-blurb, .plate-moves, .plate-ult { display: none; }
  .ready-mark { font-size: 26px; padding: 0 4px; }
  .ready-mark div { font-size: 8px; }
  .choose-row { padding-inline: 8px; flex-wrap: wrap; }
  .roster { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-inline: 8px; }
  .match-settings { padding-inline: 8px; }
}
