/* Original FRLG nine-slice tiles. Corners keep native integer scale;
   edges repeat rather than stretching the original pixel pattern. */
.classic-dialogue{border-width:16px 24px;border-image:url('assets/dialogue-frame.png') 16 24 repeat;image-rendering:pixelated}
.classic-choice,.classic-mon-window,.route .map-card,.route .side section,.skill-list,.combat-actions{border-width:8px;border-image:url('assets/choice-frame.png') 8 repeat;image-rendering:pixelated}
dialog,.combat-menu>div,.combat-items>div,.node-preview-menu nav,.combat-console,.rest-layout{border-width:8px!important;border-image:url('assets/choice-frame.png') 8 repeat!important;image-rendering:pixelated}
.lab-home .reveal,.combat-skills{border-width:8px!important;border-image:url('assets/move-list-frame.png') 8 repeat!important;image-rendering:pixelated}
/* These silhouettes are asymmetric; do not give all four edges one width. */
.combat-status>div{border-width:5px 5px 11px 14px;border-image:url('assets/hud-player-frame.png') 5 5 11 14 repeat;padding:3px 2px 0 2px}
.combat-status>div:last-child{border-width:5px 14px 11px 5px;border-image:url('assets/hud-opponent-frame.png') 5 14 11 5 repeat;padding:3px 2px 0 2px}

