[hidden]{display:none!important}
:root{
  color-scheme:dark;
  --ui-safe-left:max(14px,env(safe-area-inset-left));
  --ui-safe-right:max(14px,env(safe-area-inset-right));
  --ui-safe-bottom:max(14px,env(safe-area-inset-bottom));
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#10151d;touch-action:none;overscroll-behavior:none}
body{display:grid;place-items:center;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
button,input{font:inherit}
button{-webkit-tap-highlight-color:transparent}
#shell{width:100vw;height:100dvh;display:grid;place-items:center;background:#10151d;touch-action:none}
#gameFrame{position:relative;width:min(100vw,calc(100dvh * 1.5));aspect-ratio:3/2;max-height:100dvh;overflow:hidden;background:#000;box-shadow:0 0 0 1px #ffffff14;touch-action:none}
#game{display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;background:#000}
#loading{position:absolute;inset:0;display:grid;place-items:center;background:#10151d;color:#fff;font-weight:800;font-size:clamp(12px,2vw,18px);z-index:60}

#profileChip{position:absolute;z-index:34;top:max(8px,env(safe-area-inset-top));left:8px;display:flex;align-items:center;gap:7px;padding:5px 7px;background:#142034d9;border:1px solid #ffffff55;border-radius:8px;color:#fff;box-shadow:0 2px 8px #0007;pointer-events:auto}
#profileChip>div{display:flex;flex-direction:column;line-height:1.05}
#profileChip strong{font-size:10px}
#profileChip span{font-size:8px;color:#d8e6f0;margin-top:2px}
#profileLogout{border:1px solid #ffffff55;background:#ffffff16;color:#fff;border-radius:5px;padding:5px 6px;font-size:8px;font-weight:900}
#gameFrame.dialog-open #profileChip,#gameFrame.battle-active #profileChip,#gameFrame.battle-prompt-open #profileChip{opacity:0;pointer-events:none}

#mobileControls{
  position:absolute;inset:0;pointer-events:none;z-index:30;
  touch-action:none;
  -webkit-user-select:none;user-select:none;
  -webkit-touch-callout:none;
  -webkit-user-drag:none;
}
#mobileControls *,#mobileControls button{
  touch-action:none;
  -webkit-user-select:none;user-select:none;
  -webkit-touch-callout:none;
  -webkit-user-drag:none;
}
.joystick{position:absolute;left:var(--ui-safe-left);bottom:var(--ui-safe-bottom);width:86px;height:86px;pointer-events:auto;touch-action:none}
.joystick-ring{position:absolute;inset:0;border-radius:50%;background:#08111b57;border:2px solid #ffffff61;box-shadow:inset 0 0 0 8px #ffffff0d;backdrop-filter:blur(2px)}
.joystick-knob{position:absolute;left:25px;top:25px;width:36px;height:36px;border-radius:50%;background:#f0f8ffb8;border:2px solid #0a192673;box-shadow:0 2px 8px #0006;transform:translate(0,0);will-change:transform}
.interact{position:absolute;right:var(--ui-safe-right);bottom:calc(var(--ui-safe-bottom) + 8px);width:68px;height:68px;border-radius:50%;border:2px solid #ffffff8c;background:#2580e1a3;color:#fff;font:800 27px/1 system-ui,sans-serif;box-shadow:0 3px 10px #0005,inset 0 0 0 6px #ffffff14;pointer-events:auto;touch-action:none}
.interact:active,.interact.pressed{transform:scale(.94);background:#2580e1d9}

.dialog,.battlePrompt{
  position:absolute;left:1.6667%;right:1.6667%;bottom:2.5%;z-index:40;
  min-height:30%;padding:3.2% 5.2% 2.6%;color:#303030;background:#fff;
  border:clamp(8px,3.333vw,28px) solid transparent;
  border-image-source:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAMFBMVEVzzaT///9iYmLV1c3mCAj/vXMgnAiU9pQxUs2kxfb/AP/N1dWczd5ic3tBrOaDpLT0uJqWAAAAK0lEQVQYlWNgwA1470LBBSDnLhyAOLuhAMzZKAgG0kOLg+IFZM+heBsXAAA/FVjbLqm42wAAAABJRU5ErkJggg==");
  border-image-slice:8 fill;border-image-width:1;border-image-repeat:stretch;border-radius:0;
  image-rendering:pixelated;font-family:"Trebuchet MS","Arial Rounded MT Bold",Arial,sans-serif;
  font-size:clamp(14px,3vw,28px);font-weight:800;line-height:1.25;white-space:pre-line;pointer-events:auto;touch-action:none
}
.dialogHint{position:absolute;right:5.5%;bottom:11%;font-size:.72em;opacity:.72;animation:dialogPrompt .7s steps(2,end) infinite}
@keyframes dialogPrompt{0%,49%{transform:translateY(0)}50%,100%{transform:translateY(2px)}}
#gameFrame.dialog-open .joystick{opacity:0;pointer-events:none}
#gameFrame.dialog-open .interact{bottom:34%;z-index:45;opacity:.95}

.battlePrompt{z-index:72;left:39%;right:2%;bottom:4%;min-height:35%;padding:4% 5%;display:flex;align-items:center;gap:5%;font-size:clamp(13px,2.5vw,24px)}
.battleChoiceButtons{margin-left:auto;display:flex;flex-direction:column;gap:6px;min-width:28%}
.battleChoiceButtons button{background:#fff;color:#222;border:2px solid #313131;border-radius:3px;padding:7px 10px;font-weight:900}
#gameFrame.battle-prompt-open .joystick,#gameFrame.battle-prompt-open .interact{opacity:0;pointer-events:none}

.authLayer{
  position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;
  overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;
  padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right))
    max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
  background-color:#355f6b;
  background-image:linear-gradient(45deg,#ffffff0c 25%,transparent 25%,transparent 75%,#ffffff0c 75%),
    linear-gradient(45deg,#122f3c24 25%,transparent 25%,transparent 75%,#122f3c24 75%);
  background-position:0 0,5px 5px;background-size:10px 10px;
  overscroll-behavior:contain;
}
.authScreen{
  display:grid;grid-template-columns:minmax(250px,38%) minmax(0,1fr);
  width:min(900px,100%);margin:auto;border:6px solid #263e50;outline:4px solid #b0b6a1;
  background:#f8f6e8;box-shadow:12px 12px 0 #203b4680;
  color:#313b3b;font-family:"Courier New",monospace;image-rendering:pixelated;
}
.authHero{
  position:relative;display:flex;align-items:center;min-width:0;overflow:hidden;
  padding:30px 24px;border-right:6px solid #263e50;background:#335d80;color:#fff;
}
.authHero::before{
  content:"";position:absolute;inset:0;opacity:.35;pointer-events:none;
  background-image:linear-gradient(90deg,#ffffff20 1px,transparent 1px),
    linear-gradient(#ffffff20 1px,transparent 1px);
  background-size:16px 16px;
}
.authHeroInner{position:relative;z-index:1;width:100%;text-align:center}
.authEyebrow{font:900 12px/1.35 "Courier New",monospace;letter-spacing:.12em;color:#e6e4a9}
.authLogo{
  margin:18px 0 8px;color:#f6d753;font:900 clamp(29px,3.5vw,43px)/.95 "Trebuchet MS",Arial,sans-serif;
  letter-spacing:-.09em;-webkit-text-stroke:2px #315fa9;text-shadow:3px 3px 0 #163c74,5px 5px 0 #fff;
}
.authLogo span{
  display:block;width:max-content;margin:8px auto 0;padding:4px 8px;border:2px solid #f8f1bd;
  background:#be4a42;color:#fff;font:900 13px/1 "Courier New",monospace;
  letter-spacing:.16em;-webkit-text-stroke:0;text-shadow:none;box-shadow:3px 3px 0 #1a3957;
}
.authMascots{
  display:flex;align-items:end;justify-content:center;gap:0;min-height:126px;
  margin:20px -10px 12px;padding-bottom:8px;border-bottom:4px solid #dbe7d0;
}
.authMascots img{display:block;width:30%;height:auto;max-width:88px;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(3px 4px 0 #183956)}
.authMascots img:nth-child(2){width:37%;max-width:108px;margin:0 -6px}
.authCopy{
  padding:16px 14px;border:8px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 8px / 0 stretch;
  background:#ffffde;color:#414141;text-align:left;font:700 14px/1.4 "Courier New",monospace;
  box-shadow:5px 5px 0 #1c405b;
}
.authHeroFoot{margin-top:20px;color:#e6e4a9;font:900 10px/1.4 "Courier New",monospace;letter-spacing:.08em}
.authHeroFoot span{color:#f5b247}
.authPanel{
  min-width:0;padding:32px 38px 30px;
  background:#f8f6e8;
}
.authPanelIndex{display:block;color:#b14d4b;font:900 12px/1.2 "Courier New",monospace;letter-spacing:.1em}
.authPanelHead h1{margin:8px 0 4px;color:#263e50;font:900 clamp(24px,3vw,31px)/1.1 "Courier New",monospace}
.authPanelHead p{margin:0 0 18px;color:#576364;font:700 14px/1.4 "Courier New",monospace}
.authTabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:18px}
.authTabs button,#authSubmit,.authGuest{
  position:relative;min-height:48px;border-radius:0;padding:10px 14px;
  font:900 15px/1.1 "Courier New",monospace;letter-spacing:.04em;
  touch-action:manipulation;cursor:pointer;
}
.authTabs button{
  border:3px solid #596a67;background:#e4e6d5;color:#53605b;
  box-shadow:inset 0 0 0 2px #f8f8e8;
}
.authTabs button.active{
  border-color:#2e5176;background:#fffde8;color:#aa4242;
  box-shadow:inset 0 0 0 2px #a6bfd1;
}
.authTabs button.active::before{content:"▶";position:absolute;left:10px;top:50%;transform:translateY(-50%);color:#384c5b;font-size:12px}
#authForm{display:grid;grid-template-columns:1fr;gap:7px}
#authForm label{color:#344a54;font:900 13px/1.2 "Courier New",monospace;letter-spacing:.07em}
#authForm input{
  width:100%;min-width:0;min-height:48px;margin:0 0 6px;padding:10px 13px;
  border:3px solid #526a62;border-radius:0;outline:0;background:#fffef0;color:#303a3c;
  font:700 16px/1.2 "Courier New",monospace;box-shadow:inset 0 0 0 2px #d5d9c4;
  touch-action:manipulation;user-select:text;-webkit-user-select:text;
}
#authForm input::placeholder{color:#707e79;opacity:1}
#authForm input:focus{border-color:#2e5e96;box-shadow:inset 0 0 0 2px #9fc5e8,0 0 0 2px #2e5e96}
#authSubmit{
  width:100%;margin-top:6px;border:3px solid #263e5d;background:#35649e;color:#fff;
  box-shadow:inset 0 0 0 2px #9cc2dc,4px 4px 0 #b3b9a6;
}
#authSubmit::before{content:"▶";position:absolute;left:16px;top:50%;transform:translateY(-50%);font-size:12px}
#authSubmit:active,.authGuest:active{transform:translate(2px,2px);box-shadow:inset 0 0 0 2px #9cc2dc,2px 2px 0 #b3b9a6}
#authSubmit:disabled,.authGuest:disabled{opacity:.65;cursor:wait}
.authError,.authResult{margin-top:10px;font:800 14px/1.35 "Courier New",monospace}
.authError{color:#a43131}.authResult{color:#367349}
.authError:empty,.authResult:empty{display:none}
.authGuestArea{margin-top:23px;padding-top:16px;border-top:3px solid #c6cbb9}
.authDivider{text-align:center;color:#66716c;font:900 11px/1.2 "Courier New",monospace;letter-spacing:.05em}
.authGuest{
  width:100%;margin-top:12px;border:3px solid #4d6654;background:#eef4dc;color:#355c43;
  box-shadow:inset 0 0 0 2px #fff,4px 4px 0 #b3b9a6;
}
.authGuest::before{content:"▶";position:absolute;left:16px;top:50%;transform:translateY(-50%);font-size:12px}
.authGuestArea p{margin:14px 0 0;color:#5d6760;font:700 12px/1.4 "Courier New",monospace}
.authTabs button:focus-visible,#authSubmit:focus-visible,.authGuest:focus-visible{
  outline:3px solid #b74545;outline-offset:3px;
}

.battleLayer{position:absolute;inset:0;z-index:70;overflow:hidden;background:#b6d9ef;color:#222;font-family:"Trebuchet MS","Arial Rounded MT Bold",Arial,sans-serif}
.battleSky{position:absolute;inset:0 0 43% 0;background:linear-gradient(#dff5ff,#aed9f0)}
.battleGround{position:absolute;left:0;right:0;bottom:30%;height:40%;background:linear-gradient(#b9db7b,#7db957 65%,#609b43)}
.battlePlatform{position:absolute;width:34%;height:10%;border-radius:50%;background:#5f9443;box-shadow:inset 0 3px 0 #8ec167}
.enemyPlatform{right:7%;top:33%}
.playerPlatform{left:4%;top:61%;width:42%;height:12%}
.battleSprite{position:absolute;z-index:4;width:27%;height:auto;max-height:44%;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 3px 0 #0002)}
.battleEnemySprite{right:10%;top:13%}
.battlePlayerSprite{left:8%;top:39%;width:31%}
.battleSprite.battle-attack{animation:battleAttack .38s steps(4,end)}
.battleSprite.battle-hit{animation:battleHit .38s steps(4,end)}
@keyframes battleAttack{0%{transform:translate(0)}40%{transform:translate(10px,-4px)}100%{transform:translate(0)}}
@keyframes battleHit{0%,100%{filter:brightness(1)}25%,65%{filter:brightness(3);transform:translateX(3px)}45%,85%{transform:translateX(-3px)}}

.battleHealth{position:absolute;z-index:8;width:42%;padding:2.2% 3%;background:#faf8e5;border:3px solid #38464e;border-radius:8px;box-shadow:inset 0 0 0 2px #cfc8a0;font-weight:900}
.enemyHealth{left:4%;top:7%}
.playerHealth{right:4%;top:48%}
.battleMonLine{display:flex;align-items:center;justify-content:space-between;gap:4px;font-size:clamp(8px,1.55vw,14px)}
.battleStatus{background:#bc663f;color:#fff;border-radius:3px;padding:1px 3px;font-size:.72em}
.hpLine{display:flex;align-items:center;gap:4px;color:#d79e24;font-size:clamp(7px,1.2vw,11px)}
.hpTrack{height:7px;flex:1;background:#263128;border-radius:6px;padding:1px}
.hpFill{height:100%;width:100%;background:#54bd4a;border-radius:5px;transition:width .38s linear}
.hpFill.mid{background:#e7b33f}.hpFill.low{background:#d64b3f}
.battleHealth small{display:block;text-align:right;font-size:clamp(6px,1vw,10px)}

.battleCommand{position:absolute;left:0;right:0;bottom:0;height:31%;z-index:20;display:grid;grid-template-columns:43% 57%;background:#f8f6ea;border-top:4px solid #334550}
.battleText{padding:4% 5%;font-size:clamp(10px,2vw,18px);font-weight:900;line-height:1.25;white-space:pre-line}
.battleMoves{display:grid;grid-template-columns:1fr 1fr;gap:3px;padding:4px;background:#596c78}
.battleMoves.disabled{pointer-events:none;opacity:.72}
.battleMove{min-width:0;border:2px solid #38474d;border-radius:5px;background:#fff;color:#252b2f;padding:4px 5px;text-align:left;font-weight:900}
.battleMove strong{display:block;font-size:clamp(7px,1.4vw,13px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.battleMove span{display:block;font-size:clamp(5px,.9vw,9px);color:#5e6870}
.battleMove:disabled{opacity:.4}
.battleEnd{position:absolute;right:3%;bottom:10%;z-index:40;border:3px solid #304d72;border-radius:8px;background:#f5e7a3;color:#26394e;padding:8px 14px;font-weight:1000}

.battleFx{position:absolute;z-index:12;width:23%;height:28%;border-radius:50%;pointer-events:none;opacity:0}
.fx-enemy{right:12%;top:16%}.fx-player{left:11%;top:43%}
.battleFx[class*="fx-"]:not(.battleFx){opacity:1}
.fx-fire{background:radial-gradient(circle,#fff6a3 5%,#ff8a22 35%,#d72a11aa 62%,transparent 70%);animation:fxPulse .42s}
.fx-water{background:radial-gradient(circle,#ffffffcc 0 9%,#45aaf2cc 10% 28%,transparent 30%),radial-gradient(circle at 70% 70%,#2d84dccc 0 18%,transparent 20%);animation:fxSpin .42s}
.fx-electric{background:conic-gradient(from 20deg,transparent 0 10%,#fff36a 11% 20%,transparent 21% 45%,#ffe537 46% 57%,transparent 58%);animation:fxFlash .42s}
.fx-grass,.fx-bug{background:repeating-conic-gradient(#80d84c 0 8deg,transparent 9deg 22deg);animation:fxSpin .42s}
.fx-ice{background:conic-gradient(#dffcff 0 12%,transparent 13% 25%,#75dbea 26% 38%,transparent 39% 55%,#c7f7ff 56% 68%,transparent 69%);animation:fxSpin .42s}
.fx-psychic,.fx-ghost,.fx-dark{box-shadow:0 0 0 5px #b56deaaa,0 0 0 11px #6945a477,0 0 18px 14px #d7a2ff99;animation:fxPulse .42s}
.fx-poison{background:radial-gradient(circle at 35% 30%,#d88cff 0 13%,transparent 14%),radial-gradient(circle at 65% 55%,#9c48c7 0 17%,transparent 18%);animation:fxPulse .42s}
.fx-rock,.fx-ground{background:conic-gradient(#8b6b49 0 10%,transparent 11% 25%,#b18a5e 26% 38%,transparent 39% 60%,#6c4f37 61% 73%,transparent 74%);animation:fxShake .42s}
.fx-fighting,.fx-normal,.fx-flying,.fx-steel,.fx-dragon,.fx-sound,.fx-boost,.fx-heal,.fx-protect{box-shadow:0 0 0 5px #ffffffaa,0 0 18px 9px #f0d65099;animation:fxPulse .42s}
@keyframes fxPulse{0%{transform:scale(.2);opacity:0}55%{transform:scale(1.2);opacity:1}100%{transform:scale(.7);opacity:0}}
@keyframes fxSpin{0%{transform:rotate(0) scale(.4);opacity:0}60%{opacity:1}100%{transform:rotate(180deg) scale(1.2);opacity:0}}
@keyframes fxFlash{0%,100%{opacity:0}20%,60%{opacity:1;filter:brightness(2)}40%,80%{opacity:.2}}
@keyframes fxShake{0%{transform:translate(0);opacity:0}25%{transform:translate(-5px,3px);opacity:1}50%{transform:translate(5px,-2px)}75%{transform:translate(-3px,2px)}100%{opacity:0}}

#gameFrame.battle-active #mobileControls,#gameFrame.battle-active .dialog{display:none!important}

@media(hover:hover) and (pointer:fine){#mobileControls{display:none}}
@media(min-width:761px) and (max-height:700px){
  .authHero{padding-top:20px;padding-bottom:20px}
  .authLogo{margin-top:10px}
  .authMascots{min-height:105px;margin-top:10px;margin-bottom:7px}
  .authHeroFoot{margin-top:11px}
  .authPanel{padding-top:20px;padding-bottom:20px}
  .authPanelHead p{margin-bottom:11px}
  .authTabs{margin-bottom:11px}
  .authGuestArea{margin-top:14px;padding-top:11px}
  .authGuestArea p{margin-top:9px}
}
@media(max-width:760px){
  .authLayer{align-items:flex-start;padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}
  .authScreen{grid-template-columns:1fr;max-width:470px;border-width:4px;outline-width:2px;box-shadow:6px 6px 0 #203b4680}
  .authHero{padding:18px 18px 15px;border-right:0;border-bottom:5px solid #263e50}
  .authEyebrow{font-size:10px}
  .authLogo{margin:10px 0 5px;font-size:34px}
  .authLogo span{margin-top:5px;font-size:11px}
  .authMascots{min-height:0;margin:10px 0 9px;padding-bottom:5px}
  .authMascots img{max-width:60px}
  .authMascots img:nth-child(2){max-width:74px}
  .authCopy{padding:10px 12px;border-width:6px;border-image-width:6px;font-size:12px;line-height:1.3;box-shadow:3px 3px 0 #1c405b}
  .authHeroFoot{display:none}
  .authPanel{padding:20px 18px 22px}
  .authPanelHead h1{font-size:24px}
  .authPanelHead p{margin-bottom:14px}
  .authTabs{margin-bottom:14px}
  .authGuestArea{margin-top:18px}
}
@media(max-width:350px){
  .authPanel{padding-left:13px;padding-right:13px}
  .authLogo{font-size:29px}
  .authTabs button,#authSubmit,.authGuest{font-size:13px}
}
@media(orientation:portrait){
  #gameFrame{width:100vw;height:auto}
  .joystick{width:78px;height:78px}.joystick-knob{left:23px;top:23px;width:32px;height:32px}
  .interact{width:62px;height:62px}
}


/* FireRed-native battle presentation (240x160 logical layout). */
#gameFrame{container-type:inline-size}
.battleLayer{
  position:absolute;inset:0;z-index:70;overflow:hidden;
  background:#e8f7e8;color:#202020;
  font-family:"Courier New",monospace;
  font-weight:800;
  image-rendering:pixelated;
}
.battleTerrain{
  position:absolute;left:0;top:0;width:100%;height:46.6667cqw;
  object-fit:fill;image-rendering:pixelated;z-index:0;
}
.battleSprite{
  position:absolute;z-index:5;
  width:26.6667cqw;height:26.6667cqw;
  object-fit:contain;image-rendering:pixelated;
  filter:none;
}
.battleEnemySprite{right:7.5cqw;top:13.3333cqw}
.battlePlayerSprite{left:10cqw;top:25.8333cqw;width:29.1667cqw;height:29.1667cqw}
.battleHealth{
  position:absolute;z-index:9;
  padding:1.1cqw 1.55cqw .8cqw;
  background:#f8f5cf;
  border:.8333cqw solid #354a44;
  border-radius:1.25cqw;
  box-shadow:
    inset 0 0 0 .4167cqw #ffffff,
    inset 0 0 0 .8333cqw #b9b890,
    .8333cqw .8333cqw 0 #596a5e;
  color:#232323;
}
.enemyHealth{left:5cqw;top:5cqw;width:39.1667cqw;height:12.9167cqw}
.playerHealth{right:4.1667cqw;top:30.4167cqw;width:39.5833cqw;height:15cqw}
.battleMonLine{
  display:flex;align-items:center;justify-content:space-between;gap:.8333cqw;
  font-size:3.15cqw;line-height:1;white-space:nowrap;
}
.battleStatus{
  padding:.2083cqw .625cqw;border-radius:.4167cqw;
  background:#b85a36;color:#fff;font-size:2.2cqw;line-height:1.15
}
.hpLine{
  display:flex;align-items:center;gap:.625cqw;
  margin-top:.8333cqw;color:#d09b15;
  font-size:2.5cqw;line-height:1
}
.hpTrack{
  flex:1;height:2.5cqw;padding:.4167cqw;
  border-radius:2.0833cqw;background:#24362b
}
.hpFill{
  height:100%;width:100%;border-radius:1.25cqw;
  background:#55c64d;transition:width .35s steps(8,end)
}
.hpFill.mid{background:#e7b23f}.hpFill.low{background:#df493b}
.battleHealth small{
  display:block;text-align:right;margin-top:.4cqw;
  font-size:2.55cqw;line-height:1;color:#343434
}

.battleCommand{
  position:absolute;left:0;right:0;bottom:0;height:20cqw;z-index:25;
  background:#f7f7ef;
}
.battleMessageFrame{
  position:absolute;left:0;top:0;width:50cqw;height:20cqw;
  padding:3.3333cqw 3.75cqw;
  background:#f7f7ef;
  border:1.6667cqw solid #5b718b;
  box-shadow:inset 0 0 0 .8333cqw #f7f7ef,inset 0 0 0 1.25cqw #293e55;
}
.battleMessageFrame.message-wide{width:100cqw}
.battleText{
  padding:0;margin:0;
  font-size:3.3333cqw;line-height:1.28;
  font-weight:800;white-space:pre-line;color:#222
}
.battleActionMenu{
  position:absolute;left:50cqw;top:0;width:50cqw;height:20cqw;
  display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;
  padding:2.2cqw 2.5cqw;
  background:#fff;
  border:1.6667cqw solid #5b718b;
  box-shadow:inset 0 0 0 .8333cqw #f7f7ef,inset 0 0 0 1.25cqw #293e55;
}
.battleActionMenu button{
  position:relative;border:0;background:transparent;color:#202020;
  padding:0 0 0 3.5cqw;text-align:left;
  font-family:inherit;font-weight:900;font-size:3.3333cqw;line-height:1;
}
.battleActionMenu button:hover::before,
.battleActionMenu button:focus::before,
.battleActionMenu button:active::before{
  content:"▶";position:absolute;left:.4cqw;top:0
}

.battleMoveMenu{
  position:absolute;left:0;top:0;width:100cqw;height:20cqw;
  display:grid;grid-template-columns:66.6667cqw 33.3333cqw;
  background:#fff;
  border:1.6667cqw solid #5b718b;
  box-shadow:inset 0 0 0 .8333cqw #f7f7ef,inset 0 0 0 1.25cqw #293e55;
}
.battleMoves{
  display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;
  gap:0;padding:1.8cqw 1.6cqw 1.5cqw 2.2cqw;background:#fff
}
.battleMove{
  position:relative;min-width:0;border:0;background:transparent;color:#202020;
  padding:0 1cqw 0 3.3cqw;text-align:left;
  font-family:inherit;font-weight:900;font-size:2.9cqw;line-height:1.05;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis
}
.battleMove span{display:none}
.battleMove:hover::before,.battleMove:focus::before,.battleMove:active::before{
  content:"▶";position:absolute;left:.3cqw;top:0
}
.battleMove:disabled{opacity:.38}
.battleMoveInfo{
  display:flex;flex-direction:column;justify-content:center;gap:1.3cqw;
  padding:1.8cqw 2cqw;
  border-left:.8333cqw solid #293e55;
  color:#202020;background:#fff;
  font-size:2.65cqw;line-height:1.1
}
.battleMoveInfo>div{white-space:nowrap}
#battleMoveBack{
  border:0;background:transparent;color:#555;padding:0;text-align:right;
  font-family:inherit;font-size:2.2cqw;font-weight:900
}
.battleEnd{display:none!important}

.battleFx{z-index:15}
#gameFrame.battle-active #mobileControls,
#gameFrame.battle-active .dialog{display:none!important}

/* Keep the yes/no encounter prompt in the same FireRed window language. */
.battlePrompt{
  z-index:72;left:0;right:0;bottom:0;min-height:20cqw;height:20cqw;
  padding:3.2cqw 4cqw;
  border:1.6667cqw solid #5b718b;
  box-shadow:inset 0 0 0 .8333cqw #f7f7ef,inset 0 0 0 1.25cqw #293e55;
  font-family:"Courier New",monospace;font-size:3.3333cqw;
  border-image:none;background:#f7f7ef;border-radius:0
}
.battleChoiceButtons{margin-left:auto;display:grid;grid-template-columns:1fr;gap:.8333cqw;min-width:23cqw}
.battleChoiceButtons button{
  background:#fff;color:#222;border:.8333cqw solid #354a44;border-radius:.4167cqw;
  padding:1cqw 2cqw;font-family:inherit;font-size:2.9cqw;font-weight:900
}

/* FireRed-scale overworld dialogue. */
.dialog{
  left:1.6667cqw;right:1.6667cqw;bottom:.8333cqw;
  height:19.1667cqw;min-height:19.1667cqw;
  padding:3.15cqw 4.2cqw 2.2cqw;
  border-width:1.6667cqw;
  font-family:"Courier New",monospace;
  font-size:3.3333cqw;
  font-weight:800;line-height:1.28;
}
.dialogHint{right:4cqw;bottom:2.4cqw;font-size:2.5cqw}
#gameFrame.dialog-open #mobileControls{z-index:50}
#gameFrame.dialog-open .interact{
  right:2.5cqw;bottom:21.5cqw;
  width:12.5cqw;height:12.5cqw;
  font-size:5cqw;z-index:55
}


/* Native FireRed UI assets and bitmap font. */
.frTextLine{display:flex;align-items:flex-start;height:6.6667cqw;white-space:nowrap}
.frBreak{display:block;width:100%;height:0}
.frGlyph{
  display:inline-block;
  flex:0 0 auto;
  width:calc(var(--fr-width) * .416667cqw);
  height:6.6667cqw;
  background-image:url("./native/fr_font.png");
  background-repeat:no-repeat;
  background-size:106.6667cqw 213.3333cqw;
  background-position:
    calc(var(--fr-col) * -6.6667cqw)
    calc(var(--fr-row) * -6.6667cqw);
  image-rendering:pixelated;
}
.battleText,.battleMonLine strong,.battleLevelValue,.battleStatus,.battleHealth small,
.battleActionMenu button,.battleMove,.battleMoveInfo,#battleChoiceTitle,.battleChoiceButtons button,
#dialogText{
  font-size:0!important;
  letter-spacing:0!important;
  line-height:0!important;
}
.battleText,.battleActionMenu button,.battleMove,#battleChoiceTitle,.battleChoiceButtons button,#dialogText{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
}

/* Field dialogue: use the real FireRed blue/white window skin. */
.dialog{
  left:1.6667cqw!important;
  right:1.6667cqw!important;
  bottom:.8333cqw!important;
  height:20cqw!important;
  min-height:20cqw!important;
  padding:3.3333cqw 4.1667cqw 2.5cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type5.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  box-shadow:none!important;
  border-radius:0!important;
  image-rendering:pixelated;
}
.dialogHint{right:4.1667cqw!important;bottom:2.0833cqw!important;font-size:2.5cqw!important}

/* Battle background is rendered from FireRed's own grass terrain tiles/tilemap. */
.battleLayer{background:#fff!important}
.battleTerrain{
  position:absolute!important;
  left:0!important;top:0!important;
  width:100%!important;
  height:46.6667cqw!important;
  object-fit:fill!important;
  image-rendering:pixelated!important;
  z-index:0!important;
}

/* FireRed single-battle coordinates from InitBattlerHealthboxCoords. */
.battleHealth{
  position:absolute!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  background-color:transparent!important;
  background-repeat:no-repeat!important;
  background-position:left top!important;
  background-size:100% 100%!important;
  overflow:visible!important;
  color:#222!important;
}
.enemyHealth{
  left:5cqw!important;          /* x = 12 */
  top:5.8333cqw!important;      /* y = 14 */
  width:53.3333cqw!important;   /* 128 px */
  height:13.3333cqw!important;  /* 32 px */
  background-image:url("./native/fr_healthbox_enemy_final.png")!important;
}
.playerHealth{
  left:52.5cqw!important;       /* x = 126 */
  top:23.3333cqw!important;     /* y = 56 */
  width:53.3333cqw!important;   /* 128 px */
  height:26.6667cqw!important;  /* 64 px */
  background-image:url("./native/fr_healthbox_player_final.png")!important;
}
.battleMonLine{
  position:absolute!important;
  left:3.3333cqw!important;
  top:1.25cqw!important;
  width:43.3333cqw!important;
  height:6.6667cqw!important;
  display:block!important;
}
.playerHealth .battleMonLine{left:3.3333cqw!important;top:1.25cqw!important}
.battleMonLine strong{position:absolute;left:0;top:0;display:block}
.battleLevelValue{
  position:absolute;
  right:1.6667cqw;
  top:0;
  display:block;
}
.battleStatus{
  position:absolute!important;
  left:0!important;
  top:6.25cqw!important;
  display:block!important;
  background:transparent!important;
  padding:0!important;
}
.battleStatus[hidden]{display:none!important}
.hpLine{
  position:absolute!important;
  left:7.0833cqw!important;
  top:7.9167cqw!important;
  width:35cqw!important;
  height:3.3333cqw!important;
  display:flex!important;
  align-items:center!important;
  gap:1.25cqw!important;
  margin:0!important;
}
.playerHealth .hpLine{
  left:7.0833cqw!important;
  top:7.9167cqw!important;
}
.hpLine>span{width:5cqw;overflow:visible}
.hpTrack{
  height:2.5cqw!important;
  flex:1!important;
  padding:.4167cqw!important;
  background:#27332b!important;
  border-radius:1.25cqw!important;
}
.hpFill{height:100%!important;border-radius:.8333cqw!important}
.enemyHealth small{display:none!important}
.playerHealth small{
  position:absolute!important;
  right:3.3333cqw!important;
  top:12.5cqw!important;
  display:block!important;
  width:28cqw!important;
  height:6.6667cqw!important;
  text-align:right!important;
}

/* Native 240x160 sprite sizes. Position comes from firered-canvas.js using
   each species' real FireRed front/back coordinate data. Do not override it
   here with !important fixed top/left values. */
.battleEnemySprite{
  right:auto!important;
  width:26.6667cqw!important;
  height:26.6667cqw!important;
}
.battlePlayerSprite{
  width:32cqw!important;
  height:32cqw!important;
}

/* Bottom command area: 240x48 logical pixels, like the original. */
.battleCommand{
  left:0!important;right:0!important;bottom:0!important;
  height:20cqw!important;
  background:transparent!important;
  border:0!important;
}
.battleMessageFrame{
  left:0!important;top:0!important;
  width:50cqw!important;height:20cqw!important;
  padding:3.3333cqw 4.1667cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type1.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  box-shadow:none!important;
}
.battleMessageFrame.message-wide{width:100cqw!important}
.battleActionMenu{
  left:50cqw!important;top:0!important;
  width:50cqw!important;height:20cqw!important;
  padding:3.3333cqw 3.3333cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type1.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  box-shadow:none!important;
  grid-template-columns:1fr 1fr!important;
  grid-template-rows:1fr 1fr!important;
}
.battleActionMenu button{
  min-width:0!important;
  padding:0 0 0 3.3333cqw!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  border:0!important;
  background:transparent!important;
}
.battleMoveMenu{
  left:0!important;top:0!important;
  width:100cqw!important;height:20cqw!important;
  grid-template-columns:67cqw 33cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type1.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  box-shadow:none!important;
}
.battleMoves{
  padding:2.5cqw 1.6667cqw 2.0833cqw 3.3333cqw!important;
  background:transparent!important;
}
.battleMove{
  padding:0 0 0 3.3333cqw!important;
  border:0!important;
  background:transparent!important;
  align-items:flex-start!important;
}
.battleMoveInfo{
  padding:2.0833cqw 2.0833cqw!important;
  border-left:1.25cqw solid #384b61!important;
  background:#fff!important;
  font-size:0!important;
}
.battleMoveInfo>div{
  display:flex;
  align-items:flex-start;
  gap:1.25cqw;
  min-height:6.6667cqw;
  font-size:2.5cqw;
}
.battleMoveInfo>div::first-letter{font-size:0}
#battleMoveBack{font-size:0!important;min-height:6.6667cqw}
.battlePrompt{
  left:0!important;right:0!important;bottom:0!important;
  height:20cqw!important;min-height:20cqw!important;
  padding:3.3333cqw 4.1667cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type1.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  box-shadow:none!important;
  border-radius:0!important;
}
.battleChoiceButtons{min-width:26cqw!important;gap:1.25cqw!important}
.battleChoiceButtons button{
  border:1.25cqw solid #384b61!important;
  background:#fff!important;
  padding:1.25cqw 2.5cqw!important;
  min-height:6.6667cqw!important;
  align-items:center!important;
  justify-content:center!important;
}


/* Battle window tilemaps reconstructed directly from FireRed's battle_interface/textbox assets. */
.battleCommand{
  background-repeat:no-repeat!important;
  background-position:0 0!important;
  background-size:100cqw 20cqw!important;
  image-rendering:pixelated!important;
}
.battleCommand[data-mode="message"]{background-image:url("./native/fr_battle_message_bg.png")!important}
.battleCommand[data-mode="action"]{background-image:url("./native/fr_battle_action_bg.png")!important}
.battleCommand[data-mode="moves"]{background-image:url("./native/fr_battle_move_bg.png")!important}

.battleMessageFrame,
.battleActionMenu,
.battleMoveMenu{
  border:0!important;
  border-image:none!important;
  background:transparent!important;
  box-shadow:none!important;
}
.battleMessageFrame{
  padding:3.3333cqw 4.1667cqw!important;
}
.battleActionMenu{
  left:50cqw!important;
  padding:3.3333cqw 3.3333cqw!important;
}
.battleMoveMenu{
  grid-template-columns:66.6667cqw 33.3333cqw!important;
}
.battleMoveInfo{
  background:transparent!important;
  border-left:0!important;
}
.battleText .frGlyph,
#battleChoiceTitle .frGlyph{
  background-image:url("./native/fr_font_light.png")!important;
}

/* The yes/no encounter box uses the same real FireRed action-window tilemap. */
.battlePrompt{
  left:0!important;right:auto!important;bottom:0!important;
  width:100cqw!important;height:20cqw!important;min-height:20cqw!important;
  padding:3.3333cqw 4.1667cqw!important;
  border:0!important;border-image:none!important;box-shadow:none!important;
  background-image:url("./native/fr_battle_action_bg.png")!important;
  background-repeat:no-repeat!important;
  background-size:100cqw 20cqw!important;
  background-position:0 0!important;
  image-rendering:pixelated!important;
}
.battleChoiceButtons{
  position:absolute!important;
  left:52.5cqw!important;
  top:2.5cqw!important;
  width:45cqw!important;
  height:15cqw!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:1fr 1fr!important;
  gap:0!important;
  margin:0!important;
}
.battleChoiceButtons button{
  border:0!important;background:transparent!important;
  padding:0 0 0 6cqw!important;
  min-height:0!important;
  align-items:flex-start!important;justify-content:center!important;
}


/* Online overworld, team menu, and control help. */
.teamButton{
  position:absolute;
  right:calc(var(--ui-safe-right) + 78px);
  bottom:calc(var(--ui-safe-bottom) + 14px);
  width:58px;height:58px;border-radius:50%;
  border:2px solid rgba(255,255,255,.55);
  background:rgba(226,174,47,.78);
  color:#fff;font:900 11px/1 system-ui,sans-serif;
  box-shadow:0 3px 10px rgba(0,0,0,.32),inset 0 0 0 6px rgba(255,255,255,.08);
  pointer-events:auto;touch-action:none;
}
.teamButton:active{transform:scale(.94);background:rgba(226,174,47,.95)}
#gameFrame.dialog-open .teamButton,
#gameFrame.battle-prompt-open .teamButton,
#gameFrame.battle-active .teamButton,
#gameFrame.team-open .teamButton{display:none}

.pcControlsHint{
  position:absolute;right:4px;top:4px;z-index:28;
  max-width:72%;padding:4px 6px;border-radius:5px;
  background:rgba(18,31,45,.78);color:#fff;
  font:700 8px/1.25 system-ui,sans-serif;
  text-align:right;pointer-events:none
}
#gameFrame.dialog-open .pcControlsHint,
#gameFrame.battle-active .pcControlsHint,
#gameFrame.battle-prompt-open .pcControlsHint,
#gameFrame.team-open .pcControlsHint{display:none}
@media (hover:none),(pointer:coarse){.pcControlsHint{display:none}}

.onlineToast{
  position:absolute;z-index:90;left:50%;top:5%;
  transform:translateX(-50%);
  max-width:86%;padding:6px 9px;border-radius:6px;
  background:rgba(20,32,48,.93);color:#fff;
  font:800 10px/1.25 system-ui,sans-serif;
  box-shadow:0 2px 10px rgba(0,0,0,.45);
  pointer-events:none;text-align:center
}

.onlinePrompt{
  position:absolute;left:0;right:0;bottom:0;z-index:88;
  width:100%;height:20cqw;
  background-image:url("./native/fr_battle_action_bg.png");
  background-repeat:no-repeat;background-size:100cqw 20cqw;
  background-position:0 0;image-rendering:pixelated;
  pointer-events:auto
}
.onlinePromptText{
  position:absolute;left:4.1667cqw;top:3.3333cqw;
  width:47cqw;height:13cqw;overflow:hidden;
}
.onlinePromptButtons{
  position:absolute;left:52.5cqw;top:2.5cqw;
  width:45cqw;height:15cqw;
  display:grid;grid-template-rows:1fr 1fr
}
.onlinePromptButtons button{
  border:0;background:transparent;padding:0 0 0 6cqw;
  display:flex;align-items:flex-start;justify-content:center;
  image-rendering:pixelated
}
.onlinePromptText .frGlyph,
.onlinePromptButtons .frGlyph{
  background-image:url("./native/fr_font_light.png")!important
}

.teamLayer{
  position:absolute;inset:0;z-index:82;
  background:#1f756e;
  image-rendering:pixelated;
  pointer-events:auto
}
.teamBackdrop{
  position:absolute;inset:0;
  background:
    repeating-linear-gradient(0deg,rgba(255,255,255,.035) 0 2px,rgba(0,0,0,.03) 2px 4px),
    linear-gradient(90deg,#267b72 0 37%,#2f8b81 37% 100%)
}
.teamSlots{
  position:absolute;left:1.5cqw;right:1.5cqw;top:2cqw;bottom:20cqw;
  display:grid;grid-template-columns:36% 64%;grid-template-rows:repeat(5,1fr);
  gap:.8cqw
}
.teamSlot{
  position:relative;min-width:0;overflow:hidden;
  border:1.25cqw solid #21554f;border-radius:1.5cqw;
  background:linear-gradient(#45a6dc,#2581c2 55%,#2471ad);
  box-shadow:inset 0 0 0 .6cqw rgba(255,255,255,.18);
  color:#fff
}
.teamSlot:nth-child(1){grid-column:1;grid-row:1/6;border-color:#ff7a28;background:linear-gradient(#71d4ec,#59c7df)}
.teamSlot:nth-child(n+2){grid-column:2}
.teamSlot:nth-child(2){grid-row:1}.teamSlot:nth-child(3){grid-row:2}.teamSlot:nth-child(4){grid-row:3}.teamSlot:nth-child(5){grid-row:4}.teamSlot:nth-child(6){grid-row:5}
.teamSlot.empty{opacity:.58}
.teamSlot img{
  position:absolute;left:1cqw;top:50%;transform:translateY(-50%);
  width:12cqw;height:12cqw;object-fit:contain;image-rendering:pixelated
}
.teamSlot:nth-child(1) img{left:4cqw;top:30%;width:20cqw;height:20cqw}
.teamBall{
  position:absolute;left:.6cqw;top:.6cqw;width:6cqw;height:6cqw;border-radius:50%;
  background:linear-gradient(#e84b35 0 45%,#333 46% 55%,#f7f7f7 56%);
  border:.5cqw solid #344
}
.teamSlotText{
  position:absolute;left:14cqw;right:1cqw;top:50%;transform:translateY(-50%);
  display:grid;grid-template-columns:1fr auto;align-items:center;gap:.4cqw
}
.teamSlot:nth-child(1) .teamSlotText{left:2cqw;right:2cqw;top:auto;bottom:2cqw;transform:none}
.teamSlotText strong{font:900 3.1cqw/1 "Courier New",monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.teamSlotText span{font:900 2.7cqw/1 "Courier New",monospace}
.teamHpLabel{font:900 2.5cqw/1 "Courier New",monospace;color:#ffe25a}
.teamHpBar{height:2.2cqw;background:#26362d;border-radius:1cqw;padding:.35cqw}
.teamHpBar i{display:block;width:100%;height:100%;background:#51c75a;border-radius:.8cqw}
.teamSlotText small{grid-column:1/3;text-align:right;font:800 2.1cqw/1 "Courier New",monospace}
.teamFooter{
  position:absolute;left:1.5cqw;right:1.5cqw;bottom:1.5cqw;height:16.5cqw;
  display:flex;align-items:center;justify-content:space-between;
  padding:2cqw 2.5cqw 2cqw 3cqw;
  background:#fff;border:1.25cqw solid #3d5365;border-radius:1cqw;
  font:900 3.4cqw/1 "Courier New",monospace;color:#333
}
.teamFooter button{
  min-width:22cqw;height:10cqw;border:1cqw solid #513b83;border-radius:2cqw;
  background:#7b4dad;color:#fff;font:900 2.7cqw/1 "Courier New",monospace
}
#gameFrame.team-open #mobileControls,
#gameFrame.team-open #profileChip{display:none!important}


/* ===== FireRed UI correction pass: fixed logical 240x160 layout ===== */

/* The healthbox PNGs are OBJ sprites: palette color 0 must be transparent. */
.enemyHealth{
  background-image:url("./native/fr_health_enemy_clean.png")!important;
}
.playerHealth{
  background-image:url("./native/fr_health_player_clean.png")!important;
}

/* Native battle sprite boxes are 64x64. Species-specific left/top
   coordinates are written by firered-canvas.js; never pin them here. */
.battleEnemySprite{
  right:auto!important;
  width:26.6667cqw!important;
  height:26.6667cqw!important;
  max-height:none!important;
}
.battlePlayerSprite{
  width:26.6667cqw!important;
  height:26.6667cqw!important;
  max-height:none!important;
}

/* Keep healthbox lettering inside the actual sprite art. */
.battleMonLine{
  left:4.1667cqw!important;    /* 10 px */
  top:1.25cqw!important;       /* 3 px */
  width:45cqw!important;
  height:6.6667cqw!important;
}
.battleMonLine strong{max-width:31cqw!important;overflow:hidden!important}
.battleLevelValue{
  right:1.6667cqw!important;
  top:0!important;
  white-space:nowrap!important;
}
.playerHealth small{
  right:4.1667cqw!important;
  top:13.3333cqw!important;
  width:25cqw!important;
  height:6.6667cqw!important;
  overflow:hidden!important;
}
#dialogText,.battleText,#battleChoiceTitle,.onlinePromptText{
  overflow:hidden!important;
}

/* Real FireRed-style red continue marker. */
.dialogHint{
  width:0!important;height:0!important;
  right:5cqw!important;bottom:2.5cqw!important;
  border-left:1.25cqw solid transparent!important;
  border-right:1.25cqw solid transparent!important;
  border-top:1.6667cqw solid #d93434!important;
  font-size:0!important;
  animation:dialogPrompt .7s steps(2,end) infinite!important;
}

/* Slowpoke encounter is a FIELD choice, not a battle command window. */
.battlePrompt{
  left:3.3333cqw!important;
  right:auto!important;
  bottom:.8333cqw!important;
  width:93.3333cqw!important;   /* 224 logical px */
  height:20cqw!important;       /* 48 logical px */
  min-height:20cqw!important;
  padding:3.3333cqw 4.1667cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type5.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  background-image:none!important;
  box-shadow:none!important;
}
.battlePrompt:not([hidden]){display:block!important}
#battleChoiceTitle{
  position:absolute!important;
  left:4.1667cqw!important;
  top:3.3333cqw!important;
  width:58cqw!important;
  height:13.3333cqw!important;
}
.battleChoiceButtons{
  position:absolute!important;
  left:64.5cqw!important;
  top:1.25cqw!important;
  width:25cqw!important;
  height:17.5cqw!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:1fr 1fr!important;
  gap:0!important;
  margin:0!important;
  padding:2.0833cqw 1.6667cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type1.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
  box-shadow:none!important;
}
.battleChoiceButtons button{
  position:relative!important;
  border:0!important;
  background:transparent!important;
  padding:0 0 0 5cqw!important;
  min-height:0!important;
  display:flex!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
}

/* Visible selector cursor: always starts on FIGHT / YES and follows keyboard focus. */
.battleActionMenu button,
.battleMove,
.battleChoiceButtons button{
  position:relative!important;
}
.battleActionMenu button::before,
.battleMove::before,
.battleChoiceButtons button::before{
  content:""!important;
  position:absolute!important;
  left:.8333cqw!important;
  top:2.0833cqw!important;
  width:0!important;height:0!important;
  border-top:1.25cqw solid transparent!important;
  border-bottom:1.25cqw solid transparent!important;
  border-left:1.6667cqw solid #222!important;
  opacity:0!important;
}
.battleActionMenu button.battleSelected::before,
.battleMove.battleSelected::before,
.battleChoiceButtons button.battleSelected::before{
  opacity:1!important;
}
.battleActionMenu button:hover::before,
.battleActionMenu button:focus::before,
.battleActionMenu button:active::before,
.battleMove:hover::before,
.battleMove:focus::before,
.battleMove:active::before{
  /* Don't rely on focus pseudo-state; battleSelected is the source of truth. */
}

/* Match the original command spacing more closely. */
.battleActionMenu{
  padding:2.9167cqw 2.5cqw 2.0833cqw 3.3333cqw!important;
}
.battleActionMenu button{
  padding-left:4.1667cqw!important;
}
.battleMoves{
  padding:2.5cqw 1.25cqw 2.0833cqw 3.3333cqw!important;
}
.battleMove{
  padding-left:4.1667cqw!important;
}

/* Online requests use the same field dialogue language, not battle chrome. */
.onlinePrompt{
  left:3.3333cqw!important;
  right:auto!important;
  bottom:.8333cqw!important;
  width:93.3333cqw!important;
  height:20cqw!important;
  background-image:none!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type5.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
}
.onlinePromptText{
  left:4.1667cqw!important;
  top:3.3333cqw!important;
  width:57cqw!important;
  height:13.3333cqw!important;
}
.onlinePromptButtons{
  left:64.5cqw!important;
  top:1.25cqw!important;
  width:25cqw!important;
  height:17.5cqw!important;
  padding:2.0833cqw 1.6667cqw!important;
  border:3.3333cqw solid transparent!important;
  border-image-source:url("./native/fr_textbox_type1.png")!important;
  border-image-slice:8 fill!important;
  border-image-width:1!important;
  border-image-repeat:stretch!important;
  background:transparent!important;
}
.onlinePromptButtons button{
  position:relative!important;
  justify-content:flex-start!important;
  padding-left:5cqw!important;
}

.onlinePromptButtons button::before{
  content:""!important;
  position:absolute!important;
  left:.8333cqw!important;
  top:2.0833cqw!important;
  width:0!important;height:0!important;
  border-top:1.25cqw solid transparent!important;
  border-bottom:1.25cqw solid transparent!important;
  border-left:1.6667cqw solid #222!important;
  opacity:0!important;
}
.onlinePromptButtons button.battleSelected::before{opacity:1!important}


/* ===== FireRed fidelity pass 2: exact field windows, readable battle HUD, explicit cursors ===== */

/* Variable-width FireRed font. --fr-spacing is in logical GBA pixels. */
.frGlyph{
  width:calc((var(--fr-width) + var(--fr-spacing,1)) * .416667cqw)!important;
  height:6.6667cqw!important;
}
.frTextLine{
  height:6.6667cqw!important;
  min-height:6.6667cqw!important;
}

/* The field message frame is preassembled from FireRed's own standard window tiles. */
.dialog{
  left:0!important;
  right:auto!important;
  bottom:0!important;
  width:100cqw!important;
  height:20cqw!important;
  min-height:20cqw!important;
  padding:3.3333cqw 5cqw 2.5cqw!important;
  border:0!important;
  border-image:none!important;
  background-image:url("./native/fr_field_message_bg.png")!important;
  background-repeat:no-repeat!important;
  background-position:0 0!important;
  background-size:100cqw 20cqw!important;
  box-shadow:none!important;
  border-radius:0!important;
  overflow:hidden!important;
  image-rendering:pixelated!important;
}
#dialogText{
  position:relative!important;
  width:86.6667cqw!important; /* 208 logical px */
  height:13.3333cqw!important;
  overflow:hidden!important;
}
.dialogHint{
  right:6.25cqw!important;
  bottom:2.5cqw!important;
  z-index:2!important;
}

/* Slowpoke / online duel questions are FIELD yes-no boxes, not battle boxes. */
.battlePrompt,
.onlinePrompt{
  left:0!important;
  right:auto!important;
  bottom:0!important;
  width:100cqw!important;
  height:20cqw!important;
  min-height:20cqw!important;
  padding:0!important;
  border:0!important;
  border-image:none!important;
  background-image:url("./native/fr_field_message_bg.png")!important;
  background-repeat:no-repeat!important;
  background-position:0 0!important;
  background-size:100cqw 20cqw!important;
  box-shadow:none!important;
  border-radius:0!important;
  overflow:visible!important;
  image-rendering:pixelated!important;
}
#battleChoiceTitle,
.onlinePromptText{
  position:absolute!important;
  left:5cqw!important;             /* 12 logical px */
  top:3.3333cqw!important;        /* 8 logical px */
  width:61.6667cqw!important;     /* 148 logical px */
  height:13.3333cqw!important;
  overflow:hidden!important;
}
.battleChoiceButtons,
.onlinePromptButtons{
  position:absolute!important;
  left:71.6667cqw!important;      /* 172 logical px */
  top:0!important;
  width:26.6667cqw!important;     /* 64 logical px */
  height:20cqw!important;         /* 48 logical px */
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:1fr 1fr!important;
  gap:0!important;
  margin:0!important;
  padding:2.5cqw 2.0833cqw!important;
  border:0!important;
  background-image:url("./native/fr_yesno_bg.png")!important;
  background-repeat:no-repeat!important;
  background-size:26.6667cqw 20cqw!important;
  background-position:0 0!important;
  box-shadow:none!important;
  image-rendering:pixelated!important;
}
.battleChoiceButtons button,
.onlinePromptButtons button{
  position:relative!important;
  display:flex!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  min-height:0!important;
  padding:0 0 0 5cqw!important;
  border:0!important;
  background:transparent!important;
  overflow:visible!important;
}

/* Actual visible menu cursor. This does not depend on browser focus styling. */
.frMenuCursor{
  position:absolute!important;
  left:1.25cqw!important;
  top:1.25cqw!important;
  width:0!important;
  height:0!important;
  border-top:1.25cqw solid transparent!important;
  border-bottom:1.25cqw solid transparent!important;
  border-left:1.6667cqw solid #202020!important;
  pointer-events:none!important;
  z-index:8!important;
}
.battleActionMenu button::before,
.battleMove::before,
.battleChoiceButtons button::before,
.onlinePromptButtons button::before{
  display:none!important;
}

/* Battle healthbox dimensions/positions come from InitBattlerHealthboxCoords:
   opponent x=44,y=30 -> combined left=12; player x=158,y=88 -> left=126. */
.enemyHealth{
  left:5cqw!important;            /* 12 px */
  top:5.8333cqw!important;        /* 14 px */
  width:53.3333cqw!important;     /* 128 px */
  height:13.3333cqw!important;    /* 32 px */
  background-image:url("./native/fr_health_enemy_clean.png")!important;
}
.playerHealth{
  left:52.5cqw!important;         /* 126 px */
  top:23.3333cqw!important;       /* 56 px */
  width:53.3333cqw!important;     /* 128 px */
  height:26.6667cqw!important;    /* 64 px */
  background-image:url("./native/fr_health_player_clean.png")!important;
}

/* Healthbox text is the same FireRed bitmap font scaled to its healthbox size. */
.battleHealth .frGlyph{
  width:calc((var(--fr-width) + var(--fr-spacing,0)) * .2083335cqw)!important;
  height:3.3333cqw!important;     /* 8 logical px */
  background-size:53.3333cqw 106.6667cqw!important;
  background-position:
    calc(var(--fr-col) * -3.3333cqw)
    calc(var(--fr-row) * -3.3333cqw)!important;
}
.battleHealth .frTextLine{
  height:3.3333cqw!important;
  min-height:3.3333cqw!important;
}
.battleMonLine{
  left:3.3333cqw!important;       /* 8 px inside healthbox */
  top:1.6667cqw!important;        /* 4 px */
  width:44cqw!important;
  height:4.1667cqw!important;
  overflow:visible!important;
}
.battleMonLine strong{
  left:0!important;
  top:0!important;
  max-width:28cqw!important;
  overflow:hidden!important;
}
.battleLevelValue{
  right:5cqw!important;           /* keep inside visible portion */
  top:0!important;
}
.battleStatus{
  left:0!important;
  top:4.1667cqw!important;
}
.hpLine{
  left:13.3333cqw!important;      /* 32 px */
  top:7.0833cqw!important;        /* 17 px */
  width:35.8333cqw!important;     /* 86 px */
  height:3.3333cqw!important;
  gap:.8333cqw!important;
}
.hpLine>span{
  width:4.5833cqw!important;      /* 11 px */
  height:3.3333cqw!important;
}
.hpTrack{
  height:2.5cqw!important;        /* 6 px */
  padding:.4167cqw!important;
  border-radius:0!important;
}
.hpFill{border-radius:0!important}
.playerHealth small{
  right:6.6667cqw!important;      /* 16 px */
  top:14.5833cqw!important;       /* 35 px */
  width:24cqw!important;
  height:3.3333cqw!important;
  overflow:visible!important;
}

/* Battle command text and menus: keep exactly inside the 240x48 bottom region. */
.battleCommand{
  height:20cqw!important;
  overflow:hidden!important;
}
.battleMessageFrame{
  padding:3.3333cqw 4.1667cqw!important;
}
.battleText{
  width:41.6667cqw!important;     /* 100 logical px in split action view */
  height:13.3333cqw!important;
  overflow:hidden!important;
}
.battleMessageFrame.message-wide .battleText{
  width:90cqw!important;          /* 216 logical px */
}
.battleActionMenu{
  padding:2.5cqw 2.0833cqw 2.0833cqw 2.9167cqw!important;
  overflow:visible!important;
}
.battleActionMenu button{
  position:relative!important;
  padding-left:4.1667cqw!important;
  overflow:visible!important;
}
.battleMoves{
  overflow:visible!important;
}
.battleMove{
  position:relative!important;
  padding-left:4.1667cqw!important;
  overflow:visible!important;
}

/* Keep the local A button usable for advancing field dialogue. */
#gameFrame.dialog-open .interact{
  display:block!important;
  opacity:.95!important;
  pointer-events:auto!important;
}

/* Encounter and online prompts hide movement, but selection remains tappable with a visible cursor. */
#gameFrame.battle-prompt-open .joystick,
#gameFrame.battle-prompt-open .teamButton{
  opacity:0!important;
  pointer-events:none!important;
}


/* Final field/battle text-fit correction: FireRed uses zero extra letter spacing
   in these windows. */
.frGlyph{
  width:calc(var(--fr-width) * .416667cqw)!important;
}


/* Raw FireRed battle-animation PNGs use palette index 0 instead of PNG alpha.
   battle.js removes that color onto a canvas before showing each frame. */
.frNativeFxSprite{background:none!important;image-rendering:pixelated!important;image-rendering:crisp-edges!important}


/* -------------------------------------------------------------------------- */
/* Global multiplayer chat                                                     */
/* -------------------------------------------------------------------------- */
.globalChat{
  position:absolute;left:214px;top:46px;bottom:auto;z-index:142;pointer-events:none;
  font-family:"Courier New",monospace;image-rendering:pixelated;
}
.chatToggle{
  position:relative;min-width:44px;height:25px;padding:2px 7px;
  border:6px solid transparent;border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;
  background:#ffffde;color:#414141;font:900 9px/1 "Courier New",monospace;
  pointer-events:auto;touch-action:manipulation;
}
.chatBadge{
  position:absolute;right:-8px;top:-9px;min-width:17px;height:17px;padding:0 4px;
  display:grid;place-items:center;border:2px solid #fff;border-radius:999px;
  background:#d63838;color:#fff;font:900 9px/1 system-ui,sans-serif;
}
.chatPanel{
  position:absolute;left:auto;right:0;top:31px;bottom:auto;width:min(270px,72vw);height:170px;
  display:grid;grid-template-rows:25px 1fr 34px;
  border:8px solid transparent;border-image:url('./native/fr_textbox_type1.png') 8 fill / 8px / 0 stretch;
  background:#ffffde;color:#414141;box-shadow:5px 5px 0 #526a62;
  pointer-events:auto;touch-action:manipulation;
}
.chatHeader{
  display:flex;align-items:center;justify-content:space-between;padding:0 4px 2px;
  border-bottom:1px solid #9a967f;font-size:10px;
}
.chatHeaderTitle{display:flex;align-items:center;gap:7px;min-width:0;white-space:nowrap}
.chatActiveStatus{
  display:inline-flex;align-items:center;gap:3px;
  color:#3e6f3e;font:900 8px/1 "Courier New",monospace;
}
.chatActiveStatus b{font:inherit}
.chatActiveDot{
  width:6px;height:6px;border-radius:50%;background:#38a94f;
  box-shadow:0 0 0 1px #2b7438;
  flex:none;
}
.chatHeader button{
  width:26px;height:22px;border:0;background:transparent;color:#414141;
  font-size:18px;font-weight:900;line-height:18px;
}
.chatMessages{
  min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 5px;background:#fffde8;
  font:700 10px/1.28 "Courier New",monospace;white-space:pre-wrap;overflow-wrap:anywhere;touch-action:pan-y;
}
.chatMessage{margin:0 0 3px}
.chatMessage strong{color:#355caa}
.chatForm{display:grid;grid-template-columns:1fr 52px;gap:4px;padding:4px 3px 2px}
.chatForm input{
  min-width:0;width:100%;border:2px solid #526a62;border-radius:0;background:#fff;color:#303030;
  padding:3px 5px;font:700 12px/1.1 "Courier New",monospace;touch-action:manipulation;
}
.chatForm button{
  border:2px solid #526a62;border-radius:0;background:#e8e4c8;color:#303030;
  font:900 9px/1 "Courier New",monospace;touch-action:manipulation;
}
@media(max-width:560px),(hover:none){
  .globalChat{
    left:calc(var(--ui-safe-left) + 206px);
    top:max(44px,calc(env(safe-area-inset-top) + 42px));
    bottom:auto;
  }
  .chatPanel{left:auto;right:0;top:31px;bottom:auto;width:min(270px,82vw);height:155px}
}


/* Global chat image attachments. */
.chatForm{
  grid-template-columns:1fr 34px 52px!important;
  grid-template-areas:
    "preview preview preview"
    "input image send";
  align-items:center;
}
#chatInput{grid-area:input}
.chatImageButton{
  grid-area:image;
  display:grid;
  place-items:center;
  height:100%;
  min-height:24px;
  border:2px solid #526a62;
  background:#e8e4c8;
  color:#303030;
  font:900 8px/1 "Courier New",monospace;
  cursor:pointer;
  user-select:none;
  pointer-events:auto;
}
.chatImageInput{
  position:absolute!important;
  width:1px!important;height:1px!important;
  opacity:0!important;
  pointer-events:none!important;
}
.chatForm>button[type="submit"]{grid-area:send}
.chatImagePending{
  grid-area:preview;
  position:relative;
  width:max-content;
  max-width:100%;
  margin:0 0 2px;
}
.chatImagePending img{
  display:block;
  width:auto;
  height:38px;
  max-width:80px;
  object-fit:cover;
  border:2px solid #526a62;
  image-rendering:auto;
}
.chatImagePending button{
  position:absolute;
  right:-8px;top:-8px;
  width:18px;height:18px;
  padding:0;
  border:2px solid #fff;
  border-radius:50%;
  background:#b83b3b;
  color:#fff;
  font:900 13px/12px system-ui,sans-serif;
}
.chatImage{
  display:block;
  max-width:100%;
  max-height:120px;
  width:auto;
  height:auto;
  margin:4px 0 2px;
  border:1px solid #526a62;
  image-rendering:auto;
}

.chatPanel{grid-template-rows:25px 1fr auto!important}


/* Ludicolo recruiter: Oak-lab-style centered Pokemon showcase. */
.recruitShowcaseLayer{
  position:absolute;
  inset:0;
  z-index:105;
  pointer-events:none;
}
.recruitShowcaseBox{
  position:absolute;
  left:31.6667cqw;
  top:7.5cqw;
  width:36.6667cqw;
  height:36.6667cqw;
  display:grid;
  place-items:center;
  border:3.3333cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 3.3333cqw / 0 stretch;
  background:#fff;
  image-rendering:pixelated;
}
.recruitShowcaseBox img{
  display:block;
  width:26.6667cqw;
  height:26.6667cqw;
  object-fit:contain;
  image-rendering:pixelated;
  image-rendering:crisp-edges;
  transform:scale(1);
  opacity:1;
}
.recruitShowcaseBox img.silhouette{
  filter:brightness(0) contrast(200%);
}
.recruitShowcaseBox img.revealed{
  animation:recruitReveal .55s steps(5,end);
}
@keyframes recruitReveal{
  0%{filter:brightness(0);transform:scale(.92)}
  45%{filter:brightness(2.2);transform:scale(1.08)}
  100%{filter:none;transform:scale(1)}
}
#gameFrame.recruit-open .joystick,
#gameFrame.recruit-open .teamButton,
#gameFrame.recruit-open .globalChat{
  opacity:0!important;
  pointer-events:none!important;
}


/* -------------------------------------------------------------------------- */
/* Gardevoir / Vaporeon overworld events                                      */
/* -------------------------------------------------------------------------- */
.specialPrompt{
  position:absolute;left:0;right:0;bottom:0;z-index:92;
  width:100%;height:20cqw;
  background-image:url("./native/fr_battle_action_bg.png");
  background-repeat:no-repeat;background-size:100cqw 20cqw;
  background-position:0 0;image-rendering:pixelated;
  pointer-events:auto;
}
.specialPromptText{
  position:absolute;left:4.1667cqw;top:3.3333cqw;
  width:47cqw;height:13cqw;overflow:hidden;
}
.specialPromptButtons{
  position:absolute;left:52.5cqw;top:2.5cqw;
  width:45cqw;height:15cqw;
  display:grid;grid-template-rows:1fr 1fr;
}
.specialPromptButtons button{
  position:relative;
  border:0;background:transparent;padding:0 0 0 6cqw;
  display:flex;align-items:flex-start;justify-content:center;
  image-rendering:pixelated;
}
.specialPromptText .frGlyph,
.specialPromptButtons .frGlyph{
  background-image:url("./native/fr_font_light.png")!important;
}

.vaporeonImageLayer{
  position:absolute;
  inset:0;
  z-index:108;
  display:grid;
  place-items:center;
  background:rgba(0,0,0,.24);
  pointer-events:auto;
}
.vaporeonImageLayer[hidden]{display:none!important}
.vaporeonImageBox{
  width:min(34cqw,272px);
  height:min(42cqw,304px);
  display:grid;
  place-items:center;
  overflow:hidden;
  border:3.3333cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 3.3333cqw / 0 stretch;
  background:#fff;
  box-shadow:2cqw 2cqw 0 rgba(35,43,56,.45);
}
.vaporeonImageBox img{
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  image-rendering:auto;
  transform:none;
}

#gameFrame.special-event-open .joystick,
#gameFrame.special-event-open .teamButton,
#gameFrame.special-event-open .globalChat,
#gameFrame.special-event-open .pcControlsHint{
  opacity:0!important;
  pointer-events:none!important;
}


/* -------------------------------------------------------------------------- */
/* D-pad and overworld movement ability                                       */
/* -------------------------------------------------------------------------- */
#mobileControls{position:absolute;inset:0;pointer-events:none;z-index:30}
.dpad{
  position:absolute;
  left:var(--ui-safe-left);
  bottom:var(--ui-safe-bottom);
  width:94px;
  height:94px;
  pointer-events:auto;
  touch-action:none;
}
.dpadBtn,.dpadCenter{
  position:absolute;
  width:32px;height:32px;
}
.dpadBtn{
  border:2px solid rgba(255,255,255,.55);
  background:rgba(18,42,58,.72);
  color:#fff;
  font:900 13px/1 system-ui,sans-serif;
  display:grid;place-items:center;
  padding:0;
  border-radius:7px;
  box-shadow:0 2px 7px rgba(0,0,0,.35),inset 0 0 0 4px rgba(255,255,255,.06);
  pointer-events:auto;
  touch-action:none;
  user-select:none;
}
.dpadBtn:active,.dpadBtn.pressed{
  transform:scale(.94);
  background:rgba(35,84,108,.92);
}
.dpadUp{left:31px;top:0}
.dpadDown{left:31px;bottom:0}
.dpadLeft{left:0;top:31px}
.dpadRight{right:0;top:31px}
.dpadCenter{
  left:31px;top:31px;
  border-radius:7px;
  background:rgba(13,29,40,.76);
  border:2px solid rgba(255,255,255,.22);
}
.movementButton{
  position:absolute;
  right:calc(var(--ui-safe-right) + 142px);
  bottom:calc(var(--ui-safe-bottom) + 16px);
  width:54px;height:54px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.6);
  background:rgba(145,89,201,.8);
  color:#fff;
  box-shadow:0 3px 10px rgba(0,0,0,.34),inset 0 0 0 5px rgba(255,255,255,.09);
  pointer-events:auto;
  touch-action:none;
  display:grid;
  place-items:center;
  align-content:center;
  gap:1px;
  padding:0;
}
.movementButtonLabel{font:900 9px/1 system-ui,sans-serif}
.movementButton small{font:800 7px/1 system-ui,sans-serif;min-height:7px}
.movementButton.cooldown{
  opacity:.62;
  filter:saturate(.55);
}
.movementButton:active:not(.cooldown){transform:scale(.94)}
#gameFrame.dialog-open .dpad,
#gameFrame.dialog-open .movementButton,
#gameFrame.battle-prompt-open .dpad,
#gameFrame.battle-prompt-open .movementButton,
#gameFrame.battle-active .dpad,
#gameFrame.battle-active .movementButton,
#gameFrame.team-open .dpad,
#gameFrame.team-open .movementButton{
  opacity:0;pointer-events:none;
}

/* Battle switch menu: only the first three battle-team Pokémon are exposed. */
.battlePokemonMenu{
  position:absolute;
  inset:0;
  display:grid;
  grid-template-columns:1fr;
  z-index:4;
  pointer-events:auto;
}
.battlePokemonChoices{
  position:absolute;
  left:0;top:0;
  width:66.6667cqw;height:20cqw;
  display:grid;
  grid-template-columns:1fr 1fr;
  grid-template-rows:1fr 1fr;
}
.battlePokemonChoice,#battlePokemonBack{
  position:relative;
  border:0;
  background:transparent;
  color:#222;
  min-width:0;
  padding:0;
  pointer-events:auto;
  touch-action:manipulation;
}
.battlePokemonChoice strong,
.battlePokemonChoice small{
  display:block;
}
.battlePokemonChoice:disabled{opacity:.38}
#battlePokemonBack{
  position:absolute;
  right:2cqw;
  bottom:1cqw;
  width:28cqw;
  height:6cqw;
}

#gameFrame.movement-active .dpad,
#gameFrame.movement-active .movementButton,
#gameFrame.movement-active .teamButton,
#gameFrame.movement-active .interact{
  pointer-events:none!important;
}


/* Persistent account currency. Berries are display-only for now. */
.berryHud{
  position:absolute;
  z-index:34;
  top:max(8px,env(safe-area-inset-top));
  right:8px;
  min-width:78px;
  min-height:30px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:7px;
  padding:4px 7px;
  border:6px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;
  background:#ffffde;
  color:#3f4541;
  image-rendering:pixelated;
  box-shadow:3px 3px 0 rgba(44,65,61,.5);
  pointer-events:none;
}
.berryHud span{
  font:900 7px/1 "Courier New",monospace;
  letter-spacing:.02em;
}
.berryHud strong{
  min-width:18px;
  text-align:right;
  color:#b34c68;
  font:900 10px/1 "Courier New",monospace;
}
#gameFrame.battle-active .berryHud,
#gameFrame.battle-prompt-open .berryHud,
#gameFrame.team-open .berryHud,
#gameFrame.recruit-open .berryHud,
#gameFrame.piccolo-recruit-open .berryHud{
  opacity:0;
}

/* Piccolo uses the same native gacha showcase as Ludicolo. */
#gameFrame.piccolo-recruit-open .dpad,
#gameFrame.piccolo-recruit-open .movementButton,
#gameFrame.piccolo-recruit-open .teamButton,
#gameFrame.piccolo-recruit-open .interact{
  pointer-events:none!important;
}


/* Leave the top-right corner to the berry counter on desktop. */
.pcControlsHint{top:42px}


/* -------------------------------------------------------------------------- */
/* Machoke Neué / Machop Leistung training                                    */
/* -------------------------------------------------------------------------- */
.trainingLayer{
  position:absolute;inset:0;z-index:112;
  display:grid;place-items:center;
  background:rgba(14,24,30,.28);
  pointer-events:auto;
}
.trainingLayer[hidden]{display:none!important}
.trainingPanel{
  position:relative;
  width:78cqw;max-height:60cqw;
  min-height:38cqw;
  display:grid;
  grid-template-rows:auto auto 1fr auto;
  gap:1.5cqw;
  padding:3.5cqw 4cqw;
  background:#ffffde;
  border:2.5cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 2.5cqw / 0 stretch;
  box-shadow:1.5cqw 1.5cqw 0 rgba(45,61,58,.45);
  image-rendering:pixelated;
}
.trainingTitle{
  min-height:4cqw;
  color:#303030;
  font:900 3cqw/1 "Courier New",monospace;
}
.trainingBody{
  min-height:8cqw;
  color:#3e4540;
  white-space:pre-line;
  font:800 2.2cqw/1.25 "Courier New",monospace;
}
.trainingList{
  overflow:auto;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:1cqw;
  align-content:start;
  max-height:29cqw;
  padding:.5cqw;
}
.trainingList button,.trainingClose{
  min-height:5.6cqw;
  padding:.7cqw 1cqw;
  border:.45cqw solid #526a62;
  background:#fff;
  color:#303030;
  font:900 1.8cqw/1.1 "Courier New",monospace;
  text-align:left;
  image-rendering:pixelated;
}
.trainingList button small{
  display:block;margin-top:.35cqw;
  font-size:1.35cqw;line-height:1.15;font-weight:700;
}
.trainingList button:disabled{opacity:.42}
.trainingList button:focus,.trainingList button:hover{
  outline:.45cqw solid #d95f8a;
  outline-offset:-.45cqw;
}
.trainingClose{
  justify-self:end;
  width:20cqw;
  text-align:center;
}
#gameFrame.training-open .dpad,
#gameFrame.training-open .movementButton,
#gameFrame.training-open .teamButton,
#gameFrame.training-open .interact,
#gameFrame.training-open .globalChat,
#gameFrame.training-open .pcControlsHint{
  opacity:0!important;
  pointer-events:none!important;
}


/* -------------------------------------------------------------------------- */
/* Chansey berry egg                                                          */
/* -------------------------------------------------------------------------- */
.chanseyEggLayer{
  position:absolute;inset:0;z-index:111;pointer-events:none;
}
.chanseyEggBox{
  position:absolute;left:31.6667cqw;top:7.5cqw;
  width:36.6667cqw;height:36.6667cqw;
  display:grid;place-items:center;
  border:3.3333cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 3.3333cqw / 0 stretch;
  background:#fff;image-rendering:pixelated;
}
.chanseyEggBox img{
  position:absolute;width:26.6667cqw;height:26.6667cqw;
  object-fit:contain;image-rendering:pixelated;image-rendering:crisp-edges;
  transform-origin:50% 82%;
}
.chanseyEggBox img.eggSilhouette{filter:brightness(0) contrast(250%)}
.chanseyEggBox img.eggReveal{animation:eggReveal .55s steps(5,end)}
.chanseyEggBox img.eggTwitch{animation:eggTwitch .22s steps(2,end) 5}
.chanseyEggBox img.eggCrack{animation:eggCrack .42s steps(4,end)}
.chanseyEggBox img.eggHatched{animation:eggHatch .52s steps(5,end)}
.chanseyEggReward{
  position:absolute;left:3cqw;right:3cqw;bottom:2.2cqw;
  min-height:5cqw;display:grid;place-items:center;
  color:#b34c68;background:#ffffde;border:.4cqw solid #526a62;
  font:900 2.2cqw/1 "Courier New",monospace;
}
.chanseyEggReward.hiddenReward{opacity:0}
.chanseyEggReward.rewardPop{animation:eggRewardPop .55s steps(4,end)}
@keyframes eggReveal{0%{filter:brightness(0);transform:scale(.92)}60%{filter:brightness(1.8);transform:scale(1.06)}100%{filter:none;transform:scale(1)}}
@keyframes eggTwitch{0%{transform:rotate(0)}25%{transform:rotate(-5deg)}75%{transform:rotate(5deg)}100%{transform:rotate(0)}}
@keyframes eggCrack{0%{transform:translateY(0) scale(1)}50%{transform:translateY(-1cqw) scale(1.08);filter:brightness(1.8)}100%{transform:translateY(0) scale(.96)}}
@keyframes eggHatch{0%{transform:scale(.92);filter:brightness(2.5)}45%{transform:scale(1.15);filter:brightness(1.6)}100%{transform:scale(1);filter:none}}
@keyframes eggRewardPop{0%{opacity:0;transform:scale(.5)}60%{opacity:1;transform:scale(1.15)}100%{opacity:1;transform:scale(1)}}
#gameFrame.chansey-egg-open .dpad,
#gameFrame.chansey-egg-open .movementButton,
#gameFrame.chansey-egg-open .teamButton,
#gameFrame.chansey-egg-open .interact,
#gameFrame.chansey-egg-open .globalChat,
#gameFrame.chansey-egg-open .updatesDock{
  opacity:0!important;pointer-events:none!important;
}

/* -------------------------------------------------------------------------- */
/* Overworld combat                                                           */
/* -------------------------------------------------------------------------- */
.interact.attack-mode{
  background:#cc4d42c9;
  font-size:18px;
  letter-spacing:-.04em;
}
.interact.attack-mode:disabled{opacity:.78}
.overworldCountdown{
  position:absolute;left:50%;top:43%;z-index:118;
  transform:translate(-50%,-50%);
  min-width:18cqw;padding:2cqw 3cqw;text-align:center;
  border:1.2cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 1.2cqw / 0 stretch;
  background:#ffffde;color:#303030;
  font:900 8cqw/1 "Courier New",monospace;
  image-rendering:pixelated;pointer-events:none;
}
#gameFrame.overworld-combat .teamButton,
#gameFrame.overworld-combat .globalChat,
#gameFrame.overworld-combat .updatesDock{
  opacity:0!important;pointer-events:none!important;
}

/* -------------------------------------------------------------------------- */
/* Recent major updates                                                       */
/* -------------------------------------------------------------------------- */
.updatesDock{
  position:absolute;left:8px;top:46px;z-index:139;
  pointer-events:none;font-family:"Courier New",monospace;
}
.updatesToggle{
  min-width:58px;height:25px;padding:2px 7px;
  border:6px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;
  background:#ffffde;color:#414141;font:900 8px/1 "Courier New",monospace;
  pointer-events:auto;touch-action:manipulation;
}
.updatesPanel{
  position:absolute;left:0;top:31px;width:min(300px,82vw);height:min(245px,62vh);
  display:grid;grid-template-rows:25px 1fr;
  border:8px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 8px / 0 stretch;
  background:#ffffde;color:#414141;box-shadow:5px 5px 0 #526a62;
  pointer-events:auto;touch-action:manipulation;
}
.updatesHeader{
  display:flex;align-items:center;justify-content:space-between;padding:0 4px 2px;
  border-bottom:1px solid #9a967f;font-size:10px;
}
.updatesHeader button{
  width:26px;height:22px;border:0;background:transparent;color:#414141;
  font-size:18px;font-weight:900;line-height:18px;
}
.updatesList{
  min-height:0;overflow-y:auto;overscroll-behavior:contain;
  padding:5px;background:#fffde8;touch-action:pan-y;
}
.updateItem{padding:0 0 5px;margin:0 0 5px;border-bottom:1px dashed #aaa58d}
.updateItem:last-child{border-bottom:0;margin-bottom:0}
.updateItem strong{display:block;color:#355caa;font:900 9px/1.15 "Courier New",monospace}
.updateItem p{margin:2px 0 0;color:#414141;font:700 9px/1.25 "Courier New",monospace}
#gameFrame.dialog-open .updatesDock,
#gameFrame.battle-active .updatesDock,
#gameFrame.battle-prompt-open .updatesDock,
#gameFrame.team-open .updatesDock,
#gameFrame.recruit-open .updatesDock,
#gameFrame.piccolo-recruit-open .updatesDock{
  opacity:0;pointer-events:none;
}
@media(max-width:560px),(hover:none){
  .updatesDock{left:var(--ui-safe-left);top:max(44px,calc(env(safe-area-inset-top) + 42px))}
  .updatesPanel{width:min(286px,88vw);height:min(230px,56vh)}
}


/* Mobile Safari QoL: game chrome is gesture-locked, real text fields stay editable. */
input,textarea,[contenteditable="true"]{
  -webkit-user-select:text;
  user-select:text;
  -webkit-touch-callout:default;
}


/* Small permanent map-coordinate readout for tile-level bug reports. */
.tileCoords{
  position:absolute;
  right:2px;
  bottom:2px;
  z-index:39;
  padding:2px 4px;
  border-radius:3px;
  background:rgba(10,16,24,.68);
  color:rgba(255,255,255,.9);
  font:700 7px/1.1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  letter-spacing:.02em;
  pointer-events:none;
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
  text-shadow:0 1px 1px #000;
}


/* Player challenge selector: three real choices, not FireRed's baked YES/NO menu. */
.onlinePromptButtons.threeChoice{
  left:52.5cqw!important;
  top:0!important;
  width:47.5cqw!important;
  height:20cqw!important;
  padding:0!important;
  display:grid!important;
  grid-template-rows:repeat(3,1fr)!important;
  background-image:none!important;
  background:#f8f8e8!important;
  border-left:.8333cqw solid #505058!important;
  box-shadow:inset .8333cqw 0 0 #d8d8c8!important;
}
.onlinePromptButtons.threeChoice button{
  padding-left:5cqw!important;
  align-items:center!important;
  overflow:hidden!important;
}
.onlinePromptButtons.threeChoice .frGlyph{
  background-image:url("./native/fr_font_dark.png")!important;
}
.onlinePromptThreeChoice .onlinePromptText{
  width:45cqw!important;
}


/* Player suggestion box */
.suggestionsDock{position:absolute;left:74px;top:46px;z-index:140;pointer-events:none;font-family:"Courier New",monospace}
.suggestionsToggle{min-width:62px;height:25px;padding:2px 7px;border:6px solid transparent;border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;background:#ffffde;color:#414141;font:900 8px/1 "Courier New",monospace;pointer-events:auto;touch-action:manipulation}
.suggestionsPanel{position:absolute;left:0;top:31px;width:min(310px,86vw);display:grid;grid-template-rows:25px auto;border:8px solid transparent;border-image:url('./native/fr_textbox_type1.png') 8 fill / 8px / 0 stretch;background:#ffffde;color:#414141;box-shadow:5px 5px 0 #526a62;pointer-events:auto;touch-action:manipulation}
.suggestionsHeader{display:flex;align-items:center;justify-content:space-between;padding:0 4px 2px;border-bottom:1px solid #9a967f;font-size:10px}
.suggestionsHeader button{width:26px;height:22px;border:0;background:transparent;color:#414141;font-size:18px;font-weight:900;line-height:18px}
.suggestionsForm{display:grid;gap:6px;padding:7px;background:#fffde8;font:800 9px/1.25 "Courier New",monospace}
.suggestionsForm textarea{width:100%;min-height:86px;resize:none;padding:7px;border:2px solid #526a62;background:#fff;color:#303030;font:800 11px/1.3 "Courier New",monospace;touch-action:manipulation}
.suggestionsFooter{display:flex;align-items:center;justify-content:space-between;gap:7px}
#suggestionsStatus{min-height:12px;flex:1;color:#3e7651;font:800 8px/1.2 "Courier New",monospace}
#suggestionsSubmit{min-width:64px;height:28px;border:6px solid transparent;border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;background:#ffffde;color:#355caa;font:900 8px/1 "Courier New",monospace}
#gameFrame.dialog-open .suggestionsDock,#gameFrame.battle-active .suggestionsDock,#gameFrame.battle-prompt-open .suggestionsDock,#gameFrame.team-open .suggestionsDock,#gameFrame.recruit-open .suggestionsDock,#gameFrame.piccolo-recruit-open .suggestionsDock,#gameFrame.overworld-combat .suggestionsDock{opacity:0;pointer-events:none}
@media(max-width:560px),(hover:none){.suggestionsDock{left:calc(var(--ui-safe-left) + 66px);top:max(44px,calc(env(safe-area-inset-top) + 42px))}.suggestionsPanel{left:calc(-1 * (var(--ui-safe-left) + 66px));width:min(300px,92vw)}}


/* FRLG fidelity pass: full party screen presentation for the in-battle POKéMON command. */
#gameFrame.battle-party-open .battleHealth,#gameFrame.battle-party-open .battleTerrain,#gameFrame.battle-party-open .battleSprite,#gameFrame.battle-party-open .battleFx{opacity:0!important;pointer-events:none!important}
#gameFrame.battle-party-open .battleCommand{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;z-index:86!important;display:block!important;border:0!important;background:transparent!important;box-shadow:none!important;pointer-events:none!important}
#gameFrame.battle-party-open .battlePokemonMenu{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;display:block!important;z-index:87!important;pointer-events:auto!important;background:transparent!important}
#gameFrame.battle-party-open .battlePokemonChoices{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;display:block!important;pointer-events:none!important}
#gameFrame.battle-party-open .battlePokemonChoice,#gameFrame.battle-party-open #battlePokemonBack{position:absolute!important;opacity:0!important;border:0!important;background:transparent!important;pointer-events:auto!important;touch-action:manipulation!important}
#gameFrame.battle-party-open .battlePokemonChoice:nth-child(1){left:3.3333cqw!important;top:10cqw!important;width:33.3333cqw!important;height:23.3333cqw!important}
#gameFrame.battle-party-open .battlePokemonChoice:nth-child(2){left:40cqw!important;top:3.3333cqw!important;width:60cqw!important;height:10cqw!important}
#gameFrame.battle-party-open .battlePokemonChoice:nth-child(3){left:40cqw!important;top:13.3333cqw!important;width:60cqw!important;height:10cqw!important}
#gameFrame.battle-party-open #battlePokemonBack{left:69.5833cqw!important;top:52.0833cqw!important;width:30.4167cqw!important;height:14.5833cqw!important}
.teamSlot.teamCursor{outline:none}


/* Three-option Slowpoke challenge: YES / NO / HARD. */
#battlePrompt .battleChoiceButtons{
  grid-template-rows:repeat(3,1fr)!important;
}
#battlePrompt .battleChoiceButtons button{
  min-height:0!important;
  padding-top:0!important;
  padding-bottom:0!important;
}


/* Prompt hitboxes must occupy the same logical pixels as the FireRed canvas
   menus. The prompt DOM lives in the 48px field-message strip at Y112, while
   the canvas choice windows are drawn above it. The old hitboxes stayed in
   that bottom strip, which is why mouse/touch had to be aimed below the text. */
#battlePrompt,
#onlinePrompt{
  pointer-events:none!important;
}
#battlePrompt .battleChoiceButtons,
#onlinePrompt .onlinePromptButtons{
  box-sizing:border-box!important;
  pointer-events:auto!important;
}
#battlePrompt .battleChoiceButtons button,
#onlinePrompt .onlinePromptButtons button{
  width:100%!important;
  height:100%!important;
  box-sizing:border-box!important;
  touch-action:manipulation!important;
  cursor:pointer!important;
}

/* Slowpoke: canvas menu = x160,y48,w64,h64 (three rows). Parent starts at y112. */
#battlePrompt .battleChoiceButtons{
  left:66.6667cqw!important;
  top:-26.6667cqw!important;
  width:26.6667cqw!important;
  height:26.6667cqw!important;
  padding:0!important;
  border:0!important;
  grid-template-rows:repeat(3,1fr)!important;
}

/* Ordinary online YES/NO: canvas menu = x160,y64,w64,h48. */
#onlinePrompt .onlinePromptButtons:not(.threeChoice):not(.fourChoice){
  left:66.6667cqw!important;
  top:-20cqw!important;
  width:26.6667cqw!important;
  height:20cqw!important;
  padding:0!important;
  border:0!important;
  grid-template-rows:repeat(2,1fr)!important;
}

/* Player challenge picker: canvas menu = x112,y46,w124,h62. */
#onlinePrompt .onlinePromptButtons.threeChoice{
  left:46.6667cqw!important;
  top:-27.5cqw!important;
  width:51.6667cqw!important;
  height:25.8333cqw!important;
  padding:0!important;
  border:0!important;
  box-shadow:none!important;
  grid-template-rows:repeat(3,1fr)!important;
}


/* Four-row challenge picker: canvas x112,y34,w124,h74; message strip starts at y112. */
#onlinePrompt .onlinePromptButtons.fourChoice{
  left:46.6667cqw!important;
  top:-32.5cqw!important;
  width:51.6667cqw!important;
  height:30.8333cqw!important;
  padding:0!important;
  border:0!important;
  box-shadow:none!important;
  background:none!important;
  grid-template-rows:repeat(4,1fr)!important;
}
.onlinePromptFourChoice .onlinePromptText{width:45cqw!important}


/* Field menu + FireRed Bag */
.fieldMenu{
  position:absolute;right:3.3333cqw;top:8.3333cqw;z-index:96;
  width:38.3333cqw;padding:1.6667cqw;
  display:grid;grid-template-rows:repeat(3,10.8333cqw);
  border:3.3333cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 3.3333cqw / 0 stretch;
  background:#ffffde;image-rendering:pixelated;pointer-events:auto;
  filter:drop-shadow(1.25cqw 1.25cqw 0 #526a62);
}
.fieldMenu button{
  position:relative;border:0;background:transparent;
  padding:0 1cqw 0 8cqw;text-align:left;
  display:flex;align-items:center;justify-content:flex-start;
  image-rendering:pixelated;touch-action:manipulation;
}
.fieldMenu .frMenuCursor{
  position:absolute!important;
  left:5cqw!important;
  top:50%!important;
  transform:translateY(-50%)!important;
}
.fieldMenu button.battleSelected{background:rgba(255,255,222,.55)}

.bagLayer{
  position:absolute;inset:0;z-index:94;
  background:#52cdb4;image-rendering:pixelated;pointer-events:auto;
}
.bagScene{
  position:absolute;inset:0;overflow:hidden;
  background:
    linear-gradient(90deg,#52cdb4 0 35%,#fff6b4 35% 100%);
}
.bagScene:before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:35%;
  background:
    repeating-linear-gradient(0deg,rgba(255,255,255,.12) 0 1.6667cqw,rgba(0,0,0,.035) 1.6667cqw 3.3333cqw),
    linear-gradient(#41b49c,#52cdb4);
}
.bagLeft{
  position:absolute;left:0;top:0;width:35%;height:75%;
  display:flex;align-items:center;justify-content:center;
}
.bagSprite{
  position:absolute;left:4.1667cqw;top:17.5cqw;
  width:26.6667cqw;height:26.6667cqw;
  background-repeat:no-repeat;background-size:100% 400%;background-position:0 0;
  image-rendering:pixelated;
}
.bagTitle{
  position:absolute;left:3.3333cqw;right:3.3333cqw;top:4.1667cqw;height:10cqw;
  display:flex;align-items:center;justify-content:center;
  border:2.5cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 2.5cqw / 0 stretch;
  background:#ffffde;
}
.bagRight{
  position:absolute;left:35%;right:1.6667cqw;top:2.5cqw;bottom:25cqw;
  border:2.5cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 2.5cqw / 0 stretch;
  background:#fff6b4;overflow:hidden;
}
.bagItems{
  position:absolute;inset:2.5cqw 2.5cqw 2.5cqw 3.3333cqw;
  display:flex;flex-direction:column;gap:.8333cqw;overflow:auto;
}
.bagEmpty{
  margin-top:7.5cqw;min-height:10cqw;
  display:flex;align-items:center;justify-content:center;
}
.bagItem{
  position:relative;min-height:9.1667cqw;border:0;background:transparent;
  padding:0 2cqw 0 6cqw;
  display:flex;align-items:center;justify-content:space-between;
  image-rendering:pixelated;touch-action:manipulation;
}
.bagItemSelected:before{
  content:"▶";position:absolute;left:1cqw;top:50%;transform:translateY(-55%);
  color:#414141;font:900 4cqw/1 "Courier New",monospace;
}
.bagDescription{
  position:absolute;left:2.5cqw;right:29.1667cqw;bottom:2.5cqw;height:18.3333cqw;
  padding:3.3333cqw 3.3333cqw;
  border:2.5cqw solid transparent;
  border-image:url("./native/fr_textbox_type5.png") 8 fill / 2.5cqw / 0 stretch;
  background:#ffffde;overflow:hidden;
}
.bagCancel{
  position:absolute;right:2.5cqw;bottom:2.5cqw;width:25cqw;height:18.3333cqw;
  border:2.5cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 2.5cqw / 0 stretch;
  background:#ffffde;display:flex;align-items:center;justify-content:center;
  image-rendering:pixelated;touch-action:manipulation;
}

#gameFrame.field-menu-open #mobileControls,
#gameFrame.bag-open #mobileControls{opacity:0!important;pointer-events:none!important}
#gameFrame.field-menu-open #profileChip,
#gameFrame.field-menu-open .berryHud,
#gameFrame.field-menu-open .pcControlsHint,
#gameFrame.field-menu-open .globalChat,
#gameFrame.field-menu-open .updatesDock,
#gameFrame.field-menu-open .suggestionsDock,
#gameFrame.bag-open #profileChip,
#gameFrame.bag-open .berryHud,
#gameFrame.bag-open .pcControlsHint,
#gameFrame.bag-open .globalChat,
#gameFrame.bag-open .updatesDock,
#gameFrame.bag-open .suggestionsDock{opacity:0!important;pointer-events:none!important}


/* Kecleon Poké Mart */
.kecleonShopLayer{
  position:absolute;inset:0;z-index:97;
  background:rgba(22,34,45,.14);
  image-rendering:pixelated;
  pointer-events:auto;
  overflow:hidden;
}
.kecleonShopScene{
  position:absolute;
  left:2.5cqw;right:2.5cqw;top:2.5cqw;bottom:2.5cqw;
  box-sizing:border-box;
  background:#f7f1cf;
  border:1.6667cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 1.6667cqw / 0 stretch;
  filter:drop-shadow(.8333cqw .8333cqw 0 #42554e);
  display:grid;
  grid-template-columns:58% 42%;
  grid-template-rows:8.3333cqw 17.5cqw 16.5cqw 12.5cqw;
  gap:1cqw;
  padding:1.25cqw;
  overflow:hidden;
}
.kecleonShopHeader{
  grid-column:1 / 3;
  min-width:0;min-height:0;
  display:flex;align-items:center;justify-content:space-between;
  padding:0 2cqw;
  color:#303030;
  background:#ffffde;
  border:1.25cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 1.25cqw / 0 stretch;
  overflow:hidden;
}
.kecleonShopList{
  grid-column:1 / 3;
  position:relative;
  min-width:0;min-height:0;
  padding:1cqw 2cqw 3cqw;
  display:grid;
  grid-template-rows:6.2cqw 6.2cqw;
  gap:.45cqw;
  background:#fffde5;
  border:1.25cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 1.25cqw / 0 stretch;
  overflow:hidden;
}
.kecleonShopItem{
  width:100%;height:6.2cqw;min-height:0;
  border:0;background:#fffbe0;
  text-align:left;padding:0 3cqw;
  touch-action:manipulation;
  overflow:hidden;
}
.kecleonShopItem:focus,
.kecleonShopItem:active,
.kecleonShopItem.shopSelected{
  outline:0;background:#fff5b8;
}
#kecleonShopOwned{
  position:absolute;right:3cqw;bottom:.45cqw;
  max-width:32cqw;overflow:hidden;
}
.kecleonShopDescription{
  grid-column:1 / 2;
  min-width:0;min-height:0;
  padding:1cqw 2cqw;
  background:#ffffde;
  border:1.25cqw solid transparent;
  border-image:url("./native/fr_textbox_type5.png") 8 fill / 1.25cqw / 0 stretch;
  overflow:hidden;
}
.kecleonShopQuantity{
  grid-column:2 / 3;
  min-width:0;min-height:0;
  display:grid;
  grid-template-columns:6.5cqw 1fr 6.5cqw 11cqw;
  gap:.6cqw;
  align-items:center;
  padding:1.25cqw;
  background:#ffffde;
  border:1.25cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 1.25cqw / 0 stretch;
  overflow:hidden;
}
.kecleonShopQuantity button,
.kecleonShopActions button{
  height:8.3333cqw;min-height:0;
  border:0;background:#fffbe0;
  padding:0;
  touch-action:manipulation;
  overflow:hidden;
}
#kecleonShopQty{
  height:8.3333cqw;min-height:0;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
#kecleonShopMinus,
#kecleonShopPlus{
  position:relative;
}
#kecleonShopMinus:before,
#kecleonShopPlus:before{
  content:"";
  position:absolute;
  left:50%;top:50%;
  width:0;height:0;
  transform:translate(-50%,-50%);
}
#kecleonShopMinus:before{
  border-top:1.8cqw solid transparent;
  border-bottom:1.8cqw solid transparent;
  border-right:2.3cqw solid #303030;
}
#kecleonShopPlus:before{
  border-top:1.8cqw solid transparent;
  border-bottom:1.8cqw solid transparent;
  border-left:2.3cqw solid #303030;
}
#kecleonShopMinus:disabled:before{
  border-right-color:#999;
}
#kecleonShopPlus:disabled:before{
  border-left-color:#999;
}
.kecleonShopStatus{
  grid-column:1 / 2;
  min-width:0;min-height:0;
  padding:1.25cqw 2cqw;
  background:#315b73;
  color:white;
  border:1.25cqw solid transparent;
  border-image:url("./native/fr_textbox_type5.png") 8 fill / 1.25cqw / 0 stretch;
  overflow:hidden;
}
.kecleonShopActions{
  grid-column:2 / 3;
  min-width:0;min-height:0;
  display:grid;grid-template-columns:1fr 1fr;gap:1cqw;
  align-items:center;
  padding:1.25cqw;
  background:#ffffde;
  border:1.25cqw solid transparent;
  border-image:url("./native/fr_textbox_type1.png") 8 fill / 1.25cqw / 0 stretch;
  overflow:hidden;
}
#gameFrame.shop-open #mobileControls,
#gameFrame.shop-open #profileChip,
#gameFrame.shop-open .berryHud,
#gameFrame.shop-open .pcControlsHint,
#gameFrame.shop-open .globalChat,
#gameFrame.shop-open .updatesDock,
#gameFrame.shop-open .suggestionsDock{
  opacity:0!important;pointer-events:none!important;
}


/* FireRed slot machine */
.slotMachineLayer{position:absolute;inset:0;z-index:125;display:flex;align-items:center;justify-content:center;background:#000;image-rendering:pixelated;overflow:hidden;pointer-events:auto}
.slotMachineLayer[hidden]{display:none!important}
.slotMachineScene{width:100%;height:100%;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1.2cqw;padding:1.25cqw;box-sizing:border-box;background:#000}
.slotMachineScreen{display:block;width:min(100%,150cqh);max-height:76%;aspect-ratio:3/2;object-fit:contain;image-rendering:pixelated;image-rendering:crisp-edges;background:#000;touch-action:none}
.slotMachineStatus{width:min(96%,92cqw);min-height:5.2cqw;display:flex;align-items:center;justify-content:center;padding:.7cqw 1.5cqw;box-sizing:border-box;color:#fff;background:#181818;border:.55cqw solid #f6d55d;font:900 clamp(10px,2.15cqw,18px)/1.15 "Courier New",monospace;text-align:center;letter-spacing:.02em}
.slotMachineControls{width:min(96%,96cqw);display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.8cqw}
.slotMachineControls button{min-width:0;min-height:7cqw;padding:.55cqw .45cqw;border:.65cqw solid #4f2500;border-radius:.8cqw;background:#f5a623;color:#2d1600;box-shadow:inset 0 0 0 .35cqw #ffd76b;font:900 clamp(9px,1.8cqw,16px)/1 "Courier New",monospace;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.slotMachineControls button:active:not(:disabled){transform:translateY(.3cqw)}
.slotMachineControls button:focus-visible{outline:.7cqw solid #fff;outline-offset:.2cqw}
.slotMachineControls button:disabled{opacity:.42;filter:grayscale(.35)}
#slotAction{background:#f16b30;color:#fff;border-color:#782700;box-shadow:inset 0 0 0 .35cqw #ffc06d}
#slotExit{background:#ece8cf;color:#272727;border-color:#515151;box-shadow:inset 0 0 0 .35cqw #fff}
#gameFrame.slot-open #profileChip,#gameFrame.slot-open .berryHud,#gameFrame.slot-open #mobileControls,#gameFrame.slot-open .pcControlsHint,#gameFrame.slot-open .globalChat,#gameFrame.slot-open .updatesDock,#gameFrame.slot-open .suggestionsDock,#gameFrame.slot-open .dialog,#gameFrame.slot-open .fieldMenu{opacity:0!important;pointer-events:none!important}
@media (max-width:560px){.slotMachineScene{justify-content:center;gap:1.6cqw;padding:1cqw}.slotMachineScreen{width:100%;max-height:70%}.slotMachineStatus{width:100%;min-height:7cqw;font-size:2.8cqw}.slotMachineControls{width:100%;grid-template-columns:repeat(5,minmax(0,1fr));gap:.65cqw}.slotMachineControls button{min-height:9cqw;font-size:2.35cqw;padding:.45cqw .2cqw}}

.teamNameLine{display:flex;align-items:center;gap:.8cqw;min-width:0;white-space:nowrap}
.teamNameLine>strong{min-width:0;overflow:hidden}
.controlCollarSkull{
  flex:0 0 auto;
  font-family:Arial,sans-serif;
  font-size:clamp(11px,2.25cqw,18px);
  line-height:1;color:#2e2934;
  text-shadow:none;
}

/* Pokémon Summary */
.pokemonSummaryLayer{position:absolute;inset:0;z-index:106;background:#d7e6c0;image-rendering:pixelated;pointer-events:auto;color:#252532}
.pokemonSummaryLayer[hidden],.pokemonPcLayer[hidden],.pokemonPcActions[hidden],.teamActionMenu[hidden]{display:none!important}
.pokemonSummaryScene{position:absolute;inset:0;background:linear-gradient(#dfecc8,#c8dbae)}
.pokemonSummaryTabs{position:absolute;left:1.5cqw;right:1.5cqw;top:1.5cqw;height:12cqw;display:grid;grid-template-columns:repeat(3,1fr);gap:.8cqw}
.pokemonSummaryTabs button{border:1cqw solid #526b7e;border-radius:1cqw;background:#f5f1d8;color:#333;font:900 2.25cqw/1 "Courier New",monospace}
.pokemonSummaryTabs button.active{background:#ffcf54;border-color:#8a5a23}
.pokemonSummaryBody{position:absolute;left:2cqw;right:2cqw;top:15cqw;bottom:14cqw;border:1.1cqw solid #526b7e;background:#f9f6df;box-shadow:inset 0 0 0 .55cqw #fff;padding:2.5cqw;overflow:hidden}
.pokemonSummaryClose{position:absolute;right:2cqw;bottom:2cqw;width:23cqw;height:9cqw;border:1cqw solid #5b456f;border-radius:1cqw;background:#8060a0;color:#fff;font:900 2.6cqw/1 "Courier New",monospace}
.summaryHero{display:grid;grid-template-columns:34cqw 1fr;gap:3cqw;align-items:center;height:37cqw}.summarySpriteWrap{height:34cqw;display:flex;align-items:center;justify-content:center;background:#dcefcf;border:.8cqw solid #8aaa7a}.summarySpriteWrap img{width:30cqw;height:30cqw;object-fit:contain;image-rendering:pixelated}
.summaryIdentity h2{margin:0 0 2cqw;font:900 4.2cqw/1 "Courier New",monospace}.summaryLevel{font:900 3cqw/1 "Courier New",monospace;margin-bottom:2cqw}.summaryTypes{display:flex;gap:1cqw}.summaryType{padding:1cqw 2cqw;border:.6cqw solid #46545f;border-radius:1cqw;background:#dde5ef;font:900 2.2cqw/1 "Courier New",monospace}
.summaryInfoGrid{margin-top:2cqw;display:grid;grid-template-columns:24cqw 1fr;gap:1.2cqw 2cqw;font:800 2.7cqw/1.1 "Courier New",monospace}.summaryInfoGrid span{color:#68757b}
.summarySkillsHead{display:grid;grid-template-columns:1fr 1fr;gap:2cqw;margin-bottom:2.5cqw}.summarySkillsHead>div{padding:2cqw;border:.7cqw solid #7c9482;background:#e9efd5}.summarySkillsHead span{display:block;font:800 2cqw/1 "Courier New",monospace;color:#67736a}.summarySkillsHead strong{font:900 2.8cqw/1 "Courier New",monospace}
.summaryStats{display:grid;grid-template-columns:1fr 1fr;gap:1.3cqw 3cqw}.summaryStat{display:grid;grid-template-columns:18cqw 8cqw 1fr;align-items:center;gap:1cqw;font:900 2.3cqw/1 "Courier New",monospace}.summaryStat i{display:block;height:2cqw;background:#bbb;border:.35cqw solid #4f5b54}.summaryStat i b{display:block;height:100%;background:#59b95c}.summaryStyleNote{margin-top:3cqw;padding:2cqw;border:.7cqw solid #8c8065;background:#fff7c8;font:800 2.25cqw/1.25 "Courier New",monospace}
.summaryMovesLayout{height:100%;display:grid;grid-template-columns:43% 57%;gap:2cqw}.summaryMoveList{display:grid;grid-template-rows:repeat(4,1fr);gap:1cqw}.summaryMoveList button{border:.7cqw solid #607484;background:#e8eef1;text-align:left;padding:1.3cqw;overflow:hidden}.summaryMoveList button.selected{background:#ffe070;border-color:#9b682a}.summaryMoveList strong{display:block;font:900 2.35cqw/1 "Courier New",monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summaryMoveList span{font:800 1.9cqw/1 "Courier New",monospace}.summaryMoveDetail{border-left:.8cqw solid #687c8a;padding-left:2cqw;overflow:auto}.summaryMoveDetail h3{margin:0 0 2cqw;font:900 3.1cqw/1 "Courier New",monospace}.summaryMoveMeta{display:grid;grid-template-columns:1fr 1fr;gap:1.2cqw;font:800 2cqw/1.1 "Courier New",monospace}.summaryMoveMeta span{display:flex;flex-direction:column}.summaryMoveDetail p{font:800 2.1cqw/1.25 "Courier New",monospace}

/* Pokémon PC */
.pokemonPcLayer{position:absolute;inset:0;z-index:96;background:#376ba7;image-rendering:pixelated;pointer-events:auto;color:#242a31}.pokemonPcScene{position:absolute;inset:0;background:linear-gradient(135deg,#477fc0 0 32%,#dbe6d2 32% 100%)}
.pokemonPcHeader{position:absolute;left:1.5cqw;right:1.5cqw;top:1.5cqw;height:9cqw;display:flex;align-items:center;justify-content:space-between;padding:0 2cqw;border:.8cqw solid #314e6d;background:#f7f3d8;font:900 2.65cqw/1 "Courier New",monospace}
.pokemonPcPartyPane{position:absolute;left:1.5cqw;top:12cqw;bottom:14cqw;width:28cqw;border:.9cqw solid #2d5277;background:#dce9f1;padding:1.2cqw}.pokemonPcBoxPane{position:absolute;left:31.5cqw;right:1.5cqw;top:12cqw;bottom:14cqw;border:.9cqw solid #65785c;background:#dbe4bc;padding:1.2cqw}.pokemonPcPaneTitle{height:5cqw;font:900 2.5cqw/1 "Courier New",monospace;color:#234c75}
.pokemonPcParty{height:calc(100% - 5cqw);display:grid;grid-template-rows:repeat(6,1fr);gap:.6cqw}.pokemonPcPartySlot{min-height:0;border:.55cqw solid #4f687a;background:#eef5f7;display:flex;align-items:center;gap:1cqw;padding:.4cqw 1cqw;overflow:hidden}.pokemonPcPartySlot img{width:8cqw;height:8cqw;object-fit:contain;image-rendering:pixelated}.pokemonPcPartySlot span{min-width:0;text-align:left}.pokemonPcPartySlot strong{display:block;font:900 1.85cqw/1 "Courier New",monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pokemonPcPartySlot small{font:800 1.6cqw/1 "Courier New",monospace}
.pokemonPcBoxNav{height:7cqw;display:grid;grid-template-columns:8cqw 1fr 15cqw 8cqw;align-items:center;gap:.7cqw;margin-bottom:1cqw}.pokemonPcBoxNav button{height:6cqw;border:.55cqw solid #5c5a42;background:#fff2a6;font:900 2.3cqw/1 monospace}.pokemonPcBoxNav strong{text-align:center;font:900 2.8cqw/1 "Courier New",monospace}.pokemonPcBoxNav span{text-align:center;font:800 1.9cqw/1 "Courier New",monospace}
.pokemonPcGrid{height:calc(100% - 8cqw);display:grid;grid-template-columns:repeat(6,1fr);grid-template-rows:repeat(5,1fr);gap:.55cqw}.pokemonPcCell{position:relative;min-width:0;min-height:0;border:.5cqw solid #85936c;background:#eef1ce;padding:0;overflow:hidden}.pokemonPcCell.filled{background:#fffbe1}.pokemonPcCell img{position:absolute;left:50%;top:42%;transform:translate(-50%,-50%);width:8cqw;height:8cqw;object-fit:contain;image-rendering:pixelated}.pokemonPcCell span{position:absolute;left:.25cqw;right:.25cqw;bottom:.2cqw;font:900 1.15cqw/1 "Courier New",monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pcSelected{outline:.9cqw solid #ff9f28!important;outline-offset:-.9cqw}
.pokemonPcStatus{position:absolute;left:1.5cqw;right:28cqw;bottom:2cqw;height:9cqw;display:flex;align-items:center;padding:0 2cqw;border:.8cqw solid #566a79;background:#f7f5e7;font:900 2.3cqw/1 "Courier New",monospace;overflow:hidden}.pokemonPcExit{position:absolute;right:1.5cqw;bottom:2cqw;width:24cqw;height:9cqw;border:.8cqw solid #553e6f;background:#8060a3;color:#fff;font:900 2.6cqw/1 "Courier New",monospace}
.pokemonPcActions{position:absolute;right:3cqw;bottom:13cqw;width:31cqw;padding:1cqw;background:#fff;border:.9cqw solid #4d5c67;display:grid;gap:.7cqw}.pokemonPcActions button{height:7cqw;border:.6cqw solid #555;background:#f5efd2;font:900 2.2cqw/1 "Courier New",monospace}
#gameFrame.pc-open #mobileControls,#gameFrame.pc-open #profileChip,#gameFrame.pc-open .berryHud,#gameFrame.pc-open .globalChat,#gameFrame.summary-open #mobileControls{display:none!important}
.teamActionMenu{position:absolute;right:2cqw;bottom:18.5cqw;z-index:12;width:31cqw;min-height:35cqw;padding:1cqw;display:grid;grid-template-rows:repeat(5,6.2cqw);gap:.55cqw;overflow:visible;background:#fff;border:.9cqw solid #405866}.teamActionMenu button{height:6.2cqw;border:.45cqw solid #586b72;background:#f6f3dc;color:#252525;font:900 2cqw/1 "Courier New",monospace;text-align:left;padding-left:3cqw}.teamActionMenu button.battleSelected:not(:disabled){background:#ffe16a}.teamActionMenu button:disabled{opacity:.42}


/* ===== Authentic FRLG Summary / Storage screens ===== */
.frlgSummaryLayer,.frlgPcLayer{
  position:absolute!important;inset:0!important;z-index:108!important;
  display:block;background:#000!important;padding:0!important;margin:0!important;
  overflow:hidden!important;pointer-events:auto!important;image-rendering:pixelated!important;
}
.frlgSummaryLayer{z-index:112!important}
.frlgSummaryLayer[hidden],.frlgPcLayer[hidden]{display:none!important}
.frlgSummaryScreen,.frlgPcScreen{
  position:absolute;inset:0;width:100%;height:100%;overflow:hidden;
  background:#000;image-rendering:pixelated
}
.frlgSummaryCanvas,.frlgPcCanvas{
  position:absolute;inset:0;width:100%;height:100%;
  image-rendering:pixelated;image-rendering:crisp-edges
}
.frlgSummaryOverlay,.frlgPcOverlay{position:absolute;inset:0;pointer-events:none}
.frlgSummaryOverlay>*,
.frlgPcOverlay>*{pointer-events:auto}
.frlgSummaryText,.frlgPcText,.frlgPcBoxTitle,
.frlgPcDataName,.frlgPcDataLevel,.frlgPcDataNote{
  position:absolute!important;font-size:0!important;line-height:0!important;
  display:flex;flex-direction:column;align-items:flex-start;overflow:hidden
}
.frlgSummaryMon{
  position:absolute;object-fit:contain;image-rendering:pixelated;z-index:3;
}
.frlgSummaryShiny,.frlgSummarySkull{
  position:absolute;font-family:Arial,sans-serif;font-size:3.3cqw;line-height:1;z-index:5
}
.frlgSummaryShiny{color:#e1ad12}.frlgSummarySkull{color:#332742}
.frlgSummaryDots{
  position:absolute;display:grid;grid-template-columns:repeat(3,1fr);gap:.8333cqw;
  z-index:6
}
.frlgSummaryDot{
  border:0!important;padding:0!important;margin:0!important;background:transparent!important;
  min-width:0!important;min-height:0!important
}
.frlgSummaryDot::after{
  content:'';display:block;width:2.5cqw;height:2.5cqw;margin:.45cqw auto;
  border-radius:50%;background:#075ea5;border:.4167cqw solid #cbe8ed
}
.frlgSummaryDot.active::after{background:#fff6a2}
.frlgSummaryMoveRow{
  position:absolute;border:0!important;background:transparent!important;padding:.4167cqw!important;
  margin:0!important;display:block!important;
  text-align:left!important;font-size:0!important;overflow:hidden!important;
  -webkit-tap-highlight-color:transparent
}
.frlgSummaryMoveRow:active,.frlgSummaryMoveRow:focus-visible{
  outline:.8333cqw solid #d17d28!important;outline-offset:-.8333cqw
}
.frlgSummaryMoveRow.selected{outline:.8333cqw solid #d17d28!important;outline-offset:-.8333cqw}
.frlgSummaryMoveRow>div{font-size:0;line-height:0;display:flex;flex-direction:column;overflow:hidden;white-space:nowrap}
.frlgSummaryMovePp{position:absolute;right:.4167cqw;top:3.3333cqw}
.frlgSummaryMoveBack{
  position:absolute;border:0;background:transparent;padding:0;margin:0;
}
.frlgSummaryPlain{position:absolute}
.frlgSummaryExit{
  position:absolute;right:1.6667cqw;bottom:1.6667cqw;z-index:10;
  min-width:20cqw;height:8.3333cqw;padding:0 1.6667cqw!important;
  border:1.25cqw solid #50667a!important;background:#f9f7df!important;
  box-shadow:inset 0 0 0 .4167cqw #fff!important;border-radius:0!important;
  font-size:0!important;display:flex!important;align-items:center!important;justify-content:center!important;
}

/* FireRed PC Storage: original 240x160 tilemap stays underneath dynamic sprites. */
.frlgPcDataSprite,.frlgPcMonIcon{
  position:absolute;object-fit:contain;image-rendering:pixelated;z-index:4
}
.frlgPcMonIcon.frlgPcMiniFront{width:6.6667cqw!important;height:6.6667cqw!important}
.frlgPcDataName,.frlgPcDataLevel,.frlgPcDataNote,.frlgPcBoxTitle{z-index:6}
.frlgPcBoxTitle{justify-content:center;align-items:center;text-align:center}
.frlgPcDynamic.frlgPcTopHit,.frlgPcDynamic.frlgPcMonHit,.frlgPcPartyCancel{
  position:absolute;border:0!important;background:transparent!important;padding:0!important;margin:0!important;
  -webkit-tap-highlight-color:transparent;z-index:8
}
.frlgPcMonHit:focus-visible{outline:.8333cqw solid #f4d52d!important;outline-offset:-.8333cqw}
.frlgPcActionMenu{
  position:absolute;z-index:20;background:#fff!important;border:1.25cqw solid #5b6570!important;
  box-shadow:inset 0 0 0 .8333cqw #e4eeee!important;padding:1.25cqw!important;
  display:grid!important;grid-auto-rows:8.3333cqw;gap:.4167cqw!important;
}
.frlgPcActionMenu[hidden]{display:none!important}
.frlgPcActionButton{
  border:0!important;background:#fff!important;padding:0 1.25cqw!important;margin:0!important;
  display:flex!important;align-items:center!important;justify-content:flex-start!important;
  font-size:0!important;text-align:left!important;
}
.frlgPcActionButton:focus,.frlgPcActionButton:active{background:#fff3a8!important}
#gameFrame.frlg-pc-open #mobileControls,
#gameFrame.frlg-pc-open #profileChip,
#gameFrame.frlg-pc-open .berryHud,
#gameFrame.frlg-pc-open .globalChat,
#gameFrame.frlg-pc-open #updatesButton,
#gameFrame.frlg-pc-open #suggestButton,
#gameFrame.frlg-summary-open #mobileControls,
#gameFrame.frlg-summary-open #profileChip,
#gameFrame.frlg-summary-open .berryHud,
#gameFrame.frlg-summary-open .globalChat,
#gameFrame.frlg-summary-open #updatesButton,
#gameFrame.frlg-summary-open #suggestButton{
  display:none!important
}


/* FRLG UI correction pass: exact geometry + no site chrome over game menus. */
.frlgSummaryControlHit{
  left:auto!important;right:0!important;top:0!important;bottom:auto!important;
  width:36.6667cqw!important;height:6.6667cqw!important;min-width:0!important;
  padding:0!important;margin:0!important;border:0!important;border-radius:0!important;
  background:transparent!important;box-shadow:none!important;z-index:5!important;
  opacity:0!important;
}
.frlgPcDataName,.frlgPcDataSpecies,.frlgPcDataLevel,.frlgPcDataItem{
  position:absolute!important;font-size:0!important;line-height:0!important;
  display:flex!important;flex-direction:column!important;align-items:flex-start!important;
  overflow:hidden!important;z-index:6!important;
}
#gameFrame.frlg-pc-open #updatesDock,
#gameFrame.frlg-pc-open #suggestionsDock,
#gameFrame.frlg-summary-open #updatesDock,
#gameFrame.frlg-summary-open #suggestionsDock{
  display:none!important;
}

.frlgSummaryTypeIcon{position:absolute;display:block;overflow:hidden;image-rendering:pixelated;background-repeat:no-repeat;z-index:5}
.frlgSummaryExpBar{position:absolute;display:block;background:#57b9c5;border:.35cqw solid #41616f;box-sizing:border-box;z-index:5}
@keyframes frlgSummarySpriteIn{
  from{opacity:0;transform:translateY(1.25cqw)}
  to{opacity:1;transform:translateY(0)}
}
.frlgSummaryMon{animation:frlgSummarySpriteIn .18s steps(3,end) both}
@media (prefers-reduced-motion:reduce){.frlgSummaryMon{animation:none}}
/* Four player interaction choices share the FireRed canvas menu coordinates. */
#onlinePrompt .onlinePromptButtons.fourChoice{
  left:46.6667cqw!important;
  top:-32.5cqw!important;
  width:51.6667cqw!important;
  height:30.8333cqw!important;
  padding:0!important;
  border:0!important;
  box-shadow:none!important;
  display:grid!important;
  grid-template-rows:repeat(4,1fr)!important;
  background:#f8f8f0!important;
  background-image:none!important;
}
#onlinePrompt .onlinePromptButtons.fourChoice button{
  padding-left:6.6667cqw!important;
  align-items:center!important;
  overflow:hidden!important;
}
#onlinePrompt .onlinePromptButtons.fourChoice .frGlyph{
  background-image:url("./native/fr_font_dark.png")!important;
}
.onlinePromptFourChoice .onlinePromptText{width:45cqw!important;}


/* -------------------------------------------------------------------------- */
/* Active player list                                                          */
/* -------------------------------------------------------------------------- */
.playerListDock{
  position:absolute;left:144px;top:46px;z-index:141;
  pointer-events:none;font-family:"Courier New",monospace;image-rendering:pixelated;
}
.playerListToggle{
  min-width:62px;height:25px;padding:2px 7px;
  border:6px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;
  background:#ffffde;color:#414141;font:900 8px/1 "Courier New",monospace;
  pointer-events:auto;touch-action:manipulation;
}
.playerListPanel{
  position:absolute;left:0;top:31px;width:min(330px,90vw);height:min(260px,66vh);
  display:grid;grid-template-rows:25px 1fr;
  border:8px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 8px / 0 stretch;
  background:#ffffde;color:#414141;box-shadow:5px 5px 0 #526a62;
  pointer-events:auto;touch-action:manipulation;
}
.playerListHeader{
  display:flex;align-items:center;justify-content:space-between;padding:0 4px 2px;
  border-bottom:1px solid #9a967f;font:900 9px/1 "Courier New",monospace;
}
.playerListHeader button{
  width:26px;height:22px;border:0;background:transparent;color:#414141;
  font-size:18px;font-weight:900;line-height:18px;
}
.playerListRows{
  min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px;background:#fffde8;
  touch-action:pan-y;
}
.playerListRow{
  padding:4px 3px 5px;margin:0 0 4px;border-bottom:1px dashed #aaa58d;
  font:700 9px/1.2 "Courier New",monospace;
}
.playerListRow:last-child{border-bottom:0;margin-bottom:0}
.playerListName{display:flex;align-items:center;gap:6px;color:#355caa}
.playerListName strong{font:900 10px/1.15 "Courier New",monospace;overflow-wrap:anywhere}
.playerListName span{padding:1px 3px;border:1px solid #58775d;color:#3e7651;font:900 7px/1 "Courier New",monospace}
.playerListLocation{margin-top:2px;color:#414141;font:800 8px/1.2 "Courier New",monospace}
.playerListDetail{display:flex;justify-content:space-between;gap:8px;margin-top:2px;color:#6a604d;font:800 8px/1.2 "Courier New",monospace}
.playerListEmpty{padding:8px 5px;font:800 9px/1.2 "Courier New",monospace;color:#666}
.playerListSelf{background:#f4f6d4}

#gameFrame.dialog-open .playerListDock,
#gameFrame.battle-active .playerListDock,
#gameFrame.battle-prompt-open .playerListDock,
#gameFrame.team-open .playerListDock,
#gameFrame.recruit-open .playerListDock,
#gameFrame.piccolo-recruit-open .playerListDock,
#gameFrame.overworld-combat .playerListDock,
#gameFrame.field-menu-open .playerListDock,
#gameFrame.bag-open .playerListDock,
#gameFrame.shop-open .playerListDock,
#gameFrame.slot-open .playerListDock{
  opacity:0!important;pointer-events:none!important;
}
#gameFrame.frlg-pc-open .playerListDock,
#gameFrame.frlg-summary-open .playerListDock{
  display:none!important;
}
@media(max-width:560px),(hover:none){
  .playerListDock{
    left:calc(var(--ui-safe-left) + 136px);
    top:max(44px,calc(env(safe-area-inset-top) + 42px));
  }
  .playerListPanel{
    left:calc(-1 * (var(--ui-safe-left) + 136px));
    width:min(330px,94vw);height:min(240px,58vh);
  }
}


/* -------------------------------------------------------------------------- */
/* FireRed audio toggle                                                        */
/* -------------------------------------------------------------------------- */
.audioDock{
  position:absolute;left:266px;top:46px;z-index:143;
  pointer-events:none;font-family:"Courier New",monospace;image-rendering:pixelated;
}
.audioToggle{
  min-width:52px;height:25px;padding:2px 7px;
  border:6px solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 6px / 0 stretch;
  background:#ffffde;color:#414141;font:900 8px/1 "Courier New",monospace;
  pointer-events:auto;touch-action:manipulation;
}
.audioToggle.is-muted{color:#a33a3a}

#gameFrame.dialog-open .audioDock,
#gameFrame.battle-active .audioDock,
#gameFrame.battle-prompt-open .audioDock,
#gameFrame.team-open .audioDock,
#gameFrame.recruit-open .audioDock,
#gameFrame.piccolo-recruit-open .audioDock,
#gameFrame.special-event-open .audioDock,
#gameFrame.training-open .audioDock,
#gameFrame.chansey-egg-open .audioDock,
#gameFrame.overworld-combat .audioDock,
#gameFrame.field-menu-open .audioDock,
#gameFrame.bag-open .audioDock,
#gameFrame.shop-open .audioDock,
#gameFrame.slot-open .audioDock{
  opacity:0!important;pointer-events:none!important;
}
#gameFrame.pc-open .audioDock,
#gameFrame.summary-open .audioDock,
#gameFrame.frlg-pc-open .audioDock,
#gameFrame.frlg-summary-open .audioDock{
  display:none!important;
}
@media(max-width:560px),(hover:none){
  .audioDock{
    left:calc(var(--ui-safe-left) + 258px);
    top:max(44px,calc(env(safe-area-inset-top) + 42px));
  }
}

/* Competitive Season 1 — bright, legible legacy markers in pixel-sized PC slots. */
.competitiveLegacyIcon{
  display:inline-flex;align-items:center;justify-content:center;
  width:12px;height:12px;flex:none;border:1px solid #181c30;
  background:#e4c66b;color:#24243f;
  font:700 9px/1 sans-serif;box-shadow:0 1px 0 #fff8;
  border-radius:2px;pointer-events:none;z-index:7;
}
.frlgPcDynamic.competitiveLegacyIcon{
  box-sizing:border-box;width:3.8%;height:5.6%;font-size:clamp(6px,.85vw,10px);
  border-width:1px;line-height:1;
}
.competitiveLegacyMessage{
  position:absolute!important;left:19%!important;top:34%!important;
  width:63%!important;min-height:24%;box-sizing:border-box;padding:8px;
  background:#f4f5db;color:#202738;border:3px double #36364b;
  font:700 clamp(11px,1.25vw,15px)/1.4 sans-serif;
  white-space:normal;z-index:1200;pointer-events:none;
  box-shadow:0 5px 14px #0009;
}

/* The retired Alté button is never presented, even under legacy theme rules. */
button[data-battle-action="alte"]{display:inline-flex!important;}


/* Machop: FireRed Move Reminder layout, original two-panel organization. */
.specialPrompt.three-choice{height:25cqw;background-size:100cqw 25cqw}
.specialPrompt.three-choice .specialPromptButtons{
  top:1.6cqw;height:21cqw;grid-template-rows:repeat(3,1fr)
}
.specialPromptButtons button[hidden]{display:none!important}
#trainingLayer.machop-screen{background:#172b28}
#trainingLayer.machop-screen .trainingPanel{display:none}
.machopReminder{
  position:absolute;inset:0;
  display:grid;grid-template-columns:60% 40%;grid-template-rows:minmax(0,69%) minmax(0,31%);
  background:#a1e0d5;color:#222;image-rendering:pixelated;
  overflow:hidden;
  font:900 3cqw/1.18 "Courier New",monospace;
}
.machopReminder[hidden]{display:none!important}
.machopInfo{
  grid-column:1;grid-row:1;
  min-width:0;min-height:0;overflow:hidden;
  box-sizing:border-box;
  border:.85cqw solid #354e46;
  background:
    repeating-linear-gradient(0deg,rgba(255,255,255,.22) 0 .35cqw,transparent .35cqw 1.4cqw),
    linear-gradient(#8cdbce,#c0f6dc);
  padding:2cqw 2.5cqw;display:flex;flex-direction:column;
}
.machopMoveStats{
  display:grid;grid-template-columns:1fr 1fr;grid-template-rows:repeat(2,auto);
  gap:2cqw 2cqw; flex:0 0 auto;
}
.machopStatLine{display:flex;justify-content:space-between;gap:.8cqw;align-items:center;min-width:0;font-size:2.9cqw}
.machopStatLine span{background:#152323;color:#fff;padding:.5cqw .8cqw;white-space:nowrap}
.machopStatLine strong{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:clip;text-align:right;background:#f2e0a8;color:#37302a;padding:.4cqw .5cqw}
.machopEffectTitle{margin-top:3.2cqw;padding:.6cqw 1cqw;background:#182c2a;color:white;align-self:flex-start}
.machopEffect{margin:1.8cqw 1cqw 0;font:700 3.4cqw/1.37 "Courier New",monospace;white-space:pre-wrap;overflow-y:auto;overflow-wrap:anywhere}
.machopMovePanel{
  grid-column:2;grid-row:1;
  min-width:0;min-height:0;
  padding:1.7cqw 1.5cqw;
  border:.95cqw solid #929ba8;
  box-shadow:inset 0 0 0 .85cqw #fcfcfc,inset 0 0 0 1.6cqw #a3a6ad;
  background:#fff;
}
.machopMoveOptions{height:100%;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;display:flex;flex-direction:column}
.machopMoveOptions button{
  display:block;flex:none;position:relative;
  width:100%;border:0;
  padding:1.1cqw .3cqw 1.1cqw 4.2cqw;margin:0;
  background:transparent;color:#222;
  text-align:left;white-space:normal;
  overflow-wrap:anywhere;min-height:6.2cqw;
  font:900 3cqw/1.1 "Courier New",monospace;
}
.machopMoveOptions button[disabled]{opacity:.36}
.machopMoveOptions button.selected{background:#e4eee6}
.machopMoveOptions button.selected::before{
  content:"";position:absolute;left:1.2cqw;top:2.3cqw;
  border-top:1.2cqw solid transparent;border-bottom:1.2cqw solid transparent;border-left:1.7cqw solid #242424;
}
.machopMoveOptions button:focus-visible{outline:.6cqw solid #d84d6b;outline-offset:-.7cqw}
.machopPrompt{
  grid-column:1/3;grid-row:2;
  position:relative;display:flex;align-items:center;
  background:#fff;box-sizing:border-box;
  border:2.2cqw solid #a5a9ac;
  box-shadow:inset 0 0 0 .7cqw #e4e6e6;
  padding:2.6cqw 16cqw 2.6cqw 3.5cqw;
  font:900 3.4cqw/1.25 "Courier New",monospace;
}
.machopPrompt>span{overflow-wrap:anywhere}
.machopPromptBack{
  position:absolute;bottom:2.1cqw;right:2.2cqw;
  border:.65cqw solid #929da2;background:#ecf2e9;
  padding:1cqw 1.1cqw;
  font:900 2.5cqw/1 "Courier New",monospace;
}


/* FireRed Move Relearner reconstruction from pokefirered-master:
 * graphics/interface/learn_move.png + learn_move.bin, tilemap 30x20.
 * src/learn_move.c windows 6=(19,1,10,12) and 7=(2,15,26,4).
 * Position values below use the original 240x160 GBA coordinates. */
#gameFrame .machopReminder{
  position:absolute;inset:0;display:block;overflow:hidden;
  background-color:#b4eedf;
  background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAACgCAYAAAAy2+FlAAAB4UlEQVR42u3bIQ7CQBBA0SlBgERyBK5VyRWKhCOAA4dFVnKE2kokEgkObkBSGgqbfc/iJmx+JukU5bJ6BvRw2G3e/VyY0PeMjIC+ymVlCD8yXm/XpkBnze0SERGn1d4wFBj4qMBtXE2Bzur2bAj/8IDvt4cpQKoPeDqbmAIoMKDAgAKDAgMKDCgwoMCgwIACAwoMCgwoMKDAgAKDAgMKDCgwoMCgwIACAwoMCgwoMKDAgAKDAgMKDCgwoMCgwIACAwoMCgwoMKDAgAKDAgMKDCgwKDCgwIACAwoMCgwoMKDAgAKDAgMKDCgwKDCgwIACA70LvIi5KWWsjashpFzgJi6mBHZgwA4MKDAoMKDAgAKDAgMKDCgwoMCgwIACA8MV2DVS3lwjJV5g10hgBwbswIACgwIDCgwoMCgwoMCAAgMKDAoMKDAwaIFdI+XNNVLiBXaNBHZgwA4MKDAoMKDAgAKDAgMKDCgwoMCgwIACA4MW2DVS3lwjJV5g10hgBwbswIACgwIDCgwoMGT5gOv2bAqQqJERQMIFfhx9qAEKTLYOu40h/EgREU9j4Mv/MRQY8IDBAwY8YMADBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADy9ALGFcYrrX/JWQAAAABJRU5ErkJggg==");
  background-repeat:no-repeat;background-position:0 0;background-size:100% 100%;
  font-family:"Courier New",monospace;
  image-rendering:pixelated;
}
#gameFrame .machopReminder[hidden]{display:none!important}
#gameFrame .machopReminder .machopInfo{
  position:absolute;left:0;top:0;width:60.4167cqw;height:46.6667cqw;
  padding:0;display:block;border:0;box-shadow:none;background:transparent;overflow:hidden;
}
#gameFrame .machopMoveStats{
  position:absolute;inset:0 0 auto 0;width:100%;height:14.5cqw;display:block;
}
#gameFrame .machopStatLine{
  position:absolute;display:flex;align-items:center;justify-content:space-between;
  gap:.35cqw;margin:0;padding:0;min-width:0;height:5.1cqw;
  font:900 2.9cqw/1 "Courier New",monospace;white-space:nowrap;
}
#gameFrame .machopStatLine:nth-child(1){left:1cqw;top:1.3cqw;width:30cqw}
#gameFrame .machopStatLine:nth-child(2){left:34cqw;top:1.3cqw;width:24.5cqw}
#gameFrame .machopStatLine:nth-child(3){left:1cqw;top:7.9cqw;width:30cqw}
#gameFrame .machopStatLine:nth-child(4){left:34cqw;top:7.9cqw;width:24.5cqw}
#gameFrame .machopStatLine span{
  background:#26352f;color:#fff;padding:.5cqw .6cqw;
  font:inherit;flex:0 1 auto;
}
#gameFrame .machopStatLine strong{
  font:inherit;background:#e2d6a0;color:#392f29;
  padding:.5cqw .45cqw;min-width:0;text-align:center;
  white-space:nowrap;overflow:hidden;
}
#gameFrame .machopEffectTitle{
  position:absolute;top:15cqw;left:.4cqw;
  background:#25342e;color:#fff;margin:0;padding:.5cqw .8cqw;
  font:900 3.1cqw/1.1 "Courier New",monospace;
}
#gameFrame .machopEffect{
  position:absolute;top:21.5cqw;left:7cqw;right:4cqw;bottom:.9cqw;
  margin:0;padding:0;max-height:none;overflow-y:auto;
  color:#404641;font:700 3.6cqw/1.32 "Courier New",monospace;
  overflow-wrap:normal;word-break:normal;white-space:pre-wrap;
}
#gameFrame .machopMovePanel{
  position:absolute;left:60.4167cqw;top:0;width:39.5833cqw;height:46.6667cqw;
  padding:0;box-sizing:border-box;border:0;box-shadow:none;
  background:repeating-conic-gradient(#91929c 0% 25%,#dedfe7 0% 50%) 0 0/1.25cqw 1.25cqw;
}
#gameFrame .machopMovePanel::before{
  content:"";position:absolute;inset:1.45cqw;
  background:#fff;border:.55cqw solid #c2c3c9;pointer-events:none;
}
#gameFrame .machopMoveOptions{
  position:absolute;left:3.2cqw;top:2.2cqw;right:2.2cqw;bottom:2.2cqw;
  z-index:1;height:auto;margin:0;padding:0;
  overflow-y:auto;display:flex;flex-direction:column;scrollbar-width:thin;
}
#gameFrame .machopMoveOptions button{
  position:relative;flex:none;display:block;box-sizing:border-box;width:100%;
  margin:0;padding:.7cqw .4cqw .7cqw 3.7cqw;min-height:6cqw;
  border:0;border-radius:0;background:transparent;color:#363331;
  font:900 3.05cqw/1.2 "Courier New",monospace;
  white-space:nowrap;overflow:hidden;text-overflow:clip;
}
#gameFrame .machopMoveOptions button.selected{background:transparent}
#gameFrame .machopMoveOptions button.selected::before{
  left:.65cqw;top:1.65cqw;
  border-top:1.35cqw solid transparent;
  border-bottom:1.35cqw solid transparent;
  border-left:1.75cqw solid #242424;
}
#gameFrame .machopPrompt{
  position:absolute;left:3.3333cqw;top:46.6667cqw;
  width:93.3333cqw;height:20cqw;display:flex;align-items:flex-start;
  box-sizing:border-box;overflow:hidden;padding:4cqw 16cqw 3.2cqw 3.5cqw;
  border:1.8cqw solid transparent;box-shadow:inset 0 0 0 .65cqw #e7e8ed;
  background:
    linear-gradient(#fff,#fff) padding-box,
    repeating-conic-gradient(#8f939e 0% 25%,#e5e7eb 0% 50%) 0 0/1.25cqw 1.25cqw border-box;
  color:#3d3c40;
  font:700 3.25cqw/1.24 "Courier New",monospace;
}
#gameFrame .machopPrompt::before{
  content:"";position:absolute;inset:-1.8cqw;z-index:0;pointer-events:none;
  border:1.5cqw solid transparent;
  border-image:none;
}
#gameFrame .machopPrompt>span{position:relative;z-index:1;max-width:100%;overflow-wrap:normal}
#gameFrame .machopPromptBack{
  position:absolute;right:1.6cqw;bottom:1.3cqw;z-index:2;
  border:.45cqw solid #9ba1a2;background:#f0f2ef;color:#353535;
  border-radius:0;padding:.5cqw .8cqw;
  font:900 2.5cqw/1 "Courier New",monospace;
}
/* The player, berry HUD and site utility docks are only for the overworld.
 * They must never sit over battle, party, inventory, dialogue or full-screen UI. */
#gameFrame:is(.dialog-open,.special-event-open,.training-open,.team-open,.field-menu-open,
 .bag-open,.pc-open,.frlg-pc-open,.summary-open,.frlg-summary-open,.battle-active,
 .battle-prompt-open,.recruit-open,.piccolo-recruit-open,.chansey-egg-open,
 .overworld-combat,.shop-open,.slot-open,.evolution-open,.gym-open,.trade-open)
:is(#profileChip,.berryHud,#tileCoords,.updatesDock,.suggestionsDock,.playerListDock,.globalChat,.audioDock),
#gameFrame:has(:is(#dialog,#specialPrompt,#trainingLayer,#teamLayer,#fieldMenu,
 #battleLayer,#onlinePrompt,#battlePrompt):not([hidden]))
:is(#profileChip,.berryHud,#tileCoords,.updatesDock,.suggestionsDock,.playerListDock,.globalChat,.audioDock){
  display:none!important;pointer-events:none!important;
}
/* Canvas renders the real NPC question. Keep DOM hit targets directly above
 * the rendered choice rows, including Machop's third CANCEL button. */
html.firered-canvas-ready #specialPrompt{
  position:absolute!important;inset:0!important;
  left:0!important;right:0!important;top:0!important;bottom:0!important;
  width:100%!important;height:100%!important;
  background:none!important;opacity:0!important;pointer-events:none!important;
}
html.firered-canvas-ready #specialPrompt .specialPromptText{pointer-events:none!important}
html.firered-canvas-ready #specialPrompt .specialPromptButtons{
  position:absolute!important;
  left:66.6667cqw!important;top:26.6667cqw!important;bottom:auto!important;
  width:26.6667cqw!important;height:20cqw!important;
  display:grid!important;grid-template-rows:repeat(2,1fr)!important;
  padding:0!important;gap:0!important;pointer-events:auto!important;
}
html.firered-canvas-ready #specialPrompt.three-choice .specialPromptButtons{
  left:61.6667cqw!important;top:18.75cqw!important;
  width:37.5cqw!important;height:27.9167cqw!important;
  grid-template-rows:repeat(3,1fr)!important;
}
html.firered-canvas-ready #specialPrompt .specialPromptButtons button{
  width:100%;height:100%;min-height:0!important;margin:0!important;padding:0!important;
  pointer-events:auto!important;
}


/* Cody's Pokemon World start screen: reference composition with the user's
   actual muted blue Poké Ball wallpaper, and the game's existing starter sprites. */
.authLayer{
  align-items:flex-start;justify-content:center;
  padding:max(18px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right))
          max(18px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  background:#1c517b url('./native/login-blue-grid.webp') center center/cover no-repeat;
  background-attachment:local;
}
.authScreen{
  display:flex;flex-direction:column;align-items:center;
  width:min(702px,100%);max-width:702px;margin:auto;
  background:none;border:0;outline:0;box-shadow:none;
  color:#143960;image-rendering:pixelated;
}
.authHero{
  width:100%;box-sizing:border-box;display:block;flex:none;
  padding:4px 4px 10px;border:0;margin:0;
  overflow:visible;color:#fff;background:transparent;text-align:center;
}
.authHero::before{display:none}
.authHeroInner{text-align:center}
.authEyebrow{
  color:#f8e59e;font:900 clamp(12px,1.45vw,18px)/1.35 "Courier New",monospace;
  text-shadow:2px 2px 0 #113c65;letter-spacing:.1em;
}
.authLogo{
  margin:12px auto 2px;width:max-content;max-width:100%;
  color:#ffda42;font:1000 clamp(42px,5vw,66px)/.96 "Trebuchet MS",Arial,sans-serif;
  letter-spacing:-.09em;-webkit-text-stroke:2.5px #184d98;
  text-shadow:3px 3px 0 #103c81,5px 6px 0 white,7px 7px 0 #0c2e66;
}
.authLogo span{
  display:block;margin:8px auto 0;width:max-content;
  padding:8px 13px;border:3px solid #ffefc5;
  background:#be2d36;color:#fff;text-shadow:1px 1px 0 #581b2b;
  font:900 clamp(13px,1.65vw,19px)/1 "Courier New",monospace;
  letter-spacing:.12em;-webkit-text-stroke:0;box-shadow:3px 3px 0 #153a60;
}
.authMascots{
  display:flex;justify-content:center;align-items:flex-end;
  width:min(480px,100%);margin:10px auto 0;padding:0 12px 8px;
  min-height:104px;box-sizing:border-box;border-bottom:3px solid #86b0c4;
  gap:5px;
}
.authMascots img,.authMascots img:nth-child(2){
  object-fit:contain;width:auto;height:110px;max-width:30%;max-height:110px;
  margin:0;image-rendering:pixelated;
  filter:drop-shadow(3px 4px 0 #0b375d);
}
.authMascots img:nth-child(2){height:122px;max-height:122px;max-width:36%}
.authCopy,.authHeroFoot{display:none!important}
.authPanel{
  position:relative;box-sizing:border-box;width:100%;min-width:0;
  padding:26px clamp(22px,4vw,50px) 22px;
  border:6px solid #11335c;outline:3px solid #22446d;
  background:#fcf9e9;color:#123761;
  box-shadow:7px 9px 0 rgba(9,31,54,.6);
  clip-path:polygon(2.3% 0,97.7% 0,97.7% 1.6%,100% 1.6%,
    100% 98.4%,97.7% 98.4%,97.7% 100%,2.3% 100%,
    2.3% 98.4%,0 98.4%,0 1.6%,2.3% 1.6%);
}
.authPanelIndex,.authTabs{display:none!important}
.authPanelHead{text-align:center}
.authPanelHead h1{
  margin:0 0 4px;color:#103963;
  font:900 clamp(26px,3.1vw,40px)/1.15 "Courier New",monospace;
  letter-spacing:-.035em;
}
.authPanelHead p{
  margin:0 0 19px;color:#163f68;font:700 clamp(13px,1.35vw,17px)/1.35 "Courier New",monospace;
}
#authForm{display:grid;gap:8px;grid-template-columns:1fr}
#authForm label{color:#143a64;font:900 16px/1.1 "Courier New",monospace;letter-spacing:.035em}
#authForm input{
  width:100%;box-sizing:border-box;min-height:49px;
  padding:10px 16px;margin:0 0 8px;border:4px solid #476966;
  background:#fffdee;color:#183b56;
  font:700 17px/1.2 "Courier New",monospace;
  box-shadow:inset 0 0 0 2px #d6d7c5;
}
#authForm input:focus{border-color:#225b93;box-shadow:inset 0 0 0 2px #b7d6de}
#authSubmit,.authSignupAction,.authGuest{
  display:block;box-sizing:border-box;width:100%;min-height:54px;
  margin:6px 0 0;border:4px solid #34555d;border-radius:0;
  color:#2d5057;background:#f1f1e3;
  font:900 clamp(15px,1.55vw,19px)/1.15 "Courier New",monospace;
  letter-spacing:.05em;text-align:center;
  cursor:pointer;touch-action:manipulation;
  box-shadow:inset 0 0 0 2px white,3px 4px 0 #aab5ac;
}
#authSubmit{
  margin-top:7px;border-color:#103867;background:#235b9b;color:white;
  box-shadow:inset 0 0 0 2px #9abedc,3px 4px 0 #aab5ac;
}
#authSubmit::before,.authGuest::before{
  position:absolute;left:18px;top:50%;transform:translateY(-50%);
  content:"▶";font-size:17px;
}
.authSignupAction:focus-visible,#authSubmit:focus-visible,.authGuest:focus-visible{
  outline:3px solid #d5a74a;outline-offset:2px;
}
.authSignupAction:active,#authSubmit:active,.authGuest:active{transform:translate(2px,2px)}
.authError,.authResult{margin:10px 0;font:800 13px/1.35 "Courier New",monospace}
.authGuestArea{margin:11px 0 0;padding:0;border:0}
.authDivider{
  position:relative;display:flex;gap:10px;align-items:center;justify-content:center;
  font:900 13px/1.1 "Courier New",monospace;color:#71828b;
}
.authDivider::before,.authDivider::after{content:"";display:block;height:2px;flex:1;background:#c8cfbf}
.authGuest{
  position:relative;margin-top:11px;background:#eff6dd;
  color:#2a5548;border-color:#385e51;
}
.authGuestArea p{display:none}
@media(max-width:760px){
  .authLayer{align-items:flex-start;padding:max(12px,env(safe-area-inset-top)) 12px max(20px,env(safe-area-inset-bottom))}
  .authScreen{display:flex;flex-direction:column;width:min(550px,100%);max-width:550px;border:0;outline:0;box-shadow:none}
  .authHero{padding:4px 0 7px;border:0}
  .authEyebrow{font-size:clamp(10px,3vw,15px)}
  .authLogo{margin:9px auto 4px;font-size:clamp(38px,10vw,57px);max-width:100%}
  .authLogo span{font-size:13px;margin-top:6px;padding:6px 11px}
  .authMascots{width:min(370px,93%);min-height:0;margin:8px auto 0;gap:4px;padding:0 0 6px}
  .authMascots img,.authMascots img:nth-child(2){max-width:31%;height:75px;max-height:75px}
  .authMascots img:nth-child(2){max-width:35%;height:85px;max-height:85px}
  .authPanel{padding:20px clamp(14px,4vw,24px) 17px;border-width:4px;outline-width:2px;box-shadow:4px 6px 0 #102a46a6}
  .authPanelHead h1{font-size:clamp(23px,6vw,31px)}
  .authPanelHead p{font-size:12px;margin-bottom:15px}
  #authForm label{font-size:13px}
  #authForm input{min-height:43px;margin-bottom:5px;font-size:16px}
  #authSubmit,.authSignupAction,.authGuest{min-height:46px;font-size:14px}
}
@media(max-width:380px){
  .authPanel{padding:15px 14px}
  .authMascots img,.authMascots img:nth-child(2){height:65px}
  .authLogo{font-size:37px}
}
@media(min-width:761px) and (max-height:760px){
  .authPanel{padding-top:17px;padding-bottom:15px}
  .authMascots{min-height:83px;margin-top:5px}
  .authMascots img,.authMascots img:nth-child(2){height:90px}
  .authHero{padding-top:0}
  #authForm input{min-height:42px;margin-bottom:3px}
  #authSubmit,.authSignupAction,.authGuest{min-height:45px}
}


/* Move reminder: original FireRed 240x160 positions and native glyph tiles.
 * All measurements track the GBA frame (1px=0.416667cqw). */
#gameFrame .machopReminder :is(.machopStatLine,.machopEffectTitle,.machopEffect,.machopMoveOptions button,.machopPrompt>span){
  font-size:0!important;letter-spacing:0!important;line-height:0!important;
}
#gameFrame .machopReminder .frTextLine{display:flex;align-items:flex-start;white-space:nowrap;flex:none}
#gameFrame .machopReminder .machopStatLine{
  height:5.8333cqw;align-items:center;gap:.5cqw;
}
#gameFrame .machopReminder .machopStatLine span{
  display:flex;align-items:center;background:#283930;box-sizing:border-box;
  height:5.4167cqw;padding:0 .7cqw;min-width:0;
}
#gameFrame .machopReminder .machopStatLine strong{
  display:flex;align-items:center;justify-content:center;box-sizing:border-box;
  height:5.4167cqw;padding:0 .4cqw;
  color:#49443d;background:#e6d9a8;
}
#gameFrame .machopReminder .machopStatLine :is(span,strong) .frTextLine,
#gameFrame .machopReminder .machopEffectTitle .frTextLine{
  height:6.6667cqw;transform:scale(.72);transform-origin:center left;
}
#gameFrame .machopReminder .machopStatLine:nth-child(1){left:1.7cqw;top:1.2cqw;width:28.5cqw}
#gameFrame .machopReminder .machopStatLine:nth-child(2){left:33.5cqw;top:1.2cqw;width:24.7cqw}
#gameFrame .machopReminder .machopStatLine:nth-child(3){left:1.7cqw;top:7.4cqw;width:28.5cqw}
#gameFrame .machopReminder .machopStatLine:nth-child(4){left:33.5cqw;top:7.4cqw;width:24.7cqw}
#gameFrame .machopReminder .machopEffectTitle{
  top:15.2cqw;left:1.1cqw;height:6cqw;box-sizing:border-box;
  display:flex;align-items:center;padding:0 .5cqw;
}
#gameFrame .machopReminder .machopEffect{top:22cqw;left:7.5cqw;right:2cqw;bottom:1.4cqw}
#gameFrame .machopReminder .machopEffect .frTextLine{
  height:5.6cqw;max-height:5.6cqw;
}
#gameFrame .machopReminder .machopMoveOptions{left:3.25cqw;top:2.7cqw;right:1.65cqw;bottom:1.8cqw}
#gameFrame .machopReminder .machopMoveOptions button{
  display:flex;align-items:center;height:6.45cqw;min-height:6.45cqw;
  padding:0 .3cqw 0 4cqw;text-align:left;white-space:nowrap;overflow:hidden;
}
#gameFrame .machopReminder .machopMoveOptions button .frTextLine{
  transform:scale(.84);transform-origin:left center;
}
#gameFrame .machopReminder .machopMoveOptions button.selected::before{top:2.25cqw}
#gameFrame .machopReminder .machopPrompt{
  top:46.6667cqw;left:3.3333cqw;height:20cqw;width:93.3333cqw;
  padding:3.4cqw 3.6cqw;
  align-items:flex-start;
}
#gameFrame .machopReminder .machopPrompt>span{
  display:flex;flex-direction:column;align-items:flex-start;
  width:100%;max-width:100%;height:auto;overflow:hidden;
}
#gameFrame .machopReminder .machopPrompt>span .frTextLine{height:6.4cqw}
#gameFrame .machopReminder .machopPromptBack{
  right:1.6cqw;bottom:1.15cqw;
  border:.42cqw solid #b8bec1;background:#f9faf8;
  box-shadow:none;color:#4b5557;font:900 2.3cqw/1 "Courier New",monospace;
  padding:.35cqw .7cqw;opacity:.75;
}


/* Main Menu revision — the FireRed field menu has six destinations.
 * Button order: TEAM, BAG, SUGGEST, SOUND, LOG OUT, CANCEL. */
#gameFrame .fieldMenu{
  top:2.5cqw;right:2.25cqw;width:44cqw;
  box-sizing:border-box;
  padding:.9cqw;
  display:grid;
  grid-template-rows:repeat(6,8.65cqw);
  height:60.1cqw;
  gap:0;
  overflow:hidden;
}
#gameFrame .fieldMenu button{
  padding:0 .6cqw 0 7.6cqw;min-height:0;
  justify-content:flex-start;white-space:nowrap;overflow:hidden;
}
#gameFrame .fieldMenu button .frTextLine{max-width:100%}
#gameFrame .fieldMenu .frMenuCursor{left:3.7cqw!important}

/* The old profile panel and the old text utility buttons have been retired.
   Keep their underlying controls for account logout and suggestions compatibility. */
#gameFrame #profileChip,
#gameFrame #audioDock,
#gameFrame #suggestionsToggle{display:none!important}
#gameFrame .berryHud{
  left:8px;right:auto;top:max(8px,env(safe-area-inset-top));
}

/* The three new top-right shortcuts use genuine 24x24 FireRed item artwork. */
#gameFrame{
  --poke-shortcut-size:clamp(32px,7.5cqw,56px);
  --poke-shortcut-gap:clamp(3px,1.0cqw,7px);
}
#gameFrame .updatesDock,
#gameFrame .playerListDock,
#gameFrame .globalChat{
  position:absolute;left:auto!important;right:1.4cqw!important;
  bottom:auto!important;
  width:var(--poke-shortcut-size);
  height:var(--poke-shortcut-size);
  display:block;
  pointer-events:none;
  z-index:143;
}
#gameFrame .updatesDock{top:1.8cqw!important}
#gameFrame .playerListDock{
  top:calc(1.8cqw + var(--poke-shortcut-size) + var(--poke-shortcut-gap))!important;
}
#gameFrame .globalChat{
  top:calc(1.8cqw + 2 * (var(--poke-shortcut-size) + var(--poke-shortcut-gap)))!important;
}
#gameFrame :is(.updatesToggle,.playerListToggle,.chatToggle){
  display:flex;align-items:center;justify-content:center;
  width:var(--poke-shortcut-size);height:var(--poke-shortcut-size);
  min-width:0;min-height:0;margin:0;padding:3px;
  box-sizing:border-box;border:3px solid #263d58;border-radius:999px;
  background:linear-gradient(145deg,#fffdea,#d6e8d5);
  box-shadow:inset 0 0 0 2px #f9ffff,2px 3px 0 #132f48;
  image-rendering:pixelated;touch-action:manipulation;pointer-events:auto;
}
#gameFrame :is(.updatesToggle,.playerListToggle,.chatToggle):active{
  transform:translate(1px,2px);box-shadow:inset 0 0 0 2px #e2f2ff,1px 1px 0 #132f48;
}
#gameFrame :is(.updatesToggle,.playerListToggle,.chatToggle):focus-visible{
  outline:3px solid #f6c15d;outline-offset:2px;
}
#gameFrame .shortcutIcon{
  display:block;width:80%;height:80%;max-width:34px;max-height:34px;
  object-fit:contain;image-rendering:pixelated;pointer-events:none;
}
#gameFrame .chatBadge{right:-7px;top:-7px;z-index:2}
#gameFrame .updatesPanel,
#gameFrame .playerListPanel,
#gameFrame .chatPanel{
  left:auto;right:calc(100% + 1.5cqw);top:0;bottom:auto;
  max-width:calc(100cqw - var(--poke-shortcut-size) - 3cqw);
  z-index:151;
}
#gameFrame .chatPanel{width:min(270px,70vw);height:min(220px,48cqw)}
#gameFrame .updatesPanel{width:min(300px,80vw);height:min(245px,55cqw)}
#gameFrame .playerListPanel{width:min(330px,80vw);height:min(260px,55cqw)}
#gameFrame .suggestionsDock{
  left:auto!important;right:2cqw!important;top:2.5cqw!important;
  z-index:161;width:0;height:0;pointer-events:none;
}
#gameFrame .suggestionsPanel{
  left:auto!important;right:0!important;top:0!important;
  width:min(310px,90cqw);
  max-width:90cqw;
  pointer-events:auto;
}
#gameFrame .suggestionsDock:has(.suggestionsPanel:not([hidden])){
  z-index:161;
}

/* The audio settings page is a full-screen RPG menu, not an on/off shortcut. */
#gameFrame .soundSettingsLayer{
  position:absolute;inset:0;z-index:158;
  box-sizing:border-box;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
  padding:2.5cqw;
  color:#213a3e;
  background:
    repeating-linear-gradient(0deg,rgba(255,255,255,.1) 0 .55cqw,transparent .55cqw 1.9cqw),
    linear-gradient(#7dddc7,#3ea78f);
  image-rendering:pixelated;pointer-events:auto;
}
#gameFrame .soundSettingsLayer[hidden]{display:none!important}
#gameFrame .soundSettingsWindow{
  box-sizing:border-box;width:100%;max-width:94cqw;
  border:2.1cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 2.1cqw / 0 stretch;
  background:#fffde7;
  display:grid;grid-template-columns:1fr;gap:2.1cqw;
  padding:3.3cqw 4.2cqw 2.7cqw;
  box-shadow:1.3cqw 1.3cqw 0 #27595f;
}
#gameFrame .soundSettingsTitle{
  font:900 5.6cqw/1.15 "Courier New",monospace;
  color:#244467;text-align:center;
  padding-bottom:1cqw;border-bottom:.75cqw solid #b4c7b1;
}
#gameFrame .soundSettingsHelp{
  margin:0;text-align:center;
  font:700 2.8cqw/1.25 "Courier New",monospace;color:#5b6b5f;
}
#gameFrame .soundSettingsControl{
  box-sizing:border-box;display:grid;
  grid-template-columns:23cqw 1fr 14cqw;
  align-items:center;gap:2cqw;
  min-height:8cqw;
}
#gameFrame .soundSettingsControl label{
  font:900 3.8cqw/1.2 "Courier New",monospace;
  white-space:nowrap;
}
#gameFrame .soundSettingsControl input[type=range]{
  width:100%;height:5cqw;min-height:22px;
  margin:0;padding:0;accent-color:#326eab;
  cursor:pointer;touch-action:pan-x;
}
#gameFrame .soundSettingsControl output{
  font:900 3.7cqw/1 "Courier New",monospace;
  text-align:right;color:#205985;
}
#gameFrame :is(.soundSettingsMute,.soundSettingsBack){
  min-height:8cqw;border:1.1cqw solid transparent;
  border-image:url('./native/fr_textbox_type1.png') 8 fill / 1.1cqw / 0 stretch;
  padding:1cqw 2cqw;
  background:#f6f1d5;color:#314649;
  font:900 3.8cqw/1.15 "Courier New",monospace;
  touch-action:manipulation;
}
#gameFrame .soundSettingsMute[aria-pressed="true"]{color:#9a3e45}
#gameFrame .soundSettingsBack{background:#deefd6;color:#31574d}
#gameFrame.sound-settings-open :is(#mobileControls,.globalChat,.updatesDock,.playerListDock,.berryHud,#tileCoords){
  display:none!important;pointer-events:none!important;
}
@media(max-width:470px){
  #gameFrame .soundSettingsControl{grid-template-columns:24cqw 1fr 13cqw;gap:1.5cqw}
  #gameFrame .soundSettingsHelp{font-size:2.6cqw}
}

/* Pokémon suggestion categories: native checkbox controls and readable feedback on phones. */
.suggestionsCategories{border:1px solid #8f927e;margin:0;padding:4px 5px;display:grid;gap:3px;min-width:0}
.suggestionsCategories legend{padding:0 4px;font-size:9px;font-weight:900;color:#345b94}
.suggestionsCategories label{display:flex;gap:7px;align-items:center;min-height:20px;cursor:pointer;touch-action:manipulation}
.suggestionsCategories input{appearance:auto;accent-color:#355caa;width:15px;height:15px;margin:0;flex:none;touch-action:manipulation}
.suggestionsHint{font-size:8px;color:#6b6c59}
.suggestionsCounter{font-size:9px;color:#8a5037;text-align:right}
.suggestionsCounter.valid{color:#376a48}
.suggestionsPanel{max-height:min(88vh,520px);overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
