@font-face{font-family:Pixel;src:url('../assets/fonts/pixel-font.woff2') format('woff2');font-display:swap}*{box-sizing:border-box}html{color-scheme:light}body{margin:0;background:#182b31;color:#25394b;font-family:Pixel,'Courier New',monospace;font-size:10px;line-height:1.8;min-height:100dvh;background-image:radial-gradient(ellipse at top,#45615b,#172731 75%)}button,input,select{font:inherit}button{cursor:pointer;touch-action:manipulation}button:disabled{opacity:.5;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #f1c84e;outline-offset:3px}.hidden,[hidden],#pokemonReveal.hidden,#rulesModal.hidden{display:none!important}.app{width:min(540px,100%);margin:20px auto 40px;background:#24527e;border:3px solid #172b40;box-shadow:0 0 0 2px #94b7c7,0 0 0 5px #233b51,0 18px 55px #0007;position:relative}.brand{height:66px;display:flex;align-items:center;gap:12px;padding:10px 12px;background:#245d91;border:3px solid #172b40;box-shadow:inset 0 0 0 2px #89aec4;position:relative;z-index:1}.logo{margin:0;color:#ffd348;font-size:22px;font-weight:normal;letter-spacing:-1.5px;text-shadow:2px 2px #163959,-1px -1px #fff296;white-space:nowrap;line-height:1.2}.header-stats{display:flex;gap:10px;align-items:center;margin-left:auto;color:#fff7e2;font-family:'Courier New',monospace;font-weight:bold;font-size:15px;line-height:1.3;white-space:nowrap}.header-stats span+span{border-left:1px solid #88abc9;padding-left:10px}.header-stats b{font-weight:bold}.btn{min-height:40px;padding:8px 10px;color:#25394b;background:#fff8dc;border:2px solid #263a51;box-shadow:inset 0 0 0 2px #b5c6c7,2px 2px #152a3f;font-size:10px;line-height:1.5}.btn:hover{background:#ffedab}.btn:active{transform:translateY(1px);box-shadow:inset 0 0 0 2px #b5c6c7}.btn.secondary{background:#dce9f1}.header-login{font-family:Pixel,monospace;font-size:10px;min-height:35px;padding:6px 8px;background:#dce9f1;white-space:nowrap}.save-bar{position:absolute;top:100%;left:0;width:100%;display:flex;align-items:center;justify-content:center;gap:8px;margin-top:10px;color:#b8cfdb;font-family:'Courier New',monospace;font-size:11px}.save-bar .btn{font-family:'Courier New',monospace;font-size:11px;min-height:26px;padding:4px}.route-stage{height:550px;position:relative;overflow:hidden;background:#79ab58;border:3px solid #1f3648;border-top:0;border-bottom:0;isolation:isolate}#typeSceneBg,#routeArt{position:absolute;inset:0;background-size:cover;background-position:center;background-repeat:no-repeat;image-rendering:pixelated;z-index:-2}#routeArt{background-image:url('../assets/backgrounds/route-explorer.webp');z-index:-1}.route-hud{position:absolute;left:12px;right:12px;top:12px;display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.trainer-label{padding:5px 8px;background:#fff9dbed;border:2px solid #243b4c;box-shadow:inset 0 0 0 1px #b8c8ba;font-family:'Courier New',monospace;line-height:1.4;font-size:13px;max-width:60%;overflow-wrap:anywhere}.trainer-prefix{font-size:8px;font-family:Pixel,monospace;color:#647367}.turn-name{font-size:12px;font-family:Pixel,monospace;line-height:1.5;margin:1px 0}.type-bonus-box{display:flex;gap:5px;align-items:center;background:#fff9dbed;border:2px solid #243b4c;padding:4px 6px;line-height:1.4}.type-bonus-label{font-size:7px}.type-bonus-multiplier{font-size:8px}.type-badge{padding:4px 5px;font-family:'Courier New',monospace;font-weight:bold;font-size:10px;border:1px solid #314252;color:white;background:#669577}.last-box{position:absolute;left:12px;bottom:55px;max-width:260px;min-width:190px;background:#fff8ddeb;border:2px solid #263b50;box-shadow:inset 0 0 0 2px #a5b9b8,2px 2px #223c4ca0;padding:7px}.last-empty{font-size:8px;padding:4px;line-height:1.8}.last-empty span{font-family:'Courier New',monospace;font-size:12px;color:#6f795f}.last-box:has(.pokemon-reveal:not(.hidden)) .last-empty{display:none}.pokemon-reveal{display:grid;grid-template-columns:68px minmax(0,1fr);gap:8px;align-items:center}.sprite-window{width:68px;height:68px;display:grid;place-items:center;background:#d4e2c9;border:1px solid #9cafa0}.pokemon-sprite{width:68px;height:68px;image-rendering:pixelated;object-fit:contain}.reveal-kicker{font-size:6px;color:#5e715f}.reveal-name{font-size:10px;line-height:1.6;overflow-wrap:anywhere;margin:3px 0}.reveal-meta{font-family:'Courier New',monospace;font-size:11px;line-height:1.4}.shiny-name{color:#927013}.route-message{position:absolute;bottom:10px;left:12px;right:12px;background:#fff9dbee;border:2px solid #314452;padding:7px 10px;font-family:'Courier New',monospace;font-weight:bold;font-size:12px;line-height:1.3;max-height:135px;overflow:auto;box-shadow:inset 0 0 0 1px #bcc8b0}.route-message.good{background:#e9f3d9f5}.route-message.bad{background:#ffe1d7f5;color:#783b37}.dialogue-panel{background:#fff6d9;border:3px solid #223b51;box-shadow:inset 0 0 0 3px #b6c7bd,inset 0 0 0 5px #fcf9e7;padding:14px 12px 12px;margin:0 5px 5px;position:relative}.entry-heading{font-size:12px;line-height:1.6;margin:0 0 8px}.letter{display:inline-block;color:#245f9d;font-size:17px;padding:0 3px}.word-entry{display:grid;grid-template-columns:minmax(0,1fr) 148px;gap:8px 12px;align-items:center}.entry-field{min-width:0}.word-entry input{width:100%;height:46px;border:2px solid #51677a;box-shadow:inset 0 0 0 2px #e0ded0;background:#fffdf2;color:#233c50;font-family:'Courier New',monospace;font-size:17px;font-weight:bold;padding:8px 10px;min-width:0}.word-entry input::placeholder{color:#788798}.entry-actions{display:grid;gap:6px;margin-top:-32px}.entry-actions>#playBtn{background:#2364a0;color:white;border:2px solid #284159;box-shadow:inset 0 0 0 2px #79acc3,2px 2px #29465b;font-size:11px;height:44px}.small-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px}.small-actions .btn{font-size:8px;padding:5px 3px;min-height:39px;background:#dceaf4;box-shadow:inset 0 0 0 2px #a4bdcb,2px 2px #29465b}.suggestion-box{grid-column:1/-1;background:#dce9d3;padding:6px;border:1px solid #95ac90}.suggestion-label{font-size:8px}.suggestion-chip{background:#fff9db;border:1px solid #34475a;padding:6px;font-family:'Courier New',monospace;font-size:13px;font-weight:bold;margin:3px}.dex-nav{position:relative;display:flex;align-items:stretch;background:#23598c;border:3px solid #20374e;box-shadow:inset 0 0 0 2px #6b97b2;min-height:60px;margin:0 3px 3px;padding:4px}.dex-tab{flex:1;border:0;background:none;color:#fff8e2;display:flex;align-items:center;justify-content:center;gap:12px;font-size:12px;padding:10px 4px}.dex-tab+.dex-tab{border-left:2px solid #88abc5}.dex-tab:hover,.menu-toggle:hover{background:#3e79a6}.ball-icon{width:24px;height:24px;display:inline-block;flex-shrink:0;background:linear-gradient(#ea4b41 0 44%,#243748 44% 58%,#f6f6df 58%);border:3px solid #223b4f;border-radius:50%;box-shadow:inset 2px 2px #ffffff55;position:relative}.ball-icon:after{content:'';position:absolute;left:5px;top:5px;width:7px;height:7px;background:#e7f0ea;border:2px solid #223b4f;border-radius:50%}.star-icon{color:#ffda4d;font-size:29px;line-height:1;text-shadow:2px 2px #364853}.menu-toggle{font:18px 'Courier New',monospace;background:none;color:white;border:0;border-left:1px solid #7695b3;padding:0 8px}.game-details{display:none;background:#fff9dc;padding:14px;border-top:3px solid #223b51}.game-details[open]{display:block}.game-details summary{cursor:pointer;font-size:10px}.game-details #roundInfo{font-family:'Courier New',monospace;font-size:12px;margin-left:8px}.single-mode-tag{display:inline-block;margin-left:5px;font-size:9px}.rule-pills{display:flex;flex-wrap:wrap;gap:5px;margin:10px 0}.pill{background:#e5e9d1;border:1px solid #a5b293;font-family:'Courier New',monospace;font-size:12px;padding:4px 6px}.pill.active{background:#ffe9a2}.game-details h2{font-size:11px;margin:18px 0 8px}.scores{display:grid;gap:6px;grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}.score-row{display:flex;align-items:center;justify-content:space-between;gap:6px;border:1px solid #a6b6a1;padding:8px;background:#fffdf0}.score-row.current{background:#e1edcf}.score-name{font-size:9px;overflow-wrap:anywhere}.score-row small{font:11px 'Courier New',monospace}.score-points{font-size:13px}.single-best-card{display:none;padding:8px;background:#fff0b5;margin-top:10px}.single-best-card.visible{display:block}.single-best-label{font-size:8px}.single-best-value{font-size:14px}.history{display:grid;gap:6px;max-height:220px;overflow:auto}.history-item{border:1px solid #a6b6a1;background:#fffdf0;padding:8px;font-family:'Courier New',monospace;font-size:13px;line-height:1.5}.history-item small{font-size:11px}.history-line{display:flex;align-items:center;gap:8px}.history-inline-sprite{width:32px;height:32px;object-fit:contain;image-rendering:pixelated}.history-copy{flex:1;min-width:0}.detail-actions{display:flex;gap:10px;margin-top:14px}.card{margin:18px;background:#fff8de;border:3px solid #213a50;box-shadow:inset 0 0 0 3px #b5c6b7;padding:22px}.mode-screen{margin-top:180px;margin-bottom:170px;text-align:center}.mode-title,.setup-heading{font-size:16px;line-height:1.8;margin:12px 0}.mode-subtitle{font-family:'Courier New',monospace;font-size:16px;line-height:1.5;margin-bottom:20px}.mode-buttons{display:grid;gap:10px}.mode-choice{background:#dcebf2;border:2px solid #253c50;box-shadow:inset 0 0 0 3px #f8f6e7;padding:15px;display:flex;flex-direction:column;gap:8px;align-items:center}.mode-choice.single{background:#ffe29a}.mode-choice-title{font-size:12px}.mode-choice-desc{font-family:'Courier New',monospace;font-size:14px}.mode-choice:hover{outline:2px solid #497597}.setup-row{display:grid;gap:8px;margin:16px 0}.player-inputs{display:grid;gap:10px;margin:16px 0}label{font-size:10px}input,select{font-family:'Courier New',monospace;font-size:16px;padding:10px;background:#fffdf0;color:#243c50;border:2px solid #56717e;max-width:100%}select{min-height:42px}.player-inputs input{width:100%}dialog{width:min(820px,94vw);max-height:90dvh;overflow:auto;background:#fff8de;color:#233e50;border:3px solid #223a50;box-shadow:inset 0 0 0 3px #a8bbae;padding:20px}dialog::backdrop{background:#101f2ed9}.collection-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.collection-head h2{font-size:14px}.collection-tools{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.collection-tools>*{flex:1;min-width:130px}#collectionGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(115px,1fr));gap:8px;max-height:50dvh;overflow:auto}.collection-card{background:#e0e9d1;border:2px solid #99ac98;padding:8px;text-align:center;font:12px 'Courier New',monospace}.collection-card img{width:80px;height:80px;object-fit:contain;image-rendering:pixelated}.collection-card b{display:block}.collection-card.uncollected img{filter:brightness(0);opacity:.35}#collectionStats,#collectionNotice,#collectionDialog p,#accountMessage,#accountIdentity{font-family:'Courier New',monospace;font-size:14px;line-height:1.5}button[aria-pressed=true]{outline:2px solid #d4a53d;outline-offset:1px}#accountDialog{max-width:450px}#accountDialog label{display:block;margin:14px 0}#accountDialog input{display:block;width:100%;margin-top:6px}.rules-modal{position:fixed;inset:0;z-index:200;display:grid;place-items:center;background:#102030d9;padding:14px}.rules-modal-card{width:min(640px,94vw);max-height:88dvh;overflow:auto;background:#fff8de;color:#233e50;border:3px solid #223a50;box-shadow:inset 0 0 0 3px #a8bbae;padding:20px}.rules-modal-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.rules-modal-title{font-size:14px}.rules-list{display:grid;gap:8px}.rules-close{min-width:40px}.sprite-credit,.sprite-status,.double-badge:empty{display:none}.type-normal{background:#9fa19f}.type-fire{background:#da6040}.type-water{background:#3f8ee8}.type-electric{background:#e4bd32;color:#302600}.type-grass{background:#63a952}.type-ice{background:#73cec0;color:#173331}.type-fighting{background:#ce416b}.type-poison{background:#aa6bc8}.type-ground{background:#d97845}.type-flying{background:#8fa9de}.type-psychic{background:#fa7179}.type-bug{background:#91c12f;color:#23320b}.type-rock{background:#c5b78c;color:#342f20}.type-ghost{background:#5269ad}.type-dragon{background:#0b6dc3}.type-dark{background:#5a5465}.type-steel{background:#5a8ea2}.type-fairy{background:#ec8fe6;color:#4d2049}
@media(max-width:560px){.app{width:calc(100% - 12px);margin:8px auto 42px}.brand{height:58px;gap:8px;padding:8px}.logo{font-size:clamp(14px,4.5vw,20px)}.header-stats{font-size:12px;gap:5px}.header-stats span+span{padding-left:5px}.header-login{font-size:8px;padding:5px;min-height:32px}.route-stage{height:clamp(350px,60dvh,630px)}.route-hud{left:8px;right:8px;top:8px}.type-bonus-label{display:none}.turn-name{font-size:9px}.trainer-label{font-size:11px}.type-bonus-multiplier{font-size:7px}.last-box{left:8px;max-width:235px;bottom:60px;min-width:180px}.entry-heading{font-size:10px}.dialogue-panel{padding:12px 10px 10px}.word-entry{grid-template-columns:minmax(0,1fr) 118px;gap:6px 8px}.word-entry input{font-size:16px;padding:8px 6px;height:44px}.entry-actions>#playBtn{font-size:9px;height:40px}.small-actions .btn{font-size:7px;min-height:36px}.dex-tab{font-size:10px;gap:8px}.dex-nav{min-height:55px}.star-icon{font-size:24px}.ball-icon{width:23px;height:23px}.mode-screen{margin-top:140px;margin-bottom:130px}.card{padding:18px;margin-inline:12px}.mode-title{font-size:13px}.mode-subtitle{font-size:15px}.route-message{left:8px;right:8px;font-size:12px}.save-bar{font-size:10px}}
@media(max-width:360px){.header-stats{font-size:10px;gap:4px}.logo{font-size:14px}.header-login{font-size:7px}.brand{gap:5px}.word-entry{grid-template-columns:minmax(0,1fr) 105px}.type-bonus-box{gap:3px;padding:3px}.type-badge{font-size:9px}.dex-tab{font-size:9px}.last-box{max-width:210px}}

.route-message:has(.status:empty){display:none}.route-message .status{margin:0}.route-message:has(.good){background:#e9f3d9f5}.route-message:has(.bad){background:#ffe1d7f5;color:#783b37}.route-setting{display:flex;align-items:center;gap:8px;font:13px "Courier New",monospace;margin-top:15px}.route-setting input{width:18px;height:18px}.route-message{font-weight:normal}
.last-box{top:66px;bottom:auto!important}.last-empty{font-size:7px}.last-empty span{font-size:11px}.reveal-kicker{line-height:1.8}
.app{background-image:url('../assets/backgrounds/route-explorer.webp');background-position:center;background-size:cover}.game-details{background-image:none}
.sprite-window{overflow:hidden}.pokemon-sprite{width:100px;height:100px;max-width:none;flex-shrink:0}

/* Center the visible sprite, excluding transparent margins in its source PNG. */
.sprite-window{position:relative;overflow:hidden}.pokemon-sprite{position:absolute;object-fit:contain;margin:0}

/* The fixed canvas contains only the visible pixels, with six pixels of padding. */
.sprite-window .pokemon-sprite{width:100%!important;height:100%!important;inset:0!important;transform:none!important;object-fit:contain!important}
.fitted-sprite{position:absolute;inset:0;width:100%;height:100%;display:block;image-rendering:pixelated;pointer-events:none}

.route-trainer{position:absolute;pointer-events:none;z-index:-1;object-fit:contain;image-rendering:pixelated;transform:translate(-50%,-50%)}

/* One stable frame; route art is fully visible and controls have solid panels. */
.app{background:#24527e;background-image:none}
.screen-shell{position:relative;min-height:var(--screen-height,1000px)}
.mode-screen,#setupScreen{margin:18px;min-height:0}
.mode-screen{position:relative;top:100px}
.route-stage{height:auto!important;aspect-ratio:2/3;background:#182b31}
.route-hud{position:relative;inset:auto;left:auto;right:auto;top:auto;margin:8px 10px;min-height:52px}
.last-box{position:relative;left:auto;top:auto!important;bottom:auto!important;margin:8px 10px;max-width:none;min-height:58px}
.route-message{position:relative;inset:auto;margin:8px 10px}
.dialogue-panel,.dex-nav{background:#fff6d9}

/* Restore the gameplay overlays shown in the reference. */
.route-hud{position:absolute;left:12px;right:12px;top:12px;margin:0;min-height:0}
.last-box{position:absolute;left:12px;top:76px!important;bottom:auto!important;margin:0;max-width:260px;min-width:190px;min-height:58px}
.route-message{position:absolute;left:12px;right:12px;bottom:10px;top:auto;margin:0}
@media(max-width:480px){.last-box{max-width:220px;min-width:170px;top:68px!important}}

/* Full route artwork without inset margins or stretching. */
.route-stage{border:0;aspect-ratio:2/3}

/* Top-bar Dex and regional form selection. */
.brand{gap:9px}.header-stats{font-size:13px;gap:6px}.header-stats span+span{padding-left:6px}
.pokedex-button{flex:0 0 42px;width:42px;height:44px;padding:2px;border:0;background:transparent;display:grid;place-items:center}
.pokedex-button svg{width:32px;height:36px;filter:drop-shadow(2px 2px 0 #172b40)}
.pokedex-button:hover{background:#3675a5}.pokedex-button:active{transform:translateY(1px)}
.header-menu{height:36px;color:#fff8dc;border:1px solid #8db3c9;padding:0 5px;font-size:19px;background:#1e4d78}
.brand .header-login{margin-left:auto}.game-active .header-login{margin-left:0}
#regionDialog{width:min(480px,94vw);padding:20px}#regionDialog h2{font-size:12px;line-height:1.8}
#regionHint,.region-footnote{font-family:'Courier New',monospace;font-size:14px;line-height:1.5}
#regionChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0}
.region-card{display:flex;flex-direction:column;align-items:center;gap:9px;background:#e4edd7;border:2px solid #455e65;box-shadow:inset 0 0 0 3px #fffdf0,2px 2px #243b50;padding:12px 8px;color:#25394b;min-width:0}
.region-card:hover,.region-card:focus-visible{background:#fff0b8}.region-card img{width:92px;height:92px;object-fit:contain;image-rendering:pixelated}
.region-card b{font-size:9px;line-height:1.7}.region-types{display:flex;justify-content:center;gap:4px;flex-wrap:wrap}.region-types .type-badge{font-size:11px}
@media(max-width:560px){.brand{gap:5px}.header-stats{font-size:11px;gap:4px}.header-stats span+span{padding-left:4px}.pokedex-button{flex-basis:32px;width:32px;height:38px}.pokedex-button svg{width:27px;height:30px}.header-menu{font-size:16px;padding:0 4px;height:31px}.brand .logo{font-size:clamp(12px,3.8vw,18px)}.header-login{font-size:7px}#regionDialog{padding:16px}.region-card{padding:10px 6px}.region-card img{width:80px;height:80px}}

body:not(.game-active) .screen-shell{background-image:url("../assets/backgrounds/starting-connected-region.webp");background-size:100% 100%;background-position:center;background-repeat:no-repeat}

/* Three-button title menu leaves the connected region visible. */
#modeScreen{background:none;border:0;box-shadow:none;padding:0;margin:18px;}
#modeScreen .mode-buttons{width:min(340px,100%);margin:0 auto;gap:14px;}
#modeScreen .mode-choice{min-height:62px;justify-content:center;padding:16px 12px;}
#modeScreen .mode-choice.battle{background:#dce2dc;color:#62706b;opacity:1;box-shadow:inset 0 0 0 3px #f8f6e7;}
#modeScreen .mode-choice.battle:hover{outline:0;}

#modeScreen .mode-choice.battle{color:#25394b;cursor:pointer}
#modeScreen .mode-choice.battle:hover{outline:2px solid #497597}
#battleScreen{padding:18px 14px;position:relative}
.battle-panel{background:#fff8deef;border:3px solid #213a50;box-shadow:inset 0 0 0 3px #b5c6b7;padding:16px}
.battle-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.battle-tag{font:700 11px/1.5 'Courier New',monospace;color:#576b72;text-align:right}
#battleView h2{font-size:14px;line-height:1.8;margin:10px 0 14px}
.battle-copy,#battleStatus{font:14px/1.5 'Courier New',monospace;margin:12px 0}
#battleStatus:empty{display:none}#battleStatus.bad{color:#973f3b}
.battle-menu{display:grid;gap:12px;margin:18px 0}.battle-choice{min-height:48px}
.difficulty-options{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.difficulty-options .btn{padding:8px 4px;font-size:9px}
.battle-name-label{display:block;margin:12px 0}.battle-name-label input{display:block;width:100%;margin-top:6px}
.battle-teams{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0}
.battle-teams fieldset{min-width:0;border:2px solid #9cafaa;background:#edf0db;padding:10px}
.battle-teams legend{padding:0 5px;font-size:9px}.battle-teams label{display:block;font-size:8px;margin:10px 0}
.battle-teams input{display:block;width:100%;font-size:15px;margin-top:5px;padding:8px}
.battle-person{display:flex;align-items:center;gap:8px;min-width:0;margin:8px 0;font:14px/1.5 'Courier New',monospace}
.battle-person b{overflow-wrap:anywhere;display:block}.battle-person small{display:block;font-size:11px;color:#637670}
.rank-placeholder{display:grid;place-items:center;flex:0 0 30px;width:30px;height:34px;color:#9ca79a;border:2px dashed #a3b1a0;background:#e5ebdc;font:22px 'Courier New',monospace}
.battle-ready h3{font-size:10px;margin:16px 0 4px}.battle-ready{padding:6px 12px;background:#e5ecd9;border:1px solid #a7b9a0;margin:14px 0}
.battle-ready p{font:14px/1.5 'Courier New',monospace;margin:8px 0}
.lobby-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:12px 0}.lobby-actions>*{flex:1;min-width:125px}.lobby-actions .btn{font-size:9px}
#battleJoinCode{font-weight:bold;text-transform:uppercase;width:130px;min-width:130px}
.lobby-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:540px;overflow:auto;padding:3px}
.lobby-card{border:2px solid #829c91;background:#e5eedb;padding:10px;min-width:0}.empty-lobby{background:#ebeddf;border-style:dashed}
.lobby-card-head{display:flex;align-items:center;justify-content:space-between;gap:6px;font:12px/1.5 'Courier New',monospace}.lobby-card-head small{font-size:11px}
.lobby-card .battle-person{font-size:13px}.lobby-card .rank-placeholder{width:26px;flex-basis:26px;height:30px}
.lobby-placeholder-copy{font:12px/1.5 'Courier New',monospace;color:#697970;display:block}.lobby-code{font:700 15px 'Courier New',monospace;letter-spacing:1px;margin:10px 0}.join-listed{width:100%;font-size:8px}
.lobby-code-box{display:grid;grid-template-columns:1fr auto;gap:5px;align-items:center;background:#e1ead6;border:2px solid #93a893;padding:12px;margin:12px 0}
.lobby-code-box>span{font:12px 'Courier New',monospace}.lobby-code-box>b{font:700 24px 'Courier New',monospace;letter-spacing:2px;grid-row:2}.lobby-code-box button{grid-column:2;grid-row:1/3;font-size:8px}
.lobby-settings{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:14px 0}.lobby-settings label{font-size:8px}.lobby-settings select{display:block;width:100%;font-size:14px;margin-top:6px;padding:8px 3px}
.leader-transfer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:end;margin:16px 0}.leader-transfer label{font-size:8px}.leader-transfer select{display:block;margin-top:5px;width:100%;font-size:14px}.leader-transfer .btn{font-size:8px}
@media(max-width:560px){#battleScreen{padding:12px 8px}.battle-panel{padding:12px}.battle-top{gap:6px}.battle-tag{font-size:10px}.battle-teams fieldset{padding:8px}.lobby-card{padding:8px}.lobby-card .battle-person{gap:5px;font-size:12px}.lobby-card-head{flex-wrap:wrap}.lobby-list{max-height:400px}.leader-transfer{grid-template-columns:1fr}.lobby-code-box>b{font-size:21px}.battle-teams .battle-person{gap:5px;font-size:12px}}
/* Live battle: complete route image, anchored combat boxes, and pixel HP bars. */
#battleGameScreen{width:100%;background:#fff6d9}.battle-game-top{display:flex;align-items:center;gap:12px;padding:8px;background:#245d91;color:#fff8dc}.battle-game-top .btn{min-height:32px;padding:4px 8px;font-size:8px}.battle-game-top>b{color:#ffd348}.battle-game-top>span{margin-left:auto;font:13px 'Courier New',monospace;font-weight:bold}.battle-arena{position:relative;width:100%;aspect-ratio:2/3;isolation:isolate;overflow:hidden}.battle-route-image{position:absolute;inset:0;background-size:100% 100%;background-repeat:no-repeat;image-rendering:pixelated;z-index:-1}.battle-route-tag{position:absolute;left:8px;top:8px;padding:5px 7px;background:#fff9e2ed;border:2px solid #243b4c;font:12px 'Courier New',monospace;font-weight:bold;max-width:75%}.combat-card{position:absolute;width:64%;max-width:315px;background:#fff8e3f5;border:3px solid #243b4c;box-shadow:inset 0 0 0 2px #aabbac,3px 3px #152a3f85;padding:10px;z-index:2;will-change:transform}.player-card{left:10px;bottom:16px;border-radius:4px 18px 4px 4px}.opponent-card{right:10px;top:48px;border-radius:18px 4px 4px 4px}.combat-name{font-size:10px;overflow-wrap:anywhere;line-height:1.7}.combat-type{display:flex;align-items:center;gap:6px;font:12px 'Courier New',monospace;margin:5px 0}.combat-body{display:grid;grid-template-columns:70px minmax(0,1fr);align-items:center;gap:6px}.combat-body canvas{width:70px;height:70px;image-rendering:pixelated;background:#dbe6ce;border:1px solid #a4b8a1}.combat-body b{display:block;font:12px 'Courier New',monospace;font-weight:bold;overflow-wrap:anywhere;margin-bottom:8px}.hp-wrap{display:flex;align-items:center;gap:4px;background:#34464d;padding:3px;border-radius:8px}.hp-wrap>span{font:10px 'Courier New',monospace;font-weight:bold;color:#f6d96c}.hp-track{flex:1;height:10px;background:#172b31;border:1px solid #14262a;overflow:hidden;border-radius:4px}.hp-fill{height:100%;background:#54bc73;border-top:2px solid #a5e897;transition:width .35s ease}.hp-number{font:12px 'Courier New',monospace;text-align:right;margin-top:4px;font-weight:bold}.battle-roll-box{position:absolute;left:50%;top:44%;transform:translate(-50%,-50%);display:flex;align-items:center;flex-direction:column;gap:7px;background:#fff8e6ed;border:3px solid #243b4c;box-shadow:inset 0 0 0 2px #afbdaf;padding:12px;max-width:88%;min-width:180px;text-align:center}.battle-roll-box>b{font-size:8px;line-height:1.8}.battle-roll-box>span{font:16px 'Courier New',monospace;font-weight:bold;color:#275581}.d18-shape{display:grid;place-items:center;width:94px;height:100px;clip-path:polygon(50% 0,95% 25%,95% 75%,50% 100%,5% 75%,5% 25%);background:conic-gradient(from 30deg,#547e9e,#244568,#7da8b9,#254563,#547e9e);border:3px solid #18334d;position:relative}.d18-shape:after{content:'';position:absolute;inset:12px;border:1px solid #adc4d1;clip-path:polygon(50% 0,100% 100%,0 100%);pointer-events:none}.d18-shape small{position:absolute;bottom:8px;color:#eaf5ef;font:10px 'Courier New',monospace;font-weight:bold}.battle-type-icon{display:inline-block;width:46px;height:46px;background-image:url('../assets/icons/battle-type-icons.png');background-size:341.333px 164px;background-position:var(--icon-x) var(--icon-y);background-repeat:no-repeat;flex-shrink:0}.small-icon{width:23px;height:23px;background-size:170.666px 82px;background-position:calc(var(--icon-x) / 2) calc(var(--icon-y) / 2)}.rolling{animation:type-dice-tumble .45s linear infinite}.battle-impact{position:absolute;left:50%;top:50%;z-index:4;padding:12px 18px;background:#fff1a4;border:3px solid #314353;color:#bd3d3e;font-size:24px;text-shadow:1px 1px #fff;pointer-events:none}.battle-entry{border:3px solid #233b51;box-shadow:inset 0 0 0 3px #b6c7bd;padding:12px}.battle-turn-roster{font:12px 'Courier New',monospace;font-weight:bold;border-bottom:1px solid #aebda7;padding-bottom:8px;line-height:1.6;overflow-wrap:anywhere}#battleMessage{font:13px 'Courier New',monospace;font-weight:bold;line-height:1.6;min-height:42px}.battle-input-row{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:8px;margin:8px 0}.battle-input-row input{width:100%;min-width:0}.battle-input-row .btn{color:white;background:#2364a0}#battleInputError{font:13px 'Courier New',monospace;color:#a03432;min-height:20px}#battleTargetLabel select{display:block;width:100%;margin-top:4px}.battle-entry details{font:12px 'Courier New',monospace;line-height:1.6}.battle-entry summary{cursor:pointer;font-family:Pixel,monospace;font-size:8px}#battleHistory{max-height:200px;overflow:auto}#battleHistory p{border-top:1px solid #c1cbb4;padding-top:5px}#battleWinner{font-size:12px;line-height:1.8}.battle-finished .battle-roll-box{background:#fff0a5}.battle-playing #battleScreen{display:none!important}@keyframes type-dice-tumble{0%{transform:rotate(0deg) scale(.85)}50%{transform:rotate(180deg) scale(1.05)}100%{transform:rotate(360deg) scale(.85)}}@media(max-width:440px){.combat-card{width:74%;padding:7px;max-width:290px}.combat-body{grid-template-columns:58px minmax(0,1fr)}.combat-body canvas{width:58px;height:58px}.combat-name{font-size:8px}.combat-type{font-size:11px}.combat-body b{font-size:11px}.opponent-card{top:42px;right:7px}.player-card{left:7px;bottom:10px}.battle-roll-box{top:48%;min-width:155px;padding:8px}.d18-shape{width:80px;height:86px}.battle-roll-box>span{font-size:14px}.battle-route-tag{font-size:11px}.battle-entry{padding:10px}.battle-input-row{grid-template-columns:minmax(0,1fr) 80px}}@media(prefers-reduced-motion:reduce){.rolling{animation:none}.hp-fill{transition:none}}
/* Trainer HUD, compact history and player menu. */
.header-score{display:flex;flex-direction:column;line-height:1.35;flex-shrink:0}.header-score .single-best-card{padding:0;margin:1px 0 0;background:none;color:#d6e9ff;font:11px 'Courier New',monospace;font-weight:bold;line-height:1.1}.header-score .single-best-card.visible{display:flex;align-items:center;gap:5px}.header-score .single-best-label,.header-score .single-best-value{font:inherit}.header-stats>span{border-left:1px solid #88abc9;padding-left:6px}.header-menu-panel{position:absolute;right:8px;top:calc(100% + 5px);width:190px;padding:6px;background:#fff8dc;border:3px solid #263b50;box-shadow:inset 0 0 0 2px #b6c7bd,3px 3px #152a3f80;z-index:20}.header-menu-panel button{display:block;width:100%;padding:11px 8px;text-align:left;border:0;background:transparent;color:#25394b;font-size:10px;line-height:1.6}.header-menu-panel button+button{border-top:1px solid #b4c5b2}.header-menu-panel button:hover{background:#ffe9ad}#menuPlaceholder{width:min(380px,94vw)}#menuPlaceholder p{font:15px/1.6 'Courier New',monospace}.trainer-name-line{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.trainer-name-line .turn-name{font-size:10px;margin:0}.trainer-prefix{white-space:nowrap}#trainerTurn{font:12px 'Courier New',monospace;font-weight:bold;border-left:1px solid #a5b7a0;padding-left:6px;white-space:nowrap}.trainer-label{max-width:67%}.route-history{position:absolute;right:12px;bottom:56px;width:40%;max-width:212px;padding:7px;background:#fff8ddeF;border:2px solid #263b50;box-shadow:inset 0 0 0 2px #a5b9b8,2px 2px #223c4ca0}.route-history h2{font-size:8px;margin:0 0 5px;line-height:1.5}.route-history .history{max-height:126px;min-height:34px;gap:4px;overscroll-behavior:contain;scrollbar-width:thin}.route-history .history:empty:after{content:'No Pokémon played yet.';font:11px/1.4 'Courier New',monospace;color:#6c7b69}.route-history .history-item{padding:4px;font:11px/1.3 'Courier New',monospace;overflow-wrap:anywhere}.route-history .history-line{display:block}.route-history .history-inline-sprite{width:20px;height:20px;vertical-align:middle;margin:0 3px}.route-history .history-copy>small,.route-history .history-copy>br{display:none}.history-empty{font:11px/1.4 'Courier New',monospace;color:#6c7b69;margin:4px}.last-box{width:calc(50% - 18px);min-width:0;max-width:none}.pokedex-button:hover{background:transparent}.header-menu{flex-shrink:0}@media(max-width:560px){.header-score .single-best-card{font-size:10px}.trainer-label{max-width:68%;padding:5px}.trainer-name-line{gap:4px}.trainer-name-line .turn-name{font-size:9px}.trainer-prefix{font-size:7px}#trainerTurn{font-size:11px;padding-left:4px}.last-box{width:calc(50% - 14px);left:8px;padding:5px}.pokemon-reveal{grid-template-columns:54px minmax(0,1fr);gap:5px}.sprite-window,.pokemon-sprite{width:54px;height:54px}.reveal-name{font-size:8px}.reveal-meta{font-size:10px}.route-history{right:8px;width:39%;padding:5px}.route-history .history{max-height:94px}.route-history .history-item{font-size:10px}.route-history .history-inline-sprite{width:16px;height:16px}.header-menu-panel{right:4px;width:175px}}@media(max-width:360px){.header-stats{font-size:10px}.header-score .single-best-card{font-size:9px}.brand{gap:4px}.header-stats{gap:3px}.header-stats>span{padding-left:3px}.pokemon-reveal{grid-template-columns:45px minmax(0,1fr)}.sprite-window,.pokemon-sprite{width:45px;height:45px}.trainer-label{max-width:67%}}
.game-details{display:block}.route-history .history-inline-sprite{display:none}.route-history .history-line>span:last-child{display:block;margin-top:3px;color:#526757}
.route-history .history-inline-sprite{display:none!important}@media(max-width:420px){.game-active .brand .logo{font-size:11px;letter-spacing:-1px}}@media(max-width:360px){.game-active .brand .logo{font-size:10px}.game-active .header-stats{font-size:9px;gap:3px}.game-active .pokedex-button{flex-basis:28px;width:28px}.game-active .header-login{padding-inline:4px}.header-score .single-best-card{font-size:9px}}
.game-active .brand .logo{min-width:0;overflow:hidden;text-overflow:ellipsis}
/* Battle Log and account profile. */
.route-history .history-inline-sprite{display:inline-block!important;width:22px;height:22px;object-fit:contain;image-rendering:pixelated;vertical-align:middle}
.battle-route-history{z-index:1;right:10px;bottom:18px;width:30%;max-width:185px}.battle-route-history .history{max-height:155px;overflow:auto}.battle-route-history .history-item{font:11px/1.4 'Courier New',monospace}.battle-route-history .history-inline-sprite{width:22px;height:22px}.battle-playing .player-card{width:64%;max-width:315px}#battleHistory{max-height:155px}#battleHistory:empty:after{content:'No Pokémon played yet.'}
#profileDialog{width:min(630px,94vw);max-height:90vh;overflow:auto}#profileDialog p,#achievementsDialog p,#achievementsList{font:14px/1.5 'Courier New',monospace}.profile-identity{display:flex;align-items:center;gap:16px;padding:12px;background:#e0e8d3;border:2px solid #a8bba5}.profile-identity>img{width:88px;height:88px;object-fit:contain;image-rendering:pixelated;background:#fff7de;border:2px solid #2c4554}.profile-identity b{font-size:12px;overflow-wrap:anywhere}#profileEmail{overflow-wrap:anywhere}.profile-title-label{display:block;margin-top:15px;font-size:9px}.profile-title-label select{display:block;width:100%;margin-top:8px}.profile-filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:12px 0}.profile-filters input[type=text],#profileSearch{min-width:0;flex:1;width:160px}.profile-filters label{font:13px 'Courier New',monospace}.profile-filters input[type=checkbox]{width:auto}#profileAvatarGrid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-height:320px;overflow:auto;padding:3px}.profile-avatar{padding:5px;background:#f5f2d8;border:2px solid #a8bba5;color:#263b50;display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0}.profile-avatar[aria-pressed=true]{border-color:#226ca0;box-shadow:0 0 0 2px #226ca0;background:#d6eddf}.profile-avatar img{width:54px;height:54px;object-fit:contain;image-rendering:pixelated}.profile-avatar b{font:12px 'Courier New',monospace;overflow-wrap:anywhere}.profile-avatar small{font:11px 'Courier New',monospace}.profile-avatar.locked{opacity:.55}.profile-more,.profile-empty{grid-column:1/-1}#profileSaveStatus{color:#486b53}#achievementsDialog{width:min(450px,94vw)}@media(max-width:440px){.battle-playing .player-card{width:62%;padding:6px}.battle-playing .combat-body{grid-template-columns:42px minmax(0,1fr);gap:4px}.battle-playing .combat-body canvas{width:42px;height:42px}.battle-playing .combat-body b{font-size:10px}.battle-playing .combat-name{font-size:7px}.battle-playing .combat-type{font-size:10px}.battle-route-history{right:7px;bottom:10px;width:32%;padding:5px}.battle-route-history .history,#battleHistory{max-height:110px}.battle-route-history .history-item{font-size:10px}.battle-route-history .history-inline-sprite{width:18px;height:18px}#profileAvatarGrid{grid-template-columns:repeat(3,minmax(0,1fr))}.profile-identity{gap:10px;padding:8px}.profile-identity>img{width:66px;height:66px}}

.history-sprite-frame{display:inline-block;width:22px;height:22px;position:relative;overflow:hidden;vertical-align:middle;margin:0 3px;flex-shrink:0}.history-sprite-frame .history-inline-sprite{position:absolute;max-width:none;max-height:none;margin:0;object-fit:fill}

.profile-level{margin-top:12px;padding:12px;background:#e0e8d3;border:2px solid #a8bba5}.profile-level-heading{display:flex;justify-content:space-between;align-items:center;gap:8px}.profile-level-heading b{font-size:11px}.profile-level-heading span{font:bold 13px 'Courier New',monospace}.profile-xp-track{margin-top:10px;height:16px;background:#233c4c;border:2px solid #203747;overflow:hidden;box-shadow:inset 0 2px #142a38}#profileXPFill{height:100%;background:#4caddb;border-top:3px solid #a6e4ff;transition:width .3s ease}#profileXPDetail{margin:8px 0 0;font-size:12px!important}@media(max-width:360px){.profile-level{padding:8px}.profile-level-heading b{font-size:9px}.profile-level-heading span{font-size:12px}}

/* Compact, sprite-only avatar choices. Sparkle marks an unlocked shiny variant. */
#profileAvatarGrid{grid-template-columns:repeat(auto-fill,minmax(56px,1fr));gap:6px;max-height:220px}.profile-avatar{position:relative;min-height:56px;padding:4px;gap:0;justify-content:center}.profile-avatar img{width:44px;height:44px}.profile-shiny-badge{position:absolute;top:2px;left:2px;width:15px;height:15px;pointer-events:none}.profile-shiny-badge svg{display:block;width:100%;height:100%}@media(max-width:440px){#profileAvatarGrid{grid-template-columns:repeat(auto-fill,minmax(48px,1fr));gap:5px}.profile-avatar{min-height:50px;padding:3px}.profile-avatar img{width:40px;height:40px}}

.profile-avatar canvas{width:44px;height:44px;image-rendering:pixelated}@media(max-width:440px){.profile-avatar canvas{width:40px;height:40px}}
/* Six avatar choices per row, with fitted sprites growing alongside their tiles. */
#profileAvatarGrid{grid-template-columns:repeat(6,minmax(0,1fr))}.profile-avatar{aspect-ratio:1;min-height:0;padding:5px}.profile-avatar canvas{width:100%;height:auto;aspect-ratio:1;min-width:0}.profile-shiny-badge{width:17px;height:17px}@media(max-width:440px){#profileAvatarGrid{grid-template-columns:repeat(6,minmax(0,1fr))}.profile-avatar{min-height:0;padding:3px}.profile-avatar canvas{width:100%;height:auto}.profile-shiny-badge{width:13px;height:13px}}

.difficulty-options{grid-template-columns:1fr}.difficulty-options .btn{display:flex;align-items:center;gap:12px;text-align:left;padding:10px 14px;color:#fff;min-height:56px;text-shadow:1px 1px #172b31}.difficulty-options [data-difficulty=easy],.ai-easy{background:#298447!important}.difficulty-options [data-difficulty=medium],.ai-medium{background:#bc651a!important}.difficulty-options [data-difficulty=hard],.ai-hard{background:#ba353e!important}.difficulty-options [data-difficulty=insane],.ai-insane{background:#7844b6!important}.difficulty-options .btn[aria-pressed=true]{outline:3px solid #e3b642;outline-offset:1px}.ai-profile{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;border:2px solid #243b4c;box-shadow:inset 0 0 0 1px #ffffff70;color:#fff;font:bold 16px 'Courier New',monospace;line-height:1;text-shadow:1px 1px #172b31}.combat-name{display:flex;align-items:center;gap:8px}.combat-name .ai-profile{width:28px;height:28px;font-size:14px}@media(max-width:440px){.combat-name .ai-profile{width:24px;height:24px;font-size:12px}}

.build-marker{font:10px/1.4 "Courier New",monospace;color:#335875;white-space:nowrap}.save-bar{flex-wrap:wrap}
.type-die{display:block;width:150px;height:150px;max-width:100%;image-rendering:auto}.battle-roll-box{padding-top:4px;gap:4px}@media(max-width:440px){.type-die{width:125px;height:125px}}

.type-roulette{display:block;width:280px;height:auto;max-width:100%}.battle-roll-box{width:310px;max-width:88%;min-width:0;padding:10px;box-sizing:border-box}@media(max-width:440px){.type-roulette{width:260px}.battle-roll-box{width:285px;padding:8px}}

/* Shared roulette type icons for bonuses and played Pokémon. */
.pokemon-type-icon{display:inline-block;width:24px;height:24px;flex:none;vertical-align:middle;image-rendering:auto}
.pokemon-type-icons{display:inline-flex;align-items:center;gap:3px;margin-left:5px;vertical-align:middle}
.type-bonus-icon{display:flex;align-items:center;justify-content:center;line-height:1}
.type-bonus-icon .pokemon-type-icon{width:30px;height:30px}
.reveal-types{display:flex;margin:3px 0}.reveal-types .pokemon-type-icons{margin-left:0}
.combat-body b .pokemon-type-icons{display:flex;margin:3px 0 0}.combat-body .pokemon-type-icon{width:22px;height:22px}
.battle-route-tag{display:flex;align-items:center;justify-content:center;gap:5px}
.history-line .pokemon-type-icon,.battle-history .pokemon-type-icon{width:16px;height:16px}

.privacy-link{color:#fff3bf;font:12px/1.5 system-ui,sans-serif;text-decoration:underline}#accountDialog .privacy-link{color:#20374c;display:inline-block;padding:6px 0}

.rank-badge{width:38px;height:38px;object-fit:contain;image-rendering:pixelated;flex-shrink:0}.profile-rank{display:flex;gap:14px;align-items:center;margin:16px 0;padding:12px;background:#e0e8d3;border:2px solid #a8bba5}.profile-rank>img{width:72px;height:72px;object-fit:contain;image-rendering:pixelated}.profile-rank>div{flex:1;min-width:0}.profile-rank b{font-size:11px}#profileRankFill{height:100%;background:#7566bc;transition:width .3s}#profileRankRecord,#profileRankPoints{margin:6px 0}

/* Keep collection panels inside the visible viewport, including mobile keyboards. */
#profileDialog,#collectionDialog{position:fixed;inset:auto;margin:0;left:var(--panel-center-x,50vw);top:var(--panel-center-y,50dvh);transform:translate(-50%,-50%);width:min(820px,calc(var(--panel-viewport-width,100vw) - 24px));max-width:calc(var(--panel-viewport-width,100vw) - 24px);max-height:calc(var(--panel-viewport-height,100dvh) - 24px);padding:12px;overflow:hidden}
#profileDialog{width:min(630px,calc(var(--panel-viewport-width,100vw) - 24px))}
#profileDialog[open],#collectionDialog[open]{display:flex;flex-direction:column;gap:8px}
#profileDialog>.collection-head,#collectionDialog>.collection-head{flex:none;min-width:0;margin:0;padding-bottom:8px;border-bottom:2px solid #a8bbae}
#profileDialog .collection-head h2,#collectionDialog .collection-head h2{margin:0;font-size:clamp(10px,2.8vw,14px);line-height:1.6;overflow-wrap:anywhere}
#profileClose,#collectionClose{flex:none;min-width:40px}
.collection-panel-body{min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:2px 4px 6px 2px;max-width:100%}
#profileContent{min-width:0}
#profileDialog .profile-identity>div{min-width:0;flex:1}
#profileDialog .profile-identity>img,#profileDialog .profile-rank>img{flex:none}
#profileDialog .profile-filters>*{min-width:0;max-width:100%}
#profileDialog p,#collectionDialog p{overflow-wrap:anywhere}
#collectionDialog .collection-tools>*{min-width:min(130px,100%);max-width:100%}
#collectionGrid{grid-template-columns:repeat(auto-fill,minmax(min(100px,100%),1fr));max-height:min(45dvh,420px);min-height:0;padding:3px}
.collection-card{min-width:0;overflow-wrap:anywhere}
.collection-card img{max-width:100%;height:80px}
@media(max-width:440px),(max-height:700px){
 #profileDialog,#collectionDialog{padding:10px;gap:6px}
 #profileDialog .profile-identity{gap:8px;padding:8px}
 #profileDialog .profile-identity>img{width:56px;height:56px}
 #profileDialog .profile-identity b{font-size:10px}
 #profileDialog p,#collectionDialog p{font-size:12px;line-height:1.4}
 #profileDialog .profile-identity p{margin:5px 0}
 #profileChangeName{font-size:8px;min-height:32px;padding:5px 7px}
 #profileDialog .profile-level{margin:10px 0;padding:8px}
 #profileDialog .profile-rank{gap:10px;margin:10px 0;padding:8px}
 #profileDialog .profile-rank>img{width:54px;height:54px}
 #profileDialog .profile-title-label{margin-top:10px}
 #profileDialog h3{font-size:10px;margin:12px 0 6px}
 #profileAvatarGrid{max-height:min(180px,30dvh)}
 #collectionDialog .collection-tools{margin:8px 0;gap:6px}
 #collectionGrid{gap:6px;max-height:40dvh}
 .collection-card{padding:5px;font-size:11px}
 .collection-card img{width:64px;height:64px}
}

#profileDialog .profile-identity b{display:block;margin-bottom:5px}

/* Phone screens use the available height, rather than a desktop-height frame. */
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 html,body{height:100%;overflow:hidden;overscroll-behavior:none}
 .app{position:fixed;top:calc(var(--game-viewport-top,0px) + env(safe-area-inset-top));left:env(safe-area-inset-left);width:calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right));height:calc(var(--game-viewport-height,100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:0!important;margin:0;box-shadow:none;display:flex;flex-direction:column;overflow:hidden;border-width:2px}
 .brand{flex:none;height:48px;min-height:0;padding:6px;gap:4px}
 .screen-shell{flex:1;min-height:0;overflow:hidden}
 body:not(.game-active) .screen-shell{background-size:contain;background-color:#183545}
 #modeScreen{position:absolute;inset:0;top:0;margin:0;padding:16px;display:grid;place-items:center}
 .mode-inner{width:min(340px,100%)}
 #modeScreen .mode-buttons{gap:12px}
 #modeScreen .mode-choice{min-height:54px;padding:12px}
 #setupScreen{margin:10px;padding:12px;max-height:calc(100% - 20px);overflow:auto;overscroll-behavior:contain}
 .setup-heading{font-size:12px;margin:8px 0}.setup-row{margin:10px 0}
 .player-inputs{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0}
 .player-inputs input{min-width:0;padding:8px;font-size:16px}
 #gameScreen:not(.hidden),#battleGameScreen:not(.hidden){height:100%;display:flex;flex-direction:column;min-height:0;overflow:hidden}
 .route-stage{flex:1;min-height:0;aspect-ratio:auto}
 .dialogue-panel{flex:none;margin:0;padding:8px;border-width:2px}
 #requirement{font-size:8px;line-height:1.5;margin-bottom:5px}
 .word-entry{grid-template-columns:minmax(0,1fr) 108px;gap:6px}
 .word-entry input{height:42px;font-size:16px}
 .entry-actions{margin-top:0;gap:4px}
 .entry-actions>#playBtn{height:36px;min-height:36px;font-size:8px}
 .small-actions .btn{min-height:32px;font-size:7px;padding:4px}
 .game-details{flex:none;padding:0 8px;max-height:28%;overflow:auto;overscroll-behavior:contain}
 .game-details summary{padding:5px 0;font-size:8px}
 .game-details h2{margin:8px 0}.game-details .rule-pills{margin:6px 0}
 .route-hud{top:8px;left:8px;right:8px}
 .route-message{left:8px;right:8px;bottom:6px;padding:5px 7px;font-size:11px;max-height:25%}
 .route-history .history{max-height:min(94px,18dvh)}
 #battleScreen{height:100%;padding:10px;overflow:hidden}
 .battle-panel{height:100%;display:flex;flex-direction:column;min-height:0;padding:10px}
 .battle-top{flex:none;margin-bottom:8px}
 #battleView{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
 #battleStatus{flex:none;margin:6px 0}
 .battle-game-top{flex:none;padding:5px 8px}
 .battle-arena{flex:1;min-height:0;aspect-ratio:auto;background:#183545}
 .battle-route-image{background-size:contain;background-position:center}
 .battle-entry{flex:none;padding:7px;max-height:48%;overflow:auto;overscroll-behavior:contain}
 #battleMessage{margin:5px 0;min-height:0;font-size:12px;line-height:1.3}
 #battleInputError:empty{display:none}
 .battle-input-row{margin:5px 0}
 .battle-input-row input{font-size:16px;padding:7px}
 .battle-turn-roster{font-size:11px;padding-bottom:4px}
 .combat-card{padding:6px}
 .combat-body{grid-template-columns:40px minmax(0,1fr);gap:5px}
 .combat-body canvas{width:40px;height:40px}
 .combat-name{font-size:8px;margin-bottom:3px}.combat-type{font-size:10px;margin-bottom:3px}
 .combat-body b,.hp-number{font-size:10px}
 .battle-route-history{bottom:8px;padding:4px}
 .battle-route-history .history{max-height:min(100px,18dvh)}
 .battle-roll-box{padding:7px;gap:4px;min-width:150px}
 .save-bar{display:none}
}
@media(max-height:500px) and (max-width:1000px){
 .brand{height:40px}.battle-game-top{padding:3px 6px}
 .dialogue-panel{padding:5px 8px}.game-details summary{padding:3px 0}
 #modeScreen .mode-buttons{gap:8px}#modeScreen .mode-choice{min-height:42px;padding:8px}
 .last-box{top:45px!important}.route-hud{top:5px}
 .route-history .history{max-height:48px}
 .combat-card{width:48%!important;max-width:none}.player-card{bottom:5px}.opponent-card{top:30px}
 .battle-entry{max-height:52%;padding:5px 7px}
}

/* Picture unlock progress stays below centered sprites. */
.profile-avatar{display:grid;grid-template-rows:minmax(0,1fr) 5px;gap:4px;padding:5px;opacity:1!important}
.profile-avatar canvas{width:100%;height:100%;min-height:0;object-fit:contain;justify-self:center;align-self:center}
.unlock-progress{height:5px;width:100%;background:#c1c8b5;border:1px solid #20374c;overflow:hidden;align-self:end;flex-shrink:0}
.unlock-progress>span{display:block;height:100%}
.unlock-locked canvas{filter:brightness(0);opacity:.38}
.collection-card{position:relative;display:grid;grid-template-rows:18px minmax(0,1fr) 5px;aspect-ratio:1;gap:5px;padding:6px;text-align:left;min-height:0}
.collection-card .dex-number{font-family:Pixel,monospace;font-size:8px;color:#20374c;justify-self:start;align-self:start;z-index:1}
.collection-card .dex-sprite{display:block;width:100%;height:100%;min-height:0;object-fit:contain;image-rendering:pixelated;justify-self:center;align-self:center}
@media(max-width:440px){.collection-card{padding:4px;gap:3px;grid-template-rows:13px minmax(0,1fr) 5px}.collection-card .dex-number{font-size:6px}.profile-avatar{padding:3px;gap:3px}}
#multiplayerScreen{min-height:0}#multiView{min-height:0}#collectionNotice:empty{display:none}
@media(max-width:600px),(max-height:500px) and (max-width:1000px){#multiplayerScreen{height:100%;overflow:hidden}#multiplayerScreen .battle-panel{height:100%;display:flex;flex-direction:column;margin:0}#multiView{flex:1;overflow:auto}#multiStatus{flex:none;margin:4px;font:12px monospace}.collection-card{contain:layout paint}}

/* Keep the account controls together in every screen and viewport. */
.brand .account-actions{display:flex;align-items:center;gap:5px;margin-left:auto;flex:none}.brand .account-actions .header-login{margin-left:0}.account-actions .header-menu{flex:none}
#leaderboardDialog{width:min(650px,calc(100vw - 20px));max-width:calc(100vw - 20px);max-height:calc(100dvh - 24px);padding:0;border:3px solid #263b50;background:#fff8dc;color:#25394b;overflow:hidden}#leaderboardDialog[open]{display:flex;flex-direction:column}#leaderboardDialog::backdrop{background:#102238aa}#leaderboardDialog .collection-head{flex:none;padding:12px;display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:2px solid #a5b9b8}#leaderboardDialog h2{font-size:13px;margin:0}.leaderboard-body{overflow:auto;overscroll-behavior:contain;padding:12px;min-height:0}.leaderboard-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px}.leaderboard-tabs .btn,#leaderboardDexModes .btn{font-size:9px}#leaderboardDialog button[aria-pressed=true]{background:#245d91;color:#fff8dc}#leaderboardDexModes{display:flex;gap:6px;margin-top:8px}#leaderboardStatus,#leaderboardClock,#leaderboardResults>p{font:13px/1.5 'Courier New',monospace}#leaderboardClock{color:#586b65;font-size:12px}#leaderboardResults table{width:100%;border-collapse:collapse;font:14px/1.4 'Courier New',monospace;table-layout:fixed}#leaderboardResults caption{text-align:left;font-weight:bold;padding:8px 0}#leaderboardResults th,#leaderboardResults td{text-align:left;padding:9px 6px;border-bottom:1px solid #b6c7bd;overflow-wrap:anywhere}#leaderboardResults th:first-child{width:17%}#leaderboardResults th:last-child{width:37%}#leaderboardResults small{display:block;color:#596c69;font-size:11px}.leaderboard-you{background:#e3eecb;font-weight:bold}#leaderboardRetry{margin-top:8px}@media(max-width:360px){.brand .account-actions{gap:3px}#leaderboardResults table{font-size:12px}.leaderboard-body{padding:8px}}

.build-marker{display:inline!important;font:10px/1.4 Courier New,monospace}.lobby-empty{font:14px/1.5 Courier New,monospace;text-align:center;padding:20px;color:#61736e}

.brand>.build-marker{position:absolute;left:12px;bottom:2px;color:#e8f2ff;font-size:9px}

.standard-heading{text-align:center;margin:0;color:#fff5cf;text-shadow:2px 2px #26394b;font-size:16px}#standardBack{justify-self:start}

.lobby-avatar{display:grid;place-items:center;flex:0 0 52px;width:52px;height:52px;background:#e5f2e7;border:2px solid #26394b;box-shadow:inset 0 0 0 2px #afc7b7}.lobby-avatar canvas{width:48px;height:48px;image-rendering:pixelated}.battle-person .rank-badge{flex-shrink:0}

.brand .logo{display:flex;align-items:center;flex-shrink:1;min-width:0;width:205px;max-width:48%;text-shadow:none;letter-spacing:0}.brand .logo img{display:block;width:100%;height:auto;max-height:43px;object-fit:contain;object-position:left center}@media(max-width:400px){.brand .logo{width:175px;max-width:46%}}
.brand>.build-marker{bottom:-13px;left:12px;background:#183545;padding:0 3px;z-index:2}
/* v0.59: shared menu, lobby identity, and opening sign-in screen. */
.brand .account-actions{align-items:stretch;gap:6px}.brand .account-actions>.header-menu,.brand .account-actions>.header-login{height:36px;min-height:36px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;margin:0}.brand .account-actions>.header-menu{width:36px;font-size:22px;padding:0}
.battle-person b{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.battle-person b>.rank-badge{width:20px;height:20px;object-fit:contain;margin:0;flex:0 0 20px}
button.back-arrow,.battle-game-top button.back-arrow{font-family:Arial,sans-serif;font-size:32px;line-height:1;min-width:48px;min-height:40px;padding:0 6px}
#standardModes{width:100%;max-width:none}#standardModes h2{font-size:14px;line-height:1.8;margin:10px 0 14px}#modeScreen:has(#standardModes:not(.hidden)){top:0;margin:18px 14px}#modeScreen:has(#standardModes:not(.hidden)) .mode-inner{padding:0}
#loginScreen{position:relative;min-height:100%;display:grid;place-items:center;padding:18px 12px}#loginScreen[hidden]{display:none}.login-active .screen-shell{overflow:auto}.login-active .brand,.login-active .save-bar,.login-active .screen-shell>section:not(#loginScreen){display:none!important}.login-active .app{grid-template-rows:minmax(0,1fr)}
.login-content{width:min(420px,100%);display:grid;gap:20px}.login-logo{width:100%;height:auto;max-height:118px;object-fit:contain;filter:drop-shadow(2px 3px 0 #183545)}.login-panel{padding:18px}.login-panel label{display:block;font:700 14px 'Courier New',monospace;margin:12px 0}.login-panel input{display:block;width:100%;margin-top:6px;height:42px}.login-panel #accountForm{display:grid}.login-panel .collection-tools{justify-content:center}.login-panel #accountSocialSignIn{display:grid;grid-template-columns:1fr 1fr;margin-top:12px}.login-panel #accountSocialSignIn button{display:flex;align-items:center;justify-content:center;gap:8px;font-size:9px}.social-symbol{display:grid;place-items:center;width:24px;height:24px;font:bold 23px Arial,sans-serif;background:#fff;border-radius:3px}.google-symbol{color:#4285f4}.facebook-symbol{color:#fff;background:#1877f2}.login-panel small,.login-panel #loginMessage{font:12px/1.4 'Courier New',monospace}.login-panel #loginMessage:empty{display:none}.login-panel #accountForgot{font-size:8px;margin-top:8px}.login-panel #continueGuest{width:100%;margin-top:10px;font-size:8px}.login-panel>.privacy-link{display:block;text-align:center;margin-top:12px;font:12px 'Courier New',monospace}
@media(max-width:560px){.login-content{gap:12px}.login-logo{max-height:90px}.login-panel{padding:12px}#loginScreen{padding:12px}.brand .account-actions>.header-menu,.brand .account-actions>.header-login{height:32px;min-height:32px}.brand .account-actions>.header-menu{width:32px}.battle-person b>.rank-badge{width:16px;height:16px;flex-basis:16px}}
.login-panel>.privacy-link{color:#284957;text-decoration:underline}.login-active .app{background-image:url('../assets/backgrounds/starting-connected-region.webp');background-size:100% 100%;background-position:center}.login-active .screen-shell{background:transparent!important}

.login-panel #signUpTab,.login-panel #signInTab{margin-top:8px;font-size:9px}.login-panel [hidden]{display:none!important}

/* v0.59: one viewport-sized frame on every device. */
html,body{width:100%;height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
.app{position:fixed;inset:0;width:100%;height:100dvh;max-width:none;min-height:0!important;margin:0;box-shadow:none;display:flex;flex-direction:column;overflow:hidden;border-width:2px}
.brand{flex:none}.screen-shell{flex:1;min-height:0!important;width:100%;overflow:hidden}
.app>.build-marker{position:absolute;left:8px;bottom:4px;z-index:30;background:#183545e8;color:#e8f2ff;padding:1px 5px;font:10px/1.4 'Courier New',monospace;pointer-events:none}
.save-bar{position:absolute;top:auto;bottom:4px;left:auto;right:8px;width:auto;margin:0;z-index:29;padding:1px 5px;background:#183545e8;max-width:65%}
body:not(.game-active) .screen-shell{background-size:cover;background-position:center;background-color:#183545}
#modeScreen{position:absolute;inset:0;top:0!important;margin:0!important;padding:20px;display:grid;place-items:center}
#modeScreen .mode-inner{width:min(420px,100%)}#modeScreen .mode-buttons{width:100%}#standardModes{height:auto}
#setupScreen{max-height:calc(100% - 40px);overflow:auto}
#battleScreen,#multiplayerScreen{height:100%;padding:18px;overflow:hidden}
#battleScreen>.battle-panel,#multiplayerScreen>.battle-panel{height:100%;max-width:900px;margin:auto;display:flex;flex-direction:column;min-height:0}
#battleView,#multiView{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
#battleStatus,#multiStatus{flex:none}
#gameScreen:not(.hidden),#battleGameScreen:not(.hidden){height:100%;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.route-stage,.battle-arena{flex:1;min-height:0;aspect-ratio:auto;background:#183545}
.dialogue-panel,.battle-entry,.battle-game-top{flex:none}.dialogue-panel{margin:0}.game-details{flex:none;max-height:28%;overflow:auto}
.battle-route-image{background-size:contain;background-position:center}
.login-active .app{background-size:cover}.login-active .screen-shell{overflow:auto}#loginScreen{height:100%;min-height:0}.login-content{margin:auto}
@media(max-width:600px){#battleScreen,#multiplayerScreen{padding:10px}.save-bar{display:none}#modeScreen{padding:16px}}

/* v0.59: centered portrait frame matching the desktop reference. */
@media(min-width:601px) and (min-height:501px){
 .app{inset:auto;top:50%;left:50%;transform:translate(-50%,-50%);width:min(760px,calc((100dvh - 24px)*.56),calc(100vw - 24px));height:calc(100dvh - 24px);border-width:3px;box-shadow:0 0 0 2px #94b7c7,0 0 0 5px #233b51,0 18px 55px #0007}
 .brand{gap:6px;padding:8px}.brand .logo{width:175px;max-width:40%}.header-stats{font-size:12px;gap:5px}.header-stats span+span{padding-left:5px}.brand .header-login{font-size:8px;padding:6px}.pokedex-button{flex-basis:32px;width:32px}
 .last-box{max-width:260px;width:auto}.word-entry{grid-template-columns:minmax(0,1fr) 118px;gap:8px}.word-entry input{font-size:16px}.entry-actions{margin-top:0}.small-actions .btn{font-size:7px}.dialogue-panel{padding:10px}.route-history{max-width:34%}
}
.login-panel .login-password{display:grid;grid-template-columns:1fr auto;align-items:center;gap:6px}.login-password input{grid-column:1/-1}.password-forgot{border:0;background:none;text-decoration:underline;color:#284957;padding:0;font:12px 'Courier New',monospace}.social-logo{width:24px;height:24px;object-fit:contain}.brand .logo{max-width:32%;width:140px;flex-shrink:1}.brand .logo img{max-height:32px;width:100%;object-fit:contain}.brand .logo{cursor:pointer}.route-exit{position:absolute;top:8px;left:50%;transform:translateX(-50%);z-index:5;font-size:8px;min-height:30px}.connection-notice{position:absolute;left:8px;right:8px;top:64px;z-index:10;background:#fff0b8f5;border:2px solid #263b50;padding:8px;font:700 13px 'Courier New',monospace;text-align:center}.save-exit-actions{display:grid;gap:10px}#saveExitDialog{max-width:420px}#saveExitDialog p{font:14px 'Courier New',monospace}.profile-match-record{font:14px 'Courier New',monospace}

.route-exit{left:auto;right:8px;top:48px;transform:none}.login-panel #accountForgot{margin:0;font-size:12px}

/* v0.60: keep mobile gameplay controls above the on-screen keyboard. */
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 body.keyboard-open .app{inset:auto 0 auto;top:var(--keyboard-view-top,0px);height:var(--keyboard-view-height,100dvh);transform:none}
 body.keyboard-open .brand{height:42px;padding:3px 6px}
 body.keyboard-open .dialogue-panel{padding:5px 7px}
 body.keyboard-open .requirement{font-size:8px;margin:0 0 4px}
 body.keyboard-open .word-entry{gap:4px 6px}
 body.keyboard-open .entry-actions{margin-top:0}
 body.keyboard-open .word-entry input{height:38px}
 body.keyboard-open .entry-actions>#playBtn{height:32px;min-height:32px}
 body.keyboard-open .small-actions .btn{min-height:28px;padding:3px}
 body.keyboard-open .route-history .history,body.keyboard-open #battleHistory{max-height:64px}
 body.keyboard-open .route-history{max-height:96px;overflow:auto}
 body.keyboard-open .battle-entry{max-height:45%;padding:5px 7px}
 body.keyboard-open .battle-game-top{padding:3px 6px}
 body.keyboard-open .combat-card{padding:4px}
 body.keyboard-open .combat-body{grid-template-columns:32px minmax(0,1fr)}
 body.keyboard-open .combat-body canvas{width:32px;height:32px}
 body.keyboard-open .combat-body b{margin-bottom:3px}
 body.keyboard-open .combat-name{font-size:7px}
 body.keyboard-open .combat-type{margin:2px 0}
 body.keyboard-open .opponent-card{top:30px}
 body.keyboard-open .player-card{bottom:5px}
}

/* v0.62: mobile controls overlay the route, preserving its proportions. */
body.game-active .app>.build-marker,body.battle-playing .app>.build-marker{display:none!important}
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 #gameScreen{position:relative;container-type:inline-size;justify-content:flex-start}
 #gameScreen .route-stage{flex:none;width:100%;height:150cqw;min-height:150cqw;border:0}
 #gameScreen .dialogue-panel{position:absolute;left:4px;right:4px;bottom:4px;z-index:8;background:#fff6d9f2;padding:7px;border-width:2px}
 #gameScreen .word-entry{grid-template-columns:minmax(0,1fr);gap:6px}
 #gameScreen .word-entry input{height:40px;width:100%}
 #gameScreen .entry-actions{display:grid;grid-template-columns:1.4fr 1fr;gap:6px;margin:0}
 #gameScreen .small-actions{gap:6px}
 #gameScreen .entry-actions>#playBtn,#gameScreen .small-actions .btn{height:34px;min-height:34px;margin:0;padding:4px;font-size:8px}
 #gameScreen .suggestion-box{max-height:72px;overflow:auto}
 #gameScreen .route-message{bottom:calc(var(--route-overlay-lift,0px) + var(--mobile-controls-height,120px) + 10px)}
 #gameScreen .route-history{bottom:calc(var(--route-overlay-lift,0px) + var(--mobile-controls-height,120px) + var(--mobile-message-height,28px) + 18px)!important}
 body.keyboard-open #gameScreen .dialogue-panel{padding:5px}
 body.keyboard-open #gameScreen .entry-actions>#playBtn,body.keyboard-open #gameScreen .small-actions .btn{height:30px;min-height:30px}
}
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 #battleGameScreen{position:relative;container-type:inline-size}
 #battleGameScreen .battle-arena{flex:none;width:100%;height:150cqw;min-height:150cqw}
 #battleGameScreen .battle-entry{position:absolute;bottom:4px;left:4px;right:4px;z-index:8;background:#fff6d9f2;max-height:45%;padding:6px}
 #battleGameScreen .battle-route-history,#battleGameScreen .player-card{bottom:calc(var(--battle-overlay-lift,0px) + var(--battle-controls-height,120px) + 12px)}
}

#typeSceneBg,#battleRoute{background-image:url('../assets/backgrounds/route-normal-approved.webp?v=64')}
#assetLoading{position:fixed;inset:0;z-index:1000;background:#102b34f5;display:grid;place-items:center;padding:18px}.asset-loading-card{width:min(390px,100%);padding:24px;border:3px solid #263b50;background:#fff8dc;text-align:center}.asset-loading-card h2{font-size:15px}.asset-loading-card p{font:14px/1.5 monospace}.asset-loading-card progress{width:100%;height:16px;margin-bottom:16px}.asset-loading-card button{margin-top:8px;width:100%}#assetLoadContinue{font-size:8px}button:active{filter:brightness(.94)}#playBtn:disabled,#battleAttack:disabled{filter:saturate(.65)}

/* v0.64: compact HUD, closed-keyboard overlays and four-column mobile Dex. */
#resumeAccountGame{display:none!important}
.header-exit{font-size:8px;min-height:32px;height:32px;padding:4px 7px;flex-shrink:0}
.brand{gap:7px}.header-stats{margin-left:auto;gap:0}
.last-box{bottom:auto!important;height:auto!important;align-self:start;width:max-content!important;max-width:47%!important;padding:5px!important}
.pokemon-reveal{grid-template-columns:68px minmax(0,110px);gap:5px}.reveal-name{margin:1px 0}.last-empty{max-width:150px;padding:2px}
.type-bonus-box{box-sizing:border-box;flex-shrink:0}
.route-message:has(.status:empty){display:none}
#continueGameDialog{width:min(390px,94vw)}#continueGameDialog p{font:15px/1.6 'Courier New',monospace}
#battleGameScreen .battle-game-top>#battleExit{display:none}
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 .brand{gap:4px}.header-exit{font-size:7px;padding:3px 5px;min-height:28px;height:28px}.brand .logo{max-width:28%}
 .pokemon-reveal{grid-template-columns:54px minmax(0,100px);gap:4px}
 #gameScreen .route-stage{flex:1;min-height:0;height:auto}
 #gameScreen .dialogue-panel{position:relative;left:auto;right:auto;bottom:auto;flex:none;margin:0 4px 4px}
 #gameScreen .route-message{bottom:8px}
 #gameScreen .route-history{bottom:calc(var(--mobile-message-height,28px) + 16px)!important}
 body.keyboard-open #gameScreen .route-stage{flex:none;height:150cqw;min-height:150cqw}
 body.keyboard-open #gameScreen .dialogue-panel{position:absolute;left:4px;right:4px;bottom:4px;margin:0}
 body.keyboard-open #gameScreen .route-message{bottom:calc(var(--route-overlay-lift,0px) + var(--mobile-controls-height,120px) + 10px)}
 body.keyboard-open #gameScreen .route-history{bottom:calc(var(--route-overlay-lift,0px) + var(--mobile-controls-height,120px) + var(--mobile-message-height,28px) + 18px)!important}
 #collectionGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 #collectionGrid .collection-card{min-width:0;padding:4px;min-height:0}
 #collectionGrid canvas{width:100%;height:auto;max-width:100%;aspect-ratio:1}
}
@media(max-width:360px){.pokemon-reveal{grid-template-columns:45px minmax(0,95px)}}

.type-bonus-box{padding-top:0;padding-bottom:0}.type-bonus-box .pokemon-type-icon{transform:scale(.625)}

/* Profile and sprite layout refinements. */
#profileDialog .profile-identity b{display:inline;margin:0 5px 0 0}
#profileChangeName{padding:2px 5px;min-height:28px;font:22px/1 monospace;vertical-align:middle}
.profile-avatar{grid-template-rows:minmax(0,1fr);gap:0}
#collectionGrid .collection-card .dex-sprite{width:100%;height:100%;max-height:100%;min-height:0;aspect-ratio:auto;object-fit:contain}
@media(max-width:600px){
 #profileDialog{padding:8px;gap:4px}
 #profileDialog .collection-panel-body{padding:0;scrollbar-gutter:auto}
 #profileDialog p{font:11px/1.25 'Courier New',monospace;margin:3px 0}
 #profileDialog .profile-identity{padding:5px;gap:6px}
 #profileDialog .profile-identity>img{width:44px;height:44px}
 #profileDialog .profile-level{padding:5px;margin:5px 0}
 #profileDialog .profile-rank{padding:5px;margin:5px 0;gap:7px}
 #profileDialog .profile-rank>img{width:40px;height:40px}
 #profileDialog .profile-xp-track{height:9px;margin-top:4px}
 #profileDialog .profile-title-label{margin-top:4px}
 #profileDialog select,#profileDialog input{padding:5px;min-height:30px;font-size:14px}
 #profileDialog .profile-title-label select{margin-top:3px}
 #profileDialog h3{font-size:9px;margin:5px 0 3px}
 #profileDialog .profile-filters{margin:4px 0;gap:4px}
 #profileAvatarGrid{max-height:min(110px,19dvh);gap:3px}
 #profileDialog #profileXPDetail{font-size:10px!important}
 #collectionGrid .collection-card{grid-template-rows:12px minmax(0,1fr) 5px;gap:3px}
 #collectionGrid .collection-card .dex-sprite{width:90%;height:90%;max-height:100%;align-self:center;justify-self:center}
}

/* v0.66: scale the desktop Battle composition together on mobile. */
.battle-layout{display:contents}
@media(max-width:600px),(max-height:500px) and (max-width:1000px){
 #battleGameScreen .battle-arena{flex:1;min-height:0;height:auto;container-type:normal}
 #battleGameScreen .battle-entry{position:relative;left:auto;right:auto;bottom:auto;flex:none;margin:0 4px 4px;max-height:45%;padding:6px}
 #battleGameScreen .battle-route-image{background-size:cover;background-position:center}
 #battleGameScreen .battle-layout{display:block;position:absolute;width:500px;height:750px;left:50%;top:50%;transform:translate(-50%,-50%) scale(var(--battle-scene-scale,0.6));transform-origin:center}
 #battleGameScreen .combat-card{width:64%!important;max-width:315px;padding:10px}
 #battleGameScreen .player-card{left:10px;bottom:16px}
 #battleGameScreen .opponent-card{right:10px;top:48px}
 #battleGameScreen .combat-body{grid-template-columns:70px minmax(0,1fr);gap:6px}
 #battleGameScreen .combat-body canvas{width:70px;height:70px}
 #battleGameScreen .combat-body b{font-size:12px;margin-bottom:8px}
 #battleGameScreen .combat-name{font-size:10px;margin-bottom:0}
 #battleGameScreen .combat-type{font-size:12px;margin:5px 0}
 #battleGameScreen .hp-number{font-size:12px}
 #battleGameScreen .combat-name .ai-profile{width:28px;height:28px;font-size:14px}
 #battleGameScreen .battle-route-tag{top:8px;left:8px;font-size:12px}
 #battleGameScreen .battle-roll-box{width:310px;top:44%;padding:10px;min-width:0;gap:4px}
 #battleGameScreen .type-roulette{width:280px}
 #battleGameScreen .battle-roll-box>span{font-size:16px}
 #battleGameScreen .battle-route-history{right:10px;bottom:18px;width:30%;max-width:185px;padding:7px}
 #battleGameScreen .battle-route-history .history,#battleGameScreen #battleHistory{max-height:155px}
 #battleGameScreen .battle-route-history .history-item{font:11px/1.4 'Courier New',monospace}
 #battleGameScreen .battle-route-history .history-inline-sprite{width:22px;height:22px}
}

/* Keep the starting account actions together on desktop and mobile. */
.login-panel #accountForm{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:8px}
.login-panel #accountForm>label{grid-column:1/-1}
.login-panel #accountForm>#accountSubmit,.login-panel #accountForm>#signUpTab,.login-panel #accountForm>#signInTab{min-width:0;margin-top:8px;font-size:9px}
/* v0.68: stable home artwork; the header overlays the same full-frame picture. */
body:not(.game-active):not(.battle-playing) .app{background-image:url('../assets/backgrounds/starting-connected-region.webp');background-size:cover;background-position:center;background-repeat:no-repeat}
body:not(.game-active):not(.battle-playing) .screen-shell{background:transparent!important}
.save-bar{display:none!important}
#headerDex{margin-left:auto;flex-shrink:0}
#profileSaveStatus:empty,#battleStatus:empty,#multiStatus:empty{display:none}
#profilePicture{display:grid;place-items:center;flex:none;width:calc(var(--profile-choice-size,56px) + 4px);height:calc(var(--profile-choice-size,56px) + 4px);background:#fff7de;border:2px solid #2c4554}
#profilePicture canvas{width:var(--profile-choice-size,56px);height:var(--profile-choice-size,56px);image-rendering:pixelated}
#achievementsDialog{width:min(560px,94vw)}
#achievementsList{display:grid;gap:8px}
.achievement-card{display:grid;grid-template-columns:38px minmax(0,1fr);gap:10px;align-items:center;padding:10px;border:2px solid #99ac98;background:#e0e9d1}
.achievement-icon{display:grid;place-items:center;width:38px;height:38px}
.achievement-icon canvas,.achievement-emblem{width:32px;height:32px;image-rendering:pixelated}
.achievement-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;font:13px/1.4 'Courier New',monospace;margin-bottom:6px}
.achievement-heading>span{white-space:nowrap;font-size:12px}
.achievement-progress{height:7px}
.lobby-achievement{display:flex;align-items:center;gap:4px;margin:2px 0;font:12px/1.5 'Courier New',monospace;color:#365e80;white-space:nowrap;min-width:0}
.lobby-title-text{white-space:nowrap;min-width:0}
.lobby-achievement-icon{width:16px;height:16px;flex:0 0 16px;display:grid;place-items:center}
.lobby-achievement-icon canvas,.lobby-achievement-icon svg{width:16px;height:16px}
.battle-person>div{min-width:0;flex:1}
.battle-person .lobby-avatar{flex:0 0 52px}
.lobby-browser #battleView,.lobby-browser #multiView{display:flex;flex-direction:column}
.lobby-browser .lobby-list:has(.lobby-empty){flex:1;min-height:160px;max-height:none;display:grid;place-items:center;margin:0}
.lobby-browser .lobby-empty{grid-column:1/-1;margin:0;padding:10px;font:16px/1.5 'Courier New',monospace}
.battle-compact#battleScreen{height:auto;max-height:100%;overflow:auto}
.battle-compact#battleScreen>.battle-panel{height:auto;padding-bottom:16px}
.battle-compact #battleView{flex:none;overflow:visible}
.battle-compact .difficulty-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0}
.battle-compact #battleAIStart{width:100%}
.leaderboard-options{display:grid;gap:6px;font:14px 'Courier New',monospace;margin-bottom:10px}
.leaderboard-options select{width:100%}
.leaderboard-placeholder{color:#697b75}
@media(max-width:600px){
 .achievement-card{padding:8px;gap:6px;grid-template-columns:30px minmax(0,1fr)}
 .achievement-icon{width:30px;height:30px}.achievement-heading{font-size:12px}.achievement-heading>span{font-size:11px}
 .battle-teams:has(.lobby-achievement){grid-template-columns:1fr}
 .battle-compact .battle-choice{min-height:42px}.battle-compact .battle-panel{padding:10px}
}

/* Keep short phone profiles within the available screen. */
@media(max-width:600px) and (max-height:650px){
 #profileTitleHint{display:none}
 #profileDialog .profile-level,#profileDialog .profile-rank{padding:3px}
 #profileAvatarGrid{max-height:85px}
}
.lobby-browser #battleView,.lobby-browser #multiView{position:relative}
.lobby-browser .lobby-list:has(.lobby-empty){min-height:0}
.lobby-browser .lobby-empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;text-align:center}
@media(max-width:600px){
 .lobby-browser .lobby-actions{display:grid;grid-template-columns:1fr minmax(0,1fr) 1fr;gap:5px}
 .lobby-browser .lobby-actions button{font-size:7px;padding:6px 3px;min-width:0}
 .lobby-browser .lobby-actions input{width:100%;min-width:0;padding:5px;font-size:12px}
}

/* Public description and compact legal footer. */
.login-description{max-width:360px;margin:0;text-align:center;color:#fff8dc;font:13px/1.45 'Courier New',monospace;text-shadow:0 1px 2px #102b36;background:#183545d9;padding:6px 10px;border-radius:3px}
.site-footer{position:absolute;left:8px;right:8px;bottom:4px;z-index:30;display:flex;align-items:center;justify-content:space-between;gap:8px;color:#e8f2ff;font:10px/1.4 'Courier New',monospace}
.site-footer .build-marker{color:#e8f2ff}
.site-footer .build-marker,.site-footer nav{background:#183545e8;padding:3px 5px}
.site-footer nav{display:flex;gap:12px;align-items:center}
.site-footer .privacy-link{color:#e8f2ff;font:inherit;margin:0;text-decoration:underline}
#loginScreen{padding-bottom:36px}
body.game-active .site-footer,body.battle-playing .site-footer{display:none!important}
@media(max-width:360px){.site-footer{left:4px;right:4px;gap:4px;font-size:9px}.site-footer nav{gap:8px}.login-description{font-size:12px}.login-content{gap:8px}}