.classic-dialogue,.classic-choice,.classic-mon-window,.route .map-card,.route .side section,.skill-list,.combat-actions,.lab-home .reveal,.combat-skills,dialog,.combat-menu>div,.combat-items>div,.node-preview-menu nav,.combat-console,.rest-layout{background-color:#fff!important;background-clip:padding-box!important}
.combat-status>div{background-color:#ffffde;background-clip:padding-box}
/* One original right-hand menu, vertical commands, one active cursor. */
.classic-choice,.classic-choice:has([data-confirm-start]){display:block;top:8px;bottom:auto;left:auto;right:3px;width:90px;padding:0}
.classic-choice button{display:block;width:100%;min-height:44px;padding:0 1px;font-size:16px;white-space:nowrap}
.classic-choice button:before{content:'▸';display:inline-block;width:14px;visibility:hidden}
.classic-choice:not(:focus-within):not(:has(button:hover)) button:first-child:before,.classic-choice:not(:has(button:hover)) button:focus:before,.classic-choice button:hover:before{visibility:visible}
/* Move content owns its cooldown row; borders must not consume that row. */
.combat-console{grid-template-rows:minmax(170px,1fr) auto 84px 56px}
.combat-skills{min-height:78px}
.combat-skills .cooldown-move{padding-bottom:0;grid-template-rows:auto auto 4px;align-content:center;row-gap:4px}
.combat-skills .cd-progress{position:static;grid-column:1/-1;display:block;width:80%;height:4px;justify-self:center;margin:0}
.combat-party button:disabled{filter:none;opacity:1}
.combat-party button[aria-label*="无法战斗"] img{filter:grayscale(1);opacity:.4}
@media(max-width:650px){.combat-console{grid-template-rows:minmax(170px,1fr) auto 80px 56px}}
/* One aligned home composition. Scale room by available height, never crop it. */
.classic-home{padding:10px 12px;min-height:540px}
.classic-home .home-core{width:min(100%,calc((100svh - 116px)*208/224));max-width:none;gap:8px;flex:0 0 auto;margin:auto}
.classic-home .lab-stage{width:100%;height:auto;aspect-ratio:208/224;margin:0;flex:none}
.classic-home .reveal{width:100%;max-width:none;height:88px;min-height:88px;flex:none;margin:0}
.classic-home .moves{grid-template-columns:repeat(2,minmax(0,1fr))}
.classic-home .move-chip{justify-content:flex-start}
.classic-home .open-ball{opacity:1}
@media(max-width:360px){.classic-home{padding:8px}.classic-home .home-core{width:min(100%,calc((100svh - 112px)*208/224))}}
.classic-choice{height:104px}
/* Answers belong beside Oak's dialogue, not detached below the skills. */
.classic-choice,.classic-choice:has([data-confirm-start]){top:auto;bottom:6px;right:3px;height:104px}
.classic-home .lab-stage:has(.classic-choice) .classic-dialogue{width:calc(100% - 98px)}
@media(max-width:680px){
 .classic-home{padding-bottom:max(10px,env(safe-area-inset-bottom))}
 .classic-home .home-core{width:min(100%,calc((100svh - 116px - env(safe-area-inset-bottom))*208/224));padding-bottom:0}
 .classic-home .classic-dialogue{height:128px;min-height:128px;font-size:18px;line-height:22px;padding:4px 6px;border-left-width:16px;border-right-width:16px;border-image-slice:16}
 .classic-home .classic-choice{bottom:12px}
}
@media(max-width:360px){.classic-home{padding:8px 8px max(8px,env(safe-area-inset-bottom))}.classic-home .home-core{width:min(100%,calc((100svh - 112px - env(safe-area-inset-bottom))*208/224))}}
.classic-home .lab-stage:has(.classic-choice) .classic-dialogue{width:100%;padding-right:108px}
.classic-choice{z-index:7}
/* Extend the room with four native16px floor rows, never stretch its furniture. */
.classic-home .home-core{width:min(100%,calc((100svh - 116px - env(safe-area-inset-bottom))*208/288))}
.classic-home .lab-stage{aspect-ratio:208/288;background:none}
.lab-floor-extension{position:absolute;inset:0;width:100%;height:100%;image-rendering:pixelated;pointer-events:none}
.classic-home .lab-table{top:23.333333%}
.classic-home .balls{top:calc(23.333333% - 24px)}
.classic-home .secret{top:calc(19.444444% - 22px)}
.classic-home .prof-oak{top:31.111111%}
@media(max-width:360px){.classic-home .home-core{width:min(100%,calc((100svh - 112px - env(safe-area-inset-bottom))*208/288))}}
.classic-home .balls{top:calc(23.333333% + 7px)}

/* Title is outside the scene; room keeps its native aspect ratio. */
.classic-home .game-title{display:block;margin:0;min-height:32px;line-height:32px;text-align:center;font-size:27px;font-weight:400;letter-spacing:2px;color:#354e78;text-shadow:1px 1px 0 #fff4c6;flex:none}
.classic-home .home-core{width:min(100%,calc((100svh - 156px - env(safe-area-inset-bottom))*208/288))}
@media(max-width:360px){.classic-home .home-core{width:min(100%,calc((100svh - 152px - env(safe-area-inset-bottom))*208/288))}.classic-home .game-title{font-size:27px}}
/* Dialogue follows its text and grows upwards from a stable door clearance. */
.classic-home .classic-dialogue{height:auto;min-height:0;bottom:11.111111%;line-height:1.25;padding-top:6px;padding-bottom:6px}
.classic-home .classic-choice,.classic-home .classic-choice:has([data-confirm-start]){bottom:calc(11.111111% + 4px)}
/* The selection menu occupies the open floor below the ball table. */
.classic-home .classic-choice,.classic-home .classic-choice:has([data-confirm-start]){top:39%;bottom:auto;right:3px}
.classic-home .lab-stage:has(.classic-choice) .classic-dialogue{padding-right:6px}
/* Both map modes share one elastic layout. Tiny screens may scroll rather than
   reduce the entire region to an unreadable thumbnail. */
@media(max-width:360px){.route .retro-map{min-height:180px}}
@media(max-width:360px){.route{min-height:620px}}
/* Original sprites: optical bounds trimmed, no decorative backdrop. */
.route .steps button{width:44px;height:44px;min-height:44px;background:transparent;position:relative}
.route .steps button.current{background:transparent;outline:none}
.route .steps button.current:after{content:'';position:absolute;inset:2px;border:2px solid #536a58;clip-path:polygon(0 0,24% 0,24% 7%,7% 7%,7% 24%,0 24%,0 0,100% 0,100% 24%,93% 24%,93% 7%,76% 7%,76% 0,100% 0,100% 100%,76% 100%,76% 93%,93% 93%,93% 76%,100% 76%,100% 100%,0 100%,0 76%,7% 76%,7% 93%,24% 93%,24% 100%,0 100%);pointer-events:none}
.route-node-sprite{display:block;object-fit:contain;image-rendering:pixelated;width:28px;height:28px;filter:none;opacity:1}
.route-node-sprite.trainer{height:32px;width:24px}
.route-node-sprite.center{width:32px;height:30px}
@media(max-width:360px){.route .steps{margin-left:-6px;margin-right:-6px}}
/* Compact English game wordmark, aligned with the room instead of centered. */
.classic-home .game-title{align-self:stretch;display:flex;align-items:baseline;justify-content:flex-start;gap:10px;text-align:left;letter-spacing:0;line-height:32px;white-space:nowrap;color:#334f7b;text-shadow:1px 1px 0 #fff0ab}
.classic-home .game-title span:nth-child(2){font-size:27px;color:#dba936;text-shadow:1px 0 #334f7b,-1px 0 #334f7b,0 1px #334f7b,0 -1px #334f7b,1px 2px #334f7b}
.classic-home .game-title span:last-child{font-size:18px;color:#334f7b;text-shadow:none}
.classic-home .game-title{margin-bottom:8px}
.classic-home .home-core{width:min(100%,calc((100svh - 164px - env(safe-area-inset-bottom))*208/288))}
@media(max-width:360px){.classic-home .home-core{width:min(100%,calc((100svh - 160px - env(safe-area-inset-bottom))*208/288))}}
/* Match both visible map windows to4:3, without source white columns or letterboxing. */
.route{height:auto;min-height:100svh}
.route .route-grid{flex:0 0 auto;align-items:start}
.route .map-card{flex:none;min-height:0;align-self:start;width:100%}
.route .retro-map{flex:none;min-height:0;height:auto;padding-bottom:0;aspect-ratio:auto}
.route .retro-map svg{width:100%;height:auto;aspect-ratio:4/3;display:block}
.route .retro-map .map-place{position:static}
@media(max-width:680px){.route .map-card{align-self:stretch}.route .route-grid{align-items:stretch}}
@media(min-width:681px){.route{max-width:min(1120px,calc((100svh - 282px)*4/3 + 294px))}}
/* Location belongs to the same original-menu surface, not a colored web banner. */
.route .map-place{background:#fff;color:#363a43;border:0;height:32px;padding:6px 12px 2px;font-size:16px;line-height:24px}
/* The same route choice occupies the same baseline and inset in either state. */
.route .journey .node-heading h2,.route .journey .choices button{font-size:14px;font-weight:400;line-height:24px;letter-spacing:0}
.route .journey .node-heading h2{position:relative;padding-left:24px}
.route .journey .node-heading h2:before,.route .journey .choices button:before{content:'';position:absolute;left:8px;top:50%;transform:translateY(-50%);width:0;height:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #394b3d;opacity:1}
.route .journey .choices button{position:relative;padding:0 4px 0 24px;text-align:left;height:48px;border:0;background:transparent!important}
.route .journey .choices button>span{display:none}
.route .journey .primary,.route .journey:has(.choices) .primary{min-width:84px;padding:10px 12px}
.route .steps{position:relative}
.route .steps:before{display:none}
.route .path-dots{position:absolute;top:21px;transform:translateX(-50%);display:flex;gap:2px;pointer-events:none}
.route .path-dots i{width:2px;height:2px;background:#bcb4a5}
.route .path-dots.travelled i{background:#927251}
@media(max-width:680px){.route .journey .node-heading h2,.route .journey .choices button{font-size:12px}.route .journey,.route .journey:has(.choices){column-gap:4px}.route .journey .primary,.route .journey:has(.choices) .primary{min-width:68px;padding:10px 8px}}
.route .journey,.route .journey:has(.choices){padding:8px 8px 12px;grid-template-rows:44px 56px;height:126px;column-gap:4px}
.route .journey .node-heading{height:56px;min-height:56px;margin:0;padding:0}
.route .journey .node-heading>div{padding:0;margin:0}
.route .journey .choices{align-self:stretch}
.route .journey .choices button:before{visibility:visible}
.route .journey .choices button{padding-left:20px}
.route .journey .node-heading h2{padding-left:20px}
.classic-home .game-title .title-ball{width:16px;height:16px;background:url(assets/ball.png) top center /16px 48px no-repeat;image-rendering:pixelated;align-self:center;flex:none}
.classic-home .game-title{gap:8px}
/* Keep connectors outside the 32px visual slot, not against a 40px outline. */
.route .steps button.current:after{inset:6px}
.route .steps button:focus-visible{outline:0}
.route .steps button:focus-visible:after{content:'';position:absolute;inset:6px;border:2px solid #35597b;pointer-events:none;clip-path:polygon(0 0,25% 0,25% 8%,8% 8%,8% 25%,0 25%,0 0,100% 0,100% 25%,92% 25%,92% 8%,75% 8%,75% 0,100% 0,100% 100%,75% 100%,75% 92%,92% 92%,92% 75%,100% 75%,100% 100%,0 100%,0 75%,8% 75%,8% 92%,25% 92%,25% 100%,0 100%)}
@media(max-width:680px){.route .path-dots i:last-child{display:none}}
.route .steps button.current:after,.route .steps button:focus-visible:after{border:0;clip-path:none;--corner:#536a58;background:linear-gradient(var(--corner),var(--corner)) left top/8px 2px no-repeat,linear-gradient(var(--corner),var(--corner)) left top/2px 8px no-repeat,linear-gradient(var(--corner),var(--corner)) right top/8px 2px no-repeat,linear-gradient(var(--corner),var(--corner)) right top/2px 8px no-repeat,linear-gradient(var(--corner),var(--corner)) left bottom/8px 2px no-repeat,linear-gradient(var(--corner),var(--corner)) left bottom/2px 8px no-repeat,linear-gradient(var(--corner),var(--corner)) right bottom/8px 2px no-repeat,linear-gradient(var(--corner),var(--corner)) right bottom/2px 8px no-repeat}
.route .steps button:focus-visible:after{--corner:#35597b}
.route .journey .node-heading h2,.route .journey .choices button[aria-pressed=true],.route .journey .primary{font-size:16px}
.route .journey .choices button[aria-pressed=false]{font-size:14px;color:#666457}
.route .journey .choices{grid-template-columns:minmax(0,4fr) minmax(0,5fr)}
.route .journey .choices button{padding-left:14px;padding-right:0}
.route .journey .node-heading h2{padding-left:14px}
.route .journey .choices button:before,.route .journey .node-heading h2:before{left:2px}
@media(max-width:680px){.route .journey .primary,.route .journey:has(.choices) .primary{min-width:60px;padding:10px 2px}.route .journey .choices{gap:2px!important}}
/* Center recovery is one aligned menu, not independently centered text rows. */
.node-page:has(.center-scene) .recovery-slot{width:min(100%,256px);height:76px;min-height:76px;margin:0 auto;align-items:stretch;justify-content:center;text-align:left}
.node-page:has(.center-scene) .rest-layout .encounter-actions{width:min(100%,256px);height:44px;min-height:44px;margin:0 auto;padding:0;display:flex;align-items:center;justify-content:flex-start}
.node-page:has(.center-scene) .recovery-slot>.primary,.node-page:has(.center-scene) .encounter-actions>.quiet-link{width:100%;height:44px;min-height:44px;padding:0 8px;display:flex;align-items:center;justify-content:flex-start;gap:0;font-size:16px;line-height:24px;text-align:left;border:0;border-image:none;background:transparent}
.node-page:has(.center-scene) .encounter-actions>.quiet-link:before{content:'▸';display:inline-block;width:16px;flex:none}
.node-page:has(.center-scene) .recovery-slot h2{font-size:16px;line-height:24px;margin:0;padding-left:24px}
.node-page:has(.center-scene) .recovery-slot p{font-size:12px;line-height:18px;padding-left:24px}
.camp-layout{width:min(100%,720px);margin:auto;display:grid;gap:8px}
.camp-scene{display:block;width:100%;height:auto;max-height:calc(100svh - 330px);min-height:150px;object-fit:contain;image-rendering:pixelated}
.camp-team{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));list-style:none;padding:0;margin:0;gap:8px}
.camp-team li{display:grid;justify-items:center;gap:3px;font-size:12px;line-height:16px}
.camp-team img{width:32px;height:32px;object-fit:contain;image-rendering:pixelated}.camp-team meter{width:100%;max-width:70px;height:5px}
.camp-dialogue{border:16px solid transparent;border-image:url('assets/dialogue-frame.png') 16 24 repeat;background:#fff;background-clip:padding-box;min-height:76px;font-size:14px;line-height:20px;padding:0 6px}
.camp-recovery{display:grid;grid-template-columns:1fr 1fr;gap:12px;height:78px}
.camp-recovery .option-card{position:relative;border:0!important;margin:0;padding:4px 4px 4px 20px;min-height:76px;font-size:16px;line-height:24px}
.camp-recovery .option-card:before{position:absolute;left:0;top:6px}.camp-recovery .option-card span{font-size:12px;line-height:18px;display:block;margin:0}
.camp-actions{display:flex;justify-content:space-between;gap:8px;min-height:44px}.camp-actions button{font-size:16px;min-height:44px;padding:0 4px;line-height:24px}.camp-actions .quiet-link:before{content:'▸';display:inline-block;width:16px}
@media(max-width:360px){.camp-layout{gap:6px}.camp-recovery{gap:8px}.camp-recovery .option-card,.camp-actions button{font-size:14px}.camp-dialogue{font-size:12px;line-height:18px;min-height:76px}}
.camp-dialogue{border-width:16px 24px}
.center-layout .camp-recovery{grid-template-columns:1fr;height:60px}
.center-layout .camp-recovery .option-card{min-height:60px;padding-top:18px;padding-bottom:18px}
.center-layout .camp-recovery .option-card:before{left:4px;top:18px}
.center-layout .camp-actions{justify-content:flex-start}
.center-layout .camp-actions button{font-size:16px}
.camp-recovery .option-card{display:block}
.node-page:has(.camp-layout) .node-title{margin:8px 0 12px}
.node-page:has(.camp-layout) .node-title h1{font-size:24px;line-height:30px}
.node-page:has(.camp-layout) .node-title p{font-size:12px;line-height:18px;margin-top:4px}
.route-node-sprite.grass{width:24px;height:24px}
.route .steps button.current:after,.route .steps button:focus-visible:after{background-size:4px 2px,2px 4px,4px 2px,2px 4px,4px 2px,2px 4px,4px 2px,2px 4px}
@media(min-width:681px){.node-page:has(.camp-layout){max-width:clamp(360px,calc((100svh - 530px)*1.5 + 80px),960px)}.camp-scene{max-height:max(150px,calc(100svh - 530px))}.camp-layout{width:100%}}
@media(max-width:360px){.camp-scene{max-height:150px}.node-page:has(.camp-layout) .node-title{margin:4px 0 8px}.node-page:has(.camp-layout) .node-title h1{margin:4px 0;line-height:26px}}
.camp-recovery .option-card:before,.center-layout .camp-recovery .option-card:before{position:static;display:inline-block;vertical-align:baseline;width:16px;margin-left:-16px}
/* The building sits inside its selection corners, not over them. */
.route-node-sprite.center{width:24px;height:24px;object-fit:contain}
/* Recovery choices and their footer actions share identical columns. */
.camp-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.camp-actions button{display:flex;align-items:center;justify-content:flex-start;text-align:left;width:100%;padding-left:4px;padding-right:0;white-space:nowrap}
.center-layout .camp-actions{grid-template-columns:1fr}
@media(max-width:360px){.camp-actions{gap:8px}}
/* Shared menu gutters keep selected and unselected labels on one vertical line. */
.combat-menu button,.node-types button{display:flex;justify-content:flex-start;text-align:left;align-items:center;gap:0;padding-left:8px;padding-right:8px}
.combat-menu button:before,.node-types button:before{content:'▸';display:inline-block;width:16px;flex:0 0 16px;margin:0;visibility:hidden}
.combat-menu button[aria-pressed=true]:before,.node-types button[aria-pressed=true]:before,.combat-menu button[data-node-action]:before{visibility:visible}
.node-page>.node-preview-menu[open]>.node-types{left:auto;right:0;top:100%;width:min(270px,calc(100vw - 102px));min-width:0}
.skill-option{align-items:flex-start}.skill-option>.radio{align-self:flex-start;margin-top:2px;flex:none}
[data-close-party]{width:44px!important;height:44px!important;min-width:44px;display:inline-flex;align-items:center;justify-content:center;padding:0}
.learn-actions button{display:flex;align-items:center;justify-content:flex-start;text-align:left;padding-left:20px;gap:0}
.learn-actions button:before{width:16px;flex:0 0 16px}
.party-roster small>span{display:block;white-space:nowrap}
.party-roster .roster-line{align-items:flex-start}
.party-roster .roster-line>.order-buttons{padding-top:8px}
@media(max-width:360px){.party-roster .roster-line>.order-buttons{flex-direction:column;gap:0;padding-top:8px}.party-roster .roster-line>button{align-items:flex-start}.party-roster .roster-line>button img{margin-top:2px}.party-roster em{margin-left:4px}.party-roster .roster-line b{white-space:nowrap;font-size:12px}}
.combat-menu button[aria-pressed=true]:before,.node-types button[aria-pressed=true]:before{margin:0}
.combat-menu button[data-node-action]{display:flex;justify-content:flex-start;align-items:center;padding:8px;text-align:left}
.studio nav button{display:flex;align-items:center;justify-content:flex-start;gap:0}
.studio nav button:before{content:'▸';display:inline-block;width:12px;flex:0 0 12px;visibility:hidden;margin:0}
.studio nav button[aria-pressed=true]:before{visibility:visible;margin:0}
.result-card .encounter-actions{display:flex;flex-direction:column;align-items:stretch;width:min(100%,256px);margin-left:auto;margin-right:auto;gap:4px}
.result-card .encounter-actions button{width:100%;min-height:44px;display:flex;align-items:center;justify-content:flex-start;text-align:left;padding-left:8px;padding-right:8px;gap:0}
.result-card .encounter-actions button:before{width:16px;flex:0 0 16px;margin:0}
.node-preview-menu .node-types{display:flex;flex-direction:column;gap:0;padding:8px}
.node-preview-menu .node-types button{width:100%;min-height:44px;font-size:14px;background:transparent;border:0;line-height:24px}
.learn .result>button{display:flex;align-items:center;justify-content:flex-start;width:min(100%,200px);min-height:44px;margin:8px auto;padding:0 8px;text-align:left;gap:0}
.learn .result>button:before{content:'▸';display:inline-block;width:16px;flex:0 0 16px;margin:0}
.learn .result>br{display:none}

/* Manual exterior review: no timer and no implicit navigation. */
.exterior-home{min-height:calc(100svh - 32px);display:flex;align-items:center;justify-content:center;padding:16px 12px}
.exterior-core{width:min(100%,640px,calc((100svh - 220px)*1.125));display:flex;flex-direction:column;gap:12px}
.exterior-home .game-title{margin:0 0 4px;flex-shrink:0}
.exterior-scene{display:block;width:100%;height:auto;aspect-ratio:9/8;image-rendering:pixelated;background:#90d8b0}
.exterior-dialogue{border:solid transparent;border-width:16px 24px;border-image:url('assets/dialogue-frame.png') 16 24 repeat;background:#fff;background-clip:padding-box;font-size:16px;line-height:24px;padding:0 2px}
.exterior-enter{display:flex;align-items:center;justify-content:flex-start;gap:0;min-height:44px;align-self:flex-end;padding:0 12px;background:transparent;border:0;font-size:16px;line-height:24px}
.exterior-enter:before{content:'▸';width:16px;flex:0 0 16px}
@media(max-height:600px){.exterior-home{padding-top:8px;padding-bottom:8px}.exterior-core{width:min(100%,calc((100svh - 190px)*1.125));gap:8px}}

/* Branch choices reserve their geometry while selection changes visual weight. */
.route .journey:has(.choices){grid-template-columns:minmax(0,1fr) 96px}
.route .journey:has(.choices) [data-go]{width:96px;min-width:96px;padding:0 4px;white-space:nowrap;justify-content:center}
.route .journey .choices button:before{content:'▹';border:0;width:12px;height:24px;line-height:24px;font-size:12px;left:0;top:50%;transform:translateY(-50%);color:inherit}
.route .journey .choices button[aria-pressed=true]:before{content:'▸'}
.route .journey .choices button[aria-pressed=true]{color:#293641;font-size:16px}
.route .journey .choices button[aria-pressed=false]{color:#666457;font-size:12px}
.route .journey .choices button{padding-left:14px;min-height:44px;white-space:nowrap}
/* Result options are the same hierarchy: primary/secondary never alter type size. */
.result-card .encounter-actions button{font-family:inherit;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0}

/* Completed marks sit over the visible sprite; slot geometry never changes. */
.route .steps button.done .route-node-sprite{opacity:.58}
.route .steps button.done:before{content:'';position:absolute;left:calc(50% + var(--done-x,0px));top:calc(50% + var(--done-y,0px));width:12px;height:10px;transform:translate(-50%,-50%);background:url(assets/route/completed-check.svg) center/12px 10px no-repeat;border:0;pointer-events:none;z-index:1;opacity:1}
.route .steps button:has(.grass){--done-x:0px;--done-y:0px}
.route .steps button:has(.badge-water){--done-y:2px}
.route .path-dots.travelled i{background:#765338}
/* Hosted preview's bottom-right edit affordance must never cover battle actions.
   Reserve its strip inside the same screen, taken from flexible arena whitespace. */
@media(max-width:650px){.battle-page{padding-bottom:calc(70px + env(safe-area-inset-bottom));box-sizing:border-box}}
.player-selection{height:100svh;min-height:500px;max-width:650px;margin:auto;padding:36px 24px 80px;display:grid;grid-template-rows:auto minmax(180px,1fr) auto auto;gap:20px;background:#f3f1e9}
.player-selection .game-title{margin:0;justify-content:flex-start}.player-options{display:flex;justify-content:center;align-items:center;gap:32px}.player-options button{width:160px;min-height:220px;padding:12px;background:transparent;border:0;display:flex;align-items:center;flex-direction:column;justify-content:center;gap:16px;position:relative;font-size:18px}.player-options img{width:128px;height:128px;image-rendering:pixelated;object-fit:contain}.player-options button:before{content:'▸';position:absolute;left:0;top:50%;opacity:0}.player-options button[aria-pressed=true]:before{opacity:1}.player-options button[aria-pressed=false]{opacity:.6}.player-options button:focus-visible{outline:2px dashed #586c59;outline-offset:2px}.player-intro{border:12px solid transparent;border-image:url(assets/dialogue-frame.png) 12 repeat;background:#fffef5;background-clip:padding-box;font-size:18px;line-height:28px;padding:8px}.player-confirm{min-height:48px;justify-self:end;padding:4px 12px;background:transparent;border:0;font-size:18px}.player-confirm:before{content:'▸';margin-right:10px}@media(max-width:420px){.player-selection{padding:22px 16px 76px;gap:16px}.player-options{gap:8px}.player-options button{width:140px;min-height:180px}.player-options img{width:128px;height:128px}.player-intro{font-size:16px;line-height:24px}.player-selection .game-title{font-size:24px}}
.title-screen{height:100svh;min-height:450px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:44px;padding:30px 20px 80px;background:#f3f1e9}.title-screen .game-title{display:flex;flex-direction:column;align-items:center;font-size:clamp(32px,8vw,56px);gap:12px;line-height:1.2;margin:0}.title-pokeball{display:block;width:64px;height:64px;background:url(assets/ball.png) top center/64px 192px no-repeat;image-rendering:pixelated}.title-screen>button{background:transparent;border:0;min-height:48px;min-width:180px;font-size:20px;letter-spacing:2px}.title-screen>button:before{content:'▸';margin-right:12px}.title-screen>button:disabled{opacity:.55;cursor:wait}.title-screen>button:focus-visible{outline:2px dashed #536a58;outline-offset:4px}
.battle-page{padding-bottom:calc(70px + env(safe-area-inset-bottom));box-sizing:border-box}
/* Original FireRed title composition; Champion subtitle is this prototype's adaptation. */
.title-screen{height:100svh;min-height:0;padding:0 0 env(safe-area-inset-bottom);gap:0;background:#000;justify-content:center;overflow:hidden}
.title-scene{position:relative;width:min(100%,960px,150svh);aspect-ratio:3/2;flex:none}
.title-scene>img{display:block;width:100%;height:100%;object-fit:contain;image-rendering:pixelated}
.title-scene>button{position:absolute;left:5%;bottom:10%;width:50%;min-height:44px;padding:6px 4px;color:#fff;background:transparent!important;border:0!important;border-image:none!important;box-shadow:none!important;border-radius:0;font-size:clamp(16px,3vw,28px);line-height:1.5;text-align:center;letter-spacing:2px}
.title-scene>button:before{content:none!important}.title-scene>button:disabled{opacity:.7;cursor:wait}.title-scene>button:not(:disabled){animation:title-start-blink 1.6s steps(1,end) infinite}.title-scene>button:focus-visible{outline:2px dashed #fff;outline-offset:1px;animation:none}
@keyframes title-start-blink{0%,70%{opacity:1}71%,100%{opacity:.45}}
@media(prefers-reduced-motion:reduce){.title-scene>button:not(:disabled){animation:none}}
/* Champion's own title lettering; only the approved original Charizard is retained. */
body:has(.champion-title),body:has(.champion-title) #app{background:#211c1b}
.title-screen.champion-title{width:100%;max-width:none;margin:0;height:100svh;min-height:0;background:#211c1b!important;padding:52px 20px 76px;box-sizing:border-box}
.champion-title .title-scene{width:min(100%,900px);height:100%;max-height:650px;aspect-ratio:auto;position:relative;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto;gap:20px}
.champion-logo{grid-column:1/3;grid-row:1;margin:0;z-index:1;line-height:1.2;text-align:left;align-self:start;justify-self:start;color:#f1c76d;font-weight:400;text-shadow:3px 3px #70402c}
.champion-logo>span{display:block;font-size:64px;letter-spacing:0}.champion-logo>strong{display:block;font-size:32px;font-weight:400;letter-spacing:4px;margin-top:12px;color:#e9dfc6;text-shadow:2px 2px #70402c}
.champion-title .title-charizard{grid-column:2;grid-row:2/4;position:static;display:block;width:100%;height:100%;max-height:420px;object-fit:contain;image-rendering:pixelated;align-self:center}
.champion-title .title-scene>button{grid-column:1;grid-row:3;position:static;width:100%;align-self:center;color:#f3e5c7!important;min-height:48px;font-size:24px;text-align:left;padding:10px 0}
body:has(.champion-title) .prototype-tools>summary{color:#e9dfc6;background:#211c1b}
@media(max-width:600px){.title-screen.champion-title{padding:72px 28px 92px}.champion-title .title-scene{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr) 52px;gap:26px;max-height:740px}.champion-logo{grid-column:1;justify-self:center;text-align:center}.champion-logo>span{font-size:44px}.champion-logo>strong{font-size:22px;letter-spacing:2px;margin-top:10px}.champion-title .title-charizard{grid-column:1;grid-row:2;justify-self:center;width:min(100%,312px);height:100%;max-height:336px}.champion-title .title-scene>button{grid-column:1;grid-row:3;text-align:center;font-size:20px}}
@media(max-height:600px) and (max-width:600px){.title-screen.champion-title{padding:48px 24px 66px}.champion-title .title-scene{gap:14px}.champion-logo>span{font-size:36px}.champion-logo>strong{font-size:18px}}
/* Warm low-saturation cartridge-screen backdrop separates the original dark-red silhouette. */
body:has(.champion-title),body:has(.champion-title) #app{background:#cfbe98}
.title-screen.champion-title{background:#cfbe98!important}
.champion-title .champion-logo{color:#294250;text-shadow:2px 2px #eee3ca}
.champion-title .champion-logo>strong{color:#65402b;text-shadow:1px 1px #eee3ca}
.champion-title .title-scene>button{color:#293b43!important;animation-name:champion-start-blink}
.champion-title .title-scene>button:focus-visible{outline-color:#293b43;animation:none}
body:has(.champion-title) .prototype-tools,body:has(.champion-title) .prototype-tools>summary{background:#cfbe98!important;color:#394c52!important;box-shadow:none!important;border:0!important}
@keyframes champion-start-blink{0%,70%{opacity:1}71%,100%{opacity:.65}}
.champion-title .title-actions{grid-column:1;grid-row:3;display:flex;flex-direction:column;align-items:flex-start;gap:4px;align-self:end}
.champion-title .title-actions button{background:transparent!important;border:0!important;border-image:none!important;color:#293b43;min-height:44px;padding:6px 0;font-size:20px;line-height:28px;box-shadow:none!important}
.champion-title .title-actions button:before{content:'▸';margin-right:10px}.champion-title .title-actions button:disabled{opacity:.45}.champion-title .title-actions small{font-size:12px;line-height:18px;color:#514b3e}
#new-game-confirm{border-radius:0;background:#f3ecd7;border:4px solid #4b4b48;box-shadow:none}#new-game-confirm button{display:block;min-height:44px;background:none;border:0;font-size:16px}
@media(max-width:600px){.champion-title .title-scene{grid-template-rows:auto minmax(0,1fr) auto}.champion-title .title-actions{align-items:center;align-self:end}.champion-title .title-actions button{font-size:18px}}
@media(max-width:600px){.champion-title .title-charizard{transform:translateX(-4.8%)}}
.champion-title .title-actions{min-height:118px;justify-content:flex-start}.champion-title .title-preparing{display:block;min-height:44px;padding:6px 0;box-sizing:border-box;font-size:20px;line-height:28px;color:#293b43}
@media(max-width:600px){.champion-title .title-preparing{font-size:18px}}
/* A single fixed-width menu below the character; arrows and labels share columns. */
.champion-title .title-charizard{grid-row:2}
.champion-title .title-actions{grid-column:2;grid-row:3;width:176px;justify-self:center;align-items:stretch;gap:4px;min-height:118px}
.champion-title .title-actions button{width:176px;box-sizing:border-box;display:grid;grid-template-columns:16px 1fr;column-gap:10px;align-items:center;text-align:left;padding:6px 10px;min-height:44px;line-height:28px;margin:0}
.champion-title .title-actions button:before{display:block;width:16px;margin:0;line-height:28px;text-align:center}
.champion-title .title-actions small{width:100%;text-align:center;white-space:nowrap}
.champion-title .title-preparing{width:176px;padding:6px 10px;text-align:center}
@media(max-width:600px){.champion-title .title-actions{grid-column:1;align-items:stretch}}
/* Pikachu's ball: four scene pixels lower on the left machine. */
.classic-home .secret{top:calc(20.833333% - 22px)}

/* Reuse the approved square violet-grey frame for camp/center dialogue only. */
.camp-dialogue{border:8px solid transparent;border-image:url('assets/choice-frame.png') 8 repeat;border-radius:0;background:#fff;background-clip:padding-box;image-rendering:pixelated;padding:8px 12px}

/* Selection page only: reserve the fixed preview control, keep both logo words. */
@media(max-width:420px){.player-selection .game-title{display:grid;grid-template-columns:16px minmax(0,1fr);grid-template-rows:auto auto;column-gap:8px;row-gap:0;width:calc(100% - 64px);min-width:0;white-space:normal;line-height:28px}.player-selection .game-title .title-ball{grid-column:1;grid-row:1/3}.player-selection .game-title span:nth-child(2){grid-column:2;grid-row:1;white-space:nowrap}.player-selection .game-title span:last-child{grid-column:2;grid-row:2;white-space:nowrap}}

/* Narrow branch menus: choices never compete with the contextual action. */
@media(max-width:360px){
 .route .journey:has(.choices){grid-template-columns:minmax(0,1fr);grid-template-rows:44px 48px 44px;row-gap:6px;height:168px}
 .route .journey:has(.choices) .choices{display:grid;grid-column:1;grid-row:2;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:48px;column-gap:8px!important;row-gap:0!important;height:48px!important;min-width:0}
 .route .journey:has(.choices) .choices button{min-width:0;height:48px;white-space:nowrap}
 .route .journey:has(.choices) .node-heading{grid-column:1;grid-row:3;justify-self:end;height:44px;min-height:44px}
 .route .journey:has(.choices) [data-go]{width:136px;min-width:136px;min-height:44px;padding:0 4px;justify-content:flex-start}
 .route .journey:has(.choices button:nth-child(3)){grid-template-rows:44px 96px 44px;height:216px}
 .route .journey:has(.choices button:nth-child(3)) .choices{height:96px!important}
}

/* Result text must never share the absolutely positioned battle HUD layer. */
.combat-console:has(.combat-arena.has-result){grid-template-rows:auto minmax(120px,1fr) auto 84px 56px}
.combat-console:has(.combat-arena.has-result) .combat-status{position:static;grid-row:1;margin:6px 6px 0}
.combat-console:has(.combat-arena.has-result) .combat-arena{grid-row:2;min-height:0}
@media(max-width:650px){.combat-console:has(.combat-arena.has-result){grid-template-rows:auto minmax(120px,1fr) auto 80px 56px}}
/* A third branch must remain reachable throughout the phone layout range. */
@media(max-width:600px){
 .route .journey:has(.choices button:nth-child(3)){grid-template-columns:minmax(0,1fr);grid-template-rows:44px 96px 44px;row-gap:6px;height:216px}
 .route .journey:has(.choices button:nth-child(3)) .choices{display:grid;grid-column:1;grid-row:2;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:48px;column-gap:8px!important;row-gap:0!important;height:96px!important;min-width:0}
 .route .journey:has(.choices button:nth-child(3)) .choices button{min-width:0;height:48px;white-space:nowrap}
 .route .journey:has(.choices button:nth-child(3)) .node-heading{grid-column:1;grid-row:3;justify-self:end;height:44px;min-height:44px}
 .route .journey:has(.choices button:nth-child(3)) [data-go]{width:156px;min-width:156px;min-height:44px;padding:0 4px;justify-content:flex-start}
}
