
:root{color-scheme:dark;--ink:#eaf1e9;--muted:#a6b6b8;--gold:#f4c87a;--line:#3b515a;--panel:#183441}*{box-sizing:border-box}body{margin:0;background:#102733;color:var(--ink);font-family:"Yu Gothic UI","Meiryo",sans-serif}button,select{font:inherit}button,a,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid var(--gold);outline-offset:4px}header,main,footer{max-width:1160px;margin:auto}header{padding:26px 34px;display:flex;align-items:center;gap:24px;border-bottom:1px solid var(--line)}.brand{font-size:28px;font-weight:900;letter-spacing:3px;text-decoration:none;color:var(--ink)}.brand span{display:block;font-size:8px;letter-spacing:2px;color:var(--gold)}.build{font-size:10px;letter-spacing:2px;color:var(--muted);margin-left:auto}.quiet{background:none;color:var(--muted);border:1px solid var(--line);padding:8px 12px;font-size:12px;border-radius:3px}.quiet:hover{color:var(--ink);border-color:var(--gold)}main{padding:0 34px}.intro{padding:36px 0 26px}.eyebrow{color:var(--gold);font-size:10px;letter-spacing:3px}h1{font-size:clamp(28px,4vw,46px);letter-spacing:3px;margin:10px 0;font-weight:900}h1 span{color:var(--gold)}.intro p{color:var(--muted);font-size:13px;letter-spacing:1px}.game{border:1px solid #647b80;box-shadow:0 14px 50px #06192380;background:var(--panel);border-radius:7px;overflow:hidden}.gamebar{display:flex;justify-content:space-between;padding:15px 22px;background:#203c47;font-size:10px;letter-spacing:1px}.gamebar b{margin-left:18px;font-weight:400;color:#c1cfd0}.gamebar i{display:inline-block;width:6px;height:6px;background:var(--gold);margin-right:8px}.viewport{position:relative;background:#5f8c9e;aspect-ratio:2/1;overflow:hidden}canvas{width:100%;height:100%;display:block;image-rendering:pixelated}.map-label{position:absolute;top:20px;left:24px;color:#e8f2ed;text-shadow:0 2px #294c5b;font-size:13px;letter-spacing:3px}.map-label span{display:block;font-size:10px;letter-spacing:1px;margin-top:5px}.scene-title{position:absolute;top:19px;right:22px;background:#183441df;padding:9px 14px;font-size:12px;border-left:2px solid var(--gold)}.legend{position:absolute;bottom:15px;left:50%;transform:translateX(-50%);white-space:nowrap;background:#102733df;padding:9px 16px;font-size:11px;letter-spacing:1px;color:#e0e7df}.hud{display:grid;grid-template-columns:1.3fr 1fr 1fr 1.3fr;gap:14px;padding:15px 24px;background:#122d39;border-bottom:1px solid var(--line)}[hidden]{display:none!important}.hud small{display:block;color:var(--muted);font-size:10px;margin-bottom:4px}.hud strong{font-size:14px;color:var(--gold)}progress{display:block;width:100%;height:4px;margin-top:7px;accent-color:#83c9b2}.dialog{display:grid;grid-template-columns:150px 1fr;padding:24px;gap:24px;min-height:242px}.speaker{display:flex;gap:10px}.speaker-icon{height:36px;width:36px;background:#315763;display:grid;place-items:center;color:var(--gold);font-size:24px}.speaker small{display:block;font-size:9px;color:var(--gold);letter-spacing:1px;margin-bottom:5px}.speaker strong{font-size:13px}h2{font-size:20px;line-height:1.6;margin:0 0 9px}#story{font-size:13px;line-height:1.9;color:#c4d1d0;margin:0 0 17px}.choices{display:flex;gap:10px;flex-wrap:wrap}.choices button{border:1px solid #657e83;background:#274854;padding:12px 19px;color:var(--ink);border-radius:3px;text-align:left;min-height:46px}.choices button:first-child{background:var(--gold);border-color:var(--gold);color:#25343b;font-weight:700}.choices button:hover{filter:brightness(1.12);transform:translateY(-1px)}.choices button:disabled{opacity:.45;cursor:not-allowed;transform:none}.choices button small{display:block;font-size:10px;margin-top:4px;font-weight:400;opacity:.8}#feedback{font-size:12px;color:var(--gold);line-height:1.7;margin:12px 0 0}#form{display:flex;gap:14px;flex-wrap:wrap;margin-bottom:16px}label{font-size:12px;color:#c4d1d0}select{display:block;margin-top:6px;min-width:145px;padding:10px;background:#102d3a;color:var(--ink);border:1px solid #617982;border-radius:3px}.below{display:flex;align-items:center;gap:20px;padding:16px 0;color:var(--muted);font-size:11px}.below span{letter-spacing:2px;color:var(--gold)}.below .quiet{margin-left:auto}.notes{border-top:1px solid var(--line);display:grid;grid-template-columns:1fr 1fr;gap:50px;padding:26px 0 32px}.notes b{font-size:14px}.notes p{color:var(--muted);font-size:11px;line-height:1.9;margin:8px 0 0}footer{padding:24px 34px;border-top:1px solid var(--line);font-size:11px;color:var(--muted);display:flex;justify-content:space-between}footer span{font-size:9px;letter-spacing:2px}.battle .scene-title{border-color:#e69794}body.reduced *{scroll-behavior:auto!important;transition:none!important}@media(max-width:650px){header{padding:17px 18px;gap:10px}.build{display:none}header .quiet{margin-left:auto}main{padding:0 12px}.intro{padding:26px 5px 17px}h1{letter-spacing:1px}.eyebrow{font-size:8px;letter-spacing:2px}.intro p{font-size:11px}.gamebar{padding:11px;font-size:9px}.gamebar b{display:none}.viewport{aspect-ratio:1.35/1}canvas{object-fit:cover}.map-label{left:12px;top:12px;font-size:10px}.scene-title{right:10px;top:12px;font-size:10px;padding:7px}.legend{font-size:9px;bottom:10px;letter-spacing:0}.dialog{display:block;padding:18px 15px;min-height:270px}.speaker{margin-bottom:15px}.speaker small{display:inline;margin-right:9px}.speaker-icon{width:28px;height:28px;font-size:19px}.speaker strong{font-size:12px}.speaker>div{align-self:center}h2{font-size:18px}#story{font-size:12px}.choices{gap:8px}.choices button{flex:1 1 44%;font-size:12px;padding:11px}.hud{gap:10px;padding:12px}.hud strong{font-size:11px}.hud small{font-size:9px}select{min-width:135px}.below{gap:8px;flex-wrap:wrap}.below span{font-size:9px}.below p{font-size:10px}.notes{grid-template-columns:1fr;gap:8px;padding:20px 5px}footer{padding:20px 18px}footer span{display:none}}

#cover{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center 65%;z-index:2}#resultCard{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#102733;z-index:3}.viewport:has(#resultCard:not([hidden])){aspect-ratio:1/1;max-height:680px}.viewport:has(#cover:not([hidden])) .map-label,.viewport:has(#cover:not([hidden])) .scene-title{display:none}.viewport:has(#cover:not([hidden])) .legend{z-index:3}#route{padding:11px 18px;background:#1a3545;color:#f4c87a;font-size:11px;text-align:center;line-height:1.8}dialog{max-width:620px;width:calc(100% - 30px);max-height:85dvh;overflow:auto;background:#183441;color:#eaf1e9;border:2px solid #e8bf6b;border-radius:8px;padding:24px}dialog::backdrop{background:#04121cbd}dialog button{min-height:48px;padding:12px 16px;background:#f4c87a;color:#183441;border:0;border-radius:3px;margin:5px}dialog p{font-size:13px;line-height:1.8}#collectionList{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:20px 0}#collectionList div{padding:12px;border:1px solid #4d6876;font-size:12px}.locked{color:#8499a5}.unlocked{color:#f4c87a;background:#294858}textarea{width:100%;height:100px;padding:12px;background:#102733;color:white;border:1px solid #67808a;font:inherit;font-size:14px}.dialog-body{min-width:0}@media(max-width:650px){.viewport{aspect-ratio:1.2/1}.viewport:has(#resultCard:not([hidden])){aspect-ratio:4/5;max-height:none}.intro{padding-top:20px}#route{font-size:10px;padding:8px}.choices button{min-height:56px}#cover{object-position:53% 75%}.gamebar{min-height:36px}#collectionList{grid-template-columns:1fr 1fr}dialog{padding:18px}}

@media(max-width:650px){.viewport:not(:has(#cover:not([hidden]))):not(:has(#resultCard:not([hidden]))){aspect-ratio:2/1}canvas{object-fit:contain}.map-label{display:none}.scene-title{top:auto;bottom:8px;right:8px;font-size:9px}.legend{display:none}}
#taunt{padding:12px 15px;background:#132733;border-left:3px solid #d68c98;color:#eac7cf;font-size:13px;line-height:1.8;border-radius:0 5px 5px 0}#resultDetails{font-size:13px;line-height:1.9;padding:15px;border:1px solid #53717d;border-radius:5px;color:#d9e4dc}.summer{--gold:#ffc789;--panel:#3c3546}.summer .gamebar{background:#493a4c}.summer .hud{background:#302d3e}.summer #route{background:#3a3040}.summer #taunt{background:#352534;color:#ffdbb9;border-color:#f8a361}#badgeList{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:20px 0}#badgeList>div{padding:14px;border:1px solid #486571;border-radius:4px}#badgeList strong{font-size:13px}#badgeList small{display:block;font-size:11px;line-height:1.6;margin-top:5px}#recordList p{padding:10px 0;border-bottom:1px solid #486571;font-size:12px}.choices button{touch-action:manipulation}h2:focus{outline:none}dialog button:focus-visible{outline:3px solid white;outline-offset:2px}@media(max-width:650px){#taunt{font-size:12px;padding:10px}#resultDetails{font-size:12px}.dialog-body .choices{position:relative}#badgeList{gap:7px}#badgeList>div{padding:10px}#badgeList strong{font-size:12px}}

/* v0.3: full-height certificate and collectible hero roster */
.viewport:has(#resultCard:not([hidden])){aspect-ratio:1/2;max-height:none;max-width:720px;margin:auto}
.viewport:has(#resultCard:not([hidden])) .scene-title,.viewport:has(#resultCard:not([hidden])) .map-label,.viewport:has(#resultCard:not([hidden])) .legend{display:none}
.hero-gallery{margin-top:24px;padding:24px;background:#173343;border:1px solid #557383;border-radius:7px}
.hero-gallery>p{font-size:13px;line-height:1.8;color:#d2dfdf;min-height:3.6em}
#heroGrid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.hero-tile{min-width:0;padding:8px;background:#214355;border:1px solid #476577;border-radius:5px;color:#e7ece0;text-align:center}
.hero-tile.current{border:2px solid #edc570;background:#36586b}
.hero-tile canvas{width:100%;height:auto;aspect-ratio:1;max-width:170px;margin:auto}
.hero-tile strong{display:block;font-size:12px;line-height:1.6;overflow-wrap:anywhere}
.hero-tile small{display:block;font-size:10px;color:#e9c87e;margin-top:6px}
.replay-hints{margin-top:24px;border-top:1px solid #516b77;padding-top:14px}.replay-hints h3{font-size:16px;color:#edc570}.replay-hints p{font-size:13px;line-height:1.9}
#replayFromGallery{padding:14px 20px;min-height:48px;background:#f4c87a;color:#173343;border:0;border-radius:4px;font:inherit;font-weight:bold}
#collectionList canvas{max-width:140px;height:auto;margin:auto}
@media(max-width:650px){.hero-gallery{padding:18px 12px}#heroGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.hero-tile strong{font-size:11px}.viewport:has(#resultCard:not([hidden])){aspect-ratio:1/2}.replay-hints p{font-size:12px}}
/* Mobile-first play surface: long text and results remain scrollable. */

/* Dedicated playfield and command panel: no overlays on the game. */
.screen-controls{display:flex;gap:6px;margin-left:auto}.screen-controls button{min-height:38px;white-space:nowrap;padding:5px 10px;font-size:11px}.screen-settings-actions{display:flex;gap:8px;flex-wrap:wrap}
body.immersive{margin:0;height:var(--app-height,100dvh);overflow:hidden;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);display:grid;grid-template-rows:44px minmax(0,1fr);background:#102b39}
body.immersive>header{position:relative;inset:auto;width:100%;max-width:none;height:44px;padding:3px 12px;gap:8px;border-bottom:1px solid #47606a;background:#102b39;margin:0}
body.immersive .brand{font-size:18px;letter-spacing:1px}body.immersive .brand span{font-size:6px}body.immersive .build,body.immersive .intro,body.immersive .below,body.immersive .notes,body.immersive>footer{display:none}
body.immersive>main{position:relative;inset:auto;width:100%;max-width:none;min-height:0;height:100%;margin:0;padding:0;overflow:hidden}
body.immersive .game{position:relative;inset:auto;display:grid;grid-template-columns:minmax(0,57fr) minmax(0,43fr);grid-template-rows:26px auto minmax(0,1fr);height:100%;min-height:0;border:0;border-radius:0;box-shadow:none;background:#122c3a;gap:0}
body.immersive .gamebar{position:static;grid-column:1;grid-row:1;padding:5px 10px;min-height:0;width:auto;font-size:10px;background:#183747;overflow:hidden;white-space:nowrap}
body.immersive .hud{position:static;grid-column:1;grid-row:2;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;width:auto;margin:0;padding:7px 10px;border:0;background:#203f4c}
body.immersive .hud strong{font-size:11px;white-space:normal}body.immersive .hud small{font-size:9px}body.immersive .hud progress{height:5px}
body.immersive .viewport{position:relative;inset:auto;grid-column:1;grid-row:3;width:100%;height:100%;max-height:none;min-height:0;aspect-ratio:auto;overflow:hidden;background:#153346}
body.immersive .viewport canvas{width:100%;height:100%;object-fit:fill}body.immersive #cover{width:100%;height:100%;object-fit:cover;object-position:42% center}body.immersive #resultCard{object-fit:contain}
body.immersive .map-label,body.immersive .legend,body.immersive .scene-title,body.immersive #route{display:none}
body.immersive .dialog{position:relative;inset:auto;grid-column:2;grid-row:1/4;display:block;width:auto;height:100%;max-height:none;min-height:0;overflow:auto;margin:0;padding:14px;border:0;border-left:2px solid #c7a969;border-radius:0;background:#122e40;box-shadow:none;overscroll-behavior:contain}
body.immersive .dialog .speaker{display:none}body.immersive .dialog h2{font-size:16px;line-height:1.5;margin:0 0 8px}body.immersive #story{font-size:13px;line-height:1.6;margin:0 0 10px}body.immersive #taunt{font-size:11px;padding:6px;margin:6px 0}
body.immersive .choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}body.immersive .choices button{min-width:0;min-height:48px;padding:8px;font-size:12px;overflow-wrap:anywhere}body.immersive .choices button small{font-size:10px}body.immersive #feedback{font-size:11px;margin:7px 0 0}
body.immersive[data-scene="result"]>main{overflow:auto}body.immersive[data-scene="result"] .game{height:calc(var(--app-height,100dvh) - 44px);min-height:240px}body.immersive[data-scene="result"] .hero-gallery{margin:12px}
body.immersive dialog{width:min(720px,calc(100vw - 24px));max-height:calc(var(--app-height,100dvh) - 20px);overflow:auto;padding:18px}body.immersive dialog button{min-height:44px}
@media(max-height:420px){body.immersive .game{grid-template-columns:minmax(0,52fr) minmax(0,48fr)}body.immersive .dialog{padding:10px}body.immersive .dialog h2{font-size:13px;margin-bottom:5px}body.immersive #story{font-size:11px;line-height:1.5;margin-bottom:7px}body.immersive .choices{gap:5px}body.immersive .choices button{min-height:44px;padding:6px;font-size:11px}body.immersive .choices button small{font-size:9px}body.immersive .hud{padding:5px 8px}body.immersive .gamebar{font-size:9px}}
#landscapeGate{display:none}body.portrait-blocked>:not(#landscapeGate){visibility:hidden!important;pointer-events:none!important}body.portrait-blocked #landscapeGate{display:flex}#landscapeGate{position:fixed;inset:0;z-index:2147483647;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:24px;background:#102d39;color:#fff1d1}#landscapeGate svg{width:120px;color:#f0cc79;margin-bottom:18px}#landscapeGate h1{font-size:21px;line-height:1.6;margin:0 0 12px}#landscapeGate p{font-size:15px}#landscapeGate small{font-size:12px;line-height:1.8;max-width:290px;color:#b9ced2}body.portrait-blocked dialog::backdrop{background:transparent}
@media(orientation:portrait) and (max-width:1100px){body>:not(#landscapeGate){visibility:hidden!important;pointer-events:none!important}body #landscapeGate{display:flex!important;visibility:visible!important}}

/* Preserve the whole 960x480 scene, including feet and bottom map nodes. */
body.immersive .viewport canvas{object-fit:contain;background:#173747}body.immersive #cover{object-fit:contain;background:#112b39}.dialog .screen-controls{position:sticky;top:-10px;z-index:5;background:#122e40;justify-content:flex-end;border-bottom:1px solid #42606f;margin:-2px 0 8px;padding:2px 0 5px}.dialog .screen-controls button{min-height:34px}
@media(max-height:600px) and (orientation:landscape),(max-width:600px){body.immersive{grid-template-rows:minmax(0,1fr)}body.immersive>header{display:none}body.immersive[data-scene="result"] .game{height:var(--app-height,100dvh)}}

/* v1.5 — wide world, speech below it, buttons only on the right. */
body.immersive.wide-world{grid-template-rows:minmax(0,1fr)}
body.immersive.wide-world>header{display:none}
body.immersive.wide-world .game{grid-template-columns:minmax(0,1fr) clamp(176px,22vw,270px);grid-template-rows:22px auto minmax(0,1fr) auto}
body.immersive.wide-world .gamebar{font-size:9px;padding:3px 8px}
body.immersive.wide-world .hud{padding:3px 8px;gap:8px}
body.immersive.wide-world .hud>div{display:flex;gap:6px;align-items:center;position:relative;min-height:25px}
body.immersive.wide-world .hud small{margin:0;font-size:9px;white-space:nowrap}
body.immersive.wide-world .hud strong{font-size:11px}
body.immersive.wide-world .hud progress{position:absolute;left:0;bottom:0;margin:0;width:90%;height:3px}
body.immersive.wide-world .dialog{grid-row:1/5;padding:6px;overflow:auto;border-left:1px solid #8e815e}
body.immersive.wide-world .dialog-body{display:block}
body.immersive.wide-world .screen-controls{position:static;margin:0 0 6px;padding:0 0 5px;flex-wrap:wrap;justify-content:flex-end}
body.immersive.wide-world .screen-controls button{min-height:36px}
body.immersive.wide-world .choices{grid-template-columns:1fr;gap:6px}
body.immersive.wide-world .choices button{min-height:44px;padding:7px 8px;font-size:12px;line-height:1.35}
body.immersive.wide-world .choices button small{font-size:10px;line-height:1.35;margin-top:3px}
body.immersive.wide-world .speech-bubble{grid-column:1;grid-row:4;position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;margin:4px 8px 8px;padding:8px 12px;min-height:58px;max-height:30vh;border:2px solid #dcc17c;border-radius:10px;background:#142e3dec;box-shadow:0 3px 0 #061d29}
body.immersive.wide-world .speech-bubble:before{content:'';position:absolute;left:27px;top:-8px;width:12px;height:12px;transform:rotate(45deg);background:#142e3d;border-left:2px solid #dcc17c;border-top:2px solid #dcc17c}
body.immersive.wide-world .speech-content{min-height:0;max-height:calc(min(30vh,140px) - 20px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-right:6px}
body.immersive.wide-world .speech-content h2{font-size:13px;line-height:1.45;margin:0 0 3px}
body.immersive.wide-world #story{font-size:12px;line-height:1.55;margin:0}
body.immersive.wide-world #taunt,body.immersive.wide-world #resultDetails{font-size:12px;line-height:1.5;padding:4px 6px;margin:5px 0 0}
body.immersive.wide-world #feedback:empty{display:none}
body.immersive.wide-world .speech-next{min-height:44px;font-size:10px;padding:4px;max-width:65px}
body.immersive.wide-world #form:empty{display:none}
body.immersive.wide-world #form{grid-column:1/-1;margin:5px 0 0;gap:8px;flex-wrap:nowrap}
body.immersive.wide-world #form label{flex:1;min-width:0;font-size:10px}
body.immersive.wide-world #form select{min-width:0;width:100%;margin-top:2px;padding:5px;font-size:12px;min-height:36px}
body.immersive.wide-world[data-scene="setup"] .speech-bubble{max-height:48vh}
body.immersive.wide-world[data-scene="result"] .game{height:var(--app-height,100dvh);min-height:0}
body.immersive.wide-world .viewport:has(#resultCard:not([hidden])){max-width:none;margin:0}
@media(max-height:480px){body.immersive.wide-world:is(.battle,[data-scene="result"]) .game{grid-template-columns:minmax(0,1fr) clamp(210px,27vw,270px)}body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices{grid-template-columns:repeat(2,minmax(0,1fr))}body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices button{font-size:11px;padding:5px;min-height:44px}body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices button small{font-size:9px}}
@media(max-height:300px){body.immersive.wide-world .gamebar{display:none}body.immersive.wide-world .game{grid-template-rows:0 auto minmax(0,1fr) auto}body.immersive.wide-world .speech-bubble{margin:3px 6px 5px;padding:5px 8px;min-height:48px}body.immersive.wide-world .speech-content{max-height:65px}body.immersive.wide-world .choices{gap:4px}body.immersive.wide-world .choices button{padding:5px;font-size:11px}body.immersive.wide-world .choices button small{font-size:9px}}

@media(max-height:320px){body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices button small{display:none}body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices button{min-height:44px;line-height:1.35;font-size:11px}body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices{grid-auto-rows:minmax(44px,auto)}}

@media(max-height:300px){body.immersive.wide-world[data-scene="setup"] .speech-content{max-height:43px}body.immersive.wide-world[data-scene="setup"] .speech-bubble{max-height:none}}

/* Discrete dialogue pages: no text scrolling. */
body.immersive.wide-world .paged-speech{grid-template-columns:minmax(0,1fr) 68px;max-height:none;align-items:stretch;gap:8px;padding:7px 10px}
body.immersive.wide-world .speech-page{height:clamp(54px,21vh,92px);overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;line-height:18px;min-width:0;color:#e9eee5}
body.immersive.wide-world .speech-pager{display:grid;grid-template-columns:1fr;grid-template-rows:1fr 14px 1fr;gap:0;align-items:center}
body.immersive.wide-world .speech-pager button{font-size:11px;padding:2px;min-height:24px;color:#ffe5a5;border-color:#6b786e;touch-action:manipulation}
body.immersive.wide-world .speech-pager button:disabled{opacity:.3;cursor:default}
body.immersive.wide-world .speech-count{font-size:10px;text-align:center;color:#b8c5c8}
body.immersive.wide-world[data-scene="setup"] .speech-page{height:54px}
@media(max-height:300px){body.immersive.wide-world .paged-speech{padding:5px 8px}body.immersive.wide-world .speech-page{height:54px;font-size:11px;line-height:18px}body.immersive.wide-world .speech-pager{grid-template-columns:1fr;grid-template-rows:1fr 12px}body.immersive.wide-world .speech-pager button:first-child{display:none}body.immersive.wide-world .speech-pager button:last-child{grid-row:1;min-height:40px}body.immersive.wide-world .speech-count{grid-row:2}body.immersive.wide-world[data-scene="setup"] .speech-page{height:36px}}

body.immersive.wide-world .speech-pager{grid-template-rows:1fr 14px}body.immersive.wide-world .speech-pager button:first-child{display:none}body.immersive.wide-world .speech-pager button:last-child{grid-row:1;min-height:44px}body.immersive.wide-world .speech-count{grid-row:2}

/* Two-line skill names: maker / technique. */
.choices button{white-space:pre-line}.choices button small{white-space:normal}

/* v1.6.2: prioritize world height, compact two-line dialogue. */
body.immersive.wide-world .game{grid-template-rows:0 auto minmax(0,1fr) auto}
body.immersive.wide-world .gamebar{display:none}
body.immersive.wide-world .hud{padding:2px 8px}
body.immersive.wide-world .hud>div{min-height:24px}
body.immersive.wide-world .paged-speech{margin:3px 6px 5px;padding:5px 8px;min-height:0;gap:6px;grid-template-columns:minmax(0,1fr) 68px}
body.immersive.wide-world .speech-page{height:36px;font-size:12px;line-height:18px}
body.immersive.wide-world .speech-pager{grid-template-rows:1fr;position:relative}
body.immersive.wide-world .speech-pager button:last-child{min-height:36px;height:36px;padding:0 0 8px}
body.immersive.wide-world .speech-count{position:absolute;bottom:0;width:100%;pointer-events:none;font-size:9px}
body.immersive.wide-world[data-scene="setup"] .speech-page{height:36px}

/* v1.6.3: one-column commands; sharing is the clear primary action. */
body.immersive.wide-world .screen-controls{display:none}
body.immersive.wide-world .game,body.immersive.wide-world:is(.battle,[data-scene="result"]) .game{grid-template-columns:minmax(0,1fr) clamp(138px,18vw,200px)}
body.immersive.wide-world .choices,body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices{grid-template-columns:1fr;gap:4px}
body.immersive.wide-world .choices button small{display:none}
body.immersive.wide-world .dialog{padding:4px}
body.immersive.wide-world .choices button{min-height:44px;padding:5px;font-size:12px}
@media(max-height:340px){body.immersive.wide-world .choices,body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices{gap:2px;grid-auto-rows:minmax(0,auto)}body.immersive.wide-world .choices button,body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices button{min-height:34px;font-size:11px;line-height:13px;padding:3px}}

/* v1.6.5: desktop readability, independent of compact landscape phones. */
@media(min-width:900px) and (min-height:600px) and (hover:hover) and (pointer:fine){
 body.immersive.wide-world .game,body.immersive.wide-world:is(.battle,[data-scene="result"]) .game{grid-template-columns:minmax(0,1fr) clamp(260px,24vw,340px)}
 body.immersive.wide-world .dialog{padding:16px;border-left-width:2px}
 body.immersive.wide-world .choices,body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices{gap:10px}
 body.immersive.wide-world .choices button{min-height:64px;padding:10px 16px;font-size:clamp(18px,1.3vw,22px);line-height:1.4;border-radius:6px}
 body.immersive.wide-world .hud{padding:9px 18px;gap:16px}
 body.immersive.wide-world .hud>div{min-height:32px;gap:8px}
 body.immersive.wide-world .hud small{font-size:12px}
 body.immersive.wide-world .hud strong{font-size:17px}
 body.immersive.wide-world .paged-speech{margin:8px 16px 16px;padding:14px 18px;gap:18px;grid-template-columns:minmax(0,1fr) 112px;border-radius:12px}
 body.immersive.wide-world .speech-page,body.immersive.wide-world[data-scene="setup"] .speech-page{height:84px;font-size:18px;line-height:28px}
 body.immersive.wide-world .speech-pager button:last-child{height:64px;min-height:64px;font-size:17px;padding:4px 8px 15px}
 body.immersive.wide-world .speech-count{font-size:12px;bottom:8px}
 body.immersive.wide-world #form{gap:14px;margin-top:10px}
 body.immersive.wide-world #form label{font-size:15px}
 body.immersive.wide-world #form select{font-size:17px;min-height:44px;padding:8px}
}

/* v1.6.6: readable phone text and an explicit, one-time introduction. */
@media(max-width:899px),(max-height:599px),(pointer:coarse){
 body.immersive.wide-world .speech-page,body.immersive.wide-world[data-scene="setup"] .speech-page{font-size:14px;line-height:21px;height:63px}
 body.immersive.wide-world .paged-speech{grid-template-columns:minmax(0,1fr) 86px}
 body.immersive.wide-world .speech-pager button:last-child{font-size:12px;min-height:48px;height:48px}
 body.immersive.wide-world .choices button,body.immersive.wide-world:is(.battle,[data-scene="result"]) .choices button{font-size:13px;line-height:14px}
}
body.immersive #firstPlayGuide{width:min(620px,calc(100vw - 24px));padding:20px;border:2px solid #edc570}
#firstPlayGuide h2{font-size:21px;margin-bottom:12px}#firstPlayGuide ol{padding-left:24px;margin:0;line-height:1.7;font-size:16px}#firstPlayGuide li{margin:8px 0}#firstPlayGuide p{font-size:13px;color:#c8d8d7;margin:12px 0}#firstPlayGuide .guide-start{display:block;width:100%;min-height:44px;font-size:16px;margin:0}
@media(max-height:340px){body.immersive #firstPlayGuide{padding:12px 16px}#firstPlayGuide h2{font-size:18px;margin:0 0 6px}#firstPlayGuide ol{font-size:14px;line-height:1.5}#firstPlayGuide li{margin:4px 0}#firstPlayGuide p{font-size:12px;margin:7px 0}}

body.immersive.wide-world .paged-speech.single-page {grid-template-columns:minmax(0,1fr)}
body.immersive.wide-world .single-page .speech-pager {display:none}
body.immersive.wide-world .paged-speech:not(.single-page){grid-template-columns:minmax(0,1fr) clamp(128px,14vw,176px)}
body.immersive.wide-world .speech-pager{display:grid;grid-template-columns:44px minmax(0,1fr);grid-template-rows:auto;align-items:center;gap:4px}
body.immersive.wide-world .speech-pager button:first-child,
body.immersive.wide-world .speech-pager button:last-child{display:flex;flex-direction:column;justify-content:center;align-items:center;grid-row:1;height:100%;min-height:44px;max-height:74px;margin:0;padding:2px;gap:2px;white-space:nowrap}
body.immersive.wide-world .speech-pager .speech-count{position:static;width:auto;line-height:1.1;font-variant-numeric:tabular-nums}
body.immersive.wide-world .speech-pager button:disabled{opacity:.65;cursor:default}

body.immersive.wide-world .choices .forecast-choice {position:relative;border-color:#92e5d7;box-shadow:inset 3px 0 #92e5d7;padding-inline:14px}
.forecast-cue {position:absolute;right:3px;top:0;color:#99f4e1;font-size:11px;line-height:14px}
.choices button:first-child .forecast-cue {color:#304643}

#collectionList button{display:grid;justify-items:center;gap:4px;padding:8px;background:#23414f;color:#eef4e7;border:1px solid #526f7b}
body.immersive #heroDetail{width:min(650px,94vw);max-height:92dvh;overflow:auto;padding:14px}
.detail-layout{display:grid;grid-template-columns:clamp(88px,23vw,155px) minmax(0,1fr);align-items:start;gap:16px}
#detailPortrait canvas{display:block;width:100%;height:auto;background:#203f4e;border-radius:8px}
#heroDetail h2,#heroDetail h3,#heroDetail p,#heroDetail ol{margin:4px 0 8px}
#heroDetail h3,#detailNumber{color:#f4cf81}
#heroDetail h3{font-size:15px}
#detailSteps{padding-left:1.5em;line-height:1.5}
#heroDetail button{min-height:44px}

#pinStatus:not(:empty){display:block;margin-top:4px;color:#ffe195}

body.immersive #journalDialog{padding:0 14px 14px;width:min(680px,94vw);max-height:92dvh;overflow:auto}
body.immersive #journalDialog .book-head,.book-tabs{display:flex;position:sticky;background:#163342;align-items:center;gap:6px;z-index:1}
body.immersive #journalDialog .book-head{top:0;height:48px;justify-content:space-between;padding:2px 0}
#journalDialog .book-head h2{margin:0;font-size:20px}
#journalDialog button{min-height:40px;padding:5px 10px;margin:0}
.book-tabs{top:48px;padding:4px 0 8px}
.book-tabs button[aria-pressed=true]{background:#f2ca78;color:#20333d}
#journalDialog [hidden]{display:none!important}
#journalDialog section{margin:8px 0}
.book-lead{grid-column:1/-1;color:#ffdf95;margin:2px 0}
#titleAlbum,#recordList{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
#titleAlbum div,#recordList div{padding:8px;border:1px solid #516d79}
#journalDialog small{display:block;font-size:13px;line-height:1.45}
#journalDialog .locked{opacity:1;color:#cfdbdf}

#journalDialog .book-tabs button[aria-pressed="false"]{background:#203e4e;color:#dce6e8;border:1px solid #57717e}

body.immersive.wide-world .paged-speech:not(.single-page){grid-template-columns:minmax(0,1fr) 50px}
.speech-forward{font-size:16px;line-height:1}
@keyframes speech-nudge{0%,100%{transform:translateX(-2px)}50%{transform:translateX(2px)}}
@media(prefers-reduced-motion:no-preference){.speech-pager .speech-forward.can-advance{animation:speech-nudge 1s steps(2,end) infinite}}

body.immersive.wide-world .speech-pager button:first-child[hidden]{display:none}
body.immersive.wide-world .speech-pager button:last-child{grid-column:2}

body.immersive.wide-world .speech-pager{grid-template-columns:1fr}
body.immersive.wide-world .speech-pager button:only-child{grid-column:1}

.title-duo{display:none}body[data-scene="title"] .title-duo{display:flex;position:absolute;inset:0;z-index:5;align-items:flex-end;justify-content:space-between;padding:clamp(4px,1vw,14px);pointer-events:none}
.title-duo p{position:relative;margin:0 0 7px;padding:.45em .65em;color:#fff7e1;background:#122c3bf5;border:2px solid #e8bd71;border-radius:9px;font-size:clamp(12px,1.45vw,21px);line-height:1.35;font-weight:700}
.title-duo p:last-child{align-self:flex-start;margin:6px 0 0;border-color:#9fdcf5}.title-duo b{display:block;font-size:.82em;color:#ffda86;margin-bottom:.2em}.title-duo p:last-child b{color:#aee7ff}.title-duo p:after{content:'';position:absolute;left:1em;bottom:-7px;border:6px solid transparent;border-bottom:0;border-top-color:#e8bd71}.title-duo p:last-child:after{left:auto;right:1em;border-top-color:#9fdcf5}body[data-scene="title"] .viewport .legend{display:none}
@media(prefers-reduced-motion:no-preference){body:not(.reduced) .title-duo p:last-child{animation:duo-answer .32s steps(2,end) .7s backwards}@keyframes duo-answer{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}}

/* Reuse the loaded character sheets for the opening exchange. */
.title-duo p::before {
  content: "";
  position: absolute;
  width: clamp(36px, 6.5vmin, 70px);
  aspect-ratio: 1;
  left: 4px;
  bottom: 100%;
  background: url("guides-v03.webp?v=1.9.9") 33% 8% / 264% auto no-repeat;
  image-rendering: pixelated;
}
.title-duo p:last-child::before {
  inset: 100% 5px auto auto;
  background-image: url("characters.webp?v=1.9.9");
  background-size: 478% auto;
  background-position: 52% 15%;
}

.title-duo p {white-space:pre-line}
.title-duo.in-play {display:flex;position:absolute;inset:0;z-index:5;justify-content:space-between;align-items:flex-start;padding:3px;pointer-events:none}
.title-duo.in-play p,.title-duo.in-play p:last-child {margin:0;max-width:43%;font-size:clamp(11px,1.1vw,17px);animation:none}
.title-duo.in-play p::before {top:100%;bottom:auto}
.title-duo.summer-speaker p:last-child::before {background-position-x:94%}

.preview-only{background:#3e3544;color:#ffe3ac;padding:10px 14px;text-align:center;font-size:12px;line-height:1.7}.preview-only a{color:#fff;margin-left:12px}.choices button{min-width:0;overflow-wrap:anywhere}
