/* Keep encounter choices together above the Fight / Flee buttons. */
.encounter-attack-mode{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0}
.encounter-attack-mode button{display:flex;flex-direction:column;gap:4px;text-align:center;background:#fff;border:1px solid #dce3df;border-radius:12px;padding:10px 7px;color:#526158}
.encounter-attack-mode button b{font-size:13px}.encounter-attack-mode button small{font-size:10px;font-weight:400}
.encounter-attack-mode button.selected{border-color:#638f7a;background:#edf7f0;box-shadow:inset 0 0 0 1px #638f7a;color:#2e644d}
.ongoing-battle{padding:24px!important}.ongoing-battle button{width:100%;margin-top:12px}

/* The parent outcome grid also serves the two result actions. Our whole skill
   panel spans it; explicit ID-scoped buttons win over the result-button rules. */
.battle-overlay #combat-outcome>.manual-battle-controls{grid-column:1/-1;width:100%;min-width:0;text-align:left}
.battle-overlay #combat-outcome:has(>.manual-battle-controls){padding:8px 10px;gap:0}
.manual-battle-top{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:30px;margin:0 0 6px}
.manual-battle-top strong{font-size:12px;line-height:1.3;color:#354e40}.manual-battle-top small{font-size:10px;color:#788a7e}
.battle-overlay #combat-outcome .manual-battle-top button{width:auto;flex:0 0 auto;min-height:30px;margin:0;padding:5px 9px;font-size:11px;line-height:1.3}
.manual-skill-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;min-width:0}
.battle-overlay #combat-outcome .manual-skill{width:100%;min-width:0;min-height:48px;margin:0;padding:7px 9px;border:1px solid #dfe8e1;background:#fff;border-radius:10px;text-align:left;color:#293f34;display:flex;flex-direction:column;justify-content:center;gap:3px;font-size:12px;line-height:1.2}
.manual-skill strong{font-size:12px;line-height:1.2;overflow-wrap:anywhere}.manual-skill small{font-size:10px;line-height:1.2;color:#708378}
.battle-overlay #combat-outcome .manual-skill.ultimate{background:linear-gradient(135deg,#fff8e2,#f4f1ff);border-color:#d7c494}
.manual-skill:disabled{opacity:.42;cursor:not-allowed}
.manual-battle-error{color:#a04740;font-size:12px;margin:8px 0}.manual-battle-sync{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
/* Announce activity without spending another line over the arena. */
.manual-battle-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
/* Preserve identical fighter positions during selection, attacks and capture.
   The scrolling controls stay below the existing 23% / 27% / 18% floor lines. */
.battle-overlay .battle-panel:has(.manual-battle-controls) .battle-footer{box-sizing:border-box;width:min(600px,100%);padding:0 14px max(10px,env(safe-area-inset-bottom,0px));max-height:22vh;max-height:22dvh;overflow:auto}
@media(max-width:767px){
 .battle-overlay .battle-panel:has(.manual-battle-controls) .battle-footer{width:100%;padding:0 8px max(4px,env(safe-area-inset-bottom,0px));max-height:26vh;max-height:26dvh}
 .battle-overlay #combat-outcome:has(>.manual-battle-controls){padding:6px 8px;border-radius:14px}
 .battle-overlay #combat-outcome .manual-skill{min-height:44px;padding:5px 6px;font-size:11px;gap:2px}
 .manual-skill strong{font-size:11px}.manual-battle-top{margin-bottom:5px}.manual-battle-top strong{font-size:11px}.manual-battle-top small{font-size:9px}
 .battle-overlay #combat-outcome .manual-battle-top button{font-size:10px;padding:5px 7px;min-height:30px}
 .encounter-choice-footer .encounter-attack-mode button{flex:1;min-width:0}.encounter-choice-footer .encounter-attack-mode button small{font-size:9px}
}
@media(max-height:520px) and (min-width:568px){
 .battle-overlay .battle-panel:has(.manual-battle-controls) .battle-footer{width:min(1000px,96%);padding:0 5px max(6px,env(safe-area-inset-bottom,0px));max-height:17vh;max-height:17dvh}
 .battle-overlay #combat-outcome:has(>.manual-battle-controls){padding:4px;border-radius:12px}
 .battle-overlay #combat-outcome>.manual-battle-controls{display:grid;grid-template-columns:96px minmax(0,1fr);gap:6px;align-items:stretch}
 .manual-battle-top{display:flex;margin:0;min-width:0}.manual-battle-top>div{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
 .battle-overlay #combat-outcome .manual-battle-top button{width:100%;min-height:44px;padding:4px 6px;font-size:10px;white-space:normal}
 .manual-skill-list{display:flex;gap:5px;min-width:0;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none}
 .battle-overlay #combat-outcome .manual-skill{flex:1 0 78px;min-height:44px;padding:4px 6px;gap:2px;font-size:11px}
 .manual-skill strong{font-size:11px}.manual-skill small{font-size:9px}
 .manual-skill-list::-webkit-scrollbar{display:none}
 .manual-battle-error,.manual-battle-sync,.manual-battle-help{grid-column:1/-1}
}

.manual-battle-help{font-size:11px;line-height:1.6;color:#67776e;margin:7px 0 0}

.automatic-battle-help{font-size:11px;line-height:1.6;color:#617668;margin:5px 0 0}.battle-overlay #combat-outcome .battle-choose-skills{min-height:44px;padding:8px 14px;font-size:12px;font-weight:700;background:#315e48;color:#fff;border:1px solid #315e48;border-radius:10px}.manual-battle-controls.is-automatic .manual-battle-top{margin-bottom:3px}.battle-choose-skills:focus-visible{outline:3px solid #c9a874;outline-offset:2px}@media(max-height:520px) and (min-width:568px){.automatic-battle-help{align-self:center;margin:0}.battle-overlay #combat-outcome>.manual-battle-controls.is-automatic{grid-template-columns:120px minmax(0,1fr)}}
