/* Game Boy Advance command layout. The battle field and command belt share one screen. */
.dex-tools,.dex-pages{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.dex-tools input{min-width:0;flex:1}
.dex-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(94px,1fr));gap:5px;margin:8px 0}
#game .dex-grid button{position:relative;display:grid;justify-items:center;align-content:start;text-align:center;min-width:0;padding:4px 3px;background:#f3ecd5;border:1px solid #9aab91;border-radius:3px;box-shadow:none;color:#254239}
#game .dex-grid button.selected{background:#d7ead4;border:2px solid #267058;padding:3px 2px}
.dex-grid strong{font:700 12px/1.2 Consolas,monospace;overflow-wrap:anywhere}
.dex-grid small{font:11px Consolas,monospace;color:#516950}
.dex-grid i{position:absolute;left:3px;top:2px;background:#285d50;color:white;min-width:1.3em;font-style:normal}
.dex-grid img{height:46px;width:100%;object-fit:contain;image-rendering:pixelated}
.dex-grid .unknown img{filter:brightness(0);opacity:.78}
.dex-pages{justify-content:space-between}.dex-pages span{font-size:12px}
.field-options form{display:flex;align-items:end;gap:8px;flex-wrap:wrap}
.field-options label{flex:1}.field-options select{max-width:100%}
#game.in-battle .console:has([data-stage="preview"]){max-height:82%;height:min(80%,610px);overflow:auto}
#game.in-battle #panel[data-stage="preview"]{height:100%;grid-template-columns:minmax(160px,.7fr) minmax(210px,1.3fr);align-items:stretch}
#game [data-stage="preview"] .battle-copy{align-items:start;gap:8px}
#game [data-stage="preview"] .battle-choices{display:block;overflow:auto;align-content:start}
@media(max-width:600px){#game.in-battle #panel[data-stage="preview"]{display:flex;flex-direction:column}.dex-grid{grid-template-columns:repeat(auto-fill,minmax(82px,1fr))}}
#battlefield{image-rendering:pixelated}
#game.in-battle {--navy:#28324b;--ivory:#fffae6;--rim:#54566b;--command-h:22vh}
#game.in-battle .location{display:none}
#game.in-battle .overlay-top{justify-content:flex-end}
#game.in-battle .console{
  bottom:0;left:0;right:0;top:auto;width:100%;max-height:43%;min-height:18%;padding:5px;
  border:4px solid #303345;border-radius:0;background:#bfa875;
  box-shadow:inset 0 0 0 2px #f5d99a,0 -3px #383e4d;
}
#game.in-battle #panel{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);align-items:stretch;gap:4px;min-height:16vh}
.battle-copy,.battle-choices{border:3px solid #444959;min-width:0}
#game .battle-copy{display:flex;flex-direction:column;justify-content:center;padding:clamp(8px,2vmin,25px) clamp(12px,3vmin,42px);background:#285566;color:#fff9db;box-shadow:inset 0 0 0 3px #73979a}
#game .battle-copy h2{color:#fff9db;text-shadow:2px 2px #263b50;font:700 clamp(17px,3.2vmin,36px)/1.22 Consolas,monospace;letter-spacing:-.045em;margin:3px 0}
#game .battle-copy p,#game .battle-copy small,#game .battle-copy details{color:#f0ecce}
#game .battle-copy small{font-size:clamp(9px,1.4vmin,14px);text-transform:uppercase;letter-spacing:.08em}
#game .battle-copy p{font-size:clamp(12px,1.9vmin,19px);margin:2px 0}
#game .battle-copy details{font-size:12px;max-height:8vh;overflow:auto}
#game .battle-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(29px,1fr);align-content:center;gap:0;background:var(--ivory);box-shadow:inset 0 0 0 3px #ceceb3;padding:clamp(5px,1vmin,13px)}
#game .battle-choices button{position:relative;text-align:left;border:0;border-radius:0;box-shadow:none;outline:0;background:transparent;color:#293646;padding:.25em .25em .25em 1.24em;font:700 clamp(14px,2.6vmin,29px)/1.15 Consolas,monospace;letter-spacing:-.045em}
#game [data-stage="main"] .battle-choices button{text-transform:uppercase}
#game .battle-choices button:focus,#game .battle-choices button:hover{background:#f3e9cf;color:#263248}
#game .battle-choices button:focus:before,#game .battle-choices button:hover:before{content:"";position:absolute;left:.28em;top:calc(50% - .31em);width:.46em;height:.64em;background:#3e3b49;clip-path:polygon(0 0,40% 0,40% 18%,70% 18%,70% 34%,100% 34%,100% 66%,70% 66%,70% 82%,40% 82%,40% 100%,0 100%)}
#game .battle-choices button:disabled{opacity:.38}
#game #battlefield .health{position:absolute;z-index:2;width:clamp(136px,25vw,355px);padding:5px 14px;background:#fff9da;color:var(--navy);border:3px solid #3e4d4b;border-radius:0;box-shadow:inset 0 -3px #b8bba0,4px 4px #34404baa;line-height:1.08}
#battlefield .health strong{font:700 clamp(13px,2.1vmin,23px) Consolas,monospace}
#battlefield .enemy-hp{left:4%;top:calc(5% + var(--slot)*9%)}
#battlefield .ally-hp{right:4%;bottom:calc(var(--command-h,19vh) + 1.5vh + var(--slot)*10vh)}
#battlefield .hp-track{display:flex;align-items:center;margin-left:auto;width:82%;background:#495359;padding:1px 4px;gap:4px}
#battlefield .hp-track b{color:#f9bb58;font:900 clamp(9px,1.4vmin,14px) Consolas,monospace}
#battlefield .health progress{appearance:none;display:block;width:100%;height:clamp(5px,1vmin,10px);border:0;background:#333f44}
#battlefield progress::-webkit-progress-bar{background:#333f44}
#battlefield progress::-webkit-progress-value{background:#55c383;border-top:2px solid #8adca3}
#battlefield progress[data-level="gold"]::-webkit-progress-value{background:#dcb858}
#battlefield progress[data-level="red"]::-webkit-progress-value{background:#d86e60}
#battlefield .health small{display:block;text-align:right;font:bold clamp(10px,1.6vmin,16px) Consolas,monospace}
#battlefield .battle-trainer i{background-size:1100% 7600%}
.trainer-portrait{background-size:880px 4864px}
#game #panel[data-stage="fight"] .battle-choices{order:0}
#game.in-battle .console:has(.short-roster){height:auto;max-height:62%}
#game [data-stage="preview"] .short-roster .dex-pages,#game [data-stage="preview"] .short-roster .dex-tools{display:none}
#game [data-stage="preview"] .dex-grid{grid-template-columns:repeat(auto-fill,minmax(100px,1fr))}
#game [data-stage="preview"] .dex-grid button{background:#f2ecd3;border:1px solid #a3ad97;padding:5px;text-align:center}
#game [data-stage="preview"] .dex-grid button.selected{border:2px solid #34735f;background:#d7ead4;padding:4px}
#game [data-stage="preview"] .dex-grid img{height:60px}
#game [data-stage="preview"] .short-roster .dex-grid{grid-template-columns:repeat(auto-fit,minmax(95px,170px));align-items:stretch;justify-content:center}
#game #panel[data-stage="fight"] .battle-copy{order:1;background:#fff9df;color:#324353;box-shadow:inset 0 0 0 3px #c5c6ac}
#game #panel[data-stage="fight"] .battle-copy h2,#game #panel[data-stage="fight"] .battle-copy p,#game #panel[data-stage="fight"] .battle-copy small,#game #panel[data-stage="fight"] .battle-copy details{color:#324353;text-shadow:none}
#game.encounter-start:after{content:"";pointer-events:none;position:absolute;z-index:8;inset:0;background:repeating-linear-gradient(0deg,#263043 0 7px,#35384b 7px 14px);animation:encounter-iris .42s steps(12,end) forwards;transform-origin:center}
@keyframes encounter-iris{from{clip-path:inset(50% 0)}to{clip-path:inset(0)}}
@media(max-width:640px){#game.in-battle #panel{grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:2px}#game .battle-copy{padding:7px 9px}#game .battle-choices{padding:4px}#game .battle-choices button{font-size:clamp(12px,3.5vw,17px)}#game .battle-copy h2{font-size:clamp(15px,4vw,20px)}#game #battlefield .health{width:39%;padding:3px 6px}}
@media(prefers-reduced-motion:reduce){#game.encounter-start:after{animation:none;opacity:0}}


#battlefield .battle-trainer i,.trainer-portrait{background-image:url('/art/kaldera/trainer-detail.png')}
#battlefield .health em{float:right;font:700 clamp(9px,1.35vmin,14px) Consolas,monospace;color:#627163;text-transform:uppercase}
#game #battlefield .health{border-radius:2px 12px 2px 12px;border-bottom-width:4px}
#game #battlefield .ally-hp{border-radius:12px 2px 12px 2px}
#battlefield .party-health{position:absolute;z-index:2;display:flex;flex-direction:column;gap:4px;width:clamp(136px,25vw,355px);pointer-events:none}
#battlefield .opposing-party{top:5%;left:4%}
#battlefield .allied-party{bottom:calc(var(--command-h,19vh) + 1vh);right:4%;flex-direction:column-reverse}
#game #battlefield .party-health .health{position:static;width:100%}
#game #battlefield .fighter.far{top:6%;bottom:auto}
#game #battlefield .fighter.far.slot1{top:13%;bottom:auto}
@media(max-height:480px){#game #battlefield .party-health .health{padding:1px 7px;border-width:2px}#battlefield .health strong{font-size:12px}#battlefield .health small{font-size:9px}#battlefield .hp-track b{font-size:8px}#battlefield .party-health{gap:3px}}
@media(max-width:650px) and (orientation:portrait){#battlefield .party-health{width:40%}#battlefield .opposing-party{left:2%}#battlefield .allied-party{right:2%}#game #battlefield .fighter.far{top:13%}#game #battlefield .fighter.far.slot1{top:20%}}
@media(max-width:650px) and (orientation:portrait){#battlefield .enemy-hp{left:2%}#battlefield .ally-hp{right:2%}#game .battle-copy small{font-size:10px}}
