/* Battle UI lives entirely inside one continuous painted scene. */
body.battle-mode .game-hud,body.battle-mode .game-dock,body.battle-mode .travel-journal{display:none!important}
body.battle-mode .game-client{background:#15283c}
body.battle-mode .game-client #content{padding:0!important;height:100%;max-width:none}
body.battle-mode .game-client #content>.adventure-grid.classic-battle{padding:0!important;display:block;height:100%}
.classic-battle>.adventure-left,.classic-battle .pal-battle{height:100%;display:block;margin:0;padding:0}
.classic-battle .pal-battle{border:0;border-radius:0;overflow:hidden;background:#263e56;color:#ffefcb}
.game-client .pal-battle>.battle-stage{position:relative;height:100%!important;min-height:360px;border:0;border-radius:0;isolation:isolate;overflow:hidden}
.pal-battle .painted-landscape{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.pal-battle .battle-header{position:absolute;inset:0 0 auto;padding:15px 22px;z-index:3;background:linear-gradient(#142b48bd,transparent);border:0;color:#fff1cc;pointer-events:none;text-shadow:0 1px 4px #122840}
.pal-battle .battle-header h3{font:17px 'SimSun',serif;letter-spacing:2px}.pal-battle .battle-header small{font-size:11px;color:#eee6c9}
.pal-battle .boss-health{position:absolute;right:22px;top:65px;width:min(410px,44%);max-height:160px;overflow:auto;z-index:3;padding:9px 12px;background:#172e48cf;border:1px solid #d5bd7d77;border-radius:5px;box-shadow:0 3px 15px #12243b33}
.pal-battle .boss-health-heading>strong{font-size:13px}.pal-battle .boss-intent{font-size:10px;line-height:1.7;margin-top:4px}.pal-battle .boss-skill-list{font-size:10px;margin-top:4px}
.pal-battle .stage-caption{position:absolute;left:22px;bottom:25px;top:auto;z-index:2;background:none;border:0;color:#fff3c9;font-size:11px;text-shadow:0 1px 4px #12243b;pointer-events:none}.pal-battle .stage-caption:before{display:none}
.pal-battle .stage-team{position:absolute;top:auto;height:auto;bottom:23%;align-items:flex-end;gap:24px;z-index:2}
.pal-battle .stage-team.allies{left:7%;right:auto;width:31%;justify-content:center}
.pal-battle .stage-team.enemies{left:auto;right:16%;width:35%;justify-content:center;flex-wrap:nowrap;bottom:31%}
.pal-battle .fighter{width:clamp(90px,10vw,155px);max-width:none;flex-shrink:1}
.pal-battle .fighter.enemy{width:clamp(82px,9vw,140px);padding-bottom:0}
.game-client .pal-battle .fighter>svg{height:clamp(140px,22vh,230px)!important}.game-client .pal-battle .fighter.pet>svg{height:clamp(120px,19vh,200px)!important}
.pal-battle .stage-team.allies>.fighter:first-child{margin-bottom:32px}.pal-battle .stage-team.enemies>.fighter:nth-child(2){margin-bottom:20px}
.pal-battle .fighter-label,.pal-battle .fighter-status{color:#fff1cf;text-shadow:0 1px 3px #182a3f,1px 0 2px #182a3f}.pal-battle .fighter-label{font-size:11px}
.pal-battle .unit-overhead{width:96%;margin-bottom:9px}.pal-battle .fighter.enemy.selected{outline:1px dashed #f6dfaa;background:#fff1b70a}.pal-battle .fighter.enemy.selected:after{content:'▼';color:#ffe095;top:-15px;left:calc(50% - 5px)}
.battle-overlay{position:absolute;inset:0;z-index:4;pointer-events:none}.battle-overlay button,.battle-overlay nav,.battle-overlay section{pointer-events:auto}
.battle-party{position:absolute;left:22px;top:65px;display:flex;flex-direction:column;gap:6px;max-width:38%}
.order-actor{border:1px solid #c8b48366;border-radius:4px;background:#19314cbb;color:#eee4cb;padding:7px 11px;text-align:left;box-shadow:0 2px 9px #14263b22;max-width:100%;font-size:12px}
.order-actor.current{border-color:#f2d595;background:linear-gradient(110deg,#4a6179ed,#213d57d9);box-shadow:inset 2px 0 #e5cb84}.order-actor:disabled{opacity:.6}.order-actor b{font-weight:500}
.order-summary{font-size:10px;color:#ffdc8e;margin-left:12px}.order-actor small{display:block;font-size:9px;color:#d5e1e8;margin-top:4px;line-height:1.7}
.battle-command-window{position:absolute;right:22px;bottom:65px;width:96px;padding:0;border:0;background:none}
.battle-menu-title{text-align:center;font:13px 'SimSun',serif;color:#fff2ce;margin-bottom:9px;text-shadow:0 1px 4px #12263c}
.pal-battle .command-grid{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;background:none;border:0}
.game-client .pal-battle .classic-command{width:100%;min-width:0;min-height:33px;padding:5px 10px;border:1px solid #dcc18b;border-radius:6px;background:linear-gradient(#526c83ee,#213d57ed);box-shadow:inset 0 0 0 2px #1c354c99,0 2px 5px #152a4166;color:#fff0c9;font:14px 'SimSun',serif;display:block;text-align:center;letter-spacing:3px}
.pal-battle .classic-command .command-mark,.pal-battle .classic-command small{display:none}.pal-battle .classic-command.selected{border-color:#ffe8aa;background:linear-gradient(#738b9c,#3b5870)}.pal-battle .classic-command:hover:not(:disabled){filter:brightness(1.2)}.pal-battle .classic-command:disabled{opacity:.4}
.battle-log-button{display:block;margin:9px auto 0;padding:3px 0;border:0;background:none;color:#fff1cf;font-size:10px;text-shadow:0 1px 3px #12243b}
.battle-detail{position:absolute;right:132px;bottom:65px;width:min(360px,calc(100% - 154px));height:auto;max-height:min(420px,62%);padding:14px;border:2px ridge #ceba87;border-radius:7px;background:linear-gradient(120deg,#253f5bf5,#172e47f5);color:#f4e5c4;box-shadow:0 8px 30px #12243b55;display:flex;flex-direction:column;overflow:hidden}
.battle-window-close{position:absolute;right:7px;top:5px;border:0;background:none;color:#f3d598;font-size:23px;line-height:24px;padding:0 3px;z-index:1}
.battle-detail-title{display:flex;justify-content:space-between;gap:6px;padding:0 22px 9px 0;border-bottom:1px solid #bea56a66;margin-bottom:8px;font-size:12px;flex-shrink:0}.battle-detail-title strong{font-weight:500}.battle-detail-title>span{font-size:9px;color:#cadbe7}.battle-detail-title button{display:none}
.battle-spell-list,.classic-battle-log{overflow:auto;min-height:0;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#b6a37a #263c55}
.battle-spell{display:block;width:100%;border:1px solid #8396aa77;border-radius:4px;background:#47637e55;color:#ffedc7;text-align:left;padding:9px;margin-bottom:7px}.battle-spell b{font-weight:500;font-size:12px}.battle-spell small{display:block;font-size:9px;margin-top:4px;color:#bcd8e9}.battle-spell em{display:block;font-size:10px;line-height:1.8;font-style:normal;color:#dbe5ed;margin-top:6px}.battle-spell:hover:not(:disabled){border-color:#ead293;background:#5d779477}
.battle-spell.battle-spell-with-icon{display:grid;grid-template-columns:36px minmax(0,1fr);align-items:start;gap:10px}
.battle-skill-icon{width:36px;height:36px;display:grid;place-items:center;border-radius:7px;border:1px solid currentColor;background:#283e4b;color:#ffdb9d;font:20px/1 "Segoe UI Symbol","Microsoft YaHei",sans-serif}
.battle-skill-icon.tone-magic{background:#263f63;color:#b9e3ff}
.battle-skill-icon.tone-support{background:#2a4b47;color:#b8f0d4}
.battle-skill-copy{min-width:0;overflow-wrap:anywhere}
.battle-skill-list{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#b6a37a #263c55}
.battle-skill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,58px));justify-content:center;gap:8px 6px;padding:4px 4px 6px}
.battle-skill-square{display:grid;justify-items:center;align-content:start;gap:3px;width:100%;min-width:0;padding:0;border:0;border-radius:5px;background:none;color:#f3e7cf}
.battle-skill-square-art{position:relative;display:grid;place-items:center;width:44px;height:44px;border-radius:5px;border:1px solid #97794d;color:#ffdc9c;background:linear-gradient(145deg,#4d4651,#302e3c);box-shadow:inset 0 0 0 2px #f7d59818}
.battle-skill-square.tone-magic .battle-skill-square-art{color:#bcecff;border-color:#6393b3;background:linear-gradient(145deg,#365b7a,#233857)}
.battle-skill-square.tone-support .battle-skill-square-art{color:#b7efd4;border-color:#64a091;background:linear-gradient(145deg,#39665e,#264344)}
.battle-skill-square.tone-special .battle-skill-square-art{color:#ffdc9c;border-color:#c9a970;background:linear-gradient(145deg,#65513c,#362f3b)}
.battle-skill-square .battle-skill-icon{width:auto;height:auto;border:0;border-radius:0;background:none;color:inherit;font-size:22px}
.battle-skill-name{display:block;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:center;font-size:11px;line-height:1.35}
.battle-skill-badge{position:absolute;top:1px;right:2px;color:#ffdf9b;font:9px/1.2 "Microsoft YaHei",sans-serif}
.battle-skill-square:is(:hover,:focus-visible,[aria-pressed="true"]) .battle-skill-square-art{border-color:#f4d385;box-shadow:inset 0 0 0 2px #f4d38548}
.battle-skill-square[aria-disabled="true"]{filter:grayscale(1);opacity:.61;cursor:not-allowed}
.battle-skill-list .battle-smart{margin-top:3px}
.battle-skill-touch{display:none;color:#cadbe7;font-size:10px;margin:4px 4px 0;line-height:1.5}
@media(hover:none) and (pointer:coarse){.battle-skill-touch{display:block}}
.skill-tooltip .skill-tip-reason{display:block;margin-top:5px;color:#ffcdab}
.school-skill-cards .battle-spell-with-icon{background:#294654;border-color:#52717c}
@media(max-width:740px){
  .battle-spell.battle-spell-with-icon{grid-template-columns:29px minmax(0,1fr);gap:7px}
  .battle-skill-icon{width:29px;height:29px;font-size:16px}
}
.battle-smart{width:100%;border:1px dashed #7c91a6;border-radius:3px;background:none;color:#d5e1e9;font-size:10px;text-align:left;padding:8px}.battle-smart small{display:block;font-size:9px;margin-top:4px}.battle-empty,.classic-battle-log{font-size:11px;line-height:1.9}.classic-battle-log p{margin:4px 0}
.battle-detail>.battle-spell-list>p,.battle-detail .skill-line{font-size:11px;line-height:1.8}.battle-detail .skill-line{background:#36506c;border-color:#a1a58b66;color:#e9e5d4;padding:10px;margin-top:8px}.battle-detail .skill-line p{color:#d3e0eb;font-size:10px}.battle-detail .skill-line .button{font-size:10px;padding:5px 9px}
.battle-command-prompt{position:absolute;bottom:25px;left:22px;color:#fff1c9;font-size:11px;text-shadow:0 1px 4px #122840;margin:0;background:#1b324b88;padding:5px 8px;border-radius:3px}
.battle-overlay.resolving .battle-command-window{opacity:.45}.battle-overlay.resolving .battle-detail{display:none}
.pal-battle .classic-result.battle-reward{position:absolute!important;inset:50% auto auto 50%!important;transform:translate(-50%,-50%)!important;width:min(420px,85%)!important;z-index:6;padding:25px;border:2px ridge #d4bc81;border-radius:8px;background:#1b334ded;color:#ffedca;display:flex;flex-direction:column;gap:15px;text-align:center;box-shadow:0 10px 40px #13243c66}.classic-result h3{font-size:21px}.classic-result p{font-size:12px;line-height:1.9}.round-confirm{padding:8px 16px;background:linear-gradient(#57718a,#29465e);border:1px solid #d8bc83;border-radius:5px;color:#ffedbd}
body.battle-mode .game-client .game-footer{position:fixed;bottom:3px;left:22px;z-index:5;color:#f9e9c4;text-shadow:0 1px 3px #152a3f;font-size:9px}
@media(max-width:740px){
 .pal-battle .battle-header{padding:12px}.pal-battle .battle-header h3{font-size:14px}.pal-battle .battle-header small{font-size:9px}
 .battle-party{left:10px;top:55px;max-width:45%;gap:4px}.order-actor{padding:5px 7px;font-size:10px}.order-summary{display:block;margin:3px 0 0;font-size:8px}.order-actor small{font-size:7px;line-height:1.6;margin-top:3px}
 .pal-battle .boss-health{right:10px;top:55px;width:46%;padding:6px 8px;max-height:175px}.pal-battle .boss-health-heading>strong{font-size:11px}.pal-battle .boss-intent,.pal-battle .boss-skill-list{font-size:8px;line-height:1.7}.pal-battle .boss-skill-list p{grid-template-columns:1fr;gap:2px;font-size:8px}
 .battle-command-window{right:10px;bottom:45px;width:72px}.battle-menu-title{font-size:11px;margin-bottom:6px}.pal-battle .command-grid{gap:5px}.game-client .pal-battle .classic-command{min-height:30px;padding:5px 2px;font-size:12px;letter-spacing:1px;border-radius:5px}.battle-log-button{font-size:8px;margin-top:7px}
 .battle-detail{right:90px;bottom:45px;width:calc(100% - 100px);max-width:320px;max-height:44%;padding:10px}.battle-detail-title{font-size:11px;padding-right:18px}.battle-detail-title>span{font-size:8px}.battle-spell{padding:7px;margin-bottom:5px}.battle-spell b{font-size:11px}.battle-spell em{font-size:9px;margin-top:4px}.battle-window-close{right:4px;top:3px;font-size:21px}
 .pal-battle .stage-team{gap:7px}.pal-battle .stage-team.allies{left:3%;width:36%;bottom:27%}.pal-battle .stage-team.enemies{right:27%;width:41%;bottom:45%;gap:4px}
 .pal-battle .fighter{width:clamp(48px,15vw,90px)}.pal-battle .fighter.enemy{width:clamp(39px,12vw,75px)}.game-client .pal-battle .fighter>svg{height:125px!important}.game-client .pal-battle .fighter.pet>svg{height:95px!important}.game-client .pal-battle .fighter.enemy>svg{height:100px!important}
 .pal-battle .stage-team.allies>.fighter:first-child{margin-bottom:22px}.pal-battle .stage-team.enemies>.fighter:nth-child(2){margin-bottom:17px}.pal-battle .fighter-label{font-size:8px}.pal-battle .fighter-status{font-size:7px}.pal-battle .unit-overhead{margin-bottom:6px}.pal-battle .fighter .unit-overhead .unit-hp-value,.pal-battle .fighter.enemy .unit-overhead .unit-hp-value{font-size:6px}
 .battle-command-prompt{left:10px;bottom:24px;font-size:8px;max-width:calc(100% - 20px)}.pal-battle .stage-caption{display:none}body.battle-mode .game-client .game-footer{left:10px;font-size:8px}
}
@media(max-height:520px){.battle-party{top:48px}.pal-battle .boss-health{top:48px;max-height:95px}.battle-command-window{bottom:30px}.pal-battle .command-grid{gap:3px}.game-client .pal-battle .classic-command{min-height:24px;padding:3px}.battle-detail{bottom:30px;max-height:65%}.pal-battle .stage-team{bottom:15%}.pal-battle .stage-team.enemies{bottom:20%}.battle-command-prompt{bottom:8px}}

.pal-battle .stage-caption{display:none}body.scene-busy .pal-battle .stage-caption{display:block;left:50%;top:24%;bottom:auto;transform:translateX(-50%);padding:5px 10px;background:#19314ba8;border-radius:4px;max-width:80%;white-space:nowrap}

@media(max-width:740px) and (max-height:700px){.pal-battle .stage-team.enemies{bottom:34%}.pal-battle .stage-team.allies{bottom:20%}}

/* Anchor the command column to the current fighter, positioned after layout. */
.battle-overlay.resolving .battle-command-window{visibility:hidden}.battle-command-window{right:auto;bottom:auto}.battle-detail{max-height:min(420px,62%)}
@media(max-width:740px){.battle-detail{max-height:44%}}

@media(max-width:740px) and (max-height:700px){
 .pal-battle .stage-team.enemies{bottom:41%}
 .battle-party .order-actor{font-size:9px;padding:4px 6px}.battle-party .order-summary{display:inline;margin-left:4px;font-size:7px}.battle-party .order-actor small{font-size:6px;line-height:1.4;margin-top:3px}
 .battle-command-window{width:68px}.battle-menu-title{font-size:10px;margin-bottom:3px}.pal-battle .command-grid{gap:3px}.game-client .pal-battle .classic-command{min-height:24px;font-size:11px;padding:3px 2px}.battle-log-button{font-size:8px;margin-top:4px}
}

@media(max-width:740px) and (max-height:700px){.battle-command-window .battle-menu-title{position:absolute;top:-18px;left:0;width:100%;margin:0}.battle-command-window .battle-log-button{position:absolute;bottom:-18px;left:0;width:100%;margin:0}}

/* Larger wild groups use two ranks rather than squeezing six overhead meters into one row. */
.pal-battle .stage-team.enemies.many-enemies{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));right:10%;width:44%;bottom:20%;gap:18px 12px;justify-items:center}
.pal-battle .many-enemies>.fighter.enemy{width:min(100%,110px);margin-bottom:0!important}
.game-client .pal-battle .many-enemies>.fighter.enemy>svg{height:95px!important}.battle-loot{margin:0;padding:0;list-style:none;color:#ffe0a0;font-size:12px;line-height:1.9}
@media(max-width:740px){.pal-battle .stage-team.enemies.many-enemies{right:3%;width:53%;bottom:17%;gap:16px 5px}.pal-battle .many-enemies>.fighter.enemy{width:100%;max-width:64px}.game-client .pal-battle .many-enemies>.fighter.enemy>svg{height:60px!important}.battle-loot{font-size:10px}}

@media(max-width:740px){.pal-battle .stage-team.enemies.many-enemies{right:1%;width:40%}.pal-battle .battle-stage:has(.many-enemies) .stage-team.allies{left:1%;width:32%}}

/* Mobile opposition shares the allied vertical center; JS aligns actual sprite bounds. */
@media(max-width:740px){.pal-battle .stage-team.enemies:not(.many-enemies){right:3%;width:44%;bottom:27%}}
@media(max-width:740px) and (max-height:700px){.pal-battle .stage-team.enemies:not(.many-enemies){bottom:20%}}
.battle-auto-control{position:absolute;right:16px;bottom:24px;z-index:2;min-width:90px;min-height:34px;padding:7px 12px;border:1px solid #dfc18b;border-radius:5px;background:linear-gradient(#526d87,#243e58);color:#ffedc5;font-size:12px;box-shadow:0 2px 8px #152b4544}
.battle-overlay.automatic .battle-command-window{visibility:hidden}.battle-overlay.automatic .battle-detail{display:none}.battle-command-prompt{max-width:calc(100% - 135px)}
.auto-order-field{display:block;margin:16px 0}.auto-order-field strong{display:block;font-size:13px;margin-bottom:8px}.auto-order-field select{width:100%;min-height:38px;border:1px solid #879ba9;border-radius:4px;padding:7px;background:#f8f4e8;color:#273f4e;font-size:13px}.auto-battle-settings>p{font-size:11px;line-height:1.8;margin-top:9px}
@media(max-width:740px){.battle-auto-control{right:10px;bottom:23px;min-width:78px;min-height:30px;font-size:10px;padding:5px 8px}.battle-command-prompt{max-width:calc(100% - 105px)}.auto-order-field{margin:12px 0}.auto-order-field strong{font-size:12px}.auto-order-field select{font-size:12px}.auto-battle-settings>p{font-size:10px}}

@media(max-width:740px) and (max-height:700px){.game-client .pal-battle .command-grid{gap:2px}.game-client .pal-battle .classic-command{height:22px;min-height:22px;line-height:14px;padding:2px}.battle-command-window .battle-menu-title{top:2px;left:calc(100% + 5px);width:auto;white-space:nowrap}}

/* Visible target selection: outline, pointer and ground marker share a gold accent. */
.pal-battle .fighter.enemy.selected{outline:2px solid #ffe29a;outline-offset:3px;border-radius:7px;background:linear-gradient(#fff0bb0a,#e7b34a29);box-shadow:0 0 0 4px #172c4688,0 0 17px #ffce6180,inset 0 0 0 1px #fff2bf66}
.pal-battle .fighter.enemy.selected:after{content:'▼';position:absolute;top:-23px;left:calc(50% - 9px);color:#ffe391;font-size:20px;line-height:20px;text-shadow:0 2px 1px #65471a,0 0 7px #f7bf4f;pointer-events:none;z-index:3}
.pal-battle .fighter.enemy.selected:before{content:'';position:absolute;left:9%;right:9%;height:16px;bottom:24px;border:2px solid #ffe5a0;border-radius:50%;background:#efba4833;box-shadow:0 0 8px #ffd266aa,inset 0 0 6px #ffe6a988;pointer-events:none;z-index:0}
.pal-battle .fighter.enemy.selected .fighter-label{color:#fff1aa;font-weight:700;text-shadow:0 1px 3px #352817,0 0 6px #ffcf65}
@media(max-width:740px){.pal-battle .fighter.enemy.selected{outline-offset:1px;box-shadow:0 0 0 2px #172c4688,0 0 9px #ffce6177,inset 0 0 0 1px #fff2bf55}.pal-battle .fighter.enemy.selected:after{font-size:17px;top:-20px;left:calc(50% - 8px)}.pal-battle .fighter.enemy.selected:before{height:11px;bottom:22px;left:5%;right:5%}}

.rare-badge{position:absolute;top:-27px;left:50%;transform:translateX(-50%);white-space:nowrap;padding:3px 9px;border:1px solid #f9d787;border-radius:5px;background:linear-gradient(#79528e,#3b255b);color:#ffedb1;font:bold 12px/17px 'Microsoft YaHei',sans-serif;box-shadow:0 0 12px #d89bff99,0 1px 4px #1d183c;pointer-events:none;z-index:3}
.pal-battle .fighter.rare-enemy:not(.selected){background:linear-gradient(transparent,#bc77e71f);border-radius:7px;box-shadow:0 0 13px #cb8bff55}.pal-battle .fighter.rare-enemy .fighter-label{color:#f4d2ff;font-weight:700;text-shadow:0 1px 3px #301446,0 0 6px #dca0ff}.pal-battle .fighter.rare-enemy .unit-hp-value{box-shadow:inset 3px 0 #d99aff}
.pal-battle .fighter.rare-enemy.selected:after{top:-51px}
.rare-encounter{position:absolute;top:65px;right:22px;z-index:3;max-width:42%;padding:9px 13px;text-align:left;background:linear-gradient(110deg,#583a73ee,#2f234fee);border:1px solid #f2ce88;border-radius:6px;color:#ffe8a7;box-shadow:0 0 16px #cc8bee55,0 4px 15px #17283b44}.rare-encounter strong{display:block;font-size:12px}.rare-encounter b{display:block;font-size:14px;margin-top:4px;font-weight:500;color:#f5dcff}.rare-encounter small{display:block;font-size:10px;color:#e0d1ea;margin-top:5px}
@media(max-width:740px){.rare-badge{font-size:9px;line-height:14px;padding:1px 5px;top:-23px;border-radius:4px}.pal-battle .fighter.rare-enemy.selected:after{top:-43px}.rare-encounter{top:55px;right:10px;max-width:46%;padding:7px 9px}.rare-encounter strong{font-size:10px}.rare-encounter b{font-size:12px}.rare-encounter small{font-size:8px}}
/* Mobile text remains legible while command/unit positioning uses actual bounds. */
.pal-battle .boss-intent,.pal-battle .boss-skill-list{font-size:12px}.order-actor small{font-size:11px;color:#f0f5f9}.battle-spell em,.battle-spell small{font-size:12px}.battle-spell small{color:#e2eef7}
@media(max-width:740px){.battle-party .order-actor{font-size:11px}.battle-party .order-actor small{font-size:9px;line-height:1.55}.battle-party .order-summary{font-size:9px}.pal-battle .boss-intent,.pal-battle .boss-skill-list,.pal-battle .boss-skill-list p{font-size:10px;line-height:1.6}.pal-battle .boss-health{max-height:min(220px,29vh)}.pal-battle .fighter .unit-overhead .unit-hp-value,.pal-battle .fighter.enemy .unit-overhead .unit-hp-value{font-size:9px}.unit-resource-meter{height:10px}.unit-resource-meter>em{font-size:8px;line-height:8px}.pal-battle .fighter-label{font-size:10px}.pal-battle .fighter-status{font-size:9px}.battle-command-prompt{font-size:10px}.battle-spell em,.battle-spell small{font-size:11px}.classic-battle-log{font-size:12px}}
@media(max-width:740px){.pal-battle .fighter.enemy .unit-hp-value{line-height:1.2}.pal-battle .fighter.enemy .unit-hp-max{display:block;white-space:nowrap}.pal-battle .fighter.enemy .unit-overhead .unit-hp-value{overflow:visible}}
@media(max-width:740px) and (max-height:700px){.battle-command-window .battle-menu-title{display:none}}
.battle-command-prompt .battle-hint{display:block;font-size:10px;color:#fff2d0;line-height:1.6;margin-top:2px}.battle-command-prompt{max-width:calc(100% - 150px)}
@media(max-width:740px){.battle-command-prompt{max-width:calc(100% - 105px)}.battle-command-prompt .battle-hint{font-size:9px}}
@media(max-width:740px){.battle-command-window{width:64px}.battle-log-button{font-size:9px}}
@media(max-width:400px){.battle-command-window{width:56px}}

/* 第76节：人物上肢分层，战场保持固定。 */
.battle-stage .fighter>svg.posing,.battle-stage .fighter.dashing>svg{animation:none;overflow:visible}
.posing .hero-action-pose{display:inline}
.posing .hero-rest{display:none}
.saber-attack-pose{display:none;transform-origin:87px 172px}
.fighter>svg[data-saber-pose] .hero-rest{display:none}
.fighter>svg[data-saber-pose] .saber-attack-pose{display:inline}
.character-appearance{display:grid;gap:8px;margin-bottom:16px;padding:12px 14px;background:#f3eee0;border:1px solid #d6ccb7;border-radius:6px}
.appearance-options{display:flex;align-items:center;flex-wrap:wrap;gap:7px}
.appearance-options>span{min-width:2em;color:#635a48}
.appearance-options>button{min-height:36px;padding:5px 10px;border:1px solid #c4b99f;border-radius:4px;background:#fffaf0;color:#433d30}
.appearance-options>button[aria-pressed="true"]{border-color:#46675d;background:#46675d;color:#fff}
.character-appearance .field-help{margin:0}
.battle-fx.battle-slash{width:124px;height:124px;pointer-events:none}
.battle-fx.battle-slash i{position:absolute;left:6%;top:48%;width:88%;height:7px;border-radius:100%;background:linear-gradient(90deg,transparent,#fff8d6,#ffd98a,transparent);filter:drop-shadow(0 0 7px #ffcf78);opacity:0;transform-origin:0 50%;--rot:calc((var(--i,0) - 1)*24deg + var(--tilt,1)*10deg);transform:rotate(var(--rot)) scaleX(.2);animation:slash-cut .5s ease-out forwards;animation-delay:calc(var(--i,0)*45ms)}
.battle-fx.battle-slash i:nth-child(1){--i:0}.battle-fx.battle-slash i:nth-child(2){--i:1}.battle-fx.battle-slash i:nth-child(3){--i:2}
.battle-fx.battle-slash.tone-arcane i{background:linear-gradient(90deg,transparent,#e5f7ff,#8fdcff,transparent);filter:drop-shadow(0 0 8px #8fd8ff)}
.battle-fx.battle-slash.tone-heal i{background:linear-gradient(90deg,transparent,#e8fff0,#8fe6a6,transparent)}
@keyframes slash-cut{0%{opacity:0;transform:translate(-10px,0) rotate(var(--rot)) scaleX(.15)}40%{opacity:1;transform:translate(0,0) rotate(var(--rot)) scaleX(1.1)}100%{opacity:0;transform:translate(16px,-10px) rotate(var(--rot)) scaleX(1.35)}}
.battle-fx.impact-burst{width:132px;height:132px;pointer-events:none}
.impact-burst i{position:absolute;inset:0;border-radius:50%;border:2px solid #ffe9a8;opacity:0;animation:impact-ring .62s ease-out forwards}
.impact-burst i:nth-child(2){animation-delay:.07s;border-color:#ffc45e}
.impact-burst i:nth-child(3){animation-delay:.14s;border-width:6px;border-color:#fff6d4}
.impact-burst.tone-arcane i{border-color:#9fe8ff}.impact-burst.tone-heal i{border-color:#9ff0b5}
@keyframes impact-ring{0%{opacity:.95;transform:scale(.15)}70%{opacity:.7}100%{opacity:0;transform:scale(1.4)}}
.battle-cast{position:absolute;z-index:11;width:clamp(78px,12vw,120px);aspect-ratio:1;transform:translate(-50%,-50%);pointer-events:none;color:#d9f8ff;filter:drop-shadow(0 1px 2px #12355c) drop-shadow(0 0 7px #55cfff)}
.battle-cast.cast-heal{color:#e2ffde;filter:drop-shadow(0 1px 2px #1d4932) drop-shadow(0 0 7px #64f6a0)}
.battle-cast svg{width:100%;height:100%;overflow:visible}
.cast-sigil,.cast-sparks,.cast-heart{transform-origin:50% 50%}
.cast-sigil{animation:cast-sigil-form .4s ease-out both}
.cast-sparks{animation:cast-sparks-gather .44s ease-out both}
.cast-heart{animation:cast-heart-charge .4s ease-out both}
.battle-cast[data-phase="release"] svg{animation:cast-sigil-release .37s ease-out both}
@keyframes cast-sigil-form{from{opacity:0;transform:rotate(-54deg) scale(.65)}to{opacity:1;transform:rotate(0) scale(1)}}
@keyframes cast-sparks-gather{from{opacity:0;transform:rotate(-32deg) scale(1.2)}40%{opacity:1}to{opacity:.2;transform:rotate(45deg) scale(.22)}}
@keyframes cast-heart-charge{from{opacity:0;transform:scale(.2)}to{opacity:1;transform:scale(1)}}
@keyframes cast-sigil-release{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(1.48)}}
.fx-damage{font-size:29px;letter-spacing:1px;text-shadow:0 3px 0 #3b1c12,0 0 12px #ffb15e,0 2px #fff8dc}
@media(prefers-reduced-motion:reduce){
  .battle-cast svg,.battle-cast svg>*{animation:none!important}
  .battle-fx.battle-slash i,.impact-burst i{animation-duration:.08s!important;animation-iteration-count:1!important}
}

/* 突进时隐藏不跟随的头顶条，避免出现空槽血条。 */
.battle-stage .fighter.dashing{z-index:5}
.battle-stage .fighter.dashing .unit-overhead{opacity:0;transition:opacity .12s}
.battle-stage .fighter.dashing .fighter-label,.battle-stage .fighter.dashing .fighter-status{opacity:.35}

/* 固定斜俯视战场：脚圈、投影和角色共享近景地面。 */
.pal-battle details.boss-health>summary{cursor:pointer}
.pal-battle details.boss-health>summary::after{content:'▾';color:#f4d99f}
.pal-battle details.boss-health[open]>summary::after{content:'▴'}
.battle-perspective>.painted-landscape{filter:saturate(.78) brightness(.8)}
.battle-field-ground{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.battle-field-ground::before{
  content:'';position:absolute;inset:26% -25% -43%;
  background:radial-gradient(ellipse at 54% 32%,#b7c3a939,transparent 58%),
    repeating-linear-gradient(90deg,#152a2870 0 1px,transparent 2px 11%),
    repeating-linear-gradient(0deg,#152a2860 0 1px,#bcc3a62b 2px,transparent 3px 15%),
    linear-gradient(145deg,#566c61aa,#334c48d9 76%);
  transform:perspective(650px) rotateX(48deg) rotateZ(-11deg);
  mask-image:radial-gradient(ellipse at 50% 52%,#000 18%,#000b 42%,transparent 71%);
}
.battle-field-ground::after{content:'';position:absolute;inset:0;background:radial-gradient(ellipse at 52% 54%,transparent 25%,#10212970 100%)}
.battle-field-units{position:absolute;inset:0;z-index:2;pointer-events:none}
.pal-battle .battle-perspective .stage-team.enemies,.pal-battle .battle-perspective .stage-team.allies{display:contents}
.pal-battle .battle-perspective .stage-team>.fighter{
  position:absolute;left:var(--field-x);top:var(--field-y);width:clamp(100px,13vw,195px);max-width:none;
  height:calc(clamp(150px,28vh,265px)*var(--field-size));margin:0!important;padding:0;
  transform:translate(-50%,-100%);z-index:var(--field-depth);pointer-events:auto;
}
.pal-battle .battle-perspective .stage-team>.enemy{width:clamp(85px,11vw,155px);height:calc(clamp(108px,20vh,190px)*var(--field-size))}
.pal-battle .battle-perspective .stage-team.nine-enemies>.enemy{width:clamp(74px,9.6vw,134px);height:calc(clamp(100px,18vh,172px)*var(--field-size))}
.pal-battle .battle-perspective .stage-team.dense-enemies>.enemy{width:clamp(72px,8.8vw,126px);height:clamp(80px,13vh,100px)}
.pal-battle .battle-perspective .stage-team>.pet{width:clamp(76px,10vw,142px);height:calc(clamp(88px,18vh,162px)*var(--field-size))}
.game-client .pal-battle .battle-perspective .stage-team>.fighter>svg{position:relative;top:5%;height:100%!important;z-index:1;transform-origin:50% 95%}
.battle-perspective .fighter>.unit-overhead{position:absolute;bottom:100%;left:50%;width:min(94%,86px);margin:0;transform:translateX(-50%);z-index:2}
.unit-threats{display:flex;justify-content:center;gap:2px;margin-bottom:3px;pointer-events:none}
.unit-threat{border:1px solid #ddc89169;border-radius:3px;background:#282436e8;color:#f6dca2;font:600 10px/1.25 "Microsoft YaHei",sans-serif;padding:1px 3px;white-space:nowrap}
.unit-threat.threat-seal{color:#f2d5fd;border-color:#cc99ed80}
.unit-threat.threat-weaken{color:#f7e1b0;border-color:#d8b86e85}
.unit-threat.threat-guard{color:#d8ecff;border-color:#8fc2e896;background:#1d344ce8}
.battle-perspective .fighter>.fighter-label,.battle-perspective .fighter>.fighter-status{position:absolute;top:calc(100% + 6px);left:0;right:0;pointer-events:none}
.battle-perspective .fighter>.fighter-status{top:calc(100% + 22px);margin:0}
.pal-battle .battle-perspective .fighter.enemy.selected{background:none;outline:none;box-shadow:none}
.battle-perspective .fighter.enemy:focus-visible{outline:2px solid #ffdf8e;outline-offset:3px}
.battle-perspective .fighter.enemy.selected:not(:focus-visible)::after,.battle-perspective .fighter.enemy.selected::before{display:none}
.battle-perspective .rare-badge{top:auto;bottom:calc(100% + 26px)}
.field-contact{position:absolute;left:13%;right:13%;top:100%;height:clamp(12px,2.4vw,27px);margin-top:clamp(-13px,-1.2vw,-6px);pointer-events:none;
  border-radius:50%;background:radial-gradient(ellipse,#101919ba 3%,#17232480 36%,transparent 73%)}
.battle-perspective .selected>.field-contact{border:1px solid #f6d88d;box-shadow:0 0 10px #ffe8a974,inset 0 0 12px #eab94952}
.field-blade-trail{position:absolute;inset:0;width:100%;height:100%;overflow:visible;z-index:3;pointer-events:none}
.field-blade-trail path{fill:none;stroke:#fff2be;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 0 4px #f8ab38) drop-shadow(0 0 8px #e79b4e)}
.field-blade-trail.heavy path{stroke-width:5}
.field-blade-trail.fading{animation:field-trail-fade .16s ease-out forwards}
@keyframes field-trail-fade{to{opacity:0}}
.battle-perspective .fighter.field-hit>svg{animation:field-hit .31s ease-out both}
@keyframes field-hit{0%{transform:none;filter:brightness(1.75)}24%{transform:translateX(var(--hit-away)) rotate(var(--hit-turn));filter:brightness(1.25)}100%{transform:none}}
.battle-perspective .stage-caption{z-index:3}
@media(max-width:740px){
  .pal-battle .battle-perspective .stage-team>.fighter{left:var(--field-x-mobile);top:var(--field-y-mobile);z-index:var(--field-depth-mobile);width:clamp(57px,21vw,124px);height:calc(clamp(88px,18vh,157px)*var(--field-size))}
  .pal-battle .battle-perspective .stage-team>.enemy{width:clamp(43px,14vw,108px);height:calc(clamp(54px,12vh,120px)*var(--field-size))}
  .pal-battle .battle-perspective .stage-team.nine-enemies>.enemy{width:clamp(40px,13vw,56px);height:calc(clamp(50px,10.5vh,104px)*var(--field-size))}
  .pal-battle .battle-perspective .stage-team.dense-enemies>.enemy{width:clamp(39px,11.5vw,52px);height:calc(clamp(50px,10.5vh,104px)*var(--field-size))}
  .pal-battle .battle-perspective .stage-team>.pet{width:clamp(44px,15vw,101px);height:calc(clamp(55px,13vh,104px)*var(--field-size))}
  .battle-perspective .nine-enemies .fighter>.unit-overhead{width:100%}
  .battle-perspective .nine-enemies .unit-threats{gap:1px}
  .battle-perspective .nine-enemies .unit-threat{font-size:7px;padding:0 2px;line-height:1.35}
  .battle-perspective .allies .fighter>.unit-overhead{width:clamp(34px,11.5vw,74px)}
  .battle-perspective .allies .unit-hp-max{display:block}
  .battle-perspective .fighter>.fighter-status{top:calc(100% + 19px)}
  .unit-threat{font-size:9px;padding:1px 2px}
}
@media(prefers-reduced-motion:reduce){.battle-perspective .fighter.field-hit>svg{animation:none}}
.pal-battle .battle-skill-square[data-skill-tier] .battle-skill-square-art{background:var(--skill-ground);border-color:var(--skill-border);color:var(--skill-color)}
.pal-battle .battle-skill-square[data-skill-tier]:is(:hover,:focus-visible,[aria-pressed="true"]) .battle-skill-square-art{border-color:#f4d385}
.battle-copied-passives{padding:7px 0;color:#f1dfba}
.battle-copied-passives .skill-tags{margin-top:4px}
