/* One-on-one battle presentation. The field, team battle and compact sheet have their own layouts. */
body:not(.sheet-mode) #game.battling #battle {
 --duel-text:#f4f1dc;
 --duel-muted:#c4d1ba;
 --duel-edge:#627967;
 --duel-panel:#152621;
 display:grid;
 grid-template-rows:minmax(0,1fr) auto;
 gap:10px;
 padding:14px 20px 24px;
 background:radial-gradient(ellipse at top,#223b30,#111e19 72%);
 color:var(--duel-text);
 overflow:auto;
}

body:not(.sheet-mode) #battle #battlefield {
 min-height:0;
 border:1px solid #80937c;
 border-radius:13px;
 box-shadow:0 5px 18px #06110c90,0 0 0 3px #1f372b;
}

body:not(.sheet-mode) #battle #battleScenery {
 border:0;
 z-index:-2;
 object-position:50% 39%;
}

body:not(.sheet-mode) #battle #battlefield::after {
 content:"";
 position:absolute;
 inset:0;
 pointer-events:none;
 z-index:-1;
 background:linear-gradient(180deg,#10251bb8 0%,transparent 29%,transparent 61%,#0d211779 100%);
 box-shadow:inset 0 0 42px #112b2042;
}

.duel-toolbar {
 display:flex;
 justify-content:space-between;
 align-items:center;
 gap:8px;
 padding:0;
}

body:not(.sheet-mode) #battle .duel-toolbar {
 position:absolute;
 inset:clamp(8px,2vw,20px) clamp(8px,2vw,22px) auto;
 padding:0;
 z-index:7;
}

.duel-context {
 display:flex;
 align-items:center;
 flex-wrap:wrap;
 gap:6px;
 min-width:0;
}

body:not(.sheet-mode) #battle :is(#battleMode,#battleTurn,#pvpTurn,#battleAutoBattleToggle) {
 position:static;
 margin:0;
 padding:5px 9px;
 color:var(--duel-text);
 background:#13241eea;
 border:1px solid #a0b39780;
 border-radius:7px;
 box-shadow:0 2px 5px #0b1b13a0;
 line-height:1.25;
 white-space:nowrap;
}

body:not(.sheet-mode) #battle #battleMode {font-size:clamp(12px,1.4vw,17px);font-weight:750}
body:not(.sheet-mode) #battle :is(#battleTurn,#pvpTurn) {font-size:11px;font-weight:650;color:#e0e8d3}
body:not(.sheet-mode) #battle #pvpTurn {max-width:100%;overflow:hidden;text-overflow:ellipsis}
body:not(.sheet-mode) #battle #battleAutoBattleToggle {flex:none;min-height:34px;font-size:11px}
body:not(.sheet-mode) #battle #battleAutoBattleToggle[aria-pressed="true"] {background:#41664f;color:#fff9dc;border-color:#c9d8b3}

body:not(.sheet-mode) #battle .hpbox {
 --duel-accent:#b2d9a4;
 width:clamp(128px,24%,258px);
 min-width:0;
 padding:9px 12px 10px;
 background:linear-gradient(125deg,#213a2fec,#102119eb 90%);
 border:1px solid #8aa28eaa;
 border-left:3px solid var(--duel-accent);
 border-radius:9px;
 color:var(--duel-text);
 box-shadow:0 6px 16px #0c1d166e;
 font:600 clamp(11px,1.3vw,15px)/1.3 system-ui,sans-serif;
}

body:not(.sheet-mode) #battle .hpbox.enemy {
 --duel-accent:#edc695;
 left:clamp(10px,3%,36px);
 top:clamp(57px,14%,94px);
 background:linear-gradient(125deg,#3d3325ef,#201e16eb 90%);
 border-color:#bc9e73ad;
 border-left-color:var(--duel-accent);
}

body:not(.sheet-mode) #battle #battlefield:has(#pvpTurn:not([hidden])) .hpbox.enemy {top:clamp(67px,18%,105px)}

