:root {
  color-scheme: dark;
  --canvas: #100e1a;
  --panel: #1b172a;
  --line: #383048;
  --text: #f8f3fc;
  --muted: #b9aec9;
  --lavender: #d1b7fa;
  --gold: #f6c976;
  --mint: #9ee3c6;
  --pink: #ffadb5;
  --display: Georgia, 'Times New Roman', serif;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; background: radial-gradient(ellipse at 50% 0, #21172d 0, transparent 58%); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, summary:focus-visible, .arcade-link:focus-visible { outline: 3px solid var(--lavender); outline-offset: 4px; }
[hidden] { display: none !important; }
svg { display: inline-block; width: 1.15em; height: 1.15em; flex: none; }
img { display: block; max-width: 100%; }
h1, h2, p, fieldset { margin: 0; }
fieldset { padding: 0; min-width: 0; border: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.08; }
h2 { font-size: clamp(1.65rem, 3vw, 2.2rem); }

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-header { border-bottom: 1px solid #2c2539; background: #14111e; }
.header-inner, .page { width: min(1160px, calc(100% - 56px)); margin-inline: auto; }
.header-inner { min-height: 70px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark, .climb-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #5f483a; border-radius: 10px; background: #2d2330; color: var(--gold); }
.brand-mark svg, .climb-icon svg { width: 24px; height: 24px; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 1.3rem/1.05 var(--display); }
.brand small { margin-top: 5px; color: var(--muted); font-size: .59rem; font-weight: 700; letter-spacing: .19em; }
.header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.help-button, .motion-button, .secondary-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 9px 13px; min-height: 40px; border: 1px solid #493d57; border-radius: 8px; background: #211b2f; color: #eee5f6; font-size: .87rem; font-weight: 650; }
.help-button:hover, .motion-button:hover, .secondary-button:hover { background: #2b233a; border-color: var(--lavender); }
.arcade-link { text-decoration: none; white-space: nowrap; }
.help-icon { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid #a48bc4; border-radius: 50%; color: var(--lavender); font-size: .75rem; line-height: 1; }
.header-short-label { display: none; }
.motion-state { min-width: 28px; padding: 2px 5px; border-radius: 4px; background: #203a2c; color: #b7eccd; font-size: .7rem; text-align: center; }
.motion-button[aria-pressed="false"] .motion-state { background: #393147; color: #dfd4eb; }

.page { padding-block: 30px 52px; }
.hero-banner { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; min-height: 258px; border: 1px solid #67513c; border-radius: 13px; background: #1c1521; }
.hero-art { position: absolute; z-index: -2; right: 0; top: 0; width: 78%; height: 100%; object-fit: cover; object-position: center 46%; }
.hero-banner::after { position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #1c1521 16%, #1c1521f7 30%, #1c152150 72%, transparent), linear-gradient(0deg, #15101994, transparent 30%); content: ''; }
.hero-copy { padding: 38px 44px; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--lavender); font-size: .67rem; font-weight: 800; letter-spacing: .15em; line-height: 1.3; }
.hero-kicker { color: var(--gold); }
.kicker-diamond { width: 7px; height: 7px; transform: rotate(45deg); background: var(--gold); box-shadow: 0 0 13px #f6c9766e; }
.hero-copy h1 { margin-top: 12px; font-size: clamp(2.7rem, 6.8vw, 5.1rem); line-height: .98; letter-spacing: -.065em; }
.hero-copy em { color: var(--gold); font-style: normal; }
.hero-copy > p:last-child { max-width: 340px; margin-top: 18px; color: #d9cde4; font-size: 1rem; line-height: 1.6; }
.hero-chapter { position: absolute; right: 16px; bottom: 15px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid #9874a377; border-radius: 6px; background: #1d142ddb; color: #eee0fa; font-size: .62rem; font-weight: 750; letter-spacing: .12em; }
.hero-chapter svg { color: var(--gold); }

.roster { margin-top: 30px; }
.section-heading, .campaign-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 15px; }
.section-heading h2, .campaign-heading h1 { margin-top: 7px; }
.section-heading > p { color: var(--muted); font-size: .89rem; }
.eyebrow-number { padding: 3px 6px; border: 1px solid #55456d; border-radius: 4px; background: #2b203e; color: #ddc7ff; font-size: .61rem; letter-spacing: .06em; }
.roster-grid, .upgrade-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.knight { --hero-color: #92e2db; --portrait-position: 0%; }
.mage { --hero-color: #ffd28b; --portrait-position: 50%; }
.ranger { --hero-color: #c4e89d; --portrait-position: 100%; }
.hero-card { position: relative; display: flex; cursor: pointer; }
.hero-card-body { position: relative; flex: 1; min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid #5b4957; border-radius: 10px; background: #1d1723; transition: border-color .15s; }
.hero-card:hover .hero-card-body { border-color: var(--hero-color); }
.hero-card input:checked + .hero-card-body { border-color: var(--hero-color); box-shadow: 0 0 0 1px var(--hero-color), 0 0 22px #110a15; }
.hero-card input:focus-visible + .hero-card-body, .upgrade-choice input:focus-visible + span { outline: 3px solid var(--lavender); outline-offset: 4px; }
.hero-portrait { position: relative; display: block; height: clamp(178px, 24vw, 284px); background: #2a2231 url('./art/realistic/champions.png') var(--portrait-position) top / 300% auto no-repeat; }
.hero-portrait::after { position: absolute; inset: 0; background: linear-gradient(0deg, #1d1723 0%, #1d172300 28%); content: ''; }
.hero-card-details { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 0 16px 13px; }
.hero-card-role { color: var(--hero-color); font-size: .67rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero-name { margin-top: 3px; font: 700 clamp(1.55rem, 3vw, 2rem)/1.05 var(--display); }
.hero-description { margin: 7px 0 12px; color: var(--muted); font-size: .81rem; line-height: 1.42; }
.radio-mark { position: absolute; right: 10px; top: 10px; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #a997a9; border-radius: 50%; background: #1a1422e8; color: #1a2026; }
.radio-mark svg { visibility: hidden; width: 15px; height: 15px; }
.hero-card input:checked + .hero-card-body .radio-mark { border-color: var(--hero-color); background: var(--hero-color); }
.hero-card input:checked + .hero-card-body .radio-mark svg { visibility: visible; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px solid #75658540; color: #e3d8f0; font-size: .69rem; font-weight: 750; letter-spacing: .015em; }
.hero-stats > span { display: inline-flex; align-items: center; gap: 4px; }
.hero-stats svg { color: var(--hero-color); }
.difficulty-picker { margin-top: 18px; }
.difficulty-picker legend { margin-bottom: 8px; padding: 0; font-size: .9rem; font-weight: 750; }
.difficulty-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.difficulty-choice { position: relative; display: flex; min-width: 0; cursor: pointer; }
.difficulty-choice > span { position: relative; display: grid; align-content: start; gap: 4px; width: 100%; padding: 10px 35px 10px 12px; border: 1px solid #5e4b6c; border-radius: 8px; background: #211a31; }
.difficulty-choice > span::after { position: absolute; top: 12px; right: 12px; width: 14px; height: 14px; border: 1px solid #ab94c5; border-radius: 50%; content: ''; }
.difficulty-choice strong { color: var(--text); font-size: .86rem; }
.difficulty-choice small { color: var(--muted); font-size: .75rem; line-height: 1.35; }
.difficulty-choice:hover > span, .difficulty-choice input:checked + span { border-color: var(--lavender); }
.difficulty-choice input:checked + span { background: #302343; box-shadow: inset 0 0 0 1px var(--lavender); }
.difficulty-choice input:checked + span::after { border-color: var(--lavender); background: var(--lavender); box-shadow: inset 0 0 0 3px #302343; }
.difficulty-choice input:focus-visible + span { outline: 3px solid var(--lavender); outline-offset: 3px; }
.climb-bar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 15px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: #171322; }
.climb-caption { display: flex; align-items: center; gap: 10px; }
.climb-caption strong, .climb-caption small { display: block; }
.climb-caption strong { font-size: .9rem; }
.climb-caption small { margin-top: 2px; color: var(--muted); font-size: .77rem; }
.climb-icon { width: 36px; height: 36px; border-radius: 8px; }
.climb-icon svg { width: 19px; height: 19px; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 11px; min-height: 44px; padding: 10px 16px; border: 1px solid #ffd991; border-radius: 8px; background: #f6c976; color: #251a20; box-shadow: 0 2px 0 #976533; font-weight: 800; font-size: .88rem; }
.primary-button:hover { background: #ffdc99; }
.primary-button:active { transform: translateY(1px); box-shadow: 0 1px 0 #976533; }
.primary-button svg { width: 16px; height: 16px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 4px; border: 0; border-radius: 4px; background: transparent; color: var(--lavender); font-weight: 700; font-size: .82rem; }
.text-button:hover { text-decoration: underline; }

#game:has(.campaign) { padding-block: 8px 10px; }
body:has(.campaign) .header-inner { min-height: 52px; }
body:has(.campaign-active) { display: flex; flex-direction: column; height: 100svh; }
body:has(.campaign-active) .site-header { flex: none; }
#game:has(.campaign-active), body:has(.campaign-active) .header-inner {
  width: min(1600px, calc(100% - clamp(16px, 3vw, 44px)));
}
#game:has(.campaign-active), .campaign-active {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}
.campaign { margin-inline: auto; }
.campaign-active { width: 100%; }
.campaign-heading { align-items: center; margin-bottom: 6px; }
.campaign-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.campaign-heading .eyebrow { flex-wrap: wrap; }
.campaign-heading h1 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.15rem); letter-spacing: -.035em; }
.campaign-body { display: grid; align-items: start; gap: 10px; }
.campaign-body > * { min-width: 0; }
.campaign-active .campaign-body { flex: 1 0 auto; }
.campaign-active .campaign-body > .arena { display: flex; flex-direction: column; align-self: stretch; }
.campaign-victory .campaign-body { grid-template-columns: minmax(0, 560px); justify-content: center; }
.difficulty-badge { padding: 3px 6px; border: 1px solid #705742; border-radius: 4px; background: #382b2e; color: var(--gold); font-size: .61rem; letter-spacing: .06em; }
.leave-button { color: var(--muted); flex: none; }
.tower-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; margin: 0 0 8px; padding: 0; list-style: none; }
.tower-steps li { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 3px 6px; border: 1px solid #382f48; border-radius: 8px; background: #1a1627; color: var(--muted); font-size: .68rem; font-weight: 650; }
.tower-steps li.current { border-color: #a68bc8; color: var(--text); background: #2b2140; }
.tower-steps li.cleared { color: var(--mint); }
.step-number { display: grid; place-items: center; min-width: 21px; height: 21px; border-radius: 4px; background: #2e253d; color: var(--lavender); font-size: .65rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.current .step-number { background: var(--lavender); color: #1d142a; }
.cleared .step-number { background: #203b37; color: var(--mint); }
.arena { --arena-border: #68503c; border: 1px solid var(--arena-border); border-radius: 12px; overflow: hidden; background: #19131b; }
.battle-stage {
  --arena-light: #3d6e5e33;
  --enemy-column: 0%;
  --enemy-row: 0%;
  --player-center: 29%;
  --enemy-center: 74%;
  --strike-light: #c5fff0;
  --guardian-light: #b0ed76;
  --attack-reach: 26cqw;
  --attack-lean: 5deg;
  --counter-reach: -19cqw;
  --counter-lift: 0px;
  --effect-scale: 1;
  position: relative;
  isolation: isolate;
  container-type: size;
  height: clamp(200px, 36svh, 340px);
  overflow: hidden;
  background: linear-gradient(180deg, #100b10ec, #100b1070 23%, transparent 52%, #110b0b40),
    radial-gradient(ellipse at 70% 70%, var(--arena-light), transparent 62%),
    #211923 var(--arena-backdrop, url('./art/realistic/arena.png')) center 71% / cover no-repeat;
}
.campaign-active .battle-stage {
  flex: 1 0 auto;
  height: auto;
  min-height: clamp(136px, 22svh, 200px);
}
.arena-slime {
  --arena-backdrop: url('./art/realistic/arena-slime.webp');
  --counter-lift: -5cqh;
}
.arena-mimic {
  --arena-backdrop: url('./art/realistic/arena-mimic.webp');
  --enemy-column: 50%;
  --arena-light: #8a60283f;
  --guardian-light: #ffbd7d;
}
.arena-guard {
  --arena-backdrop: url('./art/realistic/arena-guard.webp');
  --enemy-column: 100%;
  --arena-light: #66439c48;
  --guardian-light: #d9adff;
}
.arena-golem {
  --arena-backdrop: url('./art/realistic/arena-golem.webp');
  --enemy-row: 100%;
  --arena-light: #32778756;
  --guardian-light: #90efff;
}
.arena-wyrm {
  --arena-backdrop: url('./art/realistic/arena-wyrm.webp');
  --enemy-column: 50%;
  --enemy-row: 100%;
  --arena-light: #39588b52;
  --guardian-light: #add0ff;
  --counter-reach: -3cqw;
}
.arena-king {
  --arena-backdrop: url('./art/realistic/arena-king.webp');
  --enemy-column: 100%;
  --enemy-row: 100%;
  --arena-light: #ac353c66;
  --guardian-light: #ffc981;
  --counter-reach: -4cqw;
}
.arena-hud {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(7px, 2vw, 23px);
  padding: clamp(11px, 2vw, 22px) clamp(10px, 3.2vw, 34px);
  pointer-events: none;
}
.health { --health-start: #538e79; --health-end: #c1f2b2; min-width: 0; text-shadow: 0 2px 5px #080508; }
.enemy-health { --health-start: #ac3939; --health-end: #ffb586; text-align: right; }
.health-role { color: #efcd9e; font-size: .58rem; font-weight: 800; letter-spacing: .13em; }
.health-name { margin: 3px 0 5px; color: #fff4e3; font: 700 clamp(.96rem, 2.55vw, 1.75rem)/1 var(--display); }
.health-track { display: grid; grid-template-rows: minmax(0, 1fr); height: 13px; padding: 2px; border: 1px solid #a68257; background: #24131d; box-shadow: 0 2px 8px #09060b; clip-path: polygon(0 0, 98% 0, 100% 50%, 98% 100%, 0 100%); }
.health-track > span { grid-area: 1 / 1; width: var(--health-percent); }
.health-lag { background: #f5be79; transition: width 210ms ease-out 85ms; }
.health-fill { background: linear-gradient(180deg, #ffffff35, transparent 53%), linear-gradient(90deg, var(--health-start), var(--health-end)); transition: width 130ms ease-out; }
.enemy-health .health-track { transform: scaleX(-1); }
.health-count { margin-top: 3px; color: #fff4e3; font-size: .76rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.health-count small { color: #deccca; font-size: .66rem; font-weight: 650; }
.arena-round { display: grid; align-content: center; justify-items: center; gap: 1px; width: clamp(39px, 7vw, 65px); aspect-ratio: 1; padding-bottom: 3px; border: 1px solid #b28b5b; border-radius: 50%; background: radial-gradient(circle at 50% 0%, #4c3330, #171018 66%); box-shadow: 0 2px 10px #0c090e, inset 0 0 0 3px #291c25; color: #f6d8a2; }
.arena-round span { font-size: clamp(.44rem, 1.2vw, .59rem); font-weight: 800; letter-spacing: .11em; }
.arena-round strong { font: 700 clamp(1rem, 3vw, 1.74rem)/.95 var(--display); }
.arena-fighter { position: absolute; bottom: 8%; display: grid; place-items: end center; pointer-events: none; transform-origin: center 96%; }
.arena-player { --fallen-pose: translate(-5cqw, 10%) rotate(-29deg) scale(.83, .57); left: 8%; width: 43%; height: 78%; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.arena-opponent { --fallen-pose: translate(5cqw, 10%) rotate(29deg) scale(.83, .57); right: 8%; width: min(45cqw, 80cqh); aspect-ratio: 1; }
.fighter-art { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 7px 5px #10090dda); transform-origin: center 95%; }
.arena-player .fighter-art { grid-area: 1 / 1; min-width: 0; min-height: 0; }
.fighter-idle { transition: opacity 65ms ease-out; }
.fighter-pose { visibility: hidden; opacity: 0; transition: opacity 65ms ease-out; }
.battle-stage[data-hero="knight"] .fighter-pose { transform: translateY(3.5%); }
.enemy-art { position: relative; }
.enemy-art::before { position: absolute; inset: 0; background: url('./art/realistic/enemies.png') var(--enemy-column) var(--enemy-row) / 300% 200% no-repeat; filter: url(#enemy-cutout); content: ''; }
.fighter-downed { transform: var(--fallen-pose); opacity: .62; }
.damage-pop { position: absolute; top: 24%; left: 50%; z-index: 1; opacity: 0; white-space: nowrap; color: #ffe1a9; font: 800 clamp(1rem, 3cqw, 2.1rem)/1 var(--display); text-shadow: 0 2px 2px #390f0b, 0 0 6px #130809, 1px 0 #130809, -1px 0 #130809; }
.arena-player .damage-pop { color: #ffc1b2; }
.battle-stage[data-blocked="true"] .arena-player .damage-pop { color: #c8faff; }
.arena-outcome { position: absolute; z-index: 3; top: 49%; left: 50%; width: max-content; max-width: 92%; transform: translate(-50%, -50%); padding: .28em .62em .38em; border-block: 1px solid #a67a51; background: linear-gradient(90deg, transparent, #100b12ef 14% 86%, transparent); color: #ffe3ad; text-align: center; text-shadow: 0 2px 7px #170c0b; font: 700 clamp(1.15rem, 4.8vw, 3.2rem)/1 var(--display); }
.arena-status { display: grid; gap: 5px; min-height: 37px; padding: 8px 13px; border-top: 1px solid var(--arena-border); background: #211921; }
.enemy-intent { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; color: #dfd0cc; font-size: .77rem; }
.enemy-intent strong, .enemy-intent svg { color: #ffc6a6; }
.arena-report { color: #eee0d8; font-size: .8rem; line-height: 1.4; }

.battle-stage[data-hero="mage"] { --strike-light: #ffab61; --attack-reach: 4cqw; --attack-lean: 2deg; }
.battle-stage[data-hero="ranger"] { --strike-light: #d5f9a0; --attack-reach: 3cqw; --attack-lean: 1deg; }
.battle-stage[data-move="guard"] { --effect-scale: .76; }
.battle-stage[data-move="power"] { --effect-scale: 1.35; }
.battle-stage[data-hero="knight"][data-move="guard"] { --attack-reach: 21cqw; }
.battle-stage[data-hero="knight"][data-move="power"] { --attack-reach: 31cqw; --attack-lean: 8deg; }
.battle-stage:not([data-beat]) .arena-fighter:not(.fighter-downed) .fighter-art:not(.fighter-pose) { animation: fighter-ready 3.2s ease-in-out infinite; }
.battle-stage:not([data-beat]) .arena-opponent:not(.fighter-downed) .fighter-art { animation-delay: -.8s; }
.battle-stage[data-pose-ready]:is([data-beat="attack"], [data-beat="impact"]) .fighter-pose { visibility: visible; opacity: 1; }
.battle-stage[data-pose-ready]:is([data-beat="attack"], [data-beat="impact"]) .fighter-idle { opacity: 0; }
.battle-stage[data-beat="attack"] .arena-player { animation: attack-windup var(--beat-duration) ease-out both; }
.battle-stage[data-beat="impact"] .arena-player { animation: attack-return var(--beat-duration) ease-out both; }
.battle-stage[data-beat="impact"] .arena-opponent { animation: opponent-recoil var(--beat-duration) ease-out both; }
.battle-stage[data-beat="counter"] .arena-opponent { animation: counter-advance var(--beat-duration) ease-out both; }
.battle-stage[data-beat="counter-hit"] .arena-opponent { animation: counter-return var(--beat-duration) ease-out both; }
.battle-stage[data-beat="counter-hit"] .arena-player { animation: player-recoil var(--beat-duration) ease-out both; }
.battle-stage[data-beat="counter-hit"][data-blocked="true"] .arena-player { animation-name: player-block; }
.battle-stage[data-beat="knockout"][data-knockout="hero"] .arena-player,
.battle-stage[data-beat="knockout"][data-knockout="enemy"] .arena-opponent { animation: fighter-collapse var(--beat-duration) cubic-bezier(.24, .63, .37, 1) both; }
.battle-stage:is([data-beat="impact"], [data-beat="counter"], [data-beat="counter-hit"], [data-beat="knockout"]) .arena-opponent .damage-pop:not(:empty),
.battle-stage:is([data-beat="counter-hit"], [data-beat="knockout"]) .arena-player .damage-pop:not(:empty) { animation: damage-rise 480ms ease-out both; }

.arena-effects { position: absolute; z-index: 1; inset: 0; pointer-events: none; }
.arena-effects > span { position: absolute; opacity: 0; }
.attack-trail, .hit-sparks, .counter-trail, .block-flare { top: 49%; transform: translate(-50%, -50%); }
.attack-trail { left: var(--enemy-center); color: var(--strike-light); }
.battle-stage[data-hero="knight"] .attack-trail {
  left: calc(var(--enemy-center) - 6%);
  top: 45%;
  width: clamp(65px, 19cqw, 174px);
  aspect-ratio: 1.32;
  background: conic-gradient(from 12deg, transparent 0deg 26deg, #fff8df 80deg, currentColor 101deg 153deg, transparent 208deg);
  mask: radial-gradient(ellipse at center, transparent 49%, #000 59% 66%, transparent 73%);
  filter: drop-shadow(0 0 6px currentColor);
}
.battle-stage[data-hero="knight"][data-beat="impact"] .attack-trail { animation: blade-arc var(--beat-duration) ease-out both; }
.battle-stage[data-hero="mage"] .attack-trail {
  width: clamp(39px, 13cqw, 145px);
  aspect-ratio: 2.8;
  background: radial-gradient(ellipse at 78% 50%, #fffce0 0 11%, #ffd786 17% 25%, #f27435 39%, transparent 68%), linear-gradient(90deg, transparent 3%, #bf3925 70%, #ffc070);
  clip-path: polygon(0 48%, 37% 25%, 24% 33%, 74% 3%, 94% 16%, 100% 50%, 94% 82%, 74% 97%, 29% 69%, 42% 76%);
  filter: drop-shadow(0 0 9px #f3894a);
}
.battle-stage[data-hero="ranger"] .attack-trail {
  width: clamp(45px, 14cqw, 135px);
  height: clamp(7px, 1.1cqw, 12px);
  background: linear-gradient(90deg, #a8e19f00, #bce4b2 37%, #dcb872 78%, #fbefd2 92%);
  clip-path: polygon(0 43%, 82% 36%, 81% 0, 100% 50%, 81% 100%, 82% 65%, 0 57%);
  filter: drop-shadow(0 0 5px #dbfab1);
}
.battle-stage:is([data-hero="mage"], [data-hero="ranger"])[data-beat="attack"] .attack-trail { animation: projectile-release var(--beat-duration) ease-in both; }

.hit-sparks {
  left: var(--enemy-center);
  width: clamp(48px, 12cqw, 136px);
  aspect-ratio: 1;
  color: var(--strike-light);
  background: radial-gradient(circle, #fff6df 0 7%, currentColor 10%, transparent 42%), repeating-conic-gradient(from 12deg, transparent 0deg 18deg, currentColor 20deg 23deg, transparent 27deg 44deg);
  mask: radial-gradient(circle, #000 8% 32%, transparent 70%);
}
.battle-stage[data-beat="counter-hit"] .hit-sparks { left: var(--player-center); color: var(--guardian-light); }
.battle-stage[data-beat="impact"] .hit-sparks,
.battle-stage[data-beat="counter-hit"]:not([data-blocked="true"]) .hit-sparks { animation: sparks-scatter var(--beat-duration) ease-out both; }
.counter-trail {
  left: var(--player-center);
  width: clamp(48px, 14cqw, 140px);
  aspect-ratio: 3.3;
  color: var(--guardian-light);
  background: radial-gradient(ellipse at 20% 50%, #ffecd2 0 6%, currentColor 17% 26%, transparent 64%), linear-gradient(90deg, currentColor, transparent 89%);
  clip-path: polygon(0 50%, 25% 13%, 100% 27%, 67% 50%, 95% 73%, 23% 88%);
  filter: drop-shadow(0 0 7px currentColor);
}
.battle-stage[data-beat="counter"] .counter-trail { animation: counter-projectile var(--beat-duration) ease-in both; }
.block-flare {
  left: calc(var(--player-center) + 6%);
  width: clamp(37px, 10cqw, 98px);
  aspect-ratio: .79;
  border: 2px solid #d1f7ff;
  border-radius: 46% 46% 40% 40%;
  background: radial-gradient(ellipse at right, #b9f4ff55, #5dbae51b 55%, transparent 73%);
  box-shadow: inset 0 0 10px #c3eefa9c, 0 0 14px #72d2f5a3;
}
.battle-stage[data-beat="counter-hit"][data-blocked="true"] .block-flare { animation: guard-flare var(--beat-duration) ease-out both; }
.arena-flash { inset: 0; background: radial-gradient(ellipse at 72% 48%, #ffdc9c29, transparent 49%); }
.battle-stage[data-beat="impact"][data-move="power"] .arena-flash { animation: local-glow var(--beat-duration) ease-out both; }

.arena-callout {
  position: absolute;
  z-index: 3;
  top: 49%;
  left: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) skewX(-7deg);
  padding: .1em .35em .22em;
  color: #ffe0a0;
  background: linear-gradient(90deg, transparent, #1d100ee8 20% 80%, transparent);
  font: italic 900 clamp(2.8rem, 11cqw, 7rem)/.92 var(--display);
  letter-spacing: .035em;
  white-space: nowrap;
  text-shadow: 0 2px #9c562c, 0 4px #492218, 0 6px 15px #110908, 0 0 26px #b35b36ba;
  pointer-events: none;
}
.battle-stage[data-intro]:not([data-beat]) .arena-callout { animation: fight-callout 900ms ease-out both; }
.battle-stage[data-beat="knockout"] .arena-callout { animation: knockout-callout var(--beat-duration) ease-out both; }

@keyframes fighter-ready { 50% { transform: scale(1.007, 1.013); } }
@keyframes attack-windup {
  22% { transform: translateX(-1.6cqw) rotate(-2deg); }
  83%, to { transform: translateX(var(--attack-reach)) rotate(var(--attack-lean)); }
}
@keyframes attack-return {
  from, 18% { transform: translateX(var(--attack-reach)) rotate(var(--attack-lean)); }
}
@keyframes opponent-recoil {
  23% { transform: translateX(3cqw) rotate(5deg); filter: brightness(1.16); }
  61% { transform: translateX(1cqw) rotate(2deg); }
}
@keyframes counter-advance {
  22% { transform: translateX(1.4cqw) rotate(2deg); }
  78% { transform: translate(var(--counter-reach), var(--counter-lift)) rotate(-5deg); }
  to { transform: translateX(var(--counter-reach)) rotate(-4deg); }
}
@keyframes counter-return { from { transform: translateX(var(--counter-reach)) rotate(-4deg); } }
@keyframes player-recoil {
  24% { transform: translateX(-3cqw) rotate(-5deg); filter: brightness(1.12); }
  61% { transform: translateX(-1cqw) rotate(-2deg); }
}
@keyframes player-block { 35% { transform: translateX(-1cqw) scale(1.02, .97); } }
@keyframes fighter-collapse {
  16% { filter: brightness(1.18); }
  79% { transform: var(--fallen-pose); opacity: .76; }
  to { transform: var(--fallen-pose); opacity: .62; }
}
@keyframes damage-rise {
  from { opacity: 0; transform: translate(-50%, 10%); }
  20%, 63% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -118%); }
}
@keyframes blade-arc {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-35deg) scale(.58); }
  24% { opacity: .96; }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(44deg) scale(var(--effect-scale)); }
}
@keyframes projectile-release {
  from, 18% { left: calc(var(--player-center) + 4%); opacity: 0; }
  40% { opacity: 1; }
  to { left: calc(var(--enemy-center) - 3%); opacity: 1; transform: translate(-50%, -50%) scale(var(--effect-scale)); }
}
@keyframes counter-projectile {
  from, 18% { left: calc(var(--enemy-center) - 4%); opacity: 0; }
  49% { opacity: .85; }
  to { left: calc(var(--player-center) + 2%); opacity: .85; }
}
@keyframes sparks-scatter {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.36); }
  19% { opacity: .91; }
  to { opacity: 0; transform: translate(-50%, -50%) scale(var(--effect-scale)); }
}
@keyframes guard-flare {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.77); }
  23% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.13); }
}
@keyframes local-glow { 22% { opacity: .9; } }
@keyframes fight-callout {
  from { opacity: 0; transform: translate(-50%, -50%) skewX(-7deg) scale(1.22); }
  21%, 65% { opacity: 1; transform: translate(-50%, -50%) skewX(-7deg); }
  to { opacity: 0; transform: translate(-50%, -50%) skewX(-7deg) scale(.96); }
}
@keyframes knockout-callout {
  from, 14% { opacity: 0; transform: translate(-50%, -50%) skewX(-7deg) scale(1.22); }
  40%, to { opacity: 1; transform: translate(-50%, -50%) skewX(-7deg); }
}

.battle-stage[data-technique="aegis"] {
  --aegis-reach: 12cqw;
  --strike-light: #9dffe8;
  --effect-scale: 1.15;
}
.battle-stage[data-technique="aegis"] :is(.attack-trail, .block-flare) { display: none; }
.battle-stage[data-technique="aegis"][data-beat="attack"] .arena-player { animation-name: aegis-step; }
.battle-stage[data-technique="aegis"][data-beat="impact"] .arena-player { animation-name: aegis-recover; }
.aegis-ward {
  left: calc(var(--player-center) + 8%);
  top: 50%;
  width: clamp(59px, 13cqw, 151px);
  aspect-ratio: 100 / 124;
  transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 124' stroke-linejoin='round'%3E%3Cpath d='M50 4 91 20 85 64Q81 93 50 120 19 93 15 64L9 20Z' fill='%23083646' fill-opacity='.78' stroke='%23bdfff3' stroke-width='4'/%3E%3Cpath d='M50 12 82 24 77 62Q74 85 50 108 26 85 23 62L18 24Z' fill='%2326d6c6' fill-opacity='.2' stroke='%2356cabc' stroke-width='2'/%3E%3Cpath d='M50 27 68 54 50 82 32 54Z' fill='%23157178' stroke='%23fff5c5' stroke-width='2'/%3E%3Cpath d='M39 54h22M50 40v29M23 29l8 3m38 0 8-3M35 82l5 5m25-5-5 5' stroke='%23cdfff5' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 8px #47ead4) drop-shadow(0 0 19px #2c9092a6);
}
.aegis-wave {
  left: var(--enemy-center);
  top: 49%;
  width: clamp(51px, 16cqw, 151px);
  aspect-ratio: .88;
  border: 3px solid #bfffee;
  border-left-color: transparent;
  border-radius: 50%;
  background: radial-gradient(ellipse at right, #a4ffea71, #2efbc025 48%, transparent 65%);
  box-shadow: 8px 0 15px #36dbc86b, inset -6px 0 12px #60ffe396;
}
.battle-stage[data-technique="aegis"][data-beat="attack"] .aegis-ward { animation: aegis-raise var(--beat-duration) ease-out both; }
.battle-stage[data-technique="aegis"][data-beat="impact"] .aegis-ward { animation: aegis-reset var(--beat-duration) ease-out both; }
.battle-stage[data-technique="aegis"][data-beat="impact"] .aegis-wave { animation: aegis-wave var(--beat-duration) ease-out both; }
.battle-stage[data-technique="aegis"][data-beat="counter"] .aegis-ward { opacity: .82; }
.battle-stage[data-technique="aegis"][data-beat="counter-hit"] .aegis-ward { animation: aegis-absorb var(--beat-duration) ease-out both; }

@keyframes aegis-step {
  28% { transform: translateX(-1.6cqw) scale(.98, .97); }
  83%, to { transform: translateX(var(--aegis-reach)) rotate(3deg); }
}
@keyframes aegis-recover {
  from, 16% { transform: translateX(var(--aegis-reach)) rotate(3deg); }
}
@keyframes aegis-raise {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-15deg) scale(.46); }
  37% { opacity: .92; transform: translate(-50%, -50%) rotate(-7deg) scale(.92); }
  to { opacity: 1; transform: translate(calc(-50% + var(--aegis-reach)), -50%) rotate(8deg) scale(1.08); }
}
@keyframes aegis-reset {
  from, 15% { opacity: 1; transform: translate(calc(-50% + var(--aegis-reach)), -50%) rotate(8deg) scale(1.08); }
  to { opacity: .82; transform: translate(-50%, -50%); }
}
@keyframes aegis-wave {
  from { left: calc(var(--player-center) + 8% + var(--aegis-reach)); opacity: .93; transform: translate(-50%, -50%) rotate(-14deg) scale(.68); }
  55% { left: var(--enemy-center); opacity: .85; }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(1.28); }
}
@keyframes aegis-absorb {
  from { opacity: .82; }
  23% { opacity: 1; transform: translate(-54%, -50%) scale(1.13, 1.06); filter: brightness(1.22) drop-shadow(0 0 14px #77ffdf); }
  62% { opacity: .7; }
  to { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
}

.battle-stage[data-technique="finisher"] {
  --strike-light: #ffba74;
  --effect-scale: 1.55;
}
.battle-stage[data-technique="finisher"][data-beat="attack"] .arena-player { animation-name: finisher-charge; }
.battle-stage[data-technique="finisher"][data-beat="impact"] .arena-player { animation-name: finisher-follow-through; }
.battle-stage[data-technique="finisher"][data-beat="impact"] .arena-opponent { animation-name: finisher-recoil; }
.battle-stage[data-finisher-ko][data-beat="knockout"] .arena-opponent { animation-name: finisher-collapse; }
.battle-stage[data-finisher-result] .arena-opponent.fighter-downed { opacity: .23; filter: saturate(.72); }
.finisher-vignette {
  z-index: -1;
  inset: 0;
  background: linear-gradient(0deg, #0a050b 0 6%, transparent 6% 94%, #0a050b 94%),
    radial-gradient(ellipse at 54% 53%, transparent 22%, #200b1196 76%, #0b050bf0);
}
.battle-stage[data-finisher-ko]:is([data-beat="finisher-focus"], [data-beat="attack"], [data-beat="impact"], [data-beat="knockout"]) .finisher-vignette { opacity: 1; }
.battle-stage[data-finisher-ko][data-beat="finisher-focus"] .finisher-vignette { animation: finisher-darken var(--beat-duration) ease-out both; }
.finisher-sigil {
  left: var(--player-center);
  top: 57%;
  width: clamp(82px, 24cqw, 236px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #5b19170a 35%, #ff8a585c 52%, transparent 70%),
    repeating-conic-gradient(from 15deg, #ffe1a8 0deg 2deg, #ff8659 2deg 4deg, transparent 4deg 30deg);
  mask: radial-gradient(circle, transparent 31%, #0005 44%, #000 52%, #000 57%, transparent 66%);
  filter: drop-shadow(0 0 9px #ff9d49);
}
.battle-stage[data-technique="finisher"][data-beat="attack"] .finisher-sigil { animation: finisher-sigil var(--beat-duration) ease-out both; }
.finisher-burst {
  left: var(--enemy-center);
  top: 49%;
  width: clamp(86px, 25cqw, 240px);
  aspect-ratio: 1;
  background: radial-gradient(circle, #fff3b57a 0 9%, #ff91434a 25%, #b72d202e 45%, transparent 68%);
}
.finisher-burst::before {
  position: absolute;
  inset: 5%;
  background: repeating-conic-gradient(from 11deg, transparent 0deg 21deg, #ff9b64 22deg 24deg, #fff1b8 25deg 26deg, transparent 28deg 47deg);
  mask: radial-gradient(circle, transparent 9%, #000 18% 40%, transparent 68%);
  content: '';
}
.finisher-burst::after {
  position: absolute;
  inset: 6% -9%;
  background: linear-gradient(153deg, transparent 44%, #fa643954 45%, #ffd69b 47%, #fff8c5 48%, #ffbc70 49%, #b92c2755 51%, transparent 53%);
  mask: radial-gradient(ellipse, #000 13% 45%, transparent 71%);
  content: '';
}
.battle-stage[data-technique="finisher"][data-beat="impact"] .finisher-burst { animation: finisher-shock var(--beat-duration) ease-out both; }
.battle-stage[data-finisher-ko][data-beat="knockout"] .finisher-burst { animation: finisher-embers var(--beat-duration) ease-out both; }
.battle-stage[data-finisher-ko][data-beat="knockout"] .finisher-burst::after { opacity: .24; }
.battle-stage[data-finisher-ko] .arena-callout,
.battle-stage[data-finisher-result] .arena-outcome {
  padding: .16em .54em .27em;
  border-block: 1px solid #ca7349;
  background: linear-gradient(90deg, transparent, #320e13f2 17% 83%, transparent);
  color: #ffe5ac;
  font: italic 900 clamp(1.24rem, 7cqw, 4.4rem)/1 var(--display);
  letter-spacing: .035em;
  text-transform: uppercase;
  text-shadow: 0 2px #a04c33, 0 4px 10px #180308, 0 0 24px #d25138ad;
}
.battle-stage[data-finisher-result] .arena-outcome { transform: translate(-50%, -50%) skewX(-7deg); }
.battle-stage[data-finisher-ko][data-beat="finisher-focus"] .arena-callout { animation: finisher-title-in var(--beat-duration) ease-out both; }
.battle-stage[data-finisher-ko][data-beat="knockout"] .arena-callout { animation: finisher-title-hold var(--beat-duration) ease-out both; }

@keyframes finisher-charge {
  36%, 49% { transform: translateX(-2.5cqw) rotate(-4deg) scale(.98); filter: brightness(1.18); }
  85%, to { transform: translateX(var(--attack-reach)) rotate(var(--attack-lean)); }
}
@keyframes finisher-follow-through {
  from, 43% { transform: translateX(var(--attack-reach)) rotate(var(--attack-lean)); }
}
@keyframes finisher-recoil {
  18%, 53% { transform: translateX(4cqw) rotate(9deg); filter: brightness(1.2) drop-shadow(0 0 9px #e96336a0); }
  82% { transform: translateX(2cqw) rotate(4deg); }
}
@keyframes finisher-collapse {
  21% { transform: translateX(3cqw) rotate(10deg); filter: brightness(1.15) drop-shadow(0 0 9px #ff9b55a3); }
  73% { transform: var(--fallen-pose); opacity: .47; }
  to { transform: var(--fallen-pose); opacity: .23; filter: saturate(.72); }
}
@keyframes finisher-darken { from { opacity: .26; } }
@keyframes finisher-sigil {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-20deg) scale(.5); }
  39%, 57% { opacity: .96; }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(33deg) scale(1.23); }
}
@keyframes finisher-shock {
  from { opacity: .28; transform: translate(-50%, -50%) rotate(-8deg) scale(.48); }
  24% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -50%) rotate(11deg) scale(1.29); }
}
@keyframes finisher-embers {
  from { opacity: .75; transform: translate(-50%, -50%) rotate(11deg) scale(1); }
  37% { opacity: .84; }
  to { opacity: 0; transform: translate(-45%, -62%) rotate(21deg) scale(1.55); }
}
@keyframes finisher-title-in {
  from { opacity: 0; transform: translate(-50%, -50%) skewX(-7deg) scale(.92); }
  27%, 77% { opacity: 1; }
  to { opacity: .68; }
}
@keyframes finisher-title-hold {
  from { opacity: 0; transform: translate(-50%, -50%) skewX(-7deg) scale(1.11); }
  33%, to { opacity: 1; }
}
.turn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.turn-card { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.turn-card > .eyebrow { display: none; }
.turn-card h2 { font-size: clamp(1.15rem, 2.3vw, 1.52rem); }
.challenge-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.challenge-description { margin-top: 4px; color: var(--muted); font-size: .79rem; line-height: 1.35; }
.target-number { flex: none; color: var(--gold); font: 700 clamp(2.35rem, 4.5vw, 3.2rem)/1 var(--display); letter-spacing: -.035em; }
#pair-form { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.pair-fields { display: flex; gap: 5px; align-items: center; color: var(--lavender); font-weight: 800; }
.pair-fields input { width: 49px; height: 38px; padding: 4px; border: 1px solid #75618b; border-radius: 7px; background: #120e20; color: var(--text); text-align: center; font-size: 1.12rem; font-weight: 750; }
.pair-fields input::placeholder { color: #9f8db6; }
.check-button { min-height: 38px; padding: 6px 10px; }
.hint-button { min-height: 36px; }
.pair-messages :is(.hint, .feedback) { margin-top: 4px; color: var(--lavender); font-size: .78rem; line-height: 1.35; }
.feedback { color: var(--muted); }
.feedback.error { color: var(--pink); }
.pair-confirmed { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; padding: 7px 10px; border: 1px solid #477364; border-radius: 7px; background: #1b3632; color: var(--mint); font-size: 1rem; font-weight: 800; }
.pair-progress { margin-top: 5px; color: var(--lavender); font-size: .8rem; font-weight: 750; }
.confirmed-pairs { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 0; padding: 0; list-style: none; }
.confirmed-pairs .pair-confirmed { gap: 4px; margin: 0; padding: 4px 6px; font-size: .81rem; }
.attack-list { display: grid; gap: 5px; margin-top: 6px; }
.attack-option { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; width: 100%; min-height: 43px; padding: 4px 7px; border: 1px solid #59486d; border-radius: 8px; background: #2c2140; color: #f4eafd; text-align: left; }
.attack-option:hover:enabled { border-color: var(--lavender); background: #372951; }
.attack-option:disabled { border-color: #43354f; background: #211a31; color: #dbcee8; }
.move-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #644982; border-radius: 7px; background: #392951; color: var(--lavender); }
.move-icon svg { width: 17px; height: 17px; }
.attack-option .move-icon { width: 27px; height: 27px; }
.guard .move-icon { border-color: #466c76; background: #24404b; color: #a1d9dc; }
.power .move-icon { border-color: #705041; background: #4b3237; color: var(--gold); }
.attack-option strong, .attack-option small { display: block; }
.attack-option strong { font-size: .85rem; }
.attack-option small { margin-top: 2px; color: var(--muted); font-size: .69rem; line-height: 1.25; }
.attack-option.learned-attack:enabled { border-color: #aa7c54; }
.attack-option.learned-attack:hover:enabled { border-color: var(--gold); }
.learned-tag { display: inline-block; margin-left: 5px; padding: 2px 4px; border-radius: 3px; background: #453038; color: var(--gold); font-size: .56rem; letter-spacing: .05em; line-height: 1; text-transform: uppercase; }
.move-value { color: var(--gold); font-size: .71rem; font-weight: 800; white-space: nowrap; text-align: right; }
.attack-option:disabled .move-value { color: #c2aacc; }
.attack-heading { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.battle-log { flex: none; color: var(--muted); font-size: .76rem; }
.battle-log summary { padding: 3px 2px; color: var(--lavender); cursor: pointer; font-weight: 700; }
.battle-log ul { position: absolute; z-index: 5; right: 0; bottom: 100%; width: min(100%, 28rem); max-height: 30svh; margin: 0; padding: 9px 11px 9px 24px; overflow-y: auto; border: 1px solid #67527f; border-radius: 8px; background: #21182f; box-shadow: 0 5px 24px #100b1bd9; line-height: 1.5; }

.result-card { display: grid; justify-items: center; gap: 7px; padding: clamp(12px, 2vw, 24px); border: 1px solid #4f3a61; border-radius: 15px; background: radial-gradient(ellipse at 50% 0, #3a2449, transparent 68%), var(--panel); text-align: center; }
.result-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #7e5c4e; border-radius: 10px; background: #3b293a; color: var(--gold); }
.result-icon svg { width: 25px; height: 25px; }
.result-card > p:not(.eyebrow) { max-width: 420px; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.result-card form { width: 100%; }
.result-card form > .primary-button { margin-top: 10px; }
.reward-label { margin-bottom: 7px; color: var(--lavender); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
.reward-picker .upgrade-grid + .reward-label { margin-top: 9px; }
.upgrade-grid.attack-rewards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.upgrade-choice { position: relative; display: flex; cursor: pointer; }
.upgrade-choice > span { flex: 1; display: grid; justify-items: center; align-content: start; gap: 4px; padding: 8px; border: 1px solid #544165; border-radius: 9px; background: #241b35; }
.attack-reward > span { border-color: #785743; background: #332433; }
.attack-reward .move-icon { border-color: #8b6149; background: #4b3237; color: var(--gold); }
.upgrade-choice:hover > span, .upgrade-choice input:checked + span { border-color: var(--gold); }
.upgrade-choice input:checked + span { box-shadow: inset 0 0 0 1px var(--gold); }
.upgrade-choice small { color: var(--muted); font-size: .77rem; line-height: 1.35; }
.result-actions, .dialog-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.result-actions { margin-top: 6px; }
dialog { width: min(470px, calc(100% - 32px)); padding: 20px; border: 1px solid #6b5284; border-radius: 14px; background: #21182f; color: var(--text); box-shadow: 0 15px 60px #0009; }
dialog::backdrop { background: #090711b8; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 1.6rem; }
.close-button { display: grid; place-items: center; width: 35px; height: 35px; padding: 0; border: 1px solid #614d75; border-radius: 6px; background: #312442; color: var(--text); font-size: 1.3rem; line-height: 1; }
.help-steps { margin: 0 0 14px; padding-left: 24px; color: var(--muted); line-height: 1.5; }
.help-steps li + li { margin-top: 8px; }
.help-steps strong { color: var(--text); }
.dialog-actions { margin-top: 15px; justify-content: end; }

@media (min-width: 800px) {
  .campaign:not(.campaign-active, .campaign-victory) .campaign-body { grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr); }
  .battle-stage { height: clamp(235px, calc(100svh - 210px), 520px); }
  .turn-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 740px) {
  .campaign-active .campaign-body {
    grid-template-columns: minmax(0, 1fr) clamp(330px, 29vw, 410px);
    grid-template-rows: minmax(0, 1fr);
  }
  .campaign-active .battle-stage { min-height: 220px; }
  .campaign-active .turn-grid { grid-template-columns: minmax(0, 1fr); }
  .campaign-active .arena-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
}

@media (max-width: 739px) {
  .campaign-active .campaign-body { display: flex; flex-direction: column; align-items: stretch; }
  .campaign-active .campaign-body > .arena { flex: 1 0 auto; max-height: min(72vw, 43svh); }
}

@media (min-width: 740px) and (max-width: 900px) {
  .campaign-active .arena-player { left: 5%; width: 48%; }
  .campaign-active .arena-opponent { right: 4%; width: min(45cqw, 80cqh); }
}

@media (max-width: 820px) {
  .hero-banner { min-height: 231px; }
  .hero-copy { padding: 28px; }
  .hero-card-details { padding-inline: 11px; }
  .hero-stats { gap: 6px; }
  .tower-steps li { justify-content: center; }
  .step-label { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); }
}

@media (max-width: 620px) {
  .header-inner, .page { width: calc(100% - 28px); }
  .header-inner { min-height: 61px; flex-wrap: wrap; gap: 8px; padding-block: 8px; }
  .header-actions { gap: 6px; }
  .header-actions > :is(button, .arcade-link) { padding-inline: 8px; font-size: .78rem; }
  .page { padding-block: 14px 30px; }
  .hero-banner { min-height: 198px; align-items: end; }
  .hero-art { width: 100%; object-position: 63% 43%; }
  .hero-banner::after { background: linear-gradient(0deg, #1c1521 0, #1c1521e8 23%, #1c15211a 85%), linear-gradient(90deg, #1c1521aa, transparent 75%); }
  .hero-copy { padding: 18px; }
  .hero-copy h1 { margin-top: 7px; }
  .hero-copy > p:last-child { margin-top: 9px; font-size: .89rem; }
  .hero-chapter { display: none; }
  .roster { margin-top: 22px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 5px; }
  .roster-grid { grid-template-columns: 1fr; gap: 8px; }
  .hero-card-body { display: grid; grid-template-columns: clamp(89px, 30vw, 148px) minmax(0, 1fr); min-height: 139px; }
  .hero-card-details { padding: 12px 10px 10px; }
  .hero-portrait { height: clamp(112px, 38vw, 190px); }
  .hero-portrait::after { background: linear-gradient(270deg, #1d1723, #1d172300 32%), linear-gradient(0deg, #1d1723, #1d172300 22%); }
  .hero-description { margin-bottom: 7px; }
  .radio-mark { width: 19px; height: 19px; }
  .radio-mark svg { width: 12px; height: 12px; }
  .hero-stats { gap: 10px; }
  .difficulty-grid { grid-template-columns: 1fr; gap: 6px; }
  .difficulty-choice > span { grid-template-columns: 4.25rem 1fr; align-items: center; gap: 6px; min-height: 44px; padding-block: 8px; }
  .difficulty-choice > span::after { top: 50%; transform: translateY(-50%); }
  .climb-bar { flex-wrap: wrap; }
  .climb-bar .primary-button { width: 100%; }
  #game:has(.campaign) { padding-block: 5px 8px; }
  body:has(.campaign) .header-inner { min-height: 44px; padding-block: 4px; gap: 4px 8px; }
  body:has(.campaign) .header-actions { gap: 4px; }
  body:has(.campaign) .header-actions > :is(button, .arcade-link) { min-height: 34px; padding: 5px 6px; gap: 4px; font-size: .73rem; }
  body:has(.campaign) .brand { gap: 6px; }
  body:has(.campaign) .brand strong { font-size: 1.03rem; }
  body:has(.campaign) .brand-mark { width: 29px; height: 29px; }
  body:has(.campaign) .brand-mark svg { width: 18px; height: 18px; }
  body:has(.campaign) .brand small { display: none; }
  .campaign-heading { gap: 5px; margin-bottom: 5px; }
  .campaign-heading > div { gap: 4px 7px; }
  .campaign-heading h1 { font-size: clamp(1.12rem, 4.3vw, 1.55rem); }
  .leave-button { font-size: .74rem; }
  .tower-steps { gap: 3px; margin-bottom: 6px; }
  .tower-steps li { min-height: 24px; padding: 1px 3px; }
  .campaign-body, .turn-grid { gap: 6px; }
  .battle-stage { height: clamp(150px, 26svh, 250px); }
  .arena-hud { padding: 7px 9px; }
  .arena-status { min-height: 29px; gap: 3px; padding: 5px 8px; }
  .arena-report, .enemy-intent { font-size: .72rem; }
  .health-role { font-size: .49rem; }
  .health-track { height: 10px; padding: 1px; }
  .health-count { font-size: .68rem; }
  .health-count small { font-size: .56rem; }
  .arena-player { left: 2%; width: 52%; height: 71%; }
  .arena-opponent { right: 1%; width: min(49cqw, 77cqh); }
  .turn-grid { grid-template-columns: minmax(0, 1fr); }
  .turn-card { padding: 7px 8px; }
  .turn-card h2 { font-size: 1.12rem; }
  .challenge-description { font-size: .73rem; }
  .target-number { font-size: 2.2rem; }
  .pair-fields input { width: 42px; }
  .check-button { gap: 5px; }
  .hint-button { padding-inline: 3px; }
  .confirmed-pairs .pair-confirmed { font-size: .75rem; }
  .upgrade-grid, .upgrade-grid.attack-rewards { gap: 6px; }
  .upgrade-choice > span { padding-inline: 5px; }
  .upgrade-choice strong { font-size: .85rem; }
  .upgrade-choice small { font-size: .71rem; }
}

@media (max-width: 420px) {
  body:has(.campaign) .brand > span:last-child { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  body:has(.campaign) :is(.arcade-link > span, .help-icon) { display: none; }
}

@media (max-width: 480px) {
  body:has(.campaign) .header-full-label { display: none; }
  body:has(.campaign) .header-short-label { display: inline; }
}

@media (max-height: 680px), (max-width: 620px) {
  .pair-evidence { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; }
  .pair-evidence :is(.pair-progress, .confirmed-pairs) { margin: 3px 0 0; }
  .pair-evidence .pair-progress { font-size: .75rem; }
  .pair-evidence .pair-confirmed { padding: 3px 5px; }
  .attack-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attack-option { grid-template-columns: minmax(0, 1fr) auto; min-height: 40px; padding: 4px 6px; gap: 5px; }
  .attack-option :is(.move-icon, .learned-tag) { display: none; }
  .attack-option strong { font-size: .8rem; }
  .attack-option small, .move-value { font-size: .67rem; }
  .attack-detail:not(.attack-detail-state) { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .result-card { gap: 5px; padding: 11px; }
  .result-card > .result-icon { display: none; }
  .result-card h2 { font-size: 1.55rem; }
  .result-card .upgrade-grid { gap: 6px; }
  .upgrade-choice > span { gap: 3px; padding: 6px 5px; }
  .upgrade-choice .move-icon { width: 24px; height: 24px; }
  .upgrade-choice .move-icon svg { width: 14px; height: 14px; }
  .upgrade-choice strong { font-size: .85rem; }
  .upgrade-choice small { font-size: .72rem; line-height: 1.28; }
  .reward-label { margin-bottom: 4px; }
  .reward-picker .upgrade-grid + .reward-label { margin-top: 7px; }
}

@media (max-height: 680px) {
  body:has(.campaign) .header-inner { min-height: 44px; }
  .campaign-heading { margin-bottom: 4px; }
  .campaign-heading h1 { font-size: clamp(1.07rem, 2.6vw, 1.65rem); }
  .campaign-heading .leave-button { min-height: 28px; padding-block: 3px; }
  .tower-steps { margin-bottom: 6px; }
  .tower-steps li { min-height: 7px; padding: 0; border-radius: 999px; }
  .tower-steps li.cleared { border-color: #65a98c; background: #65a98c; }
  .tower-steps li.current { border-color: var(--lavender); background: var(--lavender); }
  .tower-steps .step-number { display: none; }
  .tower-steps .step-label { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); }
}

@media (min-width: 800px) and (max-height: 680px) {
  .campaign:not(.campaign-active, .campaign-victory) .campaign-body { grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr); }
  body:has(.campaign) .brand-mark { width: 34px; height: 34px; }
  body:has(.campaign) .header-actions > :is(button, .arcade-link) { min-height: 34px; padding-block: 5px; }
}

@media (min-width: 621px) and (max-width: 799px) and (max-height: 680px) {
  .battle-stage { height: clamp(170px, calc(100svh - 425px), 245px); }
}

@media (max-width: 620px) and (max-height: 700px) {
  #game:has(.campaign) { padding-bottom: 4px; }
  .campaign-heading .eyebrow-number { display: none; }
  .campaign:not(.campaign-active) .campaign-body > .arena { display: none; }
  .battle-stage { height: clamp(136px, 22svh, 162px); }
  .arena-status { min-height: 26px; padding-block: 4px; }
  .arena-report { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .turn-card { padding-block: 6px; }
  .attack-card .challenge-description { margin-top: 2px; }
  .attack-card .attack-list { margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-card-body { transition: none; }
}

:root[data-combat-motion="off"] .battle-stage .arena-fighter,
:root[data-combat-motion="off"] .battle-stage .fighter-art { animation: none !important; }
:root[data-combat-motion="off"] .battle-stage :is(.fighter-art, .health-lag, .health-fill) { transition: none; }
:root[data-combat-motion="off"] .battle-stage .fighter-idle { opacity: 1; }
:root[data-combat-motion="off"] .battle-stage :is(.fighter-pose, .arena-effects, .damage-pop, .arena-callout) { display: none; }
