/* All views are laid out inside the visual viewport; content has real space, not a scroll mask. */
html,body{height:100%;min-height:0;overscroll-behavior:none}body{height:var(--play-height,100dvh);overflow:hidden}#app{height:100%;min-height:0;max-width:1120px;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;padding:10px 14px;margin:0 auto;overflow:hidden}#app>.top{height:44px;min-height:44px;flex:none;padding:5px 8px;box-sizing:border-box}#app>footer{height:14px;flex:none;font-size:8px;line-height:14px;margin:0;letter-spacing:.5px}#app>.top .brand{font-size:15px}#app>.top .ghost{padding:7px 12px;font-size:12px}#app>.top .tag{font-size:11px}
.compact-panel{width:100%;max-width:640px;min-height:0;box-sizing:border-box;margin:auto;padding:15px 20px}.compact-panel h1{font-size:26px;margin:0 0 12px}.compact-panel h2{font-size:16px;margin:8px 0}.compact-panel .language-options{margin:10px 0;gap:10px}.compact-panel .language-options button{padding:10px;font-size:14px;min-height:40px}.compact-panel .music-settings{padding-top:4px;margin:14px 0}.compact-panel .music-actions{margin:9px 0;gap:8px}.compact-panel .music-actions button{padding:10px;font-size:12px;min-height:38px}.compact-panel .music-settings input{height:28px;margin:3px 0}.compact-panel .music-settings label{font-size:13px}.compact-panel [data-music-status]{font:12px/1.4 Arial,sans-serif;margin:6px 0;min-height:32px}.compact-panel .music-track-list{display:none}.settings-navigation{display:grid;grid-template-columns:1fr 1fr;gap:9px}.settings-navigation button{padding:10px 4px;min-height:40px;font-size:12px}.settings-navigation button:first-child{grid-column:1/-1}.compact-panel .settings-save{font:11px/1.5 Arial,sans-serif;margin:10px 0 0}
.journey-select{flex:1;width:100%;max-width:620px;min-height:0;margin:0 auto;display:grid;grid-template-rows:auto minmax(0,1fr) 18px;gap:6px}.map-heading .eyebrow{font-size:9px}.map-heading h1{font-size:20px;line-height:1.2;margin:4px 0}.map-heading p{display:none}.journey-map{width:100%;height:100%;min-height:0;margin:0;box-sizing:border-box;box-shadow:none}.map-legend{font-size:9px;line-height:16px;margin:0;white-space:nowrap;text-align:center;letter-spacing:-.3px}.journey-map .map-node{width:40px;height:40px;border-width:3px}.journey-map .map-node .map-number{font-size:19px}.journey-map .node-name{display:none}.destination-label{top:1%;padding:3px 8px;font-size:12px}.destination-label small{display:none}.map-start{bottom:1%;font-size:9px;padding:3px 8px}.map-hero{width:55px;height:65px;transform:translate(-50%,-75%)}.map-hero .sprite-frame{scale:.8;transform-origin:50% 100%}.you-label{font-size:8px}.node-lock{width:12px;height:11px}.node-lock:before{width:6px;left:-1px}.node-badge{width:19px;height:19px;font-size:13px;line-height:16px}
.stage-modal-backdrop{padding:12px}.stage-confirm{width:min(100%,400px);max-height:calc(var(--play-height,100dvh) - 24px);padding:16px;overflow:visible;box-sizing:border-box}.stage-confirm h2{font-size:23px;margin:10px 0}.stage-confirm h3{font-size:18px;margin:10px 0}.stage-confirm p{font-size:12px;line-height:1.6;margin:10px 0}.stage-preview{height:clamp(80px,22vh,145px)}.confirm-actions{margin-top:12px;gap:10px}.confirm-actions button{padding:12px 6px;min-height:42px;font-size:12px;min-width:0}
#app>.comic{flex:1;width:100%;max-width:820px;min-height:0;margin:0 auto;display:grid;grid-template-rows:16px 30px minmax(40px,1fr) auto 44px;gap:7px}#app>.comic h1{font-size:23px;margin:0;line-height:30px}#app>.comic .eyebrow{font-size:10px;line-height:16px}#app>.comic .comic-art{height:100%;width:auto;aspect-ratio:1;max-width:100%;margin:0 auto;box-sizing:border-box;box-shadow:none}#app .speech{margin:0;padding:10px 12px;min-height:0;box-shadow:none;box-sizing:border-box}#app .speech b{font-size:13px;line-height:18px}#app .speech p{font:13px/1.5 Arial,'Microsoft YaHei',sans-serif;margin:5px 0 0}.comic-controls{flex-wrap:nowrap;gap:8px}.comic-controls button{min-width:0;flex:1;font-size:12px;padding:7px 5px;line-height:16px}.ending>.ghost,.ending>.primary{margin:0;min-height:40px;padding:9px;font-size:12px}.ending>.primary{grid-row:5;grid-column:1;margin-right:51%}.ending>.ghost{grid-row:5;grid-column:1;margin-left:51%}
#app>.encounter{flex:1;width:100%;max-width:820px;min-height:0;display:grid;grid-template-rows:16px 30px minmax(100px,1fr) auto 42px;gap:8px;margin:0 auto}.encounter>.eyebrow{font-size:10px}.encounter>h1{font-size:23px;line-height:30px;margin:0}.encounter>.primary{padding:10px;font-size:13px}.encounter>.arena{height:100%;min-height:0;box-sizing:border-box;padding:10px;grid-template-columns:minmax(0,1fr) 20px minmax(0,1fr)}.encounter .fighter{display:flex;flex-direction:column;min-height:0;min-width:0}.encounter .fighter h2{font-size:14px;min-height:20px;line-height:20px;margin:0 0 4px}.encounter .hp{width:100%;min-height:0;flex:none}.encounter .actor{height:auto;flex:1;min-height:0;width:100%;margin:0}.encounter .sprite-frame{scale:var(--actor-scale,.8);transform-origin:50% 100%;bottom:3px}
#app>.travel{width:100%;max-width:820px;flex:1;min-height:0;margin:0 auto;display:flex;flex-direction:column;gap:10px}.travel h1{font-size:24px;margin:0}.travel .eyebrow{font-size:10px}.road-scene{flex:1;height:auto;min-height:140px}.travel>p{font:13px/1.5 Arial,sans-serif;margin:0}.walker{scale:.8;transform-origin:bottom left}
#app>.hero{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0;gap:10px}#app>.hero .eyebrow{font-size:10px}.hero h1{font-size:clamp(28px,5vh,50px);line-height:1.1;margin:0;letter-spacing:0}.hero p{font:14px/1.6 Arial,sans-serif;margin:0}.hero-avatar{flex:1;min-height:70px;max-height:190px;height:auto;width:200px;margin:0}.hero-avatar .sprite-frame{scale:.8;transform-origin:bottom center}.menu-actions{margin:0;gap:8px;flex-wrap:nowrap}.menu-actions button{padding:10px 9px;font-size:12px;min-height:42px}.compact-help{flex:1;width:100%;box-sizing:border-box;min-height:0;margin:0 auto;padding:20px;display:flex;flex-direction:column;gap:14px;max-width:700px}.compact-help h1{font-size:25px;margin:0}.compact-help .eyebrow{font-size:11px}.help-copy{flex:1;display:flex;flex-direction:column;justify-content:center;gap:15px}.help-copy p{font:16px/1.65 Arial,'Microsoft YaHei',sans-serif;margin:0}.help-navigation{display:flex;gap:8px}.help-navigation button{flex:1;min-width:0;padding:12px 5px;font-size:12px}.result{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:20px;padding:10px}.result h1{font-size:clamp(25px,5vw,44px);margin:0}.result p{font-size:15px;line-height:1.6;margin:0}.result .menu-actions{justify-content:center}
.board .tile.rare-letter{background:#edc5f3;border-color:#cb95d8}.board .tile.rare-letter.selected{background:#8bc6b1}.letter-bonus{position:absolute;left:4px;top:3px;font:bold 9px Arial;color:#773584;line-height:1;pointer-events:none}.tile[aria-pressed=true] .letter-bonus{color:#305b51}
@media(max-height:650px){#app{gap:6px;padding:7px 10px}#app>.comic{gap:5px;grid-template-rows:14px 26px minmax(40px,1fr) auto 42px}#app>.comic h1{font-size:20px;line-height:26px}#app .speech p{font-size:12px;line-height:1.45}#app .speech{padding:8px 10px}.compact-panel{padding:12px 15px}.compact-panel h1{font-size:23px;margin-bottom:8px}.compact-panel .music-settings{margin:10px 0}.compact-panel h2{margin:5px 0}.compact-panel .settings-save{margin-top:6px}.map-heading h1{font-size:17px}.map-legend{font-size:8px}.journey-map .map-node{width:36px;height:36px}.journey-map .map-number{font-size:17px}.destination-label{font-size:10px}.hero-avatar .sprite-frame{scale:.55}.hero p{font-size:12px}.hero .menu-actions button{font-size:11px;padding:8px}.help-copy p{font-size:14px;line-height:1.6}.compact-help{padding:15px;gap:10px}.encounter>h1{font-size:21px}.stage-confirm{padding:12px}}
@media(min-width:761px){body[data-screen=battle] .battle-layout{flex:1;min-height:0;align-items:center}body[data-screen=battle] .stage-line{margin:0;height:35px;flex:none}body[data-screen=battle] .stage-line h1{font-size:21px;margin:3px 0}body[data-screen=battle] .board{width:var(--board-side);height:var(--board-side);grid-template-rows:repeat(5,minmax(0,1fr));margin:6px auto;box-sizing:border-box}body[data-screen=battle] .board .tile{height:100%;min-height:0}body[data-screen=battle] .arena{height:min(400px,calc(var(--play-height) - 225px));min-height:0}body[data-screen=battle] .notice{min-height:0;margin:10px 0;font-size:12px}body[data-screen=battle] .history{display:none}body[data-screen=battle] .tutorial-copy{min-height:20px}body[data-screen=battle] .controls button{padding:11px;font-size:12px}body[data-screen=battle] .word{min-height:30px;font-size:24px}body[data-screen=battle] footer{display:none}}

#app>.comic,#app>.encounter{grid-template-columns:minmax(0,1fr)}#app>.comic .comic-art{min-width:0}
@media(min-width:761px){body[data-screen=battle] .stage-line{height:44px}}

.ending>.primary{margin-right:0}

/* 0.11: the canvas gains the entire former header row. */
#app{position:relative}.settings-gear{position:absolute;z-index:20;right:max(8px,env(safe-area-inset-right));top:max(6px,env(safe-area-inset-top));width:44px;height:44px;padding:9px;border:1px solid #c6d7c1;border-radius:50%;background:#132936e8;color:#f1d49b;box-shadow:0 2px 4px #05111c88;display:grid;place-items:center}.settings-gear svg{width:25px;height:25px;pointer-events:none}.settings-gear:hover{background:#35505c}.settings-gear:focus-visible{outline:3px solid #f8d38b;outline-offset:-4px}.map-heading{padding-right:48px}#app>.comic h1,#app>.encounter h1,.travel h1,.compact-help h1,.stage-line h1{padding-right:48px}.settings-panel h1{padding-right:40px}#app>.hero{padding-top:38px}.result{padding-top:44px}.settings-panel{margin:auto}body[data-screen=settings] .settings-gear{background:#203c48}body[data-modal=true] .settings-gear{visibility:hidden}
@media(max-width:370px){#app>.comic h1,#app>.encounter h1{font-size:19px}.map-heading h1{font-size:16px}body[data-screen=battle] .stage-line h1{font-size:13px}}
@media(max-width:760px){body[data-screen=battle] .stage-line{height:44px;display:flex;align-items:center}}

.battle-view.quiet .notice{display:none}@media(max-width:760px){body[data-screen=battle] .battle-view.quiet{grid-template-rows:minmax(0,1fr);gap:0}}

/* 0.15: reclaim the action-description and bottom rules rows. */
body[data-screen=battle] .battle-view .notice{position:absolute!important;left:0!important;top:0!important;width:1px!important;height:1px!important;min-height:0!important;max-height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap;padding:0!important;margin:0!important;border:0!important}body[data-screen=battle] .battle-view .history{display:none}body[data-screen=battle] .battle-view,body[data-screen=battle] .battle-view.quiet{grid-template-rows:minmax(0,1fr);gap:0}
@media(max-width:760px){body[data-screen=battle] .spell{grid-template-rows:17px 27px var(--board-side) 39px}}

.cast-feedback{position:absolute;bottom:8px;left:8px;right:8px;z-index:12;padding:7px 10px;background:#122734f2;border:1px solid #efcf91;color:#fff0c5;font:12px/1.5 Arial,"Microsoft YaHei",sans-serif;pointer-events:none}

/* Keep comic caption directly attached to its illustration. */
#app>.comic{align-content:center}#app>.comic .comic-art{position:relative;align-self:start}
/* Readable UI labels; retain pixel lettering for the game's artwork/title. */
#app button:not(.tile):not(.map-node):not(.start-game){font-family:Arial,'Microsoft YaHei',sans-serif;font-weight:700;letter-spacing:0;font-size:14px;line-height:1.25}
#app .controls button{font-size:14px;padding-left:3px;padding-right:3px}#app .comic-controls button{font-size:14px}#app .sound-tabs button{font-size:14px}#app .music-actions #music-picker{font-size:14px;font-weight:600}
@media(max-width:370px){#app .controls button{font-size:13px}#app .comic-controls button{font-size:13px}}

#app>.comic h1{height:auto;min-height:0;white-space:normal;overflow:visible;overflow-wrap:break-word;font-family:Arial,"Microsoft YaHei",sans-serif;font-weight:700;letter-spacing:0;font-size:clamp(18px,4.5vw,23px);line-height:1.25}

/* Fixed game viewport: retain single-finger panning, exclude pinch zoom. */
html,body,#app,#app *,#sb-auth-overlay,#sb-auth-overlay *,#sb-account-overlay,#sb-account-overlay *,#sb-account-button{touch-action:pan-x pan-y}