body:not(.sheet-mode) #battle .hpbox.own {right:clamp(10px,3%,36px);bottom:clamp(13px,7%,52px)}
.duel-monster-heading {display:flex;align-items:baseline;justify-content:space-between;gap:4px}
body:not(.sheet-mode) #battle .duel-monster-heading b {min-width:0;line-height:1.15;letter-spacing:0;font-size:clamp(13px,1.55vw,20px)}
.duel-monster-heading>span {flex:none;color:var(--duel-accent);font-size:.76em;font-weight:700;white-space:nowrap}
.duel-monster-tags {display:flex;gap:4px;align-items:center;min-height:15px;margin-top:2px;font-size:.73em;color:#e5dcc7}
body:not(.sheet-mode) #battle .duel-monster-tags .statusTag {position:static;margin:0;font-size:inherit}
body:not(.sheet-mode) #battle .hp-line {display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:6px;margin:5px 0 0}
body:not(.sheet-mode) #battle .hp-line span,
body:not(.sheet-mode) #battle #ownHP {margin:0;padding:0;background:none;color:#eee9d4;font-size:.72em;font-variant-numeric:tabular-nums;white-space:nowrap}
body:not(.sheet-mode) #battle .xp-line {gap:5px;margin:4px 0 0;color:#bbcfde}
body:not(.sheet-mode) #battle progress {height:7px;border:0;border-radius:9px;overflow:hidden;background:#050d0b}
body:not(.sheet-mode) #battle progress::-webkit-progress-bar {background:#050d0b;border-radius:9px}
body:not(.sheet-mode) #battle progress::-webkit-progress-value {background:linear-gradient(0deg,#152c2144,#fff4),var(--hp-color);border-radius:9px;transition:width .22s ease-out}
body:not(.sheet-mode) #battle progress::-moz-progress-bar {background:var(--hp-color);border-radius:9px}
body:not(.sheet-mode) #battle .xp-line progress {height:3px;--hp-color:#7badd0}

body:not(.sheet-mode) #battle .own-sprite {
 width:36%;
 height:55%;
 left:8%;
 bottom:9%;
 padding:0;
 z-index:2;
}

body:not(.sheet-mode) #battle .enemy-sprite {
 --duel-shadow:#1a281b9c;
 width:29%;
 height:48%;
 top:auto;
 right:12%;
 bottom:31%;
 padding:0;
 z-index:1;
}

body:not(.sheet-mode) #battle .sprite::before {
 content:"";
 display:block;
 position:absolute;
 z-index:-1;
 bottom:3%;
 left:14%;
 width:72%;
 height:12%;
 border-radius:50%;
 background:radial-gradient(ellipse,var(--duel-shadow,#1b291cc9) 0%,#16261d75 40%,transparent 76%);
 pointer-events:none;
}

body:not(.sheet-mode) #battle .sprite.cast-down::before {opacity:.2}
body:not(.sheet-mode) #battle .battle-idle {position:relative}
body:not(.sheet-mode) #battle .sprite img {
 object-position:center bottom;
 image-rendering:auto;
 filter:drop-shadow(0 3px 5px #1b291c8c);
}

body:not(.sheet-mode) #battle #battleBottom {
 grid-template-columns:minmax(0,.92fr) minmax(0,1fr);
 gap:10px;
 background:transparent;
 margin:0;
 min-height:0;
}

body:not(.sheet-mode) #battle :is(#battlemsg,#actions,#battleSub,#battleResult) {
 background:var(--duel-panel);
 border:1px solid var(--duel-edge);
 border-radius:10px;
 color:var(--duel-text);
 box-shadow:0 3px 11px #08181056;
 min-height:0;
}

body:not(.sheet-mode) #battle #battlemsg {
 display:block;
 overflow:auto;
 max-height:144px;
 padding:13px 15px;
 font:600 clamp(13px,1.45vw,19px)/1.45 system-ui,sans-serif;
 overflow-wrap:anywhere;
}

body:not(.sheet-mode) #battle #actions,
body:not(.sheet-mode) #battle #battleSub {padding:6px;gap:5px}
body:not(.sheet-mode) #battle #subActions {gap:5px;padding:0;min-height:0}
body:not(.sheet-mode) #battle #moveList {gap:5px;grid-template-columns:repeat(2,minmax(0,1fr))}
body:not(.sheet-mode) #battle #moveInfo {
 margin:0;
 padding:5px 7px;
 max-height:68px;
 overflow:auto;
 color:#d9e5cf;
 background:#172920;
 border:1px solid #657c62;
 border-radius:6px;
 line-height:1.35;
}

body:not(.sheet-mode) #battle :is(#actions,#battleSub,#battleResult) button {
 min-height:38px;
 padding:6px 9px;
 border:1px solid #62836c;
 border-radius:7px;
 background:linear-gradient(#365244,#243c31);
 color:#f4f1de;
 font-size:clamp(12px,1.35vw,16px);
 line-height:1.28;
}

