body:not([data-playmode=draw]) #home-screen,body:not([data-playmode=draw]) .paper,body:not([data-playmode=draw]) .top,body:not([data-playmode=draw]) .animal-label,body:not([data-playmode=draw]) .palette,body:not([data-playmode=draw]) #home-button{visibility:hidden;pointer-events:none}
.mode-screen,.game-screen{position:absolute;inset:0;z-index:11;background:#fff8ed;display:flex;flex-direction:column;padding:max(14px,env(safe-area-inset-top)) 18px max(12px,env(safe-area-inset-bottom));gap:12px;overflow:hidden}.mode-screen[hidden],.game-screen[hidden]{display:none}
.mode-header,.game-header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:none;min-height:50px}.mode-brand{font-weight:850;font-size:22px;letter-spacing:-.5px}.game-avatar{min-width:52px;min-height:50px;max-width:55%;border:1px solid #e5dece;box-shadow:0 3px 0 #eee5d5;border-radius:18px;background:white;display:flex;align-items:center;gap:8px;padding:8px 12px;font-weight:750}.game-avatar .av{font-size:28px}.game-avatar .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.mode-screen h1{font-size:clamp(27px,7.2vw,36px);line-height:1.1;letter-spacing:-1px;margin:10px 0 0;font-weight:850}.mode-sub{margin:0;color:#6c746d;font-size:15px}.mode-cards{flex:1;min-height:0;display:grid;grid-template-rows:repeat(3,minmax(0,1fr));gap:16px;padding:4px 0 6px}.mode-card{display:grid;grid-template-columns:minmax(82px,30%) 1fr 20px;align-items:center;gap:14px;text-align:left;border-radius:28px;border:2px solid var(--edge);background:var(--bg);box-shadow:0 5px 0 var(--edge);padding:16px;min-height:90px;color:#34404c}.mode-card[data-game-mode=draw]{--bg:#eaf5e3;--edge:#d3e6c9}.mode-card[data-game-mode=puzzle]{--bg:#fff0d8;--edge:#ecddbf}.mode-card[data-game-mode=memory]{--bg:#eeebff;--edge:#dbd5f2}.mode-card .mode-art{display:grid;place-items:center;background:white;border-radius:22px;width:100%;aspect-ratio:1;overflow:hidden;position:relative}.mode-art img,.mode-art canvas{width:100%;height:100%;object-fit:contain}.mode-art.puzzle img{object-fit:cover}.mode-card strong{display:block;font-size:clamp(22px,5.7vw,29px);letter-spacing:-.5px}.mode-card small{display:block;font-size:13px;color:#657066;margin-top:7px;line-height:1.35}.mode-card .arr{font-size:32px}.mode-card:active,.level-card:active{transform:scale(.98)}.mode-art.memory{background:#eef3ff;display:flex;gap:3px;padding:10px}.mode-art.memory img{width:48%;height:85%;object-fit:contain;background:white;border:2px solid #8a83cc;border-radius:9px;transform:rotate(-9deg)}.mode-art.memory img+img{transform:rotate(9deg)}
.mode-footer{display:flex;gap:10px;justify-content:space-between;align-items:center;min-height:32px;flex:none;color:#7b8679;font-size:11px}.mode-settings{min-width:44px;min-height:36px;border-radius:13px;background:#f0ecdf;font-weight:800;font-size:23px}.game-back,.draw-root-back,.game-home{width:48px;height:48px;flex:none;display:grid;place-items:center;border-radius:17px;background:#fff;border:1px solid #e5e1d6;font-size:30px}.game-header h2{font-size:21px;line-height:1.2;text-align:center;flex:1}.game-header .game-avatar{max-width:52px;padding:6px;justify-content:center}.game-header .nm{display:none}.draw-root-back{width:44px;height:44px;margin-right:0;font-size:25px}.game-content{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;position:relative}.game-subtitle{text-align:center;font-size:15px;color:#687668;margin:0 0 3px;line-height:1.4}.level-list{display:grid;grid-template-rows:repeat(3,minmax(0,1fr));gap:18px;flex:1;min-height:0;padding:12px 0}.level-card{display:flex;gap:18px;align-items:center;text-align:left;background:#fff;border:2px solid #e7e3d5;border-radius:25px;padding:20px;box-shadow:0 4px 0 #e7e3d5}.level-card:nth-child(1){background:#e9f6e6}.level-card:nth-child(2){background:#fff0d6}.level-card:nth-child(3){background:#efeaff}.level-icon{display:grid;grid-template-columns:repeat(var(--n),1fr);gap:3px;width:70px;height:70px;flex:none}.level-icon i{border-radius:4px;background:#88a8d7;border:1px solid #577ea5}.level-copy{flex:1}.level-copy strong{display:block;font-size:27px}.level-copy small{display:block;font-size:14px;color:#677568;margin-top:5px}.scene-gallery{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;overflow:auto;min-height:0;padding:3px 1px 14px;overscroll-behavior:contain}.scene-choice{background:white;border:2px solid #e5e7dc;border-radius:20px;overflow:hidden;padding:6px;text-align:center;position:relative}.scene-choice img{display:block;width:100%;aspect-ratio:1;object-fit:cover;border-radius:13px}.scene-choice span{display:block;min-height:34px;font-size:12px;font-weight:750;line-height:1.25;margin:7px 0 3px}.scene-choice .badge{position:absolute;right:8px;top:8px;border-radius:15px;background:#fff8;font-size:17px;padding:3px;min-height:0;margin:0}.game-status{display:flex;align-items:center;justify-content:center;gap:9px;min-height:32px;font-size:16px;font-weight:750}.game-save{font-size:11px;min-height:16px;color:#71806f;text-align:center;flex:none}.game-save[data-state=error]{color:#9e3e29;font-weight:750}.game-error{background:#fff0dd;border:1px solid #e7bd84;border-radius:18px;padding:16px;font-size:14px;line-height:1.5}.game-error button{display:block;min-height:48px;border-radius:14px;background:white;padding:10px 16px;margin-top:10px}.game-bar{display:flex;gap:10px;justify-content:center;align-items:center;min-height:46px;flex:none}.game-tool{display:flex;gap:8px;align-items:center;justify-content:center;min-height:46px;min-width:48px;background:white;border:1px solid #e3dfd1;border-radius:16px;font-size:22px;padding:8px 15px}.game-tool .txt{font-size:13px;font-weight:750}.game-tool.primary{background:#e3f3df;border:1px solid #9bc69c}.game-stage{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px}.memory-board{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));grid-template-rows:repeat(var(--rows),minmax(0,1fr));gap:10px;width:100%;height:100%;max-width:520px;max-height:650px;perspective:1000px;min-height:0}.memory-card{position:relative;min-width:0;min-height:0;padding:0;border:0;background:transparent;border-radius:19px;perspective:600px}.memory-card:disabled{opacity:1}.memory-inner{position:absolute;inset:0;transform:rotateY(180deg);transition:transform .24s;transform-style:preserve-3d}.memory-face{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:19px;border:3px solid #a7b3e4;overflow:hidden;display:grid;place-items:center;background:white}.memory-face img{width:100%;height:100%;object-fit:contain;padding:5px;pointer-events:none}.memory-back{transform:rotateY(180deg);background:#7e98de;border-color:#677fc5;background-image:radial-gradient(#ffffff35 2px,transparent 2px);background-size:16px 16px;box-shadow:0 4px 0 #5c72b6;color:white;font-size:clamp(26px,7vw,45px)}.memory-card[data-face=preview] .memory-inner,.memory-card[data-face=open] .memory-inner,.memory-card[data-face=matched] .memory-inner{transform:rotateY(0deg)}.memory-card[data-face=preview] .memory-inner{transition:none}.memory-card[data-face=matched] .memory-face{border-color:#8bc698;background:#edf9ec}.memory-card[data-face=matched]:after{content:'✓';position:absolute;bottom:5px;right:5px;background:#66a777;color:white;border-radius:50%;width:21px;height:21px;font-size:15px;display:grid;place-items:center}.puzzle-stage{flex:1;min-height:0;display:grid;grid-template-rows:minmax(0,1.25fr) minmax(var(--tray-min,150px),1fr);gap:12px}.puzzle-board-wrap{min-height:0;display:flex;justify-content:center;align-items:center}.puzzle-board{height:100%;max-width:100%;aspect-ratio:1;position:relative;isolation:isolate;box-shadow:0 0 0 5px #e8c75e,0 8px 0 #d6b849;border-radius:13px;background:#fff;touch-action:none}.puzzle-board>svg{width:100%;height:100%;display:block;border-radius:12px}.puzzle-outline{stroke:#cabd97;stroke-width:2;fill:#fffdf5}.puzzle-ghost{opacity:0;transition:opacity .18s;pointer-events:none}.puzzle-board[data-hint=true] .puzzle-ghost{opacity:.6}.puzzle-board[data-easy=true] .puzzle-ghost{opacity:.12}.puzzle-board[data-easy=true][data-hint=true] .puzzle-ghost{opacity:.6}.puzzle-slots{position:absolute;inset:0;display:grid;grid-template-columns:repeat(var(--n),1fr);grid-template-rows:repeat(var(--n),1fr)}.puzzle-slot{background:transparent;min-width:0;padding:0;min-height:0;border-radius:12px;touch-action:none}.puzzle-slot:focus-visible{outline:3px dashed #81b493;outline-offset:-5px}.piece-tray{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:3px;min-height:0;align-content:stretch;justify-items:center;background:#f3ecdf;border:1px solid #e8decc;border-radius:22px;padding:7px;overflow:hidden}.puzzle-piece{width:100%;height:100%;min-height:0;min-width:0;background:transparent;border:2px solid transparent;border-radius:15px;padding:0;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}.puzzle-piece svg{width:100%;height:100%;overflow:visible;display:block;pointer-events:none;filter:drop-shadow(0 2px 1px #48402b40)}.puzzle-piece[aria-pressed=true]{background:#e4f2dc;border:2px solid #86ad79}.puzzle-piece[data-placed=true]{visibility:hidden;pointer-events:none}.drag-piece{position:fixed;z-index:10000;pointer-events:none;filter:drop-shadow(0 7px 5px #0004);transform:translate(-50%,-50%)}.drag-piece svg{width:100%;height:100%}.game-complete{font-size:20px;font-weight:800;color:#487b50}.game-complete .spark{font-size:27px}.game-reset-dialog .confirm{padding:22px}#game-reset-dialog button{min-height:50px}.game-screen[data-mode=memory]{background:#f2f4ff}.game-screen[data-mode=puzzle]{background:#fff6e3}
@media(max-width:350px){.mode-screen,.game-screen{padding-left:12px;padding-right:12px;gap:9px}.mode-header{min-height:44px}.mode-brand{font-size:19px}.mode-screen h1{margin:4px 0 0;font-size:28px}.mode-card{padding:12px;gap:10px;grid-template-columns:78px 1fr 16px;border-radius:24px}.mode-cards{gap:12px}.mode-card strong{font-size:22px}.mode-card small{font-size:12px}.level-card{padding:14px}.level-copy strong{font-size:24px}.memory-board{gap:7px}.memory-face{border-radius:15px}.game-status{font-size:14px}.game-tool{padding:6px 12px}}
@media(orientation:landscape) and (max-height:600px){.mode-screen{max-width:none}.mode-screen h1{font-size:26px;margin:0}.mode-cards{grid-template-columns:repeat(3,1fr);grid-template-rows:1fr;gap:12px}.mode-card{grid-template-columns:1fr;justify-items:center;gap:4px;padding:10px;text-align:center;min-height:0}.mode-card .mode-art{width:65px}.mode-card .arr{display:none}.mode-card strong{font-size:21px}.mode-card small{font-size:11px;margin-top:3px}.mode-footer{min-height:20px}.mode-sub{display:none}.level-list{grid-template-rows:1fr;grid-template-columns:repeat(3,1fr);gap:14px;padding:0}.level-card{flex-direction:column;justify-content:center;text-align:center;padding:12px;gap:10px}.level-copy strong{font-size:23px}.level-icon{width:55px;height:55px}.game-screen{gap:7px;padding-top:9px;padding-bottom:8px}.game-header{min-height:44px}.game-back,.game-home,.game-header .game-avatar{height:44px;min-height:44px}.game-status{min-height:24px}.game-bar{min-height:40px}.game-tool{min-height:40px}.game-content{gap:6px}.puzzle-stage{grid-template-rows:1fr;grid-template-columns:1fr 1fr;gap:20px}.memory-board{max-width:660px;gap:9px}.scene-gallery{grid-template-columns:repeat(5,minmax(0,1fr))}.game-save{font-size:10px;min-height:12px}.game-stage{gap:7px}}
@media(prefers-reduced-motion:reduce){.memory-inner,.puzzle-ghost{transition:none}}

/* In-game difficulty, no separate level chooser. */
.game-difficulty{flex:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;width:100%;max-width:440px;margin:0 auto;padding:4px;border:1px solid #e4e4da;border-radius:20px;background:#ffffffb8}
.difficulty-choice{min-height:44px;display:flex;align-items:center;justify-content:center;gap:6px;padding:6px;border-radius:15px;background:transparent;font-size:13px;font-weight:650;color:#56616b}
.difficulty-choice strong{font-size:20px;line-height:1.1}.difficulty-choice[aria-pressed=true]{background:#dff1df;box-shadow:inset 0 0 0 2px #86b696;color:#2a4f36}.difficulty-choice:disabled{opacity:.65}
.game-status{flex:none;min-height:25px}.memory-board .memory-card{grid-column:auto}
.game-screen[data-mode=memory] .game-stage{padding:0 4px 5px}.game-screen[data-mode=memory] .game-bar{flex:none}
@media(max-width:350px){.game-content{gap:7px}.game-screen{gap:8px}.game-difficulty{gap:4px;padding:3px}.difficulty-choice{font-size:12px}.difficulty-choice strong{font-size:19px}}
@media(max-height:530px) and (orientation:landscape){.game-difficulty{max-width:390px}.game-content{gap:5px}.game-status{min-height:20px;font-size:14px}.memory-board{gap:7px}}

.game-bar{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);width:100%;max-width:440px;margin:0 auto;gap:8px}
.game-tool{min-width:0;padding:8px;gap:6px;height:100%}.game-tool .txt{min-width:0;font-size:12px;white-space:normal}
.game-screen[data-mode=memory] .game-bar{max-width:230px}
@media(max-height:530px) and (orientation:landscape){
 .game-screen[data-has-difficulty=true] #game-content{position:static}
 .game-screen[data-has-difficulty=true] #game-title{visibility:hidden}
 .game-screen[data-has-difficulty=true] .game-difficulty{position:absolute;top:9px;left:82px;right:145px;width:auto;max-width:330px;margin:0 auto;padding:0;border:0;background:transparent}
 .game-screen[data-has-difficulty=true] .difficulty-choice{background:#fff8;min-height:44px}
 .game-screen[data-has-difficulty=true] .difficulty-choice[aria-pressed=true]{background:#dff1df}
}

/* Four child-sized choices without scrolling or shrinking tap targets. */
.mode-cards{grid-template-rows:repeat(4,minmax(0,1fr));gap:10px}
.mode-card{min-height:76px;padding:11px 14px;gap:12px}
.mode-card[data-game-mode=stickers]{--bg:#fff0f6;--edge:#ead6e5}
.mode-card strong{font-size:clamp(18px,5.8vw,24px)}
.mode-card small{font-size:clamp(11px,3.2vw,14px)}
@media(max-width:350px){.mode-card{grid-template-columns:66px 1fr 13px;gap:8px;padding:9px}.mode-card .mode-art{border-radius:14px}.mode-card strong{font-size:19px}}
@media(max-height:600px){.mode-screen h1{margin-top:0}.mode-cards{gap:7px}.mode-card{padding:7px 10px;min-height:70px}}
