body.simple-play #wrap{grid-template-areas:'header' 'learning' 'field' 'answers' 'touch';grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(90px,1fr) auto auto;gap:5px}
body.simple-play #gameHeader{display:grid;grid-template-columns:minmax(0,1fr) 48px;gap:8px;align-items:center}
body.simple-play #hud{grid-column:1;grid-row:1;grid-template-columns:1fr 1fr;gap:8px}
body.simple-play #hud .hudBox{font-size:15px;padding:5px 10px;text-align:left}
body.simple-play #levelStatus>.hudBox{display:inline-block;white-space:nowrap;padding:0;margin-left:8px;font-size:12px;background:none;border:0}
body.simple-play #toast{position:absolute;bottom:10px;width:max-content;max-width:calc(100% - 16px);white-space:normal;overflow:visible;overflow-wrap:anywhere;text-overflow:clip;font-size:14px;line-height:1.4;padding:8px 12px;border-radius:12px;z-index:5}
#healthMeter,#experienceMeter{display:block;width:100%;height:8px;margin-top:3px;accent-color:#258865}#healthMeter{accent-color:#e96783}#compactEnergy{float:right;font-size:12px}
body.simple-play #pauseBtn{grid-column:2;grid-row:1;width:48px;min-height:48px;padding:6px;font-size:24px}
body.simple-play #questionSub{display:none}body.simple-play #learningArea{max-height:30dvh}body.simple-play #questionBox{padding:6px}body.simple-play #answerBar{display:block}
body.simple-play #touchControls{grid-template-columns:64px minmax(0,1fr) 64px;height:64px}body.simple-play #joystickZone,body.simple-play #dashBtn{width:64px;height:64px}body.simple-play #joystickStick{width:30px;height:30px;margin-left:-15px;margin-top:-15px}body.simple-play #skillBtn{max-width:160px}
body.simple-play [hidden]{display:none!important}
body:not(.game-running) #joystickZone,body:not(.game-running) #dashBtn,body:not(.game-running) #skillBtn{visibility:hidden}
#startupStatus{font-size:16px;line-height:1.5;color:#365b40}#repairStartup{min-height:48px}#startBtn:disabled{opacity:.65}
#mapToggle{position:absolute;left:50%;top:10px;transform:translateX(-50%);z-index:4;min-width:44px;min-height:44px;padding:6px;background:#f9f5dfeb;font-size:20px}
#playMenu{width:min(520px,94vw);max-height:90dvh;overflow:auto;border:1px solid #c8d8c1;border-radius:24px;background:#fffbed;color:#234d40;padding:20px;box-shadow:0 16px 60px #092c3655}
#playMenu::backdrop{background:#12382ec7}#playMenu h2{margin:0 0 8px;font-size:28px}#playMenu p{line-height:1.6}#playMenu #resumePlay{width:100%;background:#2f7358;color:white;min-height:48px}
#menuActions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}body.simple-play #menuActions button{position:static!important;transform:none!important;width:100%;font-size:16px;min-height:48px;padding:8px}#menuActions:not(.has-fullscreen) #playSound{grid-column:1/-1}#fullscreenTip{margin:0 0 8px;color:#4c6a5e}
#playMenu details{margin-top:10px;background:#edf3e5;border-radius:12px;padding:8px}#playMenu #gameDetails{max-height:none;overflow:visible}#playMenu select{width:100%;font-size:16px;padding:8px}#playPreferences>label{display:block;margin:12px 0}
#detailedStats{display:grid;grid-template-columns:1fr 1fr;gap:6px}#detailedStats .hudBox{font-size:14px;padding:8px;background:#fffbed}
@media(max-width:600px){body.simple-play #hud .hudBox{font-size:13px;padding:4px 6px}body.simple-play #levelStatus>.hudBox{font-size:11px}body.simple-play #answerAccess{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(orientation:landscape) and (max-height:550px){body.simple-play #wrap{grid-template-areas:'header header' 'field learning' 'field answers' 'touch touch';grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto 48px}body.simple-play #touchControls{height:48px;grid-template-columns:48px 1fr 48px}body.simple-play #joystickZone,body.simple-play #dashBtn{width:48px;height:48px}body.simple-play #learningArea{max-height:none}}
@media(min-width:1100px) and (min-height:551px){body.simple-play #touchControls{height:48px;grid-template-columns:48px 1fr 48px}body.simple-play #joystickZone,body.simple-play #dashBtn{width:48px;height:48px}}
@media(orientation:landscape) and (max-height:550px){body.simple-play:not(.learning-visible) #wrap{grid-template-areas:'header' 'field' 'touch';grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) 48px}}
/* A small entry screen; the original controls remain available in disclosures. */
body.simple-play.mobile-play #wrap{grid-template-areas:'header' 'learning' 'field' 'answers';grid-template-rows:auto auto minmax(180px,1fr) auto;gap:4px;padding:4px}
body.simple-play.mobile-play #touchControls{position:absolute;left:8px;right:8px;bottom:8px;grid-area:auto;height:68px;grid-template-columns:68px minmax(0,1fr) 68px;z-index:8;pointer-events:none}
body.simple-play.mobile-play #joystickZone,body.simple-play.mobile-play #dashBtn{width:68px;height:68px;pointer-events:auto;box-shadow:0 2px 8px #08251a66}
body.simple-play.mobile-play #joystickZone{background:#cee4ccdd;border-color:#75a597}
body.simple-play.mobile-play #joystickStick{width:30px;height:30px;margin-left:-15px;margin-top:-15px}
body.simple-play.mobile-play #dashBtn{font-size:16px}
body.simple-play.mobile-play #skillBtn{pointer-events:auto;max-width:140px;background:#d8ead4ee}
body.simple-play.mobile-play #toast{bottom:88px}
@media(orientation:landscape) and (max-height:550px){
 /* Landscape phones: the field runs the full height with health and level as a thin strip over its top edge.
    A narrow question column sits on the right; the joystick and dash button hold the bottom screen corners. */
 body.simple-play.mobile-play #wrap{grid-template-areas:'field learning' 'field answers' 'field thumbs';grid-template-columns:minmax(0,1fr) clamp(180px,28vw,290px);grid-template-rows:minmax(0,1fr) auto 70px}
 body.simple-play.mobile-play:not(.learning-visible) #wrap{grid-template-areas:'field';grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
 body.simple-play.mobile-play #gameHeader{grid-area:field;align-self:start;z-index:6;margin:4px;grid-template-columns:minmax(0,1fr) 44px;gap:6px;pointer-events:none}
 body.simple-play.mobile-play #hud{grid-column:1;grid-row:1;display:flex;align-items:center;gap:12px;width:auto;height:44px;margin:0 54px 0 0;padding:0 12px;overflow:hidden;border-radius:12px;background:#10302ac7}
 body.simple-play.mobile-play #hud .hudBox{display:flex;align-items:center;gap:4px;flex:1 1 0;min-width:0;margin:0;padding:0;border:0;border-radius:0;background:none;color:#fff;font-size:13px;line-height:1.2;white-space:nowrap;text-shadow:0 1px 2px #0009}
 body.simple-play.mobile-play #hud #levelStatus>.hudBox{flex:none;color:#ffe9a8;font-size:12px}
 body.simple-play.mobile-play #healthMeter,body.simple-play.mobile-play #experienceMeter{flex:1 1 24px;min-width:24px;height:6px;margin:0}
 body.simple-play.mobile-play #compactEnergy{float:none;flex:none;color:#fff}
 body.simple-play.mobile-play #pauseBtn{grid-column:2;width:44px;height:44px;min-height:44px;padding:0;font-size:22px;pointer-events:auto}
 body.simple-play.mobile-play #mapToggle{top:2px;right:54px;left:auto;transform:none;z-index:7}
 /* The boss bar sits just under the strip, so in boss fights the canvas starts below both. */
 body.simple-play.mobile-play #bossHUD{margin-top:50px;font-size:12px}
 body.simple-play.mobile-play #learningArea{max-height:none}
 body.simple-play.mobile-play #questionText{font-size:calc(clamp(19px,2.6vw,26px) * var(--reading-scale))}
 body.simple-play.mobile-play #touchControls{position:fixed;left:14px;right:14px;bottom:14px;height:60px;grid-template-columns:60px minmax(0,1fr) 60px}
 body.simple-play.mobile-play #joystickZone,body.simple-play.mobile-play #dashBtn{width:60px;height:60px}
 body.simple-play.mobile-play #toast{bottom:80px}
 body.simple-play.mobile-play.learning-visible #achievementPop,body.simple-play.mobile-play.learning-visible #achievementPop.show{left:auto;right:8px;bottom:84px;transform:none;max-width:calc(28vw - 16px);white-space:normal;text-align:center}
}
@media(orientation:landscape) and (max-height:550px) and (max-width:700px){
 body.simple-play.mobile-play #hud{gap:8px;padding:0 8px}
 body.simple-play.mobile-play #healthMeter,body.simple-play.mobile-play #experienceMeter{min-width:14px}
 body.simple-play.mobile-play #hud .hudBox{font-size:12px}
 body.simple-play.mobile-play #hud #levelStatus>.hudBox{display:none}
}
/* Phones held upright during a game: pause and ask to turn the phone sideways. */
#rotateGuard{border:0;margin:0;padding:24px;width:100vw;height:100dvh;max-width:none;max-height:none;background:#163f35;color:#fff8e8;text-align:center}
#rotateGuard[open]{display:grid;place-items:center}
#rotateGuard::backdrop{background:#163f35}
#rotateGuard h2{margin:12px 0 8px;font-size:26px;color:#fff8e8}
#rotateGuard p{margin:0;font-size:17px;line-height:1.6;color:#d8eadf}
.rotatePhone{display:inline-block;font-size:76px;line-height:1;animation:rotatePhone 2.4s ease-in-out infinite}
@keyframes rotatePhone{0%,20%{transform:rotate(0)}50%,80%{transform:rotate(-90deg)}100%{transform:rotate(0)}}
body.reduce-motion .rotatePhone{animation:none;transform:rotate(-90deg)}
@media(prefers-reduced-motion:reduce){.rotatePhone{animation:none;transform:rotate(-90deg)}}
}
#startPanel .card{width:min(680px,100%)}
#startPanel .titleRow{gap:8px;flex-wrap:wrap}
#startPanel h1{font-size:clamp(28px,6vw,40px);margin:0}
#startPanel .subtitle{margin:10px 0 18px;font-size:16px}
#startPanel .topChips{margin:0;gap:6px}
#startPanel .installChip{min-height:36px;padding:6px 10px;font-size:13px}
#quickStart{display:flex;flex-direction:column;gap:10px;margin-bottom:18px}
#quickStart>label{display:block;font-size:18px}
#quickStart .selectField{margin-top:6px}
#quickStart .quickPrompt{order:-1;margin:0;font-size:17px}
#quickSummary{margin:0;color:#526b61;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
#startPanel #quickStart #startBtn{width:100%;min-height:60px;margin:0;font-size:24px}
#quickStart #configErrors:empty,#quickStart #growthError:empty{display:none}
#quickStart #configErrors,#quickStart #growthError{margin:0}
#startPanel .card>details{margin:8px 0;padding:0 10px;border-radius:12px;background:#f1f5eb;border:1px solid #dce5d5}
#startPanel .card>details>summary{font-size:16px;min-height:46px;padding:8px 0}
#startPanel .card>details>summary::after{content:'＋';margin-left:auto}
#startPanel .card>details[open]>summary::after{content:'−'}
#homeSettings .setupGrid{margin-top:12px}
#startPanel .copyright{font-size:12px;margin:16px 0 0}
#homeCollection .adventureBanner{padding:10px;font-size:14px}
.assignmentSummary{margin:0;color:#286b57;font-size:15px}

/* Stop browser pull-to-refresh without disabling menu scrolling. */
html,body{overscroll-behavior-y:none}
body.game-running #playfield{touch-action:none;overscroll-behavior:none}
#playMenu,#startPanel,#levelUpPanel,#mathPopup,#merchantPopup{overscroll-behavior:contain}
/* 키보드 조작 안내: 조이스틱 오른쪽·대시 버튼 왼쪽. 터치 기기와 좁은 화면에서는 숨김 */
.keyHint{grid-row:1;grid-column:2;align-self:center;font-size:12px;line-height:1.2;color:#4f6b5d;white-space:nowrap;pointer-events:none}.keyHint kbd{display:inline-block;padding:1px 5px;border:1px solid #9fbcae;border-bottom-width:2px;border-radius:5px;background:#fffdf6;font:inherit;font-weight:700;color:#2f4b3f}
#moveKeyHint{justify-self:start}#dashKeyHint{justify-self:end}
body:not(.game-running) .keyHint,body.mobile-play .keyHint{display:none}
@media(hover:none),(max-width:639px){.keyHint{display:none}}

/* Fullscreen and notched phones: keep controls clear of the camera cutout and home bar. */
body.simple-play.mobile-play #wrap{padding:max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left))}
