@font-face { font-family: "Barlow Condensed"; src: url("assets/barlow-condensed.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  color-scheme: dark;
  --night: #201633;
  --ink: #271b3c;
  --muted: #645473;
  --cream: #fff8ee;
  --line: #d6c4e4;
  --violet: #6538a0;
  --peach: #ffbd87;
  --body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Barlow Condensed", "Bahnschrift", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 285px; margin: 0; background: var(--night); color: #f8eaff; font-family: var(--body); line-height: 1.4; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible { outline: 3px solid #a564df; outline-offset: 3px; }
img { display: block; max-width: 100%; }
.topbar { z-index: 2; position: relative; border-bottom: 1px solid #664e82; background: #211634; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 14px; max-width: 1250px; min-height: 63px; padding: 9px 25px; margin: auto; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand strong { display: block; color: #fff0e7; font-size: .93rem; }
.brand small { display: block; color: #d8bde9; font: 700 .59rem/1.1 var(--mono); letter-spacing: .1em; }
.brand-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #9870b3; border-radius: 9px; background: #4c2e6b; color: #ffcba4; font-size: 1.55rem; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.top-button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 5px 10px; border: 1px solid #836099; border-radius: 8px; background: #37234e; color: #fae7ff; font-size: .82rem; font-weight: 750; text-decoration: none; }
.top-button:focus-visible { outline: 3px solid #c18cf4; outline-offset: 3px; }
.top-button:hover { background: #543271; }
.top-button span { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid #c7a8df; border-radius: 50%; font-size: .65rem; }
.experience { position: relative; isolation: isolate; min-height: calc(100vh - 64px); }
.world { position: absolute; z-index: -1; inset: 0 0 auto; height: min(600px, 90vw); min-height: 370px; background: linear-gradient(180deg, #25143b56 0%, #20163324 38%, #201633 100%), url("assets/tower-arena.webp") center top / max(100%, 1260px) auto no-repeat; }
.shell { max-width: 1250px; margin: auto; padding: 0 25px 32px; }
.hero-heading { padding: 25px 4px 22px; min-height: 163px; }
.hero-heading h1 { margin: 0; color: #fff5e8; font: 700 clamp(3.7rem, 8vw, 7rem)/.89 var(--display); text-transform: uppercase; letter-spacing: .01em; text-shadow: 0 4px #422759, 0 0 18px #2b194b; }
.hero-heading h1 span { color: #ffca99; }
.hero-heading p { margin: 10px 0 0 3px; color: #fff1ff; font-size: clamp(.9rem, 2vw, 1.08rem); font-weight: 650; text-shadow: 0 1px 5px #200f39, 0 1px 5px #200f39; }
.experience:has(#battle:not([hidden])) .hero-heading { display: none; }
.experience:has(#battle:not([hidden])) .shell { padding-top: 13px; }
.panel { color-scheme: light; color: var(--ink); background: var(--cream); border: 2px solid #513769; border-radius: 17px; box-shadow: 0 4px #a17bbb, 0 9px #29183c, 0 15px 46px #160c28b5; }
.team-picker { display: grid; grid-template-columns: 1.56fr 1fr; gap: 17px; padding: 18px 17px; }
.team-picker h2, .interlude h2, .guide-inner h2 { margin: 0 0 9px; font: 700 2.1rem/1.02 var(--display); letter-spacing: .015em; }
.choose-pet { border-left: 1px solid #d9c7e4; padding-left: 16px; }
.hero-options, .pet-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.choice-card { position: relative; display: flex; flex-direction: column; align-items: stretch; min-width: 0; border: 2px solid #c4aed5; border-radius: 11px; padding: 5px 5px 7px; text-align: left; color: var(--ink); background: #fffaf8; box-shadow: 0 2px #d1bedd; transition: transform .15s, box-shadow .15s, border .15s; }
.choice-card:hover { transform: translateY(-2px); box-shadow: 0 4px #cbb2df; border-color: #9f78ba; }
.choice-card.is-selected { border-color: #7741a5; box-shadow: 0 3px #8452ad, 0 0 0 2px #d9bbee; background: #fbf0ff; }
.choice-card.is-selected::after { content: "✓"; position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 21px; height: 21px; color: #fff; background: #6f3b9e; border: 1px solid #eedbfc; border-radius: 50%; font-weight: 900; font-size: .8rem; }
.choice-card .choice-art { width: 100%; height: 160px; padding: 5px; object-fit: contain; object-position: center bottom; background: radial-gradient(ellipse at 50% 32%, #f5f0ff, #c9d6f5); border-radius: 7px; }
.hero-options .choice-card:nth-child(2) .choice-art { background: radial-gradient(ellipse at 50% 32%, #e2fff0, #b9ddd8); }
.hero-options .choice-card:nth-child(3) .choice-art { background: radial-gradient(ellipse at 50% 32%, #e9f0ff, #c5cff6); }
.hero-options .choice-card:nth-child(4) .choice-art { background: radial-gradient(ellipse at 50% 32%, #fff7d9, #f5bd98); }
.pet-options .choice-art { height: 127px; object-position: center; background: radial-gradient(ellipse at 50% 38%, #fff3e5, #f4cfbf); }
.pet-options .choice-card:nth-child(2) .choice-art { background: radial-gradient(ellipse at 50% 38%, #fffceb, #eadcf5); }
.pet-options .choice-card:nth-child(3) .choice-art { background: radial-gradient(ellipse at 50% 38%, #e9ffe6, #bbdfcf); }
.pet-options .choice-card:nth-child(4) .choice-art { background: radial-gradient(ellipse at 50% 38%, #fff9dc, #cbc7ee); }
.choice-name { padding: 3px 4px 1px; color: #35224c; font: 700 1.4rem/1.1 var(--display); }
.choice-title { display: block; padding-inline: 4px; color: #704798; font-size: .68rem; font-weight: 800; }
.choice-detail { display: block; padding: 2px 4px 0; color: #584767; font-size: .75rem; line-height: 1.3; overflow-wrap: anywhere; }
.setup-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 17px; border-top: 1px solid #ddcce5; border-radius: 0 0 15px 15px; background: #f8edfb; }
.game-options { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; }
.table-field { display: flex; align-items: center; gap: 9px; color: #463459; font-size: .84rem; }
.table-field select { min-height: 35px; max-width: 100%; padding: 4px 8px; color: var(--ink); border: 1px solid #a283b8; border-radius: 7px; background: #fffbff; }
.difficulty-note { color: var(--muted); font-size: .78rem; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 6px 13px; border: 2px solid #68374d; border-radius: 9px; background: #ffbd87; color: #3d2436; box-shadow: 0 3px #68374d, inset 0 2px #ffdcba; font-weight: 850; font-size: .9rem; white-space: nowrap; }
.primary-button:hover:not(:disabled) { background: #ffd2a2; }
.primary-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px #68374d; }
.primary-button:disabled { opacity: .6; }
.soft-button { min-height: 35px; padding: 5px 9px; border: 1px solid #a78bbb; border-radius: 7px; background: #faefff; color: #4b3066; font-weight: 800; font-size: .77rem; }
.soft-button:hover:not(:disabled) { background: #edd9f8; }
.soft-button:disabled { opacity: .57; }
.battle { overflow: hidden; }
.battle-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px; background: #fcf0ff; border-bottom: 1px solid #a887bd; }
.battle-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 5px 9px; }
.mode-badge { border: 1px solid #cdb0e0; border-radius: 7px; background: #f4e4fd; color: #55356d; padding: 5px 7px; font-size: .73rem; font-weight: 750; }
.battle-header h2 { margin: 0; font: 700 1.85rem/1 var(--display); }
.floor { margin: 0 0 2px; color: #684988; font: 700 .69rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.battle-stage { --hero-center: 29%; --enemy-center: 72%; --pet-center: 37%; --hero-glow: #ffd78f; --enemy-glow: #ea89ff; --pet-glow: #ffad71; position: relative; isolation: isolate; container-type: inline-size; display: grid; grid-template-columns: minmax(0,1fr) 60px minmax(0,1fr); align-items: start; gap: 12px; min-height: 238px; padding: 11px min(7vw, 94px) 0; overflow: hidden; background: linear-gradient(#20163494, transparent 47%, #2515395e), url("assets/tower-arena.webp") center 76% / cover no-repeat; color: #fff5ff; }
.fighter { min-width: 0; }
.fighter-info { max-width: 265px; padding: 6px 9px 7px; border: 1px solid #af8bcd; border-radius: 8px; background: #281b43e8; }
.enemy-fighter .fighter-info { margin-left: auto; border-color: #cf90ac; }
.fighter-name { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.fighter-name strong { font: 700 clamp(1.14rem, 2.7vw, 1.48rem)/1.05 var(--display); }
.fighter-name span { color: #f1d9f4; font: 700 .72rem/1.1 var(--mono); white-space: nowrap; }
.fighter progress { width: 100%; height: 9px; display: block; margin-top: 5px; border: 0; border-radius: 4px; background: #593e65; }
.fighter progress::-webkit-progress-bar { border-radius: 4px; background: #593e65; }
.fighter progress::-webkit-progress-value { border-radius: 4px; background: #98e6c2; transition: width .25s; }
.fighter progress::-moz-progress-bar { border-radius: 4px; background: #98e6c2; }
.enemy-fighter progress::-webkit-progress-value { background: #f5a99d; }
.enemy-fighter progress::-moz-progress-bar { background: #f5a99d; }
.fighter-art { position: relative; min-height: 179px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.hero-sprite, .enemy-sprite { position: relative; min-width: 0; filter: drop-shadow(0 5px 3px #1e103caa); }
.hero-sprite { height: 180px; width: min(85%, 190px); }
.hero-idle, .enemy-idle, .hero-pose img, .enemy-pose img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.hero-pose, .enemy-pose { position: absolute; inset: -12px -26px 0; pointer-events: none; }
.battle-stage[data-hero-pose] .hero-sprite { z-index: 2; }
.battle-stage[data-hero-pose] .hero-idle { visibility: hidden; }
.battle-stage[data-enemy-pose] .enemy-idle { visibility: hidden; }
.enemy-sprite { height: 174px; width: min(100%, 240px); }
.enemy-stage::before {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  z-index: 1;
  width: min(100%, 218px);
  height: min(96%, 168px);
  transform: translateX(-50%);
  border: 2px solid #f6d2ff;
  border-radius: 49% 49% 47% 47%;
  background: radial-gradient(ellipse, #dc9bff07 49%, #e7a2ff55);
  box-shadow: inset 0 0 16px #e3b6ff, 0 0 10px #ad62ff;
  opacity: var(--shield-progress, 100%);
  pointer-events: none;
  transition: opacity .23s;
}
.battle-stage[data-shield="broken"] .enemy-stage::before { opacity: 0; }
.pet-stage { position: relative; margin: 0 0 6px -7px; flex: 0 0 71px; text-align: center; }
.pet-sprite { position: relative; height: 64px; }
.battle-stage[data-evolved="true"] .pet-stage { flex-basis: 108px; }
.battle-stage[data-evolved="true"] .pet-sprite { height: 100px; }
.pet-idle, .pet-pose img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 4px 3px #170c34); }
.pet-pose { position: absolute; inset: -24px -25px 0; pointer-events: none; }
.pet-stage figcaption { position: relative; color: #ffecff; background: #2a1946db; border-radius: 6px; font-size: .67rem; font-weight: 800; text-shadow: 0 1px #22132f; }
.battle-stage[data-pet-pose] .pet-idle { visibility: hidden; }
.battle-stage[data-pet-phase="windup"] .pet-sprite { animation: pet-windup .24s ease-out both; }
.battle-stage[data-pet-phase="windup"] .pet-stage::before { content: ""; position: absolute; inset: 0 0 12px; border-radius: 50%; box-shadow: 0 0 13px 4px var(--pet-glow), inset 0 0 12px var(--pet-glow); animation: pet-aura .24s ease-out both; pointer-events: none; }
.battle-stage[data-pet-phase="cast"][data-pet-effect="reveal"] .pet-sprite { animation: ember-breath .58s ease-out both; }
.battle-stage[data-pet-phase="cast"][data-pet-effect="hint"] .pet-sprite { animation: mochi-pounce .58s ease-out both; }
.battle-stage[data-pet-phase="cast"][data-pet-effect="guard"] .pet-sprite { animation: pebble-stomp .58s ease-out both; }
.battle-stage[data-pet-phase="cast"][data-pet-effect="heal"] .pet-sprite { animation: luma-flight .58s ease-out both; }
.battle-stage[data-pet-effect="hint"] { --pet-glow: #e7bcff; }
.battle-stage[data-pet-effect="guard"] { --pet-glow: #9cf0c9; }
.battle-stage[data-pet-effect="heal"] { --pet-glow: #ffeb9e; }
.duel-emblem { align-self: center; justify-self: center; display: grid; place-items: center; width: 45px; height: 45px; transform: rotate(-7deg); border: 2px solid #f4b9e4; border-radius: 12px; background: #502d75; color: #ffe1ac; font: 700 1.55rem/1 var(--display); box-shadow: 0 2px #2f1746; }
.battle-intent { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 6px 10px; background: #35224e; color: #f4ddff; border-block: 1px solid #715289; font-size: .76rem; }
.battle-intent strong { color: #ffd4a6; }
.combat-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 275px); gap: 12px; padding: 11px 13px 12px; }
.rune-panel, .attack-panel { min-width: 0; padding: 10px; border: 1px solid #d7c3e0; border-radius: 10px; background: #fffaff; }
.rune-heading { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 8px; }
.rune-heading h3, .attack-panel h3 { margin: 0; color: #33204c; font: 700 1.55rem/1.05 var(--display); }
#target { display: inline-block; min-width: 28px; border: 1px solid #4a2669; border-radius: 6px; padding: 1px 4px 2px; background: #7845aa; color: #fff; text-align: center; font: 700 1.02rem/1.15 var(--mono); vertical-align: 2px; }
.rune-count { color: #684887; font: 750 .72rem/1.2 var(--mono); text-align: right; }
.runes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.runes:has(> :nth-child(10):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rune { position: relative; min-height: 46px; min-width: 0; padding: 4px 2px; border: 1px solid #a87bc7; border-radius: 8px; background: linear-gradient(#fbf1ff, #e9d7f8); color: #33204d; font: 800 clamp(.95rem, 3vw, 1.3rem)/1 var(--mono); box-shadow: 0 2px #c4a9d9; transition: transform .16s, background .16s; }
.rune:hover:not(:disabled) { background: #ead1ff; transform: translateY(-1px); }
.rune.is-cracked { color: #225444; border-color: #6fbb9b; background: linear-gradient(#edfff4, #d0ecd8); box-shadow: 0 2px #92c5a7; animation: crack .28s ease-out; }
.rune.is-cracked::after { content: "✦"; position: absolute; right: 4px; top: 3px; color: #307555; font-size: .65rem; }
.rune.is-miss { color: #842844; border-color: #ce7e9c; background: #ffe1e7; box-shadow: 0 2px #e5a3b7; }
.rune.is-miss::after { content: "×"; position: absolute; top: 3px; right: 5px; color: #8f2d50; font-size: .8rem; }
.rune.is-revealed:not(.is-cracked) { border: 2px dashed #a55c26; background: #fff0d1; }
.feedback { padding: 7px 0 5px; min-height: 32px; color: #634c76; font-size: .82rem; }
.feedback[data-tone="success"] { color: #226048; }
.feedback[data-tone="warning"] { color: #8b3052; }
.helper-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pet-assist { border-color: #c38a68; background: #fff0d9; color: #65401f; }
.pet-assist:hover:not(:disabled) { background: #ffe1b5; }
.hint-content { margin-top: 8px; padding: 7px 9px; border: 1px solid #cbb0df; border-radius: 7px; background: #f7eaff; color: #4e3067; font-size: .83rem; }
.attack-panel p { margin: 4px 0 6px; color: var(--muted); font-size: .74rem; }
.attacks { display: grid; gap: 5px; }
.attack-button, .reward-card { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; padding: 6px 8px; border: 1px solid #a682c2; border-radius: 7px; background: #f1e0fb; color: #3d2559; text-align: left; }
.attack-button:not(:disabled):hover, .reward-card:hover { background: #e4c9f5; }
.attack-button:disabled { opacity: .58; }
.attack-button:not(:disabled) { border-color: #7e469e; background: #e5ccf8; box-shadow: 0 1px #aa7bc7; }
.attack-name, .reward-name { font-weight: 850; font-size: .78rem; }
.attack-detail, .reward-detail { color: #624675; font-size: .7rem; }
.event-log:not([hidden]) { margin: 0 13px 10px; padding: 5px 8px; color: #5e3f75; border-top: 1px solid #e0c9eb; font-size: .76rem; }
.interlude { width: min(100%, 665px); margin: 0 auto; padding: 22px; text-align: center; }
.interlude p { margin: 7px auto 15px; color: #5b466a; }
.medal { display: grid; place-items: center; width: 57px; height: 57px; margin: 0 auto 11px; border: 2px solid #704694; border-radius: 12px; background: #eddbfc; color: #7d47a5; font-size: 2.1rem; }
.reward-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.reward-card { flex-direction: column; justify-content: flex-start; min-height: 68px; }
.evolution-reveal { max-width: 470px; margin: 13px auto; border: 1px solid #c1a0dd; border-radius: 13px; background: radial-gradient(ellipse at 70% 50%, #e7d3ff, #fff3fe 72%); padding: 9px; }
.evolution-pair { display: flex; align-items: center; justify-content: center; gap: 14px; }
.evolution-pair figure { width: min(37%, 132px); margin: 0; }
.evolution-pair img { width: 100%; height: 92px; object-fit: contain; filter: drop-shadow(0 3px 4px #6f4b875c); }
.evolution-pair figcaption { font: 700 1.18rem/1.1 var(--display); }
.evolution-after img { height: 112px; animation: evolution-glow .75s ease-out both; }
.evolution-arrow { color: #7845a9; font-size: 1.55rem; font-weight: 800; }
#evolution-description { margin: 7px 0 2px; font-size: .82rem; }
.summary-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
dialog { color-scheme: light; width: min(94vw, 480px); max-height: 89vh; padding: 0; border: 2px solid #684486; border-radius: 14px; color: var(--ink); background: var(--cream); box-shadow: 0 6px #8150a5, 0 14px 52px #130a22; }
dialog::backdrop { background: #170f29c9; backdrop-filter: blur(4px); }
.guide-inner { position: relative; padding: 20px; }
.guide-inner ol { margin: 10px 0 18px; padding-left: 23px; color: #503e61; }
.guide-inner li + li { margin-top: 8px; }
.close-button { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 33px; height: 33px; padding: 0; border: 1px solid #b08ac5; border-radius: 7px; background: #f4e3fa; color: #54346b; font-size: 1.35rem; }
.close-button:hover { background: #ebd3f3; }
.arena-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.arena-fx > * { position: absolute; opacity: 0; }
.fx-trail { top: 64%; left: var(--origin); width: var(--trail-width, 60px); height: var(--trail-height, 18px); border-radius: 56% 88% 88% 56%; background: linear-gradient(90deg, transparent, var(--glow) 53%, #fffdf0 92%); box-shadow: 0 0 18px var(--glow); }
.hero-trail, .echo-trail { --origin: var(--hero-center); --destination: var(--enemy-center); --glow: var(--hero-glow); }
.enemy-trail { --origin: var(--enemy-center); --destination: var(--hero-center); --glow: var(--enemy-glow); background: linear-gradient(270deg, transparent, var(--glow) 53%, #fff4ff 92%); }
.pet-trail, .pet-echo { --origin: var(--pet-center); --destination: var(--enemy-center); --glow: var(--pet-glow); --trail-width: 44px; --trail-height: 25px; top: 73%; }
.battle-stage[data-hero="ren"] { --hero-glow: #a1f7df; }
.battle-stage[data-hero="mira"] { --hero-glow: #c5a1ff; }
.battle-stage[data-hero="zara"] { --hero-glow: #ffb967; }
.battle-stage[data-hero="ren"] .hero-trail { --trail-width: 83px; --trail-height: 11px; }
.battle-stage[data-hero="mira"] .hero-trail { --trail-width: 51px; --trail-height: 33px; }
.battle-stage[data-hero="zara"] .hero-trail { --trail-width: 65px; --trail-height: 28px; }
.battle-stage[data-motion="power"] .hero-trail { --trail-width: 102px; --trail-height: 29px; }
.battle-stage[data-motion="nova-blast"] { --hero-glow: #ffb2a3; }
.battle-stage[data-motion="nova-blast"] .hero-trail { --trail-width: 109px; --trail-height: 46px; }
.battle-stage[data-motion="prism-guard"] { --hero-glow: #a2fff0; }
.battle-stage:is([data-enemy="thorn-golem"], [data-counter="thorn-golem"]) { --enemy-glow: #caf79b; }
.battle-stage:is([data-enemy="frost-kitsune"], [data-counter="frost-kitsune"]) { --enemy-glow: #a9eaff; }
.battle-stage:is([data-enemy="eclipse-wyvern"], [data-counter="eclipse-wyvern"]) { --enemy-glow: #eaaaff; }
.battle-stage:is([data-enemy="rune-sovereign"], [data-counter="rune-sovereign"]) { --enemy-glow: #ffd585; }
.battle-stage:is([data-enemy="prism-manticore"], [data-counter="prism-manticore"]) { --enemy-glow: #ffa8dc; }
.battle-stage:is([data-enemy="storm-griffin"], [data-counter="storm-griffin"]) { --enemy-glow: #a1d9ff; }
.battle-stage:is([data-enemy="astral-dragon"], [data-counter="astral-dragon"]) { --enemy-glow: #c8aeff; }
.battle-stage:is([data-enemy="glimmer-slime"], [data-enemy="prism-manticore"]) .enemy-trail { --trail-width: 42px; --trail-height: 35px; }
.battle-stage:is([data-enemy="frost-kitsune"], [data-enemy="storm-griffin"]) .enemy-trail { --trail-width: 91px; --trail-height: 14px; }
.battle-stage[data-enemy="astral-dragon"] .enemy-trail { --trail-width: 93px; --trail-height: 37px; }
.battle-stage[data-enemy-pose="bubble-pop"] .enemy-trail { --trail-width: 44px; --trail-height: 44px; border-radius: 50%; background: radial-gradient(circle at 30% 26%, #fff1ff 3%, #e5a0ff 23%, #8c4dcc66 60%, #f5c8ff 85%); }
.battle-stage:is([data-enemy-pose="frost-spiral"], [data-enemy-pose="royal-radiance"], [data-enemy-pose="nebula-burst"]) .enemy-trail { --trail-width: 87px; --trail-height: 43px; box-shadow: 0 0 25px var(--enemy-glow); }
.battle-stage:is([data-enemy-pose="root-rumble"], [data-enemy-pose="shimmer-sweep"], [data-enemy-pose="gravity-pulse"]) .enemy-trail { top: 78%; --trail-width: 105px; --trail-height: 18px; }
.battle-stage[data-evolved="true"] .pet-trail { --trail-width: 69px; --trail-height: 39px; }
.battle-stage[data-pet-effect="reveal"] .pet-trail { background: linear-gradient(90deg, #f2763500, #ff7739 42%, #fff9bd 89%); clip-path: polygon(0 44%, 22% 23%, 33% 30%, 47% 0, 66% 15%, 86% 17%, 100% 52%, 84% 92%, 60% 100%, 43% 84%, 23% 82%, 0 66%, 15% 50%); }
.battle-stage[data-pet-effect="hint"] .pet-trail { border-radius: 50%; background: repeating-radial-gradient(ellipse at 53% 50%, #fff7ff 0 3px, #cfa5fa 4px 8px, #f6eaffbb 10px 12px); }
.battle-stage[data-pet-effect="heal"] .pet-trail { --trail-width: 62px; --trail-height: 23px; border-radius: 75% 10% 70% 15%; background: linear-gradient(150deg, #f8eacc00, #fff3b4 35%, #fffef4 57%, #cdbaf9 84%); }
.battle-stage[data-pet-effect="guard"] :is(.pet-trail, .pet-echo) { background: linear-gradient(90deg, transparent, #62d8aa 33%, #dbffe4 80%); clip-path: polygon(0 38%, 41% 30%, 71% 0, 100% 50%, 69% 100%, 41% 70%, 0 62%); }
.battle-stage[data-pet-effect="guard"] .pet-echo { top: 82%; --trail-width: 38px; --trail-height: 16px; }
.battle-stage[data-motion]:not([data-motion="counter"]) .hero-trail { animation: fx-flight .28s ease-in both; }
.battle-stage[data-motion="comet-rush"] .echo-trail { animation: fx-flight .24s .085s ease-in both; margin-top: 19px; }
.battle-stage[data-motion="counter"] .enemy-trail { animation: fx-flight .28s ease-in both; }
.battle-stage[data-pet-phase="cast"] .pet-trail { animation: fx-flight .26s ease-in both; }
.battle-stage[data-pet-phase="cast"][data-pet-effect="hint"] .pet-trail { animation: cloud-flight .26s ease-in both; }
.battle-stage[data-pet-phase="cast"][data-pet-effect="guard"] .pet-echo { animation: fx-flight .23s .03s ease-in both; }
.fx-ward { top: 61%; left: var(--hero-center); width: 98px; height: 98px; border: 4px double #e6fff6; border-radius: 39%; background: radial-gradient(ellipse, transparent 35%, #b5ffe360); box-shadow: 0 0 20px #8ae7d7, inset 0 0 15px #9fefd5; }
.battle-stage:is([data-motion="guard"], [data-motion="prism-guard"], [data-pet-phase="cast"][data-pet-effect="guard"]) .fx-ward { animation: ward-rise .55s ease-out both; }
.battle-stage[data-hero-pose="prism-guard"] .fx-ward { width: 129px; height: 129px; border: 5px double #ebfff8; transform: translate(-50%, -50%); }
.battle-stage[data-impact="hero"]:is([data-hero-pose="guard"], [data-hero-pose="prism-guard"]) .fx-ward { animation: ward-hit .3s ease-out both; }
.fx-burst { top: 62%; width: clamp(53px, 11cqw, 114px); aspect-ratio: 1; background: #fffce2; clip-path: polygon(50% 0, 58% 35%, 85% 14%, 69% 42%, 100% 49%, 67% 60%, 84% 86%, 56% 72%, 49% 100%, 39% 70%, 12% 89%, 29% 61%, 0 52%, 32% 40%, 13% 12%, 43% 33%); }
.hero-burst { left: var(--hero-center); background: radial-gradient(#fff8ed, var(--enemy-glow) 72%); }
.enemy-burst { left: var(--enemy-center); background: radial-gradient(#fff8e1, var(--hero-glow) 72%); }
.battle-stage[data-pet-impact="enemy"] .enemy-burst { background: radial-gradient(#fff9dd, var(--pet-glow) 72%); }
.battle-stage[data-impact="hero"] .hero-burst,
.battle-stage:is([data-impact="enemy"], [data-pet-impact="enemy"]) .enemy-burst { animation: hit-spark .32s ease-out both; }
.damage-pop { top: 38%; white-space: nowrap; color: #fff1c4; font: 700 clamp(1.35rem, 5cqw, 2.5rem)/1 var(--display); text-shadow: 0 2px 2px #2d1640, 0 0 5px #3d214c, 0 0 8px #3d214c; }
.hero-pop { left: var(--hero-center); color: #ffd9eb; }
.enemy-pop { left: var(--enemy-center); }
.battle-stage[data-impact="hero"] .hero-pop:not(:empty),
.battle-stage:is([data-impact="enemy"], [data-pet-impact="enemy"]) .enemy-pop:not(:empty) { animation: pop-damage .36s ease-out both; }
.motion-label { bottom: 6px; left: 50%; transform: translateX(-50%); max-width: 90%; white-space: nowrap; padding: 3px 10px; border: 1px solid #d6a8f4; border-radius: 7px; background: #261638ed; color: #ffe7af; font-size: .78rem; text-align: center; }
.motion-label:not(:empty) { opacity: 1; }
.battle-stage[data-motion="quick"] .hero-sprite { animation: quick-step .58s ease-out both; }
.battle-stage[data-hero="zara"][data-motion="quick"] .hero-sprite { animation-name: shield-bash; }
.battle-stage[data-hero="bastion"][data-motion="quick"] .hero-sprite { animation-name: shield-bash; }
.battle-stage[data-hero="ren"][data-motion="quick"] .hero-sprite { animation-name: bow-release; }
.battle-stage[data-motion="guard"] .hero-sprite { animation: hero-brace .55s ease-out both; }
.battle-stage[data-motion="power"] .hero-sprite { animation: power-cast .58s ease-out both; }
.battle-stage[data-hero="bastion"][data-motion="power"] .hero-sprite { animation-name: shield-smash; }
.battle-stage[data-hero="zara"][data-motion="power"] .hero-sprite { animation-name: solar-uppercut; }
.battle-stage[data-hero="ren"][data-motion="power"] .hero-sprite { animation-name: bow-draw; }
.battle-stage[data-motion="comet-rush"] .hero-sprite { animation: comet-charge .58s ease-out both; }
.battle-stage[data-hero="bastion"][data-motion="comet-rush"] .hero-sprite { --charge-reach: 31cqw; }
.battle-stage[data-hero="zara"][data-motion="comet-rush"] .hero-sprite { --charge-reach: 29cqw; }
.battle-stage[data-motion="prism-guard"] .hero-sprite { animation: prism-brace .58s ease-out both; }
.battle-stage[data-motion="nova-blast"] .hero-sprite { animation: nova-rise .58s ease-out both; }
.battle-stage[data-motion="counter"] .enemy-sprite { animation: guardian-dash .57s cubic-bezier(.25,.5,.3,1) both; }
.battle-stage[data-enemy-pose] .enemy-sprite { animation-name: guardian-cast; }
.battle-stage:is([data-enemy-pose="slime-bounce"], [data-enemy-pose="prism-pounce"], [data-enemy-pose="tempest-dive"]) .enemy-sprite { animation-name: guardian-pounce; }
.battle-stage:is([data-enemy-pose="bramble-tap"], [data-enemy-pose="root-rumble"], [data-enemy-pose="shimmer-sweep"]) .enemy-sprite { animation-name: guardian-slam; }
.battle-stage:is([data-enemy-pose="wing-gust"], [data-enemy-pose="cloud-burst"], [data-enemy-pose="gale-call"], [data-enemy-pose="cosmic-wing"]) .enemy-sprite { animation-name: guardian-swoop; }
.battle-stage[data-enemy-pose="bubble-pop"] .enemy-sprite { animation-name: guardian-bubble; }
.battle-stage[data-enemy-pose="thunder-feint"] .enemy-sprite { animation-name: guardian-feint; }
.battle-stage[data-impact="hero"] .champion-stage { animation: recoil-hero .3s ease-out; }
.battle-stage:is([data-impact="enemy"], [data-pet-impact="enemy"]) .enemy-stage { animation: recoil-enemy .3s ease-out; }
@keyframes fx-flight { 0% { left: var(--origin); opacity: 0; transform: translate(-50%, -50%) scale(.35); } 18% { opacity: 1; } 88% { opacity: 1; } 100% { left: var(--destination); opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
@keyframes quick-step { 16% { transform: translateX(-1.8cqw); } 43% { transform: translateX(6cqw) rotate(5deg); } }
@keyframes shield-bash { 14% { transform: translateX(-2cqw) rotate(-5deg); } 47% { transform: translateX(31cqw) rotate(8deg); } 66% { transform: translateX(27cqw); } }
@keyframes bow-release { 26% { transform: translateX(-1.7cqw) rotate(-3deg); } 46% { transform: translateX(1.1cqw) rotate(2deg); } 62% { transform: translateX(-.9cqw); } }
@keyframes hero-brace { 34% { transform: translateX(2cqw) scale(.94, 1.04); filter: drop-shadow(0 0 13px #a2f4d3); } }
@keyframes power-cast { 20% { transform: translateY(-13px) rotate(-5deg); } 46% { transform: translate(6cqw,-17px) scale(1.12); filter: drop-shadow(0 0 18px var(--hero-glow)); } }
@keyframes solar-uppercut { 18% { transform: translate(-2cqw,6px) rotate(-9deg); } 47% { transform: translate(28cqw,-23px) rotate(9deg); filter: drop-shadow(0 0 16px var(--hero-glow)); } 64% { transform: translate(24cqw,-9px); } }
@keyframes shield-smash { 20% { transform: translate(-2cqw,-14px) rotate(-12deg); } 46% { transform: translate(28cqw,4px) rotate(13deg); filter: drop-shadow(0 0 15px var(--hero-glow)); } 62% { transform: translateX(24cqw); } }
@keyframes bow-draw { 23% { transform: translateX(-3cqw) scale(.96,1); } 48% { transform: translateX(1.4cqw) rotate(3deg); filter: drop-shadow(0 0 13px var(--hero-glow)); } 62% { transform: translateX(-1.1cqw); } }
@keyframes comet-charge { 24% { transform: translate(calc(var(--charge-reach, 12cqw) * .58),-11px) rotate(6deg); } 36% { transform: translate(calc(var(--charge-reach, 12cqw) * .41),-5px); } 55% { transform: translate(var(--charge-reach, 12cqw),-13px) rotate(8deg); filter: drop-shadow(0 0 14px var(--hero-glow)); } }
@keyframes prism-brace { 22% { transform: translate(-1cqw,4px) scale(1.04,.93); } 48% { transform: translateX(3cqw); filter: drop-shadow(0 0 18px #9affea); } }
@keyframes nova-rise { 27% { transform: translateY(-12px) scale(1.06); } 51% { transform: translate(3cqw,-21px) scale(1.1); filter: drop-shadow(0 0 19px var(--hero-glow)); } }
@keyframes guardian-dash { 18% { transform: translateX(2cqw) rotate(4deg); } 48% { transform: translate(-7cqw,-8px) rotate(-8deg) scale(1.09); filter: drop-shadow(0 0 11px var(--enemy-glow)); } }
@keyframes guardian-cast { 22% { transform: translate(1cqw,-7px) rotate(5deg) scale(.96,1.06); } 48% { transform: translate(-4cqw,-6px) rotate(-4deg); filter: drop-shadow(0 0 16px var(--enemy-glow)); } }
@keyframes guardian-pounce { 18% { transform: translateX(2cqw) scale(1.04,.92); } 32% { transform: translate(-14cqw,-22px) rotate(3deg); } 48% { transform: translate(-28cqw,-8px) rotate(-9deg); } 66% { transform: translate(-23cqw,0) scale(1.05,.95); } }
@keyframes guardian-slam { 20% { transform: translate(1cqw,-14px) rotate(7deg); } 46% { transform: translate(-15cqw,3px) rotate(-9deg) scale(1.07,.94); } 63% { transform: translateX(-10cqw); } }
@keyframes guardian-swoop { 22% { transform: translate(1cqw,-20px) rotate(6deg); } 47% { transform: translate(-11cqw,-13px) rotate(-8deg); filter: drop-shadow(0 0 12px var(--enemy-glow)); } }
@keyframes guardian-bubble { 20% { transform: translateX(1cqw) scale(.87,1.1); } 46% { transform: translateX(-4cqw) scale(1.1,.92); } 62% { transform: scale(.96,1.04); } }
@keyframes guardian-feint { 18% { transform: translate(-7cqw,-7px) rotate(-4deg); } 30% { transform: translate(-2cqw,-14px) rotate(3deg); } 47% { transform: translate(-13cqw,-6px) rotate(-9deg); } }
@keyframes recoil-enemy { 23% { transform: translateX(13px) rotate(5deg); filter: brightness(1.4); } 57% { transform: translateX(-4px); } }
@keyframes recoil-hero { 23% { transform: translateX(-12px) rotate(-4deg); filter: brightness(1.32); } 57% { transform: translateX(4px); } }
@keyframes hit-spark { 0% { opacity: .9; transform: translate(-50%, -50%) scale(.2); } 31% { opacity: .84; } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(24deg) scale(1.32); } }
@keyframes ward-rise { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 32% { opacity: .94; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.18); } }
@keyframes ward-hit { 0% { opacity: .97; transform: translate(-50%, -50%) scale(1.03); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); } }
@keyframes pop-damage { 0% { opacity: 0; transform: translate(-50%, 5px) scale(.66); } 26% { opacity: 1; transform: translate(-50%, -7px) scale(1.09); } 78% { opacity: .96; } 100% { opacity: 0; transform: translate(-50%, -27px); } }
@keyframes evolution-glow { 0% { transform: scale(.76); filter: brightness(1.65) drop-shadow(0 0 21px #bd74fd); } 50% { transform: scale(1.12); filter: drop-shadow(0 0 13px #bf7eff); } }
@keyframes crack { 45% { transform: scale(.94); box-shadow: 0 0 12px #a3e2ba; } }
@keyframes pet-windup { 40% { transform: translateX(-3px) scale(1.03,.92); } 100% { transform: translateX(-2px); } }
@keyframes pet-aura { 0% { opacity: 0; transform: scale(.64); } 100% { opacity: .9; transform: scale(1.08); } }
@keyframes ember-breath { 27% { transform: translate(4cqw,-8px) rotate(6deg); } 51% { transform: translate(2.5cqw,-5px); } }
@keyframes mochi-pounce { 29% { transform: translate(3cqw,-21px) rotate(-7deg); } 56% { transform: translate(4cqw,-7px) rotate(6deg); } }
@keyframes pebble-stomp { 19% { transform: translateY(-7px) rotate(-7deg); } 37% { transform: translate(1.6cqw,1px) scale(1.07,.94); } 62% { transform: translateX(1cqw); } }
@keyframes luma-flight { 27% { transform: translate(1.2cqw,-23px) rotate(-6deg); } 57% { transform: translate(3cqw,-14px); filter: drop-shadow(0 0 13px #fff0b5); } }
.battle-stage[data-pet-heal] .hero-pop:not(:empty) { color: #e3ffb9; animation: pop-damage .32s ease-out both; }
.battle-stage[data-pet-effect="heal"][data-pet-phase="cast"] .hero-sprite { filter: drop-shadow(0 0 15px #ffeb9e); }
@keyframes cloud-flight { 0% { left: var(--origin); opacity: .2; transform: translate(-50%,-50%) rotate(-35deg) scale(.5); } 58% { top: 59%; opacity: 1; } 100% { left: var(--destination); top: 62%; opacity: 0; transform: translate(-50%,-50%) rotate(150deg) scale(1.2); } }
@media (max-width: 860px) {
  .topbar-inner, .shell { padding-inline: 15px; }
  .team-picker { gap: 11px; padding: 12px; }
  .choose-pet { padding-left: 10px; }
  .choice-card .choice-art { height: 135px; }
  .pet-options .choice-art { height: 105px; }
  .choice-detail { font-size: .72rem; }
  .battle-stage { padding-inline: 16px; }
  .team-picker { grid-template-columns: 1fr; }
  .choose-pet { border-left: 0; border-top: 1px solid #dcc9e7; padding: 11px 0 0; }
}
@media (max-width: 660px) {
  .hero-heading { min-height: 128px; padding: 18px 3px 15px; }
  .hero-heading h1 { font-size: clamp(3.2rem, 12vw, 5.1rem); }
  .hero-heading p { margin-top: 7px; }
  .team-picker { grid-template-columns: 1fr; }
  .team-picker h2 { font-size: 1.75rem; }
  .choose-pet { border: 0; border-top: 1px solid #dcc9e7; padding: 9px 0 0; }
  .setup-footer { padding: 9px 12px 12px; }
  .difficulty-note { flex-basis: 100%; }
  .combat-controls { grid-template-columns: 1fr; gap: 7px; padding: 8px; }
  .attacks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attack-button { display: flex; flex-direction: column; justify-content: flex-start; }
  .rune-panel, .attack-panel { padding: 8px; }
}
@media (max-width: 450px) {
  .topbar-inner, .shell { padding-inline: 9px; }
  .topbar-inner { min-height: 54px; }
  .topbar-actions { gap: 4px; }
  .top-button { min-height: 32px; gap: 4px; padding-inline: 5px; font-size: .73rem; }
  .hero-heading { min-height: 119px; }
  .hero-heading p { font-size: .84rem; }
  .team-picker { padding: 9px; gap: 9px; }
  .hero-options, .pet-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .choice-card { padding: 3px; }
  .choice-card .choice-art { height: 110px; }
  .pet-options .choice-art { height: 85px; }
  .choice-name { font-size: 1.16rem; }
  .choice-title { font-size: .61rem; }
  .choice-detail { padding-inline: 3px; font-size: .66rem; }
  .setup-footer { flex-wrap: wrap; }
  .game-options { flex-basis: 100%; }
  .table-field { align-items: flex-start; flex-direction: column; gap: 3px; }
  .table-field select { font-size: .76rem; }
  #start { margin-left: auto; }
  .mode-badge { font-size: .63rem; }
  .primary-button { padding-inline: 8px; font-size: .81rem; }
  .battle-stage { --hero-center: 23%; --enemy-center: 77%; --pet-center: 40%; gap: 4px; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr); min-height: 165px; padding: 7px 7px 0; }
  .fighter-info { padding: 4px 5px 5px; }
  .fighter-name span { font-size: .58rem; }
  .fighter-art { min-height: 127px; }
  .hero-sprite { height: 126px; width: min(75%, 125px); }
  .hero-pose, .enemy-pose { inset: -8px -12px 0; }
  .enemy-sprite { height: 120px; }
  .pet-stage { flex-basis: 38px; }
  .pet-sprite { height: 40px; }
  .battle-stage[data-evolved="true"] .pet-stage { flex-basis: 64px; }
  .battle-stage[data-evolved="true"] .pet-sprite { height: 66px; }
  .pet-pose { inset: -18px -15px 0; }
  .pet-stage figcaption { font-size: .57rem; }
  .duel-emblem { width: 24px; height: 29px; border-width: 1px; border-radius: 6px; font-size: 1rem; }
  .runes { gap: 5px; }
  .rune { min-height: 43px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .battle-stage[data-impact="hero"] .hero-pop:not(:empty),
  .battle-stage:is([data-impact="enemy"], [data-pet-impact="enemy"]) .enemy-pop:not(:empty) { opacity: 1; transform: translateX(-50%); }
  .battle-stage[data-pet-heal] .hero-pop:not(:empty) { opacity: 1; transform: translateX(-50%); }
}
