html,body{overscroll-behavior:none}body{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}button{touch-action:manipulation}#touch-controls{display:none;align-items:center;justify-content:space-between;padding:14px 24px;user-select:none;-webkit-user-select:none}#stick{width:132px;height:132px;border-radius:50%;background:#e4d7c2;border:2px solid #fff9e9;position:relative;touch-action:none;box-shadow:inset 0 3px 15px #876e4220}#stick:before{content:'↑';position:absolute;inset:6px;text-align:center;color:#ad9a7b}#knob{pointer-events:none;position:absolute;left:39px;top:39px;width:50px;height:50px;border-radius:50%;background:#fff8e9;box-shadow:0 5px 12px #79634126}#jump{width:100px;height:100px;border-radius:50%;border:4px solid #fff3df;background:#deb3a4;box-shadow:0 6px 0 #c79b8d;color:#fff;font-size:19px;font-weight:bold;touch-action:none}#jump:active{transform:translateY(3px);box-shadow:0 3px 0 #c79b8d}#install-help{display:none;font-size:12px;line-height:1.7;color:#817765;margin:8px 18px}#install-help.visible{display:block}#app-actions{display:flex;gap:8px;justify-content:flex-end;margin:8px 12px}#notice{z-index:5}
@media(pointer:coarse),(max-width:900px){#touch-controls{display:flex}.wrap{width:100%;padding:8px 0}header{margin-bottom:8px}header small,header p,footer>div,footer .badge{display:none}header h1{font-size:18px}.stage{border-radius:14px}footer{margin:8px 16px;justify-content:flex-end}#app-actions{position:absolute;top:max(7px,env(safe-area-inset-top));right:max(7px,env(safe-area-inset-right))}#app-actions button{font-size:11px;padding:7px 10px}}
@media(pointer:coarse) and (orientation:landscape) and (max-height:600px){body{display:block;background:#e9e2d6}.wrap{padding:0;height:100dvh}header,footer{display:none}.stage{height:100dvh;border-radius:0;box-shadow:none}canvas{width:100%;height:100%;object-fit:contain}#touch-controls{position:fixed;inset:auto 0 max(8px,env(safe-area-inset-bottom));pointer-events:none;padding:0 max(18px,env(safe-area-inset-right)) 0 max(18px,env(safe-area-inset-left));z-index:2}#stick,#jump{pointer-events:auto;opacity:.8}#stick{width:112px;height:112px}#knob{left:29px;top:29px}#jump{width:88px;height:88px}#app-actions{z-index:3}#install-help.visible{position:fixed;top:40px;right:10px;max-width:320px;padding:12px;background:#fff8eb;z-index:4;border-radius:12px}}
/* Keep mobile play and both controls inside one viewport, in either orientation. */
@media(any-pointer:coarse),(max-width:900px){
 html,body{width:100%;height:100%;min-height:0;overflow:hidden}
 body{display:block;padding:0;background:#e9e2d6}
 .wrap{width:100%;height:100vh;height:100dvh;padding:0}
 header,footer{display:none}
 .stage{width:100%;height:100%;border-radius:0;box-shadow:none}
 canvas{width:100%;height:100%;object-fit:contain;touch-action:none}
 #touch-controls{display:flex;position:absolute;inset:auto 0 30px;z-index:2;pointer-events:none;padding:14px max(18px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left))}
 #stick,#jump{pointer-events:auto;opacity:.82}
 #stick{width:112px;height:112px}
 #knob{left:29px;top:29px}
 #jump{width:88px;height:88px}
 #app-actions{position:fixed;top:max(7px,env(safe-area-inset-top));right:max(7px,env(safe-area-inset-right));z-index:3}
 #app-actions button{font-size:11px;padding:7px 10px}
 #install-help.visible{position:fixed;top:48px;right:10px;max-width:min(320px,90vw);padding:12px;background:#fff8eb;z-index:4;border-radius:12px}
}
/* Bring both thumbs slightly closer to the center. */
@media(any-pointer:coarse),(max-width:900px){
 #touch-controls{padding-left:max(clamp(36px,9vw,110px),env(safe-area-inset-left));padding-right:max(clamp(36px,9vw,110px),env(safe-area-inset-right))}
}
#toy-hud{position:absolute;left:16px;top:16px;z-index:2;display:flex;flex-direction:column;gap:5px;padding:12px 16px;border-radius:15px;background:#fff9ebed;box-shadow:0 3px 12px #7c694517;pointer-events:none;color:#776b54}#toy-count{font-size:15px}#toy-hint{font-size:11px}#toy-toast{position:absolute;left:50%;top:20%;transform:translateX(-50%);z-index:3;max-width:90%;width:max-content;padding:12px 20px;background:#fff9e9f5;border:1px solid #e5d1a7;border-radius:24px;text-align:center;color:#887453;pointer-events:none;font-size:15px}#toy-toast[hidden]{display:none}@media(any-pointer:coarse),(max-width:900px){#toy-hud{left:max(10px,env(safe-area-inset-left));top:max(10px,env(safe-area-inset-top));padding:9px 11px;max-width:calc(100% - 185px)}#toy-count{font-size:13px}#toy-hint{font-size:10px;line-height:1.5}#toy-toast{font-size:13px;top:25%}}
#toy-restart{pointer-events:auto;align-self:flex-start;margin-top:3px;padding:6px 12px;font-size:12px;min-height:32px;background:#f2e4ca;border-color:#dcc9a6;color:#776b54;touch-action:manipulation}
#bubble-hud{position:absolute;left:16px;top:137px;z-index:2;display:flex;flex-direction:column;gap:5px;padding:10px 14px;border-radius:15px;background:#f3fbf6ed;box-shadow:0 3px 12px #7c694517;pointer-events:none;color:#618b8e}#bubble-count{font-size:14px}#bubble-hint{font-size:11px}#bubble-restart{pointer-events:auto;align-self:flex-start;padding:6px 10px;min-height:32px;font-size:11px;background:#dfefeb;border-color:#b7d6d1;color:#618b8e;touch-action:manipulation}@media(any-pointer:coarse),(max-width:900px){#bubble-hud{left:max(10px,env(safe-area-inset-left));top:124px;padding:8px 11px;max-width:calc(100% - 185px)}#bubble-count{font-size:12px}#bubble-hint{font-size:10px;line-height:1.5}}
#music-toggle{min-width:58px}#music-toggle[aria-pressed="true"]{background:#e6eedb;border-color:#c6d4b3;color:#71845c}@media(any-pointer:coarse),(max-width:900px){#app-actions{gap:4px;margin:4px}#app-actions button{padding:6px 7px;font-size:10px}#music-toggle{min-width:49px}}
@media(any-pointer:coarse),(max-width:900px){#toy-hud,#bubble-hud{max-width:max(110px,calc(100% - 235px))}}
#activity-picker{position:absolute;left:16px;top:14px;z-index:3;display:flex;align-items:center;gap:8px;background:#fff9ebef;border-radius:12px;padding:7px 10px;color:#776b54;font-size:11px}#activity-select{font-family:inherit;font-size:12px;border:1px solid #d8c9ad;border-radius:8px;background:#fffaf0;color:#776b54;padding:6px;max-width:150px}#toy-hud,#bubble-hud,.new-game-hud{top:67px;left:16px;max-width:220px}.new-game-hud{position:absolute;z-index:2;display:flex;flex-direction:column;gap:6px;padding:12px 14px;border-radius:15px;background:#fff9ebed;color:#776b54;font-size:12px;pointer-events:none}.new-game-hud button{pointer-events:auto;min-height:32px;align-self:flex-start;font-size:11px;padding:6px 10px}.new-game-hud strong{font-size:14px}#toy-hud[hidden],#bubble-hud[hidden],.new-game-hud[hidden]{display:none}@media(any-pointer:coarse),(max-width:900px){#activity-picker{left:10px;top:max(9px,env(safe-area-inset-top));gap:4px;padding:5px;max-width:max(115px,calc(100% - 225px))}#activity-picker label{display:none}#activity-select{font-size:11px;max-width:100%;padding:6px}#toy-hud,#bubble-hud,.new-game-hud{left:10px;top:58px;max-width:max(110px,calc(100% - 235px));padding:9px 11px}.new-game-hud strong{font-size:12px}.new-game-hud span{font-size:10px;line-height:1.5}}
#colors-preview{position:absolute;left:50%;top:16%;transform:translateX(-50%);z-index:3;display:flex;flex-direction:column;align-items:center;gap:12px;padding:16px 20px;background:#fff9eeef;box-shadow:0 5px 20px #88754725;border-radius:20px;max-width:90%;pointer-events:none;color:#766b58}#colors-preview[hidden]{display:none}#colors-sequence{display:flex;gap:8px}#colors-sequence span{padding:12px 15px;border-radius:12px;white-space:nowrap;font-size:15px;font-weight:bold;color:#5f5b50;border:2px solid #ffffffa0}#colors-timer{font-size:12px}@media(any-pointer:coarse),(max-width:900px){#colors-preview{top:22%;padding:12px;gap:9px}#colors-preview strong{font-size:13px}#colors-sequence{gap:5px}#colors-sequence span{padding:9px 10px;font-size:12px}}

@media(any-pointer:coarse),(max-width:900px){#stick{transform:translateY(-30px)}}

.colors-level-label{display:flex;align-items:center;gap:6px;pointer-events:auto}#colors-level{font:inherit;color:#776b54;background:#fffaf0;border:1px solid #d8c9ad;border-radius:8px;padding:7px;min-height:32px;max-width:100%}#colors-sequence{flex-wrap:wrap;justify-content:center;max-width:650px}

#maze-actions{position:absolute;right:16px;top:70px;z-index:3;display:flex;flex-direction:column;gap:7px}#maze-actions button{font-size:12px;min-height:36px;padding:8px 12px;background:#fff8e9;color:#776b54}#maze-actions button[hidden]{display:none}

#math-panel{position:absolute;left:50%;top:15%;transform:translateX(-50%);z-index:4;display:flex;align-items:center;flex-direction:column;gap:12px;padding:16px;border-radius:18px;background:#fff8edee;color:#776b54;max-width:90%;width:max-content}#math-panel[hidden],#math-setup[hidden],#math-answers[hidden]{display:none}#math-setup{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:center}#math-panel select{font:inherit;padding:8px;border-radius:8px}#math-panel button{min-height:40px;padding:8px 18px}#math-answers{display:flex;gap:18px}#math-answers button{min-width:100px;font-size:22px}#math-title{font-size:22px}@media(max-height:500px){#math-panel{top:12%;padding:10px;gap:7px}#math-title{font-size:18px}}

.math-mode #activity-picker,.math-mode #toy-hud,.math-mode #bubble-hud,.math-mode .new-game-hud,.math-mode #colors-preview{display:none}

.math-mode #math-panel{top:3%;padding:10px 14px;gap:6px}.math-mode #math-leave{font-size:11px;min-height:30px;padding:5px 10px}

#math-progress{font-family:Segoe UI,Malgun Gothic,sans-serif;font-size:12px;font-weight:400;letter-spacing:1px;color:#718477;background:#e8efdf;padding:4px 12px;border-radius:20px}#math-progress[hidden]{display:none}#math-title{font-family:Georgia,Malgun Gothic,serif;font-weight:700;font-size:26px;letter-spacing:.5px}

/* Keep long presses on the game from selecting text or opening touch callouts. */
.stage,.stage *{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}canvas,#stick,#jump{-webkit-tap-highlight-color:transparent}canvas{touch-action:none}