body:not(.sheet-mode) #battle #actions [data-menu="fight"] {border-color:#adc99b;background:linear-gradient(#43684c,#2b4939)}
body:not(.sheet-mode) #battle :is(#actions,#battleSub,#battleResult) button.selected {border-color:#d8e4b5;box-shadow:inset 0 0 0 1px #c6d8ac81}
body:not(.sheet-mode) #battle :is(#actions,#battleSub,#battleResult) button.selected::before {content:none}
body:not(.sheet-mode) #battle button:focus-visible {outline:2px solid #eff0a9;outline-offset:2px}
body:not(.sheet-mode) #battle #moveList button {display:flex;min-width:0;flex-direction:column;align-items:flex-start;justify-content:center;gap:2px}
body:not(.sheet-mode) #battle #moveList button strong {max-width:100%;overflow-wrap:anywhere}
body:not(.sheet-mode) #battle #moveList button small {font-size:.72em;color:#dde7cc}
body:not(.sheet-mode) #battle #battleBack {margin-top:5px}
body:not(.sheet-mode) #battle #battleResult {padding:10px}

body:not(.sheet-mode) #battle #battleIntro::before,
body:not(.sheet-mode) #battle #battleIntro::after {background:linear-gradient(#132621,#233a31)}
body:not(.sheet-mode) #battle #battleIntro strong {border:1px solid #8eab8e;border-radius:7px;background:#172d25;color:#f4efd6}

/* Readable conditions in the sheet UI while retaining its own visual design. */
.sheet-mode #battle .duel-toolbar {padding:4px}
.sheet-mode #battle :is(#battleTurn,#pvpTurn) {position:static}
.sheet-mode #battle #battleAutoBattleToggle {margin:0}
.sheet-mode #battle .duel-monster-heading b {white-space:normal}
.sheet-mode #battle .duel-monster-tags {color:inherit}
.sheet-mode #battle #moveList button small {display:block;font-size:.72em}

@media (max-width:759px) and (orientation:portrait) {
 body:not(.sheet-mode) #game.battling #battle {padding:8px 9px 87px;gap:7px}
 body:not(.sheet-mode) #battle #battleBottom {grid-template-columns:minmax(0,1fr);gap:6px}
 body:not(.sheet-mode) #battle #battlemsg {max-height:64px;padding:7px 9px;font-size:13px}
 body:not(.sheet-mode) #battle #actions,
 body:not(.sheet-mode) #battle #battleSub {padding:5px}
 body:not(.sheet-mode) #battle .hpbox {padding:6px 8px}
 body:not(.sheet-mode) #battle .own-sprite {width:47%;height:52%;left:4%;bottom:14%}
 body:not(.sheet-mode) #battle .enemy-sprite {width:39%;height:46%;right:7%;bottom:33%}
}

@media (orientation:landscape) and (max-height:550px) {
 body:not(.sheet-mode) #game.battling #battle {
  grid-template-columns:minmax(0,1.55fr) minmax(190px,1fr);
  grid-template-rows:minmax(0,1fr);
  padding:var(--land-top,8px) var(--land-right,8px) calc(var(--land-bottom,7px) + var(--land-battle-stick,50px) + 5px) var(--land-left,8px);
  gap:7px;
 }
 body:not(.sheet-mode) #battle #battlefield {grid-area:1 / 1;min-height:0}
 body:not(.sheet-mode) #battle #battleBottom {grid-area:1 / 2;display:flex;flex-direction:column;gap:5px;margin:0}
 body:not(.sheet-mode) #battle:has(#pvpTurn:not([hidden])) #battleBottom {margin-top:0}
 body:not(.sheet-mode) #battle #battlemsg {max-height:31%;padding:7px 8px;font-size:12px;min-height:30px}
 body:not(.sheet-mode) #battle #battleSub {overflow:auto}
 body:not(.sheet-mode) #battle #moveInfo {max-height:36px;font-size:10px}
 body:not(.sheet-mode) #battle .hpbox {width:clamp(111px,29%,175px);padding:4px 6px}
 body:not(.sheet-mode) #battle .hpbox.enemy {top:44px}
 body:not(.sheet-mode) #battle .hpbox.own {bottom:8px}
 body:not(.sheet-mode) #battle .duel-monster-heading b {font-size:12px}
 body:not(.sheet-mode) #battle .duel-toolbar {inset:6px 7px auto}
 body:not(.sheet-mode) #battle #battleAutoBattleToggle {min-height:29px}
}

@media (prefers-reduced-motion:reduce) {
 body:not(.sheet-mode) #battle progress::-webkit-progress-value {transition:none}
}
