/* V202 layout fixes from the full audit */
/* the follower list (rows with a picture) fits without its last row cut in half */
#placeholderScreen .sprite-actions .party-choice:has(.party-icon){min-height:44px;padding-top:6px;padding-bottom:6px}
#placeholderScreen .sprite-actions .party-icon{width:36px;height:36px;top:4px;right:10px}
/* 图鉴 → 招式表: number, name and type in their own cells; the page buttons stay under the list */
.dex-mode .dex-move{grid-template-columns:44px minmax(0,1fr);align-items:baseline}
.dex-mode .dex-move span{min-width:0;overflow-wrap:anywhere}
.dex-mode .dex-move span:first-child{color:#6b8088;font-size:12px}
.dex-mode>.dex-pagination{flex:none;margin:4px 8px}
/* tap targets: the 图鉴 返回 button was 20 px tall, the party HP tag 9 px */
.dex-back{min-height:32px;min-width:56px;padding:4px 10px}
.roster-hp-label{font-size:11px}
/* short screens (landscape phones, iPhone SE): windows scroll inside instead of running off the screen */
#startMenu .start-menu-window{max-height:100%;overflow-y:auto;overscroll-behavior:contain}
#placeholderScreen .placeholder-window{max-height:100%}
#placeholderScreen .menu-actions,#placeholderScreen .menu-notes{overscroll-behavior:contain}
/* 图鉴 list: the page buttons stick to the bottom of the list, so they are on screen however short the window is */
.dex-mode .dex-list .dex-pagination{position:sticky;bottom:0;z-index:1;background:inherit;background-color:#f4f7ef}
#appShell .dex-mode .dex-back{min-height:34px!important;min-width:56px;padding:6px 10px!important}
/* short screens (a phone turned sideways, iPhone SE): tighter rows so the lists fit */
@media (max-height:700px){
 #appShell .start-menu .menu-item{min-height:0;height:36px;padding-top:0;padding-bottom:0}
 #placeholderScreen .party-roster .party-slot:not(:first-child){min-height:0;padding-top:3px;padding-bottom:3px}
 #placeholderScreen .view-party{padding-bottom:48px}
}
@media (max-height:480px){
 #appShell .start-menu .menu-item{height:32px}
 #placeholderScreen .party-roster .party-slot:not(:first-child) .roster-art{width:36px;height:36px}
 #placeholderScreen .party-roster .party-slot:not(:first-child){grid-template-rows:auto auto;min-height:0}
 #placeholderScreen .dex-mode .dex-row,.dex-mode .dex-row{min-height:0;height:34px}
}
/* short screens: the text part of a window (挑战纪录 and others) gets more of the height */

#placeholderScreen[data-menu-view="choices"]:not(.dex-mode):not(.starter-mode) .view-choices:not(:has(.menu-actions > :nth-child(3))) .menu-notes{max-height:calc(100% - 132px)}
/* V202 in-game text box (name, trainer card digits, room code) */
.ask-overlay{position:absolute;inset:0;z-index:60;display:none;align-items:flex-start;justify-content:center;padding:12% 12px 0;background:rgba(16,24,32,.45)}
.ask-overlay.is-open{display:flex}
.ask-window{width:min(360px,100%);padding:14px 16px 12px;background:#f8f8f0;color:#384850;font-size:15px}
.ask-text{margin:0 0 10px;line-height:1.5}
.ask-input{width:100%;box-sizing:border-box;font:inherit;font-size:18px;padding:8px 10px;border:2px solid #6888a0;border-radius:4px;background:#fff;color:#203840}
.ask-note{min-height:1.2em;margin:6px 0 4px;color:#b04830;font-size:13px}
.ask-actions{display:flex;gap:10px;justify-content:flex-end}
.ask-actions button{min-width:88px;min-height:40px;font:inherit;border:2px solid #506888;border-radius:6px;background:#e0e8c8;color:#203840}
.ask-actions .ask-cancel{background:#f0f0e8}
/* the band above the battle scene on tall phones: the scene's own tree tops continue upward (mirrored) and fade out,
   instead of a plain dark gradient */
.battle-stage::before{background:linear-gradient(rgba(16,35,26,0) 12%,rgba(16,35,26,.97) 58%),url("./assets/battle/forest-v101.png?h=99def59075") center top/100% auto no-repeat,#27472f;transform:scaleY(-1);image-rendering:pixelated}
/* V205 合作挑战, placed like an Emerald double battle (src/battle_anim_mons.c sBattlerCoords, battle_interface.c
   sBattlerHealthboxCoords): this player is the left battler (x 32 of 240, singles 72), the partner the right one (x 90,
   4 px lower, drawn in front); the two player boxes stack at the bottom right, this player's above (y 76) and the
   partner's below and 12 px further right (y 101). One opponent, so it keeps the singles place. */
#battleScreen[data-coop="true"] .battle-arena .ally-sprite{left:16%}
.battle-arena .coop-partner{position:absolute;inset:0;pointer-events:none}
.battle-arena .coop-partner .coop-art{position:absolute;left:43%;top:103.5%;width:36.666667%;z-index:1;transform:translate(calc(-1 * var(--sprite-anchor-x,50%)),calc(-1 * var(--sprite-anchor-y,85%)))}
.battle-arena .coop-partner.is-down .coop-art{opacity:0;transition:opacity .4s}
.battle-arena .coop-partner.is-intro .coop-art{opacity:0}
.battle-arena .coop-partner .coop-art{transition:opacity .3s}
.battle-arena .coop-partner.is-hit .coop-art{animation:coop-hit .5s steps(2) 2}
@keyframes coop-hit{50%{opacity:.15}}
#battleScreen[data-coop="true"] .battle-arena .ally-status.hb-on{width:37%;right:7%;bottom:21%}
.battle-arena .coop-status,.battle-arena .coop-status.hb-on{position:absolute;right:2%;bottom:1%;width:37%;z-index:2}
.battle-arena .coop-status:not(.hb-on){padding:2px 5px 3px;font-size:clamp(9px,3cqw,13px)}
.battle-arena .coop-status:not(.hb-on) .coop-name{margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.battle-arena .coop-status:not(.hb-on) .coop-hp{display:block;width:100%;height:6px}
/* V209 the evolution scene */
.evo-overlay{position:absolute;inset:0;z-index:70;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;background:radial-gradient(circle at 50% 42%,#2c4a78 0,#142440 45%,#070d1c 100%);transition:opacity .35s}
.evo-overlay.is-out{opacity:0}
.evo-stage{position:relative;width:min(64vw,260px);aspect-ratio:1}
.evo-mon{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;image-rendering:pixelated;transition:filter .5s}
.evo-overlay.is-white .evo-mon{filter:brightness(0) invert(1) drop-shadow(0 0 6px #bfe3ff)}
.evo-glow{position:absolute;inset:-20%;border-radius:50%;background:radial-gradient(circle,#ffffffaa 0,#9fd4ff55 35%,transparent 70%);opacity:0;pointer-events:none}
.evo-overlay.is-done .evo-glow{opacity:0!important}
.evo-spark{position:absolute;bottom:10%;width:6px;height:6px;border-radius:50%;background:#fff;box-shadow:0 0 6px 2px #bfe3ff;animation:evo-rise var(--d,1.4s) ease-out forwards}
@keyframes evo-rise{from{transform:translate(0,0);opacity:1}to{transform:translate(var(--x,0),-220px);opacity:0}}
.evo-flash{position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none}
.evo-text{margin:0;padding:10px 16px;min-width:70%;text-align:center;color:#203840;background:#f8f8f0;border:3px solid #6888a0;border-radius:6px;font-size:16px}
/* V210 battle weather (looks only) */
.battle-arena .weather-layer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}
/* V223: the stage weather over the map, under the windows */
.tile-map .weather-layer{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:3}
/* V213 the Platinum battle scenes (battle-bg-v213.js sets --battle-bg, --battle-top and data-scene): the DS art down to
   where its text box starts sits at the bottom of the scene, so the opponent stands on its platform (176, 88 of 256 × 144,
   27 rows added above → 68.75 %, 67.3 %) and yours on the long platform at 80; the band above on tall screens takes
   the sky's colour. Without a scene (no script) the painted forest stays. */
#battleScreen .battle-arena{background-image:var(--battle-bg,url("./assets/battle/forest-v101.png?h=99def59075"))}
#battleScreen[data-scene] .battle-arena{background-size:100% 100%;image-rendering:pixelated}
#battleScreen[data-scene] .battle-arena .enemy-sprite{left:68.75%;top:67.3%}
#battleScreen[data-scene]:not([data-coop="true"]) .battle-arena .ally-sprite{left:31%}
#battleScreen[data-scene] .battle-stage::before{background:var(--battle-top,#27472f);transform:none}
/* co-op: the opponent's platform takes the middle right, so the two player boxes go to the sky at the top right
   (yours above, the partner's below and further right, as in a double battle) */
#battleScreen[data-scene][data-coop="true"] .battle-arena .ally-status.hb-on{width:31%;right:6%;bottom:auto;top:3%}
#battleScreen[data-scene] .battle-arena .coop-status,#battleScreen[data-scene] .battle-arena .coop-status.hb-on{width:31%;right:1.5%;bottom:auto;top:20%}

/* V219 co-op: both back sprites fit on screen (yours left, the partner's right, a little smaller than singles), and each
   healthbox says whose it is */
#battleScreen[data-coop="true"] .battle-arena .ally-sprite{left:24%;width:31%;--px:calc(31cqw / 80)}
#battleScreen[data-coop="true"] .battle-arena .coop-partner .coop-art{left:55%;width:31%}
#battleScreen[data-coop="true"] .battle-arena .ally-status[data-owner]::before,#battleScreen[data-coop="true"] .battle-arena .coop-status[data-owner]::before{content:attr(data-owner);position:absolute;right:100%;top:50%;transform:translateY(-50%);margin-right:3px;max-width:4.5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 5px;border-radius:6px;background:rgba(24,40,56,.82);color:#fff;font:600 clamp(9px,2.8cqw,12px)/1.3 var(--game-font);z-index:3}
/* V220: a window opened in battle (bag, party, give up) is drawn over the battle scene instead of switching to the map */
[data-over-battle="true"] #placeholderScreen{z-index:10}
[data-over-battle="true"] #battleScreen .battle-ui{visibility:hidden}
/* V220 Pokédex picture view (排列：图示): 5 × 4 pictures per page; V221: every picture shown, a ball at the bottom right
   for the ones caught (an empty ring for the others) */
#appShell .dex-mode .dex-tools{display:flex;flex-wrap:nowrap;gap:4px}#appShell .dex-mode .dex-tools .dex-cycle{flex:1 1 0;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:clamp(10px,3.1cqw,13px);padding-left:4px;padding-right:4px}
#appShell .dex-mode .dex-body.is-grid{display:flex;flex-direction:column;overflow:auto}
.dex-grid-wrap{display:flex;flex-direction:column;gap:5px;padding:5px;min-height:0}
.dex-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
#appShell .dex-mode .dex-cell{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;aspect-ratio:1/1;min-width:0;min-height:0;padding:1px;border:2px solid #c8d4c0;border-radius:7px;background:#f8f8f0;color:var(--gba-ink,#304850);overflow:hidden;box-shadow:none}
#appShell .dex-mode .dex-cell .dex-art{width:48px;height:48px;background-size:960px 1200px}
#appShell .dex-mode .dex-cell::after{content:"";position:absolute;right:3px;bottom:3px;width:9px;height:9px;border-radius:50%;box-shadow:0 0 0 1px #b8c0b8;opacity:.7}
#appShell .dex-mode .dex-cell.caught::after{opacity:1;content:"";position:absolute;right:3px;bottom:3px;width:8px;height:8px;border-radius:50%;background:linear-gradient(#e83838 0 45%,#303030 45% 55%,#fff 55%);box-shadow:0 0 0 1px #303030}
#appShell .dex-mode .dex-cell.selected{border-color:#d84848;background:#fff2c0;box-shadow:0 0 0 2px #f0c050}
.dex-cell-no{font-size:9px;line-height:1;color:#687878;font-variant-numeric:tabular-nums}
.dex-grid-info{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 8px;padding:5px;border-radius:8px;background:#f8f8f0;text-align:center}
.dex-grid-info strong{font-size:15px}.dex-grid-info .dex-open{padding:4px 10px}
.dex-grid-wrap .dex-pagination{display:flex;align-items:center;justify-content:space-between;gap:6px}
/* V221 a row that cannot be chosen yet (e.g. a Pokémon not seen, at the exchange) is greyed */
#placeholderScreen .party-choice.is-dim{opacity:.55}#placeholderScreen .party-choice.is-dim .party-icon{filter:grayscale(1)}

/* V225: only MENU stays at the top right — A and B are on the controller below */
#touchBack,#touchAction{display:none}
