/* Mode selection: raster artwork uses proportional crops, never stretched. */
#app[data-screen=home],#app[data-screen=map]{background:#2aa8e5 url('assets/home-world-v101.webp') center/cover no-repeat;padding:0;min-height:100dvh;height:100dvh;max-height:1100px;margin:0 auto;border-radius:0}
#app[data-screen=home] .topbar{height:0;padding:0}
#home{position:relative;height:100%;min-height:0!important;padding:72px 0 92px;display:flex;flex-direction:column;align-items:center;gap:5px;overflow:hidden}
#home h1{width:72%;max-width:330px;margin:0 auto;height:22%;min-height:86px;align-self:center;flex-shrink:1}
#home h1 img{height:100%;width:100%;object-fit:contain;display:block}
#home .tagline{font-size:clamp(15px,4vw,21px);margin:0;text-shadow:0 2px 3px #064965;font-weight:1000}
#home .best-badge{display:none}
#home .home-wallet{position:absolute;top:max(14px,env(safe-area-inset-top));left:10px;right:auto;transform:none;display:flex;align-items:center;gap:6px;color:white;background:#046c9dbd;border-radius:30px;padding:3px 10px 3px 0;font-size:20px;z-index:5}
#home .home-wallet img{width:40px;height:40px;object-fit:contain}
#app[data-screen=home] .home-tools{position:absolute;top:max(10px,env(safe-area-inset-top));right:8px;left:auto;display:flex;flex-direction:row;gap:7px;z-index:5}
#app[data-screen=home] .home-tools .icon-button{width:46px;height:46px;min-width:46px;min-height:46px;padding:0}
#app[data-screen=home] .home-tools .icon-button img{width:100%;height:100%;object-fit:contain}
#app[data-screen=home] .home-tools .nav-art{width:46px;height:46px}
#app[data-screen=home] #shop-open{position:fixed;position:absolute;top:calc(100dvh - 93px);right:5px;width:66px;height:66px}
#app[data-screen=home] #shop-open .nav-art{width:66px;height:66px}
#app[data-screen=home] #shop-open:after{content:'Shop';display:block;font:1000 13px Nunito;color:white;text-shadow:0 2px 3px #064965}
#app[data-screen=home] #leaderboard-open{position:absolute;right:83px;top:calc(100dvh - 83px)}
#app[data-screen=home] .home-extras{left:80px;right:auto;top:auto;bottom:21px}
#app[data-screen=home] .home-extras #achievements-open{display:none}
#app[data-screen=home] .home-extras #coins-ad-open{width:46px;height:46px;min-height:46px}
#app[data-screen=home] .video-reward-label img{width:13px;height:13px}
#app[data-screen=home] .video-reward-label{font-size:10px;bottom:-3px}
#home #profile-open{position:absolute;bottom:13px;left:10px;width:64px;height:68px;padding:0;margin:0;display:flex;flex-direction:column;gap:0;border:0;background:none;border-radius:0}
#home #profile-open .avatar,#home #profile-open .avatar-shell{width:52px;height:52px}
#home #profile-open>span:last-child:not(.avatar){font-size:0;overflow:visible}
#home #profile-open>span:last-child:not(.avatar):after{content:'Profile';font-size:13px;text-shadow:0 2px 3px #064965}
#home #home-level{position:absolute;bottom:22px;left:50%;transform:translateX(-50%);margin:0;width:90px;font-size:11px;min-height:44px;padding:3px;background:#035a83b8;z-index:1}
.mode-carousel{position:relative;width:100%;flex:1;min-height:165px;max-height:410px;margin-top:8px}
#mode-cards{position:relative;width:100%;height:100%;touch-action:pan-y;overflow:hidden}
.mode-card{position:absolute;top:2%;left:21%;width:58%;height:94%;padding:15px 6px 10px;border:3px solid #b6f7ff;border-radius:23px;box-shadow:0 5px 9px #01416d80,inset 0 0 0 3px #39c9ee;display:flex;align-items:center;flex-direction:column;background-image:url('assets/mode-cards-v101.webp');background-size:auto 100%;color:#053e60;transition:transform .28s,filter .28s;cursor:pointer;overflow:hidden}
.mode-endless{background-position:0% center}.mode-adventure{background-position:50% center}.mode-rush{background-position:100% center}
.mode-card[data-position='0']{z-index:3;border-color:#ffe878;box-shadow:0 0 14px #ffffa6,inset 0 0 0 2px #eaa42b}
.mode-card[data-position='-1']{transform:translateX(-88%) scale(.83) rotate(-5deg);z-index:2;filter:brightness(.9)}
.mode-card[data-position='1']{transform:translateX(88%) scale(.83) rotate(5deg);z-index:2;filter:brightness(.9)}
.mode-card[data-position='-2']{transform:translateX(-180%) scale(.75)}.mode-card[data-position='2']{transform:translateX(180%) scale(.75)}
.mode-card>strong{font:1000 clamp(24px,7vw,34px)/1.1 Nunito;text-shadow:0 2px #fff;background:#e6faffdf;padding:5px 9px;border-radius:14px}
.mode-card>span{font:900 13px/1.2 Nunito;background:#e6faffdf;padding:4px 8px;border-radius:8px;margin-top:5px;max-width:180px}
.mode-card>em{margin:auto 0 19%;font:1000 24px Nunito;color:#804500;text-shadow:0 1px #fff3a3}
.mode-card>small{position:absolute;bottom:8px;left:6%;width:88%;padding:8px 2px;background:#fff0bde8;border-radius:11px;font:1000 16px Nunito;color:#724a0b}
.carousel-arrow{position:absolute;z-index:4;top:44%;width:42px;height:48px;border:2px solid #c2faff;border-radius:50%;background:#00b6db;color:white;font:900 40px/1 Nunito;box-shadow:0 3px 5px #00637f80}
#mode-prev{left:5px}#mode-next{right:5px}
#mode-dots{display:flex;gap:9px;justify-content:center;padding:1px}
#mode-dots button{width:15px;height:15px;padding:0;border:1px solid #c6f8ff;border-radius:50%;background:#6bc8e5;min-height:0}
#mode-dots button.selected{background:#ffd044;border-color:#fff4a4}
#home .home-actions{margin:0;padding:0;width:76%;max-width:350px;display:flex;flex-direction:column;gap:3px}
#home .home-actions .primary{background:transparent url('assets/action-v45.webp') center/contain no-repeat;border:0;border-radius:0;box-shadow:none;aspect-ratio:3;min-height:50px;padding:8px;color:#714600;font:1000 clamp(21px,6vw,30px) Nunito}
#home .home-actions .secondary{align-self:center;width:70%;min-height:40px;padding:6px;background:#c8f8ffe8;border:2px solid #58d8ef;border-radius:24px;color:#07567a;font:1000 18px Nunito;box-shadow:0 3px 0 #188eb7}
#app[data-screen=map] .topbar{display:none}
#adventure-map{height:100%;position:relative;background:#28bcec;overflow:hidden}
.map-header{position:absolute;top:8px;left:6px;right:6px;z-index:3;display:flex;gap:6px;align-items:start;color:#055875}
.map-header>div{flex:1;background:#e1fdfff2;border:3px solid #35cfe0;border-radius:22px;padding:10px 8px;box-shadow:0 4px 6px #04617a66;text-align:center}
.map-header h2{font-size:26px;margin:0}.map-header strong{font-size:14px}
.map-header button,.map-footer button{width:44px;height:44px;border:2px solid #b9fcff;border-radius:50%;background:#08b6d5;color:white;font:900 35px/1 Nunito}
#world-progress{display:flex;justify-content:center;align-items:center;gap:8px;margin-top:5px;font-size:14px}#world-progress progress{width:40%;height:13px;accent-color:#ffd044}
#map-landscape{position:absolute;inset:0;background:url('assets/adventure-map-v101.webp') center/100% 100% no-repeat}
#map-levels{position:absolute;inset:110px 0 65px}
.level-node{position:absolute;transform:translate(-50%,-50%);width:54px;height:54px;border:3px solid #d6fcff;border-radius:50%;background:radial-gradient(circle at 30% 25%,#70edff,#00a0ea 65%,#0458bb);box-shadow:0 3px 0 #064992,0 0 0 2px #0da3dd;color:white;font:1000 26px Nunito;padding:0;text-shadow:0 2px #04588a}
.level-node.next{background:radial-gradient(circle at 30% 25%,#fffba0,#ffd030 65%,#ef9700);box-shadow:0 0 18px #fff9a0,0 0 0 3px #ffc83d;color:#8b5200;text-shadow:0 2px #fff4a4}
.level-node.locked{filter:saturate(0);opacity:.85}.level-node.locked strong{font-size:20px}
.level-stars{position:absolute;display:flex;top:43px;left:50%;transform:translateX(-50%);pointer-events:none}
.map-star{display:inline-block;position:relative;width:24px;height:27px;overflow:hidden;filter:saturate(0) brightness(.8)}
.map-star.earned{filter:none}.map-star img{position:absolute;width:151px;max-width:none;left:0;top:-33px}
.map-footer{position:absolute;bottom:max(10px,env(safe-area-inset-bottom));left:12%;right:12%;padding:5px 10px;display:flex;align-items:center;justify-content:space-between;background:#057d9bdc;border:2px solid #8ceaff;border-radius:35px;font-weight:1000}
#mode-hud{text-align:center;color:#ffed9c;font-weight:1000;font-size:14px;padding:3px}
#adventure-result{display:flex;justify-content:center;min-height:30px}
#app #shop-dialog{--panel-width:min(440px,calc(100vw - 16px),calc((100dvh - 20px)*2/3))}
#shop-dialog .dialog-content{padding:48px 20px 24px}
#shop-dialog h2{font-size:32px;margin-bottom:4px}
#shop-dialog .shop-wallet{margin:5px 0 10px;gap:7px}
.shop-tabs{position:sticky;top:-48px;z-index:4;display:grid;grid-template-columns:repeat(4,1fr);border:1px solid #70cddd;background:#b8eaf4;border-radius:14px;padding:2px;margin-bottom:14px}
.shop-tabs button{min-height:44px;padding:4px 2px;background:none;border:0;border-radius:11px;color:#065670;font:1000 13px Nunito}
.shop-tabs button[aria-selected=true]{background:#ffe17b;box-shadow:0 3px 0 #e5ad3e;color:#694300}
#shop-dialog .cosmetic-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
#shop-dialog .cosmetic-card{min-width:0;padding:8px 5px;gap:5px;border-radius:17px;text-align:center}
#shop-dialog .cosmetic-card>strong{font-size:13px}
#shop-dialog .cosmetic-card>small{font-size:10px}
#shop-dialog .shop-buy{font-size:11px;min-height:40px;padding:4px 3px}
#shop-dialog .cosmetic-preview{max-width:100%;width:70px;height:70px}
#shop-dialog .avatar{width:62px;height:62px}
#shop-items .shop-item{flex-direction:column;border:1px solid #64c6d9;border-radius:18px;background:#d6f7fa80;margin:8px 0;padding:12px;text-align:center}
#shop-items .shop-buy{width:150px;min-height:48px;font-size:15px}
/* Square sprite cells must stay square: the boost row has a 46px icon column. */
#shop-items button.power-art{width:46px;height:46px;min-width:46px;max-width:46px;min-height:46px;max-height:46px;aspect-ratio:1;padding:0;justify-self:center}
#shop-dialog [hidden],#adventure-map[hidden],#mode-hud[hidden],#adventure-result[hidden],#home [hidden]{display:none!important}
@media(max-height:680px){#home{padding-top:65px;padding-bottom:83px;gap:2px}#home h1{height:18%;min-height:75px}#home .tagline{font-size:15px}.mode-carousel{margin-top:3px}.mode-card{padding-top:8px}.mode-card>strong{font-size:24px}.mode-card>span{font-size:11px}.mode-card>small{font-size:13px;padding:5px}.mode-card>em{font-size:20px}#home .home-actions{width:69%}#home .home-actions .primary{min-height:46px;font-size:22px}#home .home-actions .secondary{font-size:15px;min-height:34px}.map-header h2{font-size:21px}.map-header strong{font-size:12px}.level-node{width:43px;height:43px;font-size:23px}.level-stars{top:34px}.map-star{width:20px;height:22px}.map-star img{width:126px;top:-28px}#map-levels{inset:105px 0 65px}#shop-dialog .dialog-content{padding:46px 15px 20px}#shop-dialog .shop-tabs button{font-size:11px}#shop-dialog .cosmetic-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.mode-card{background-size:300% auto;background-repeat:no-repeat;background-position-y:center}
#home .home-wallet{max-width:42%}
#app[data-screen=home] .home-tools #achievements-open{display:block}
#map-landscape{inset:auto 0 55px;height:auto;aspect-ratio:941/1672;background-size:contain}
#map-levels{inset:0}
@media(max-height:680px){#map-landscape{bottom:50px}#map-levels{inset:0}.level-node{width:44px;height:44px}.map-header>div{padding:6px}.map-header h2{font-size:18px}.map-header strong{font-size:11px}.map-header{top:3px}}


/* v102: aligned home navigation, cyclic modes, and a scrollable route. */
#home{padding-top:58px;padding-bottom:105px}
#app[data-screen=home] .home-tools{top:max(3px,env(safe-area-inset-top))}
#home .home-wallet{top:max(5px,env(safe-area-inset-top))}
#app[data-screen=home] .home-extras{top:56px;left:10px;right:auto;bottom:auto}
#app[data-screen=home] #leaderboard-open{position:static}
#home .home-bottom{position:absolute;bottom:12px;left:20px;right:20px;display:grid;grid-template-columns:repeat(3,1fr);align-items:start;justify-items:center;height:72px}
#app[data-screen=home] #profile-open,#app[data-screen=home] #shop-open,#app[data-screen=home] #achievements-open{position:static;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:3px;width:64px;height:72px;min-height:0;margin:0;padding:0;background:none;border:0;box-shadow:none}
#app[data-screen=home] #shop-open .nav-art,#app[data-screen=home] #achievements-open>img{width:52px;height:52px;min-height:52px;object-fit:contain}
#app[data-screen=home] #achievements-open:after{content:'Achievements';font:1000 12px Nunito;color:white;text-shadow:0 2px 3px #064965}
#home #home-level{bottom:91px;width:130px;min-height:28px;font-size:11px;padding:2px}
#mode-prev,#mode-next{display:none!important}
#home .home-actions .secondary{background:transparent url('assets/action-v45.webp') center/contain no-repeat;border:0;box-shadow:none;border-radius:0;color:#724600;width:78%;min-height:46px}
#shop-dialog .dialog-content{padding-top:22px!important}
#shop-dialog h2{margin-top:0!important}
#shop-dialog #avatar-items .cosmetic-card{padding:6px 4px;gap:3px}
#shop-dialog #avatar-items .avatar{width:56px;height:56px}
#app[data-screen=map]{max-height:none}
#adventure-map{overflow-y:auto;overscroll-behavior:contain;background:#84cf4b;scroll-behavior:smooth}
#map-landscape{position:relative;inset:auto!important;aspect-ratio:auto;height:2440px;min-height:0;background:none}
#map-levels{position:absolute;inset:0!important}
.route-tile{position:absolute;left:0;width:100%;height:220px;background:url('assets/map-route-v102.webp') center/100% 100% no-repeat}
.route-tile.flipped{transform:scaleY(-1)}
#map-levels .level-node{width:62px;height:62px;z-index:1;border:0;background:transparent url('assets/coin-v10.webp') center/contain no-repeat;box-shadow:none;color:#70410c;text-shadow:0 1px #fff9b1;filter:none;opacity:1}
#map-levels .level-node.locked{filter:grayscale(1);color:#fff;text-shadow:0 2px #43535e}
#map-levels .level-node.next{filter:drop-shadow(0 0 9px #fffbc2)}
#map-levels .level-stars{top:53px}
.map-header{position:sticky;top:0;margin-bottom:-120px;height:120px;padding:6px;left:auto;right:auto;z-index:4;background:linear-gradient(#81ce4b,transparent)}
.map-header>div{padding:8px}.map-header button{background:url('assets/action-v45.webp') center/contain no-repeat;border:0;box-shadow:none;color:#714600;font-size:27px}
.map-footer{position:sticky;bottom:8px;left:auto;right:auto;width:88%;margin:-62px auto 8px;z-index:4}
.map-footer button{background:url('assets/action-v45.webp') center/contain no-repeat;border:0;box-shadow:none;color:#714600;font-size:27px}
#adventure-map:after{display:none}
#level-objectives,.result-objectives{list-style:none;padding:0;margin:10px 0;text-align:center;font-weight:900;font-size:14px;line-height:1.5}
#level-objectives li,.result-objectives li{padding:5px 3px;border-bottom:1px solid #78cbd955}
#adventure-result{flex-direction:column;align-items:center}.earned-stars{display:flex;justify-content:center}.result-objectives .done{color:#167b3a}.result-objectives .incomplete{color:#627880}
@media(max-height:680px){#home{padding-top:55px;padding-bottom:102px}#home h1{min-height:62px;height:16%}.mode-carousel{min-height:130px}#home .home-actions .secondary{min-height:36px}#home .home-bottom{bottom:6px}}

.map-header button{width:70px;min-width:70px;font-size:15px;height:44px}.map-footer button{width:85px;font-size:13px;height:40px}.map-footer{width:94%;padding:4px 6px}.map-footer span{font-size:12px}
/* v103: phone viewport layout, shared wallet stack and immediate drag feedback. */
#app[data-screen=home]{height:100dvh;min-height:0;max-height:none}
#home{padding:52px 0 190px;gap:4px}
#home h1{width:62%;height:21%;min-height:72px;max-height:180px}
#home .tagline{font-size:clamp(14px,3.8vw,19px)}
#home .home-wallet-group{position:absolute;left:8px;top:max(4px,env(safe-area-inset-top));display:flex;flex-direction:column;align-items:flex-start;gap:8px;z-index:6;max-width:36%}
#home .home-wallet-group .home-wallet{position:static;max-width:100%;min-height:40px;padding:0 8px 0 0;gap:4px;font-size:18px}
#home .home-wallet-group .home-wallet img{width:36px;height:36px}
#home .home-wallet-group #coins-ad-open{position:relative;width:54px;height:58px;min-height:58px;padding:0;background:none;border:0;display:block}
#home #coins-ad-open>img{width:50px;height:50px;object-fit:contain}
#home .video-reward-label{bottom:0;font-size:11px;line-height:18px}
#home .video-reward-label img{width:14px;height:14px}
#app[data-screen=home] .home-tools:not(.home-extras){top:max(4px,env(safe-area-inset-top));right:4px;display:grid;grid-template-columns:repeat(3,44px);grid-auto-rows:44px;gap:6px}
#app[data-screen=home] .home-tools #settings-open{grid-column:1;grid-row:1}
#app[data-screen=home] .home-tools #quests-open{grid-column:2;grid-row:1}
#app[data-screen=home] .home-tools #leaderboard-open{grid-column:3;grid-row:1}
#app[data-screen=home] .home-tools #achievements-open{grid-column:3;grid-row:2}
#app[data-screen=home] .home-tools #shop-open{grid-column:3;grid-row:3}
#app[data-screen=home] .home-tools .icon-button,#app[data-screen=home] .home-tools #shop-open,#app[data-screen=home] .home-tools #achievements-open{position:static;width:44px;height:44px;min-width:44px;min-height:44px;display:block}
#app[data-screen=home] .home-tools #shop-open .nav-art,#app[data-screen=home] .home-tools #achievements-open>img,#app[data-screen=home] .home-tools .nav-art{width:44px;height:44px;min-height:0}
#app[data-screen=home] .home-tools #shop-open:after,#app[data-screen=home] .home-tools #achievements-open:after{content:none}
#home .home-bottom{left:6px;right:auto;bottom:max(8px,env(safe-area-inset-bottom));width:64px;height:66px;display:block}
#home #home-level{bottom:154px;left:50%;width:180px;min-height:32px;padding:3px 8px;font-size:12px}
#home .home-actions{position:absolute;bottom:max(6px,env(safe-area-inset-bottom));left:78px;right:10px;width:auto;max-width:none;gap:5px}
#home .home-actions .primary{order:2;width:100%;min-height:66px;aspect-ratio:3;font-size:clamp(19px,5.6vw,29px)}
#home .home-actions .secondary{order:1;width:80%;min-height:46px;font-size:18px}
.mode-carousel{max-height:none;min-height:120px;margin-top:4px}
.mode-card>span{display:none}
#home{touch-action:none}
#mode-cards{touch-action:none;--drag-x:0px}
#home img{-webkit-user-drag:none;user-select:none}
.mode-card{transition:transform .18s ease-out,filter .18s;will-change:transform}
.mode-card[data-position='0']{transform:translateX(var(--drag-x))}
.mode-card[data-position='-1']{transform:translateX(calc(-88% + var(--drag-x))) scale(.83) rotate(-5deg)}
.mode-card[data-position='1']{transform:translateX(calc(88% + var(--drag-x))) scale(.83) rotate(5deg)}
#mode-cards.dragging .mode-card{transition:none}
@media(max-height:680px){#home{padding-top:50px;padding-bottom:158px}#home h1{height:18%;min-height:60px}.mode-carousel{min-height:100px}#home #home-level{bottom:126px;min-height:28px}#home .home-actions .primary{min-height:54px}#home .home-actions .secondary{min-height:38px}#home .home-actions{gap:0}#home .tagline{font-size:14px}.mode-card>strong{font-size:24px}}
#home .home-actions .primary{height:80px;min-height:0;aspect-ratio:auto;flex-shrink:0}
#home .home-actions .secondary{height:46px;min-height:0;flex-shrink:0}
#home #home-level{bottom:150px}
@media(max-height:680px){#home .home-actions .primary{height:64px}#home .home-actions .secondary{height:38px}#home #home-level{bottom:118px}}
#home .home-actions{left:50%;right:auto;transform:translateX(-50%);width:76%;max-width:350px;gap:4px}
#home .home-actions .secondary{width:70%}
#home .home-bottom{left:4px;bottom:100px;width:76px;height:78px}
#app[data-screen=home] #profile-open{width:76px;height:78px}
#home #profile-open .avatar,#home #profile-open .avatar-shell{width:64px;height:64px}
#home #home-level{left:4px;bottom:74px;width:76px;height:26px;min-height:26px;transform:none;margin:0;padding:2px;font-size:11px}
@media(max-height:680px){#home .home-bottom{bottom:88px}#home #home-level{bottom:62px}#home{padding-bottom:132px}}
/* Profile sits beside Play; its level badge overlaps the avatar rim. */
#home .home-bottom{left:4px;bottom:max(10px,env(safe-area-inset-bottom));width:72px;height:72px;z-index:6}
#app[data-screen=home] #profile-open{width:72px;height:72px;gap:0;justify-content:flex-start}
#home #profile-open .avatar,#home #profile-open .avatar-shell{width:64px;height:64px}
#home #profile-open>span:last-child:not(.avatar){display:none}
#home #home-level{left:8px;bottom:max(6px,env(safe-area-inset-bottom));width:64px;height:24px;min-height:24px;z-index:7;transform:none;padding:1px 4px;border:2px solid #bdfaff;border-radius:14px;background:#087d9e;color:#fff;font-size:11px;line-height:18px;box-shadow:0 2px 4px #034b6b66}
#home .home-actions .primary{width:calc(100vw - 160px);max-width:260px;align-self:center;font-size:25px}
/* A single compact shop heading: wallet left, title truly centered. */
#shop-dialog .dialog-content{padding-top:14px!important}
#shop-dialog .shop-heading{position:relative;display:grid;place-items:center;min-height:48px;margin:0 0 8px;width:100%}
#shop-dialog .shop-heading h2{font-size:28px;line-height:1.2;margin:0!important;padding:0}
#shop-dialog .shop-heading .shop-wallet{position:absolute;left:0;top:50%;transform:translateY(-50%);display:flex;gap:3px;margin:0;padding:4px 5px;border-radius:14px;background:#fff4bc;color:#704600;font-size:13px;max-width:29%}
#shop-dialog .shop-wallet strong{font-size:13px;overflow:hidden;text-overflow:ellipsis}
#shop-dialog .shop-wallet img{width:21px;height:21px;object-fit:contain}
#shop-dialog .shop-tabs{top:0;margin-top:0}
/* Objective rewards stay inside the existing raster panel. */
#over-dialog.adventure-results .result-content{justify-content:center;gap:5px;padding:20px}
#over-dialog.adventure-results #record{order:0;font-size:18px}
#over-dialog.adventure-results #adventure-result{order:1;display:block;width:100%;position:relative}
#over-dialog.adventure-results #final-score{order:2;font-size:30px}
#over-dialog.adventure-results .result-coins{order:3}
#over-dialog.adventure-results #result-progress{order:4}
#over-dialog.adventure-results #level-progress{order:5}
#over-dialog.adventure-results #ad-status{order:6}
#over-dialog.adventure-results .result-home-hint{order:7}
#over-dialog.adventure-results #result-return-countdown{order:8}
.reward-star-slots{display:flex;justify-content:center;gap:8px;margin:8px 0 14px}
.reward-star{display:block;width:60px;height:60px;flex:none;background:url('assets/stars-v101.webp') -303px -147px/362px 271.5px no-repeat}
.reward-star.earned{background-position:0 -77px;filter:drop-shadow(0 0 8px #ffc94388)}
.reward-objectives{list-style:none;padding:0;margin:0;display:grid;gap:8px}
.reward-objectives li{position:relative;overflow:hidden;border:1px solid #73cddd;border-radius:12px;min-height:42px;display:grid;place-items:center;background:#d3f3f5;color:#125b6e;font:900 13px/1.25 Nunito,sans-serif;padding:5px 10px}
.reward-objectives li>i{position:absolute;inset:0;background:linear-gradient(90deg,#ffd641,#fff1a5);transform:scaleX(var(--fill,0));transform-origin:left}
.reward-objectives li>span{position:relative;z-index:1}
.reward-objectives li:after{content:'';position:absolute;inset:-10px 0;background:linear-gradient(110deg,transparent 30%,#ffffffdd 50%,transparent 70%);transform:translateX(var(--shine,-100%))}
.reward-objectives li.reward-converted{opacity:.24;transition:opacity .35s}
.flying-reward-star{position:absolute;left:0;top:0;z-index:5;pointer-events:none;will-change:transform}
.star-landed{animation:reward-land .48s ease-out}
@keyframes reward-land{0%{transform:scale(1.45);filter:drop-shadow(0 0 18px #ffe065)}60%{transform:scale(.93)}100%{transform:scale(1)}}
#adventure-earned-xp{display:block;margin-top:8px;color:#086c8b;font-size:16px}
@media(max-height:620px){#over-dialog.adventure-results .result-content{gap:2px;padding:12px 18px}.reward-objectives{gap:5px}.reward-objectives li{min-height:34px;font-size:12px}.reward-star-slots{margin:2px 0 5px}}

.reward-objectives li{margin:0!important}.reward-objectives li.reward-converted{opacity:0}.reward-objectives{max-height:170px;transition:max-height .5s ease,margin .5s ease;overflow:hidden}.rewards-revealed:has(li[data-earned="true"]):not(:has(li[data-earned="false"])) .reward-objectives{max-height:0;margin:0}
/* Continuous Adventure route: compact fixed header, no world pagination. */
#adventure-map{scroll-behavior:auto;overflow-x:hidden;overflow-y:auto;touch-action:pan-y}
#adventure-map .map-header{position:sticky;top:0;height:62px;margin:0 0 -62px;padding:0;display:flex;align-items:center;justify-content:center;background:linear-gradient(#164c5cc9,#164c5c00);pointer-events:none}
#adventure-map .map-header h2{margin:0;padding:6px 18px;color:white;font:1000 21px/1.2 Nunito,sans-serif;text-shadow:0 2px 3px #123d43;background:#126d7bb8;border-radius:22px}
#adventure-map #map-back{position:absolute;left:8px;top:5px;width:52px;height:52px;min-width:52px;min-height:52px;padding:0;border:0;box-shadow:none;background:url('assets/map-buttons-v106.webp') 100% center/400% auto no-repeat;pointer-events:auto}
#map-landscape{width:100%;margin:0}
#map-levels .route-tile{background-size:100% auto}
#map-levels .level-node{width:68px;height:68px;min-width:68px;min-height:68px;padding:0;background:url('assets/map-buttons-v106.webp') 0 center/400% auto no-repeat;color:white;filter:none;text-shadow:0 2px 2px #145775;box-shadow:none;border:0}
#map-levels .level-node.next{background-position:33.333333% center;color:#754000;filter:drop-shadow(0 0 9px #fffac7);text-shadow:0 1px #fff2b0}
#map-levels .level-node.locked{background-position:66.666667% center;filter:none;opacity:1;color:#f8fdff;text-shadow:0 2px 2px #344d62}
#map-levels .level-node strong{font-size:26px;line-height:1}
#map-levels .level-stars{top:60px}
html:has(#app[data-screen=map]),body:has(#app[data-screen=map]){overflow:hidden;overscroll-behavior:none}
#adventure-map{scrollbar-width:none}#adventure-map::-webkit-scrollbar{display:none}

#map-levels .route-tile{width:calc(100% + 1px);background-size:auto 100%}
/* Level briefing and paused objectives share a centered, compact layout. */
#level-dialog .dialog-content,#level-tasks-dialog .dialog-content{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:12px;padding:28px 22px;overflow:hidden}
#level-dialog h2,#level-tasks-dialog h2{margin:0;font-size:27px;line-height:1.2}
#level-dialog #level-goal{margin:0;max-width:260px;text-align:center;font-size:14px;line-height:1.4;color:#216577}
#level-dialog #level-objectives{display:grid;gap:10px;width:100%;margin:4px 0;padding:0;list-style:none}
#level-dialog #level-objectives li,.level-task-card{margin:0;padding:12px 10px;border:1px solid #75c9d5;border-radius:14px;background:#e6faffb8;color:#12566d;font:900 14px/1.4 Nunito,sans-serif;text-align:center}
#level-dialog #level-play,#level-tasks-dialog #tasks-resume{width:190px;min-height:54px;margin:4px 0 0;font-size:19px}
#level-task-list{display:grid;gap:10px;width:100%}.level-task-card{display:flex;flex-direction:column;gap:6px;align-items:center}.level-task-card strong{font-size:14px}.level-task-card span{font-size:13px;color:#347083}.level-task-card progress{width:90%;height:9px;accent-color:#20bfb5;border:0;border-radius:8px;overflow:hidden}.level-task-card.missed{opacity:.65}.level-task-card.missed span{color:#9b4148}.level-task-card.complete{border-color:#37bba3;background:#d4f8df}
.tasks-paused,.tasks-note{margin:0;font:800 12px/1.4 Nunito,sans-serif;color:#377383}
@media(max-height:620px){#level-dialog .dialog-content,#level-tasks-dialog .dialog-content{gap:7px;padding:24px 18px}#level-task-list{gap:6px}.level-task-card{padding:8px;gap:3px}#level-tasks-dialog h2{font-size:23px}}
.level-task-card progress{appearance:none;-webkit-appearance:none;background:#b6dce3;box-shadow:inset 0 1px 2px #387e9133}.level-task-card progress::-webkit-progress-bar{background:#b6dce3;border-radius:8px}.level-task-card progress::-webkit-progress-value{background:linear-gradient(90deg,#12b7c9,#6ce4d6);border-radius:8px}.level-task-card progress::-moz-progress-bar{background:#25c8c6;border-radius:8px}.level-task-card.complete progress::-webkit-progress-value{background:linear-gradient(90deg,#eeb735,#ffe378)}
/* Every shop category fits the panel; only category tabs change the content. */
html:has(#shop-dialog[open]),body:has(#shop-dialog[open]){overflow:hidden;overscroll-behavior:none}
#shop-dialog .dialog-content{display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;padding:14px 16px 18px!important;gap:8px;container-type:size}
#shop-dialog .shop-heading{flex:0 0 40px;min-height:40px;margin:0}
#shop-dialog .shop-tabs{position:static;flex:none;margin:0;min-height:46px}
#shop-dialog [role=tabpanel]{flex:1;min-height:0;width:100%;overflow:hidden}
#shop-dialog .cosmetic-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:7px;align-content:stretch}
#shop-dialog #background-items{grid-template-rows:minmax(0,1fr);align-content:start;max-height:240px}
#shop-dialog .cosmetic-card,#shop-dialog #avatar-items .cosmetic-card{min-height:0;min-width:0;margin:0;padding:7px 4px;gap:4px;justify-content:center;border-radius:13px}
#shop-dialog .cosmetic-card .cosmetic-preview{width:52px;height:52px;min-height:52px;max-height:52px;min-width:52px;flex:0 0 52px;padding:0;aspect-ratio:1;margin:0}
#shop-dialog .frame-preview .avatar{width:76%;height:76%;left:12%;top:12%}
#shop-dialog #avatar-items .avatar{width:52px;height:52px;min-height:52px;flex:0 0 52px}
#shop-dialog .cosmetic-card>strong{font-size:12px;line-height:1.15;min-height:28px;display:flex;align-items:center;justify-content:center}
#shop-dialog .cosmetic-card>small{font-size:10px;line-height:1.2;margin:0}
#shop-dialog .cosmetic-card .shop-buy{width:100%;min-width:0;max-width:100%;min-height:36px;height:36px;max-height:36px;flex:0 0 36px;margin:0;padding:4px 2px;font-size:11px;line-height:1.15;aspect-ratio:auto}
#shop-dialog .cosmetic-card .shop-buy:not(.frame-upgrade){margin-top:auto}
#shop-dialog #shop-message{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%)}
#shop-dialog #shop-items{display:grid;grid-template-rows:repeat(3,minmax(0,1fr));gap:8px;max-height:290px}
#shop-dialog #shop-items .shop-item{margin:0;padding:7px;grid-template-columns:46px minmax(0,1fr) minmax(84px,116px);gap:6px;min-height:0}
#shop-dialog #shop-items .shop-buy{width:100%;min-width:0;max-width:116px;font-size:12px}
@container(max-height:440px){#shop-dialog .cosmetic-card,#shop-dialog #avatar-items .cosmetic-card{padding:4px;gap:2px}#shop-dialog .cosmetic-card .cosmetic-preview{width:36px;height:36px;min-width:36px;min-height:36px;max-height:36px;flex-basis:36px}#shop-dialog #avatar-items .avatar{width:40px;height:40px;min-height:40px;flex-basis:40px}#shop-dialog .cosmetic-card .shop-buy{height:30px;min-height:30px;max-height:30px;flex-basis:30px;font-size:10px}#shop-dialog .cosmetic-card>strong{font-size:11px;min-height:24px}#shop-dialog .cosmetic-card>small{font-size:9px}}
#shop-dialog #frame-items{max-height:410px}#shop-dialog #avatar-items{max-height:350px}#shop-dialog #background-items{max-height:200px}
/* Upgrade details remain in the frame's tap/hover tooltip, leaving both actions visible. */
#shop-dialog .cosmetic-card:has(.frame-upgrade)>small{display:none}

/* Offer a revive before presenting final run totals. */
#over-dialog.continue-offer #final-score,
#over-dialog.continue-offer .result-coins,
#over-dialog.continue-offer #result-progress,
#over-dialog.continue-offer #level-progress,
#over-dialog.continue-offer #adventure-result,
#over-dialog.continue-offer .best-line{display:none!important}
#over-dialog.continue-offer .result-content{justify-content:center;gap:20px}
#over-dialog.continue-offer #record{font-size:28px;text-align:center}
#over-dialog.continue-offer .result-home-hint{min-height:36px}

/* Viewport-level profile feedback remains visible above the scrollable panel. */
#profile-notice{position:fixed;inset:42% auto auto 50%;margin:0;width:max-content;max-width:min(82vw,340px);padding:14px 20px;border:2px solid #a7f5ff;border-radius:20px;background:linear-gradient(#126d91,#084969);box-shadow:0 5px 18px #002f5470;color:white;font:800 17px/1.3 Nunito,sans-serif;text-align:center;pointer-events:none;overflow-wrap:anywhere}
#profile-notice::backdrop{background:transparent;pointer-events:none}
#profile-lock-message,#profile-message{display:none}

.power.level-locked .power-art{filter:grayscale(1);opacity:.3}
.power.level-locked .charges{background:#284f65;color:#fff;font-size:11px;min-width:40px}
#boost-lesson-dialog .dialog-content{text-align:center;justify-content:center}
#boost-lesson-dialog h2{padding:0;text-align:center}
#boost-lesson-copy{font-size:16px;line-height:1.5;text-align:center}
#boost-lesson-art{display:flex;justify-content:center;align-items:center;min-height:100px}
#boost-lesson-art .power-art{position:relative;display:block;width:72px;height:72px;flex:none}
.board:not([data-layout="classic"]){gap:7px;padding:8px;border-radius:22px;background:#065b7d35;min-height:270px;height:clamp(270px,37dvh,340px);max-width:100%}
.board:not([data-layout="classic"]) .choice{min-width:0;min-height:0;padding:2px}
.board:not([data-layout="classic"]) .sprite{width:44px!important;height:44px!important}
.board:not([data-layout="classic"]) .sprite.special-art{width:44px!important;height:53px!important}

#over-dialog.adventure-results #adventure-continue{order:7;width:min(260px,100%);min-height:54px;align-self:center;margin-top:8px}
#over-dialog.adventure-results .result-home-hint{display:none}

/* Match each portrait to the opening in its frame sprite, without stretching art. */
#shop-dialog .frame-preview:not([data-cosmetic="none"]) .avatar{
 width:70%;height:70%;left:var(--portrait-x,50%);top:var(--portrait-y,48%);
 transform:translate(-50%,-50%);border:0;box-shadow:none;
}
#shop-dialog .frame-preview[data-cosmetic="gold"]{--portrait-x:52%;--portrait-y:47%}
#shop-dialog .frame-preview[data-cosmetic="ice"]{--portrait-x:48.5%;--portrait-y:48%}
#shop-dialog .frame-preview[data-cosmetic="blossom"]{--portrait-x:52%;--portrait-y:48.5%}
#shop-dialog .frame-preview[data-cosmetic="cosmic"]{--portrait-x:48.5%;--portrait-y:47%}

/* Keep XP readable inside its meter, then collapse every finished objective row. */
#result-xp-bar{position:relative;display:block;width:100%;max-width:300px;height:44px;min-height:44px;flex-shrink:0;align-self:center;margin:6px auto 10px;border:3px solid #075570;border-radius:22px;overflow:hidden;background:#d0edf5;box-shadow:0 2px 0 #07395326}
#result-xp-bar #level-progress{appearance:none;-webkit-appearance:none;position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;border-radius:0}
#result-xp-bar #level-progress::-webkit-progress-value{background:linear-gradient(180deg,#64efff,#1ab9e9 50%,#0785ce);border-radius:0}
#result-xp-label{position:absolute;inset:0;display:grid;place-items:center;font:1000 17px/1 Nunito,sans-serif;white-space:nowrap;color:#073e62;text-shadow:0 1px 1px #ffffffcc;pointer-events:none}
#over-dialog.adventure-results #result-xp-bar{order:5}
#over-dialog.continue-offer #result-xp-bar{display:none}
.rewards-revealed .reward-objectives{max-height:0!important;margin:0!important;opacity:0;transition:max-height .6s ease,opacity .3s ease}
.rewards-revealed .reward-objectives li[data-earned="false"]{background:#f4d4db;border-color:#d98191}
.xp-level-up{animation:xp-level-flash .75s ease}
@keyframes xp-level-flash{0%,100%{box-shadow:0 0 0 0 #ffe57200}40%{box-shadow:0 0 15px 5px #ffe572cc;border-color:#ffcf33}}

/* Keep progress in a clear card footer and map content within its illustrated bounds. */
.mode-adventure>small{background:#fff0bd;color:#724a0b}
#adventure-map{overscroll-behavior:none}
#map-landscape{overflow:hidden}
#adventure-map .map-header h2{font-size:18px;padding:6px 10px}
#map-stars{position:absolute;right:8px;top:14px;display:flex;align-items:center;gap:4px;padding:5px 8px;border:1px solid #ffed93;border-radius:16px;background:#fff0bd;color:#724a0b;font:900 12px/1.2 Nunito,sans-serif;white-space:nowrap}
#map-stars>span{font-size:18px;color:#d38b00}

#mode-hud.collection-goal{display:grid;grid-template-columns:36px minmax(0,1fr);align-items:center;gap:2px 8px;max-width:340px;margin:3px auto 7px;padding:5px 12px;border-radius:14px;background:#034663d9;border:1px solid #98efff88;color:#fff;text-align:center;font-size:12px;line-height:1.3}
#mode-hud.collection-goal .sprite{width:32px;height:32px;grid-row:1 / 3}
#mode-hud.collection-goal progress{width:100%;height:8px;accent-color:#ffd453}
#mode-hud[hidden]{display:none!important}

/* Keep the level heading inside the panel while task rows convert into stars.
   Totals enter only after those rows have finished collapsing. */
#over-dialog.adventure-results .result-content{justify-content:safe center;padding:14px 20px;gap:4px}
#over-dialog.adventure-results #record{line-height:1.25;max-width:100%;letter-spacing:1px}

#over-dialog.adventure-results .reward-objectives{max-height:190px}
#over-dialog.adventure-results .reward-objectives li{min-height:40px;font-size:12px}
#over-dialog.adventure-results #adventure-continue{margin-top:4px}
@media(max-width:360px),(max-height:660px){
 #over-dialog.adventure-results .result-content{padding:10px 18px;gap:3px}
 #over-dialog.adventure-results #record{font-size:16px}
 #over-dialog.adventure-results .reward-star-slots{margin:4px 0 8px}
 #over-dialog #result-xp-bar{height:38px;min-height:38px;margin:4px auto}
 #over-dialog #result-xp-label{font-size:15px}
 #over-dialog.adventure-results #ad-status{font-size:10px;line-height:12px}
}

#over-dialog.adventure-results:has(#adventure-result:not(.rewards-settled)) .result-content{justify-content:flex-start}

#map-notice{position:fixed;z-index:100;left:50%;top:44%;width:max-content;max-width:min(82vw,320px);padding:13px 18px;border:2px solid #adf2ff;border-radius:18px;background:linear-gradient(#176e8b,#084764);box-shadow:0 5px 18px #002f5466;color:white;font:900 16px/1.35 Nunito,sans-serif;text-align:center;pointer-events:none;transform:translateX(-50%)}
#map-notice[hidden]{display:none}

/* Badge belongs to the Quest icon, not the whole menu grid. */
#app[data-screen=home] .home-tools #quests-open{position:relative;overflow:visible}
#quests-open #quest-badge{top:-2px;right:-3px;bottom:auto;z-index:2}
#quest-badge[hidden]{display:none!important}
#quests-dialog .dialog-content{padding:17px 20px 14px;overflow:hidden;gap:5px}
#quests-dialog h2{margin:0 35px 3px;line-height:30px;font-size:26px}
.quest-tabs{display:flex;justify-content:center;gap:6px;flex:none}
.quest-tabs button{flex:1;min-height:34px;border:1px solid #6bc6d9;border-radius:12px;background:#b5e7ef;color:#14576b;font:900 14px Nunito;padding:5px 12px}
.quest-tabs button[aria-selected=true]{background:linear-gradient(#168fac,#08728e);border-color:#086a83;color:#fff}
#quest-cycle-status{text-align:center;font:800 11px/16px Nunito;color:#246376;margin:0;flex:none}
#quests-dialog #quest-list{gap:7px}
#quests-dialog .quest-card{padding:5px 8px;gap:3px;position:relative}
#quests-dialog .quest-card h3{font-size:12px;line-height:1.15}
#quests-dialog .quest-progress{height:20px;min-height:20px}
#quests-dialog .quest-progress strong{line-height:17px;font-size:12px}
#quests-dialog .quest-footer{flex-direction:column;gap:2px}
#quests-dialog .quest-reward{font-size:14px;line-height:18px}
#quests-dialog .quest-reward img{width:19px;height:19px}
#quests-dialog .quest-collect,#quests-dialog .quest-collect:not(:disabled){height:30px;min-height:30px;width:112px;font-size:12px;padding:2px}
#quests-dialog .quest-state{display:none}
#quests-dialog #quests-collect-all{height:36px;min-height:36px;width:150px;margin:0 auto;flex:none;font-size:13px;padding:4px}
#quests-dialog [hidden]{display:none!important}
@media(max-height:650px),(max-width:360px){
 #quests-dialog .dialog-content{padding:15px 16px 10px;gap:3px}
 #quests-dialog h2{font-size:23px;line-height:26px}
 .quest-tabs button{min-height:30px;padding:3px}
 #quests-dialog .quest-card{padding:3px 6px;gap:2px}
 #quests-dialog .quest-card h3{font-size:11px}
 #quests-dialog .quest-progress{height:18px;min-height:18px}
 #quests-dialog .quest-progress strong{line-height:15px;font-size:11px}
 #quests-dialog .quest-collect,#quests-dialog .quest-collect:not(:disabled){height:25px;min-height:25px;font-size:11px}
 #quests-dialog .quest-reward{font-size:12px;line-height:16px}
 #quests-dialog .quest-reward img{width:16px;height:16px}
}

/* Empty layout cells have no card; rocks occupy only explicitly blocked cells. */
.board:not([data-layout="classic"]){background:transparent}
/* A square painted sprite is cropped, never stretched, to fill each blocked cell. */
.board-rock{position:relative;display:block;min-width:0;min-height:0;overflow:hidden;border-radius:15%;pointer-events:none;filter:drop-shadow(0 3px 2px #09374e66);container-type:size}
.stone-art{position:absolute;width:max(100cqw,100cqh);height:max(100cqw,100cqh);left:50%;top:50%;transform:translate(-50%,-50%);background:url('./assets/stone-states-v140.webp') 0 0/300% 100% no-repeat}
.board-rock.cracked .stone-art{background-position:50% 0}
.board-rock.shattered .stone-art{background-position:100% 0}

.rock-open-reveal{animation:rockOpenReveal .55s ease-out both}@keyframes rockOpenReveal{from{opacity:0;transform:scale(.55);filter:brightness(1.8)}to{opacity:1;transform:scale(1);filter:brightness(1)}}

#game{position:relative}
#streak-praise{position:absolute;left:50%;z-index:12;pointer-events:none;white-space:nowrap;font-size:26px;font-weight:1000;line-height:1.15;color:#ffed8a;text-shadow:0 2px 0 #925112,0 3px 5px #064368;background:linear-gradient(90deg,transparent,#076186e8 25%,#076186e8 75%,transparent);padding:2px 22px}
.lightning-finish{display:none;text-align:center;color:#835000;font-size:15px;font-weight:1000;border-radius:16px;background:linear-gradient(#fff5b0,#ffd45d);padding:5px 12px;margin:5px auto;max-width:230px;box-shadow:inset 0 0 0 1px #fff6c9}
.lightning-finish>span{font-size:24px;vertical-align:middle}.lightning-finish small{display:block;font-size:10px}
.rewards-settled .lightning-finish{display:block;animation:rockOpenReveal .55s ease-out both}
.map-lightning{position:absolute;right:-4px;top:0;border-radius:50%;background:#ffdc59;color:#85500d;width:25px;height:25px;line-height:25px;font-size:18px;text-shadow:none;border:2px solid #fff2b4}

/* Compact, tall actions: drawn surfaces avoid squeezing wide raster artwork. */
#shop-dialog .shop-buy,#shop-dialog .cosmetic-card .shop-buy,#shop-dialog #shop-items .shop-buy,
#quests-dialog #quests-collect-all,#quests-dialog .quest-collect:not(:disabled){
 display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
 background:linear-gradient(180deg,#fff7b8 0%,#ffe57a 46%,#ffd14b 48%,#ffc43c 100%);
 border:2px solid #e8a72a;border-radius:14px;box-shadow:inset 0 2px 0 #fffbe0,0 3px 0 #bc7e20,0 4px 7px #5d6e6b30;
 color:#684200;text-shadow:0 1px #fff4b0;aspect-ratio:auto;
 width:100%;min-width:0;max-width:100px;height:52px;min-height:52px;max-height:52px;flex:0 0 52px;
 padding:5px 4px;font-size:13px;line-height:1.1;margin-left:auto;margin-right:auto;
}
#shop-dialog .shop-action-price{display:flex;align-items:center;justify-content:center;gap:3px;font-size:12px;white-space:nowrap}
#shop-dialog .shop-action-price img{width:17px;height:17px;object-fit:contain}
#shop-dialog #shop-items .shop-buy{justify-self:center;margin:0}
#shop-dialog .shop-buy:disabled{background:linear-gradient(#d6edf0,#acd4dc);border-color:#86b8c3;box-shadow:inset 0 2px #efffff,0 2px #79a8b4;opacity:1;filter:none;color:#386877;text-shadow:none}
#quests-dialog #quests-collect-all{width:210px;max-width:85%;height:54px;min-height:54px;max-height:54px;flex:0 0 54px;font-size:17px;margin:4px auto}
#quests-dialog .quest-collect:not(:disabled){width:136px;max-width:100%;height:44px;min-height:44px;max-height:44px;flex:0 0 44px;font-size:14px;margin:3px auto}
@container(max-height:440px){#shop-dialog .cosmetic-card .shop-buy{height:46px;min-height:46px;max-height:46px;flex-basis:46px;font-size:12px}#shop-dialog .cosmetic-card>small:empty{display:none}}

@container(max-height:440px){
 #shop-dialog .cosmetic-card:has(.frame-upgrade){gap:1px;padding:2px 4px}
 #shop-dialog .cosmetic-card:has(.frame-upgrade) .cosmetic-preview{width:28px;height:28px;min-width:28px;min-height:28px;max-height:28px;flex-basis:28px}
 #shop-dialog .cosmetic-card:has(.frame-upgrade)>strong{min-height:14px;font-size:10px}
 #shop-dialog .cosmetic-card:has(.frame-upgrade) .shop-buy{height:44px;min-height:44px;max-height:44px;flex-basis:44px}
}

/* Mode scenery is independent of equipped home-menu artwork. */
#app[data-screen=game][data-mode=endless],#app[data-screen=game][data-mode=adventure]{background:#101d3b}
#app[data-screen=game][data-mode=endless]:before,#app[data-screen=game][data-mode=adventure]:before{background:none}
#gameplay-scene{position:absolute;inset:0;width:100%;height:100%;z-index:-1;pointer-events:none}
#gameplay-scene[hidden]{display:none}
#difficulty-dialog .dialog-content{padding:24px 22px;display:flex;flex-direction:column;justify-content:center;gap:14px;overflow:hidden}
#difficulty-dialog h2{font-size:25px;margin:0 20px 6px}
.difficulty-options{display:grid;gap:10px}.difficulty-option{border:2px solid #79cbd9;border-radius:16px;background:linear-gradient(#f1fdff,#c0ebf1);color:#14566e;padding:12px 8px;min-height:65px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:5px;font:900 17px Nunito}
.difficulty-option span{font-size:12px;font-weight:800}.difficulty-option[aria-pressed=true]{border-color:#e3a42c;background:linear-gradient(#fff5b5,#ffd05b);color:#6a4505;box-shadow:0 0 0 2px #fff8d6 inset}
.difficulty-note{text-align:center;font-size:11px;line-height:1.4;margin:0;color:#326476}
@media(max-height:620px){#difficulty-dialog .dialog-content{padding:18px;gap:7px}#difficulty-dialog h2{font-size:21px}.difficulty-options{gap:7px}.difficulty-option{min-height:56px;padding:7px}.difficulty-note{font-size:10px}}

#app[data-screen=home][data-background=moon],#app[data-screen=home][data-background=sunset]{background-image:url('assets/worlds-v12.webp');background-size:max(200%,100vh) auto;background-repeat:no-repeat;background-position:left center}
#app[data-screen=home][data-background=sunset]{background-position:right center}

/* Progressive Endless boards keep every sprite proportional. */
.board[data-linear=true][data-columns="3"] .sprite{width:62px;height:62px}
.board[data-linear=true][data-columns="3"] .sprite.special-art{height:74px}
.board[data-linear=true][data-count="20"]{grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr));gap:5px;min-height:252px}
.board[data-linear=true][data-count="20"] .choice{padding:2px}
.board[data-linear=true][data-count="20"] .sprite{width:42px;height:42px}
.board[data-linear=true][data-count="20"] .sprite.special-art{height:50px}
.difficulty-option small{font-size:10px;font-weight:800}
@media(max-height:650px){
 .board[data-linear=true][data-columns="3"] .sprite{width:52px;height:52px}.board[data-linear=true][data-columns="3"] .sprite.special-art{height:62px}
 .board[data-linear=true][data-columns="4"] .sprite{width:38px;height:38px}.board[data-linear=true][data-columns="4"] .sprite.special-art{height:46px}
 .board[data-linear=true][data-count="20"]{height:236px;min-height:236px;gap:4px}
 .board[data-linear=true][data-count="20"] .sprite{width:34px;height:34px}.board[data-linear=true][data-count="20"] .sprite.special-art{height:41px}
 #game:has(.board[data-linear=true]) .feedback-slot{height:12px;margin:2px 0}.difficulty-option{gap:3px}
}

/* Keep gameplay feedback at the health HUD and give the board the spare height. */
#app[data-screen=game]{padding-bottom:max(12px,env(safe-area-inset-bottom))}
#game{display:flex;flex-direction:column;min-height:calc(100dvh - max(8px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom)))}
#game>.feedback-slot,#game>.rule-note{display:none}
#game>.streaks:not(:has(span:not(:empty))){display:none}
#game>.board{flex:1 0 auto;max-height:440px}
#game>.abilities{margin-top:auto;padding-top:14px;flex-shrink:0}
#game>.timer-track,#game>.current,#game>.score-row{flex-shrink:0}

/* Compact continue panel: retain the painted top/bottom at the same scale,
   cropping only unused space from the middle of the portrait artwork. */
#app #over-dialog.continue-offer{
 width:min(350px,calc(100vw - 24px));height:280px;max-height:calc(100dvh - 24px);
 background:transparent;isolation:isolate;border-radius:22px;
}
#over-dialog.continue-offer::before,#over-dialog.continue-offer::after{
 content:'';position:absolute;left:0;right:0;height:50%;z-index:-1;pointer-events:none;
 background-image:url('assets/menu-panel-v240.webp');background-size:100% auto;background-repeat:no-repeat;
}
#over-dialog.continue-offer::before{top:0;background-position:center top}
#over-dialog.continue-offer::after{bottom:0;background-position:center bottom}
#over-dialog.continue-offer .result-content{height:100%;margin:0;padding:24px;gap:12px;justify-content:center}
#over-dialog.continue-offer #record{line-height:1.2;margin:0}
#over-dialog.continue-offer .result-home-hint{min-height:32px;margin:0;font-size:11px}
#over-dialog.continue-offer .result-home-hint:empty{display:none}
#over-dialog.continue-offer #result-return-countdown{min-height:32px;display:grid;place-items:center}

/* Swipeable difficulty choices keep the heading and close button in place. */
#difficulty-dialog .dialog-content{gap:10px;padding:30px 24px 24px}
#difficulty-dialog h2{margin:0 24px 2px;font-size:23px}
.difficulty-scroll-hint{margin:0;text-align:center;color:#326476;font-size:11px;font-weight:800}
#difficulty-dialog .difficulty-options{display:flex;flex-direction:column;gap:9px;height:200px;min-height:140px;flex:0 1 200px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;scroll-snap-type:y proximity;padding:6px 5px;scrollbar-width:thin;scrollbar-color:#159ab4 #b7e6ed;border-radius:16px;background:#8ed8e733;box-shadow:inset 0 2px 8px #075e7820}
#difficulty-dialog .difficulty-option{flex:0 0 auto;width:100%;min-height:76px;scroll-snap-align:center;padding:10px 5px}
#difficulty-dialog .difficulty-note{margin:0;font-size:10px;line-height:1.4}
@media(max-height:620px){#difficulty-dialog .dialog-content{padding:24px 20px 20px;gap:8px}#difficulty-dialog .difficulty-options{height:170px;flex-basis:170px}#difficulty-dialog h2{font-size:21px}}

/* Extra screen height belongs to the board area, never to a single card. */
#board[data-count="1"]{grid-template-columns:minmax(0,210px);justify-content:center}
#board:is([data-count="1"],[data-count="2"],[data-count="3"]){grid-template-rows:auto;grid-auto-rows:auto;align-content:center}
#board:is([data-count="1"],[data-count="2"],[data-count="3"])>.choice{width:100%;height:auto;aspect-ratio:1;align-self:center;justify-self:center}

/* Keep the short difficulty label centered within the painted button. */
#home .home-actions #view-map{display:grid;place-items:center;text-align:center;white-space:nowrap;padding:0 12px;font-size:16px;line-height:1;min-width:0}
#home .home-actions #view-map[hidden]{display:none}

/* Star total sits directly on the painted Adventure medallion. */
.mode-adventure{container-type:inline-size}
.mode-adventure>em{position:absolute;left:50%;top:calc(50% + 34.5cqw);transform:translate(-50%,-50%);margin:0;padding:0;width:70%;text-align:center;white-space:nowrap;background:none;border:0;box-shadow:none;color:#653300;font:1000 clamp(13px,3.6vw,18px)/1 Nunito,sans-serif;text-shadow:0 1px 0 #fff4a6}
/* Square tracks use the available play area, not the phone's aspect ratio. */
#game{height:calc(100dvh - max(8px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom)));min-height:0}
#game>#board{flex:1 1 0;height:auto;min-height:0;max-height:none;max-width:100%;width:100%;margin:0;grid-template-columns:repeat(var(--cols,1),var(--track,60px))!important;grid-template-rows:repeat(var(--rows,1),var(--track,60px))!important;grid-auto-rows:var(--track,60px);align-content:center;justify-content:center}
#game>#board>.choice,#game>#board>.board-rock{width:var(--track);height:var(--track);aspect-ratio:1;align-self:center;justify-self:center;padding:0}
#game>#board .sprite{width:var(--tile-art)!important;height:var(--tile-art)!important}
#game>#board .sprite.special-art{height:calc(var(--tile-art)*1.2)!important}
@media(min-width:650px){#app[data-screen=game]{margin:0 auto;min-height:100dvh;border-radius:0}}
/* Tint only the surrounding play surface, leaving each occupied card untouched. */
#game>#board{position:relative;border-radius:24px;background:transparent}
#game>#board::before{content:'';position:absolute;inset:0;border-radius:inherit;background:rgba(2,13,34,.30);-webkit-mask-image:var(--board-tint-mask);mask-image:var(--board-tint-mask);-webkit-mask-size:100% 100%;mask-size:100% 100%;pointer-events:none;z-index:0}
#game>#board>.choice,#game>#board>.board-rock{z-index:1}

/* Compact difficulty panel: crop the unused middle, preserve the art's aspect ratio. */
#app #difficulty-dialog{
 width:min(360px,calc(100vw - 24px));height:min(400px,calc(100dvh - 24px));
 background:transparent;isolation:isolate;border-radius:22px;
}
#difficulty-dialog::before,#difficulty-dialog::after{
 content:'';position:absolute;left:0;right:0;height:50%;z-index:-1;pointer-events:none;
 background:url('assets/menu-panel-v240.webp') center top/100% auto no-repeat;
}
#difficulty-dialog::before{top:0}
#difficulty-dialog::after{bottom:0;background-position:center bottom}
#difficulty-dialog .dialog-content{padding:26px 22px 22px;justify-content:flex-start;gap:10px}
#difficulty-dialog h2{font-size:21px;margin:0 36px;min-height:36px;display:grid;place-items:center}
#difficulty-dialog .difficulty-options{flex:1 1 200px;height:auto;min-height:76px}
#difficulty-dialog .difficulty-note{flex-shrink:0}
@media(max-width:350px){#difficulty-dialog h2{font-size:19px}#difficulty-dialog .dialog-content{padding:25px 18px 20px}}


/* Keep-going instruction sits on the backdrop, outside the painted panel. */
#app #over-dialog.continue-offer{height:270px;max-height:calc(100dvh - 124px);overflow:visible}
#over-dialog.continue-offer .result-content{overflow:visible;justify-content:center;gap:18px;padding:26px 20px 22px}
#over-dialog.continue-offer #record{order:1;flex-shrink:0}
#over-dialog.continue-offer #ad-status{order:2;font-size:14px;line-height:1.35;margin:0;max-width:260px;min-height:38px;display:grid;place-items:center}
#over-dialog.continue-offer #continue-ad{order:3;width:min(100%,300px);height:auto;aspect-ratio:3;min-height:0;flex-shrink:0;margin:0;padding:10px 20px}
#over-dialog.continue-offer #continue-ad strong{font-size:24px}
#over-dialog.continue-offer .result-home-hint,#over-dialog.continue-offer #result-return-countdown{
 position:absolute;top:calc(100% + 20px);left:0;right:0;width:100%;max-width:none;box-sizing:border-box;margin:0;padding:0 12px;height:auto;min-height:34px;
 color:#fff;text-shadow:0 2px 4px #00243c;font-size:14px;font-weight:900;line-height:1.4;text-align:center;
}
#over-dialog.continue-offer #result-return-countdown{font-size:26px}

#over-dialog.continue-offer::before{border-radius:22px 22px 0 0}
#over-dialog.continue-offer::after{border-radius:0 0 22px 22px}

/* Quest navigation keeps keyboard focus visible without yellow touch outlines. */
#quests-dialog button:focus{outline:none}
#quests-dialog button:focus-visible{outline:2px solid #08728e;outline-offset:2px}
#quests-dialog .quest-card:focus{outline:none}

/* Unfinished quests center their content; completed quests make room for Collect. */
#quests-dialog .quest-collect[hidden]{display:none!important}
#quests-dialog .quest-card{justify-content:center}
#quests-dialog .quest-card:not(.complete)>.quest-footer{margin-top:4px}

/* Reveal totals after the objective-to-star sequence has settled. */
#over-dialog.adventure-results:has(#adventure-result:not(.rewards-settled)) :is(#final-score,.result-coins,#result-progress,#result-xp-bar,#ad-status,#adventure-continue){display:none}

/* A consistent breathing space between cards and the tinted board edge. */
#game>#board{padding:14px;box-sizing:border-box}
#game>#board::before{clip-path:inset(var(--surface-y,0px) var(--surface-x,0px) round 24px)}

/* Adventure rules and memory cards use the existing card art without stretching. */
#adventure-mechanic{display:flex;justify-content:center;align-items:center;gap:7px;min-height:28px;margin:2px auto;color:#fff3b2;font-size:12px;font-weight:900;text-align:center;background:#123853e8;border-radius:12px;padding:4px 10px;max-width:95%}
#adventure-mechanic[hidden]{display:none}
.color-wheel{display:inline-block;width:27px;height:27px;flex:0 0 27px;border:2px solid #fff4b2;border-radius:50%;background:conic-gradient(#f75063 0 90deg,#329aff 90deg 180deg,#5ed469 180deg 270deg,#ffdc48 270deg);box-shadow:0 2px 3px #0005;transform:rotate(var(--wheel-turn,0deg));animation:none}
.color-wheel.turning{animation:wheel-arrive .9s ease-out}
@keyframes wheel-arrive{from{transform:rotate(calc(var(--wheel-turn,0deg) - 90deg))}to{transform:rotate(var(--wheel-turn,0deg))}}
.choice.memory-card{position:relative;isolation:isolate}
.choice.memory-card:not(.memory-open) .sprite{visibility:hidden}
.choice.memory-card:not(.memory-open)::after{content:'?';position:absolute;inset:12%;display:grid;place-items:center;border:2px solid #a8e9ff;border-radius:16%;color:#fff2ab;background:repeating-linear-gradient(45deg,#154a79 0 9px,#1a5686 9px 18px);font-size:clamp(20px,6vw,42px);font-weight:1000;pointer-events:none;text-shadow:0 2px #073653}
.choice.memory-used:not(.memory-open)::after{content:'?';border-color:#ffe278;box-shadow:inset 0 -5px #ffe278}
.choice.memory-open{animation:memory-flip .25s ease-out}
@keyframes memory-flip{from{transform:rotateY(80deg)}to{transform:rotateY(0)}}
#adventure-practice{width:min(370px,calc(100vw - 24px));height:auto;max-height:calc(100dvh - 24px);padding:24px 18px;border:4px solid #3fdaef;border-radius:25px;background:#e3fbff;color:#075273;text-align:center;overflow:auto;box-shadow:inset 0 0 15px #48d8ed,0 12px 40px #001d5680}
#adventure-practice::backdrop{background:#001c46c9}
#adventure-practice h2{margin:0 0 10px;font-size:25px}
#adventure-practice p{font-size:15px;line-height:1.4;margin:10px 0}
.practice-current{display:flex;align-items:center;justify-content:center;gap:10px;padding:8px;background:#b6e8f0;border-radius:15px}
.practice-current .sprite{width:65px;height:65px}
.practice-choices{display:flex;justify-content:center;align-items:center;gap:14px;margin:18px 0}
.practice-choices .choice{width:90px!important;height:90px!important;aspect-ratio:1;flex:none}
.practice-choices .sprite{width:65px!important;height:65px!important}
#adventure-practice .primary{min-height:50px;min-width:150px}
#adventure-practice [hidden]{display:none!important}
.practice-wheel{display:flex;flex-direction:column;align-items:center;gap:8px;background:#b6e8f0;border:2px solid #31b4d2;border-radius:15px;padding:12px;color:#075273}
.practice-wheel .color-wheel{width:55px;height:55px;flex-basis:55px;transition:transform .7s}

#adventure-practice{min-height:0;inset:0;margin:auto;height:fit-content;aspect-ratio:auto}

/* Compact first-run practice; crop the unused panel middle, never stretch its art. */
#app #tutorial-dialog{width:min(370px,calc(100vw - 24px));height:fit-content;min-height:0;max-height:calc(100dvh - 24px);background:transparent;isolation:isolate;border-radius:24px}
#tutorial-dialog::before,#tutorial-dialog::after{content:'';position:absolute;left:0;right:0;height:50%;z-index:-1;pointer-events:none;background:url('assets/menu-panel-v240.webp') center top/100% auto no-repeat}
#tutorial-dialog::before{top:0}#tutorial-dialog::after{bottom:0;background-position:center bottom}
#app #tutorial-dialog .dialog-content{height:auto;max-height:calc(100dvh - 24px);padding:24px 24px 28px;overflow-y:auto}
#tutorial-dialog #tutorial-step{margin:0 0 7px}
#tutorial-dialog #tutorial-board[hidden]{display:none}
#tutorial-dialog.tutorial-ready #tutorial-next{margin-top:18px;min-height:50px}
@media(max-height:620px){#app #tutorial-dialog .dialog-content{padding:20px 20px 24px}}

#game .current.has-match-lock{flex-wrap:nowrap;row-gap:5px;padding-bottom:7px}
#match-rule-badge{order:10;flex:0 0 100%;display:flex;justify-content:center;align-items:center;gap:7px;min-height:30px;padding:4px 7px;border:1px solid #ffe691;border-radius:10px;background:#073953;color:#fff2b0;box-sizing:border-box;line-height:1.1}
#match-rule-badge[hidden]{display:none!important}
#match-rule-badge strong{font-size:13px;letter-spacing:.5px;text-transform:none}
#match-rule-badge .match-rule-detail{font-size:11px;color:#e0f7ff;border-left:1px solid #8ab9cc;padding-left:7px;white-space:nowrap}
.match-rule-icon{display:block;width:22px;height:22px;flex:0 0 22px;color:#fff}
.match-rule-icon svg{display:block;width:100%;height:100%}
.match-rule-icon.color-swatch{width:18px;height:18px;flex-basis:18px;border:2px solid white;border-radius:50%;box-shadow:0 1px 3px #001929}
@media(max-height:620px){#match-rule-badge{min-height:26px;padding:2px 5px}#match-rule-badge strong{font-size:11px}#match-rule-badge .match-rule-detail{font-size:10px}.match-rule-icon{width:19px;height:19px;flex-basis:19px}}

/* Compact collection goals: counts sit at the lower right of undistorted art. */
#mode-hud.collection-goal{display:flex;justify-content:flex-start;align-items:center;gap:6px;width:max-content;max-width:100%;min-height:54px;padding:3px;margin:3px auto 7px;background:#034663cc;border-radius:16px;box-sizing:border-box}
#mode-hud.collection-goal:empty{visibility:hidden}
#mode-hud.collection-goal .collection-counter{position:relative;display:grid;place-items:center;flex:0 0 46px;width:46px;height:46px}
#mode-hud.collection-goal .sprite{display:block;width:40px;height:40px;margin:0;grid-row:auto}
.collection-remaining{position:absolute;right:0;bottom:0;font-size:18px;line-height:1.1;color:#fff7c8;text-shadow:0 2px 2px #072b44,1px 0 #072b44,-1px 0 #072b44;font-weight:1000}
.collection-done .collection-remaining{color:#b6ff99}

/* Lives are part of the target row, never a wrapping footer. */
#game .current{background:#073953;color:#fff;flex-wrap:nowrap}
#game #current-sprite{flex-shrink:0}
#game #current-sprite + div{flex:1 1 0;min-width:0}
#game #current-name{font-size:clamp(12px,3.5vw,16px);overflow-wrap:normal}
#game .current > .strike-info{flex:0 0 auto;align-self:flex-start;margin:4px 0 0 auto}
#match-rule-badge{flex:0 0 auto;width:auto;min-height:34px;gap:7px;margin:3px 0 0;padding:4px 8px;background:#062d43;border-color:#80cada}
.match-examples{display:flex;gap:5px;align-items:center}.match-examples span{width:24px;height:24px}.match-examples svg,.rule-lock svg{width:100%;height:100%;display:block}.rule-lock{width:18px;height:20px;color:#fff}
#color-change-cue{display:flex;align-items:center;gap:7px;padding:4px 8px;background:#062d43;border:1px solid #80cada;border-radius:12px;margin-top:3px;flex:0 0 auto}
#color-change-cue[hidden]{display:none!important}.color-change-steps{display:flex;gap:4px}.color-change-steps i{width:8px;height:8px;border:2px solid #d9f5ff;border-radius:50%;background:#123e55}.color-change-steps i.filled{background:#fff}
.color-next{width:17px;height:17px;border-radius:50%;border:2px solid #fff}.color-next-arrow{font-size:20px;color:#fff}
#game .rule-note,#game #board-status{display:none}
#mode-hud:not(.collection-goal):not(:empty){background:#073953;color:#fff;border-radius:10px;padding:5px 10px;width:fit-content;max-width:100%;margin:4px auto;font-size:12px}
#feedback:not(:empty){background:#073953;color:#fff;border-radius:10px;padding:4px 8px;width:fit-content;max-width:100%;margin:4px auto}

.current-cues{display:flex;flex:0 0 100%;align-items:center;gap:6px;flex-wrap:wrap}.current-cues:has(> [hidden]):not(:has(> :not([hidden]))){display:none}

/* The target artwork carries the rule; no visible rule label or example row. */
#game .current.has-match-lock #current-sprite + div{display:none}
#game .current.has-match-lock #current-sprite{border-radius:12px;outline:2px solid #e6f9ff;outline-offset:5px}
#game .current[data-match-rule="shape"] #current-sprite img{filter:grayscale(1) brightness(2.8)}
#game .current[data-match-rule="color"] #current-sprite img{visibility:hidden}
#game .current[data-match-rule="color"] #current-sprite::after{content:'';position:absolute;inset:10%;background:var(--locked-color);border:2px solid #fff;border-radius:45% 55% 58% 42% / 55% 40% 60% 45%;box-shadow:inset 0 3px 3px #ffffff66,0 2px 4px #001d2c}
.current-cues:empty{display:none}

/* Anchor collection goals to the left edge of the gameplay area. */
#mode-hud.collection-goal{margin-left:0;margin-right:auto;align-self:flex-start}

/* Preserve the original target art; lock cues are overlays only. */
#game .current.has-match-lock #current-sprite{outline:none;border-radius:0}
#game .current[data-match-rule="shape"] #current-sprite img{filter:none}
#game .current[data-match-rule="color"] #current-sprite img{visibility:visible}
#game .current[data-match-rule="shape"] #current-sprite::after{content:'';position:absolute;inset:0;background:url('assets/shape-lock-chains-v202.webp') center/contain no-repeat;pointer-events:none}
#game .current[data-match-rule="color"] #current-sprite::after{content:'';position:absolute;inset:auto 2px 2px auto;width:17px;height:15px;box-sizing:border-box;background:var(--locked-color);border:3px solid #fff3ce;border-radius:4px;box-shadow:0 1px 3px 2px #281600;pointer-events:none}
#game .current[data-match-rule="color"] #current-sprite::before{content:'';position:absolute;right:5px;bottom:15px;width:11px;height:10px;box-sizing:border-box;border:3px solid #fff3ce;border-bottom:0;border-radius:7px 7px 0 0;filter:drop-shadow(0 1px 1px #281600);z-index:1;pointer-events:none}

/* Shape-specific wrapped artwork replaces the loose X overlay. */
#game .current[data-match-rule="shape"] #current-sprite::after{content:none;background:none}

/* Three matches fill the compact meter upward beside the target. */
#game #color-change-cue{display:flex;flex-direction:column-reverse;align-items:stretch;align-self:center;flex:0 0 9px;width:9px;height:39px;gap:3px;padding:2px;margin:0 -3px 0 -3px;background:#032637;border:1px solid #ac8644;border-radius:5px;box-sizing:content-box;pointer-events:none}
#color-change-cue>i{display:block;flex:1;border-radius:2px;background:#37505b;box-shadow:inset 0 1px 2px #001824;transition:background .12s,box-shadow .12s}
#color-change-cue>i.filled{background:linear-gradient(90deg,#e5a923,#ffdf72);box-shadow:0 0 4px #ffd66566,inset 0 1px #fff1ad}

#mode-hud.collection-goal .collection-memory{display:grid;place-items:center;box-sizing:border-box;border:2px solid #a8e9ff;border-radius:16%;color:#fff2ab;background:repeating-linear-gradient(45deg,#154a79 0 6px,#1a5686 6px 12px);font-size:27px;font-weight:1000;text-shadow:0 2px #073653}

/* Reward counts belong to their icon, never the entire home toolbar. */
#app[data-screen=home] .home-tools #achievements-open{position:relative;overflow:visible}
#achievements-open #achievement-badge{top:-4px;right:-5px;bottom:auto;z-index:4;min-width:20px;padding:1px 4px;box-sizing:border-box}
.quest-tabs button{position:relative;min-height:40px;border-color:#52b8cc;background:#b4e6f3;color:#12536c}
.quest-tabs button[aria-selected=true]{background:linear-gradient(#fff2a4,#ffd159);border-color:#eab130;color:#674414;box-shadow:0 2px #cb9428}
.quest-tab-dot{position:absolute;right:3px;top:3px;width:10px;height:10px;background:#ffcf36;border:2px solid #fff4ad;border-radius:50%;box-shadow:0 1px 3px #785400;pointer-events:none}
.quest-tab-dot[hidden]{display:none!important}

#level-dialog #level-objectives{gap:5px}#level-dialog #level-objectives li{padding:6px 8px;font-size:13px}#level-dialog #level-objectives .star-challenge-heading{background:none;border:0;padding:3px;font-size:12px;color:#87601b}#level-dialog #level-objectives .star-challenge{background:#fff5c7;border-color:#e6ce73}

/* Spacious quest cards keep their progress and reward action centered. */
#app #quests-dialog{width:min(440px,calc(100vw - 16px));height:min(690px,calc(100dvh - 20px));max-height:calc(100dvh - 20px);background:#d9f9ff;border:5px solid #20c9df;border-radius:26px;box-shadow:inset 0 0 0 3px #b2faff,0 12px 35px #00395566}
#quests-dialog .dialog-content{height:100%;margin:0;padding:20px 14px 16px;gap:10px;overflow:hidden}
#quests-dialog h2{margin:6px 40px 8px;font-size:27px}
#quests-dialog .quest-tabs button{min-height:38px;font-size:15px}
#quests-dialog #quest-list{grid-template-rows:repeat(3,minmax(126px,1fr));gap:10px;overflow-y:auto;overflow-x:hidden;padding:2px;scrollbar-width:thin}
#quests-dialog .quest-card{padding:12px 10px;gap:10px;overflow:hidden;isolation:isolate;border-radius:18px}
#quests-dialog .quest-card h3{font-size:16px;line-height:1.25;font-weight:900}
#quests-dialog .quest-progress{box-sizing:border-box;align-self:center;width:100%;height:42px;min-height:42px;margin:0 auto;border:2px solid #69b4c7;border-radius:22px;background:#98c8d7;box-shadow:inset 0 3px 6px #235e7433;overflow:hidden;position:relative}
#quests-dialog .quest-progress-fill{height:100%;border-radius:18px;background:linear-gradient(#78edcf,#22b6a4);box-shadow:inset 0 2px #c5fff0}
#quests-dialog .quest-progress strong{display:grid;place-items:center;position:absolute;inset:0;font-size:20px;line-height:1;font-weight:1000;text-shadow:0 1px #eaffff}
#quests-dialog .quest-footer{flex-direction:row;justify-content:center;gap:18px;min-height:30px}
#quests-dialog .quest-reward{font-size:18px;line-height:26px}
#quests-dialog .quest-reward img{width:27px;height:27px}
#quests-dialog .quest-collect:not(:disabled),#quests-dialog .quest-collect{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:10px;flex:0 0 auto;min-width:0;width:190px;max-width:100%;height:48px;min-height:48px;max-height:48px;margin:0 auto;padding:7px 15px;font-size:15px}
#quests-dialog #quests-collect-all{flex-direction:row;gap:10px;width:230px}
#quests-dialog .quest-collect .quest-reward,#quests-dialog #quests-collect-all .quest-reward{font-size:inherit;line-height:1;color:inherit;white-space:nowrap;gap:4px}
@media(max-height:650px){#quests-dialog .quest-collect:not(:disabled),#quests-dialog .quest-collect{height:44px;min-height:44px;max-height:44px;font-size:14px}}
#quests-dialog .quest-card.quest-redeeming{border-color:#32c987;pointer-events:none}
#quests-dialog .quest-card.quest-redeeming::after{content:'';position:absolute;inset:0;z-index:2;pointer-events:none;background:linear-gradient(90deg,#4ddd9a55 0%,#6df6ae99 85%,#d3ffe3 98%);transform-origin:left;animation:daily-quest-sweep .65s ease-out both}
@keyframes daily-quest-sweep{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0)}}
#quests-dialog .quest-card.quest-redeeming-reduced::after{animation:none;background:#5ce69d55}
#quests-dialog #quest-list.daily-cleared{display:flex;align-items:center;justify-content:center;overflow:hidden}
.daily-quest-empty{width:100%;text-align:center;animation:daily-countdown-in .4s ease-out both}
#quests-dialog .daily-quest-empty h3{font-size:23px;line-height:1.25;color:#087662;margin:0 0 24px}
.daily-quest-empty p{font-size:15px;color:#246376;margin:14px auto;max-width:260px;line-height:1.4}
#daily-quest-countdown{display:block;white-space:nowrap;font-size:clamp(36px,10vw,52px);line-height:1.3;font-weight:1000;font-variant-numeric:tabular-nums;letter-spacing:1px;color:#087b98;text-shadow:0 2px #fff,0 0 20px #56dbc455}
@keyframes daily-countdown-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
#quest-save-error{margin:0;text-align:center;font-size:12px;color:#9b3344}
@media(max-height:650px){#quests-dialog .dialog-content{padding:12px 10px;gap:6px}#quests-dialog h2{margin:2px 40px 5px;font-size:23px}#quests-dialog #quest-list{gap:7px}#quests-dialog .quest-card{padding:7px 8px;gap:6px}#quests-dialog .quest-card h3{font-size:14px}#quests-dialog .quest-progress{height:36px;min-height:36px}#quests-dialog .quest-progress strong{font-size:18px}#quests-dialog #quests-collect-all{height:44px;min-height:44px;max-height:44px;flex-basis:44px}}
@media(prefers-reduced-motion:reduce){.daily-quest-empty{animation:none}#quests-dialog .quest-card.quest-redeeming::after{animation:none;background:#5ce69d55}}

/* Compact coin panels crop only the empty middle of the painted frame. */
#app #coin-help-dialog,#app #coins-ad-dialog{width:min(380px,calc(100vw - 24px));height:fit-content;min-height:0;max-height:calc(100dvh - 24px);background:transparent;border-radius:24px;isolation:isolate;overflow:clip}
#coin-help-dialog::before,#coin-help-dialog::after,#coins-ad-dialog::before,#coins-ad-dialog::after{content:'';position:absolute;left:0;right:0;height:50%;z-index:-1;pointer-events:none;background:url('assets/menu-panel-v240.webp') center top/100% auto no-repeat}
#coin-help-dialog::after,#coins-ad-dialog::after{bottom:0;background-position:center bottom}
#coin-help-dialog::before,#coins-ad-dialog::before{top:0}
#app #coin-help-dialog .dialog-content{display:flex;flex-direction:column;gap:12px;height:auto;margin:0;padding:22px 22px 20px;overflow:clip;overscroll-behavior:none}
#coin-help-dialog .coin-help-heading{display:flex;justify-content:center;align-items:center;gap:10px;min-height:42px;margin-right:36px}
#app #coin-help-dialog h2{font-size:25px;line-height:1.2;margin:0;padding:0}
#coin-help-dialog .coin-help-art{width:40px;height:40px;flex:none;object-fit:contain}
#coin-help-dialog .coin-help-methods{display:grid;gap:8px}
#app #coin-help-dialog .coin-help-methods p{margin:0;padding:9px 12px;border:1px solid #75c6d7;border-radius:14px;background:#d3f4fa;text-align:center;font-size:14px;line-height:1.35}
#coin-help-dialog .coin-help-methods strong{display:block;font-size:16px;margin-bottom:3px;color:#07566d}
#app #coin-help-dialog .hint{font-size:12px;line-height:1.4;margin:0;text-align:center}
#app #coin-help-dialog .primary{width:210px;max-width:100%;aspect-ratio:3;height:auto;min-height:0;margin:0 auto;padding:10px;font-size:18px;flex:none;background-size:contain}
#app #coins-ad-dialog .dialog-content{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:10px;height:auto;margin:0;padding:26px 22px 20px;overflow:clip}
#app #coins-ad-dialog h2{min-height:36px;display:grid;place-items:center;font-size:25px;line-height:1.2;margin:0 40px;padding:0}
#coins-ad-dialog .coin-offer-reward{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:78px}
#app #coins-ad-dialog .reward-preview{width:78px;height:78px;flex:none;object-fit:contain;margin:0}
#app #coins-ad-dialog .coin-reward-amount{font-size:30px;line-height:1.2;white-space:nowrap}
#app #coins-ad-dialog #coins-ad-status{width:100%;max-width:300px;min-height:36px;margin:0;font-size:14px;line-height:1.35;text-align:center}
#app #coins-ad-dialog #coins-ad-watch{width:100%;max-width:300px;aspect-ratio:3;height:auto;min-height:0;max-height:none;margin:0;padding:10px 16px;flex:none;background-size:contain}
#app #coins-ad-dialog #coins-ad-watch strong{font-size:23px;line-height:1.2}
#app #coins-ad-dialog #coins-ad-watch span{font-size:14px;line-height:1.3}
@media(max-width:350px){#app #coin-help-dialog .dialog-content{padding:20px 18px 16px;gap:9px}#app #coin-help-dialog h2{font-size:23px}#app #coin-help-dialog .coin-help-methods p{padding:8px 10px;font-size:13px}#app #coins-ad-dialog .dialog-content{padding:24px 18px 18px;gap:8px}#app #coins-ad-dialog .coin-reward-amount{font-size:27px}#app #coins-ad-dialog #coins-ad-watch strong{font-size:21px}}
@media(max-height:500px) and (min-width:550px){#app #coin-help-dialog{width:min(620px,calc(100vw - 24px))}#app #coin-help-dialog .dialog-content{padding:16px 20px;gap:8px}#coin-help-dialog .coin-help-methods{grid-template-columns:repeat(3,minmax(0,1fr))}#app #coin-help-dialog .coin-help-methods p{font-size:13px;padding:10px}#app #coin-help-dialog .primary{width:180px}#app #coin-help-dialog .hint{font-size:12px}#app #coins-ad-dialog .dialog-content{padding-top:18px;padding-bottom:14px;gap:6px}#app #coins-ad-dialog .reward-preview{width:62px;height:62px}#coins-ad-dialog .coin-offer-reward{min-height:62px}#app #coins-ad-dialog #coins-ad-watch{max-width:270px}}
@media(max-height:520px) and (max-width:549px){#app #coin-help-dialog .dialog-content{padding:17px 16px 14px;gap:7px}#coin-help-dialog .coin-help-heading{min-height:36px}#coin-help-dialog .coin-help-art{width:34px;height:34px}#app #coin-help-dialog h2{font-size:22px}#app #coin-help-dialog .coin-help-methods p{font-size:13px;padding:6px 10px}#coin-help-dialog .coin-help-methods strong{font-size:15px;margin-bottom:2px}#app #coin-help-dialog .hint{font-size:11px}#app #coin-help-dialog .primary{width:180px}}

#over-dialog #result-survival{margin:1px 0 5px;font:900 14px/1.3 Nunito,sans-serif;color:#087289;font-variant-numeric:tabular-nums}
#over-dialog.continue-offer #result-survival,#over-dialog #result-survival[hidden]{display:none}
/* Skin packs need room for four previews; let this panel scroll without compressing cards. */
#shop-dialog #skin-items{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:max-content;align-content:start;overflow-y:auto;overscroll-behavior:contain;gap:10px;padding:2px 2px 8px}
#shop-dialog #skin-items .skin-card{height:auto;min-height:210px;padding:8px;gap:6px}
#shop-dialog #skin-items .skin-preview{flex:none;width:100%;max-width:112px;aspect-ratio:1}
#shop-dialog #skin-items .skin-card>strong{min-height:18px;line-height:1.25}
#shop-dialog #skin-items .skin-card>small{flex:none;line-height:1.3}
#shop-dialog #skin-items .shop-buy{flex:none;min-height:46px;margin-top:auto}

/* Collection icons stay separate from the three star tasks. */
.level-requirements{display:flex;justify-content:center;align-items:center;gap:18px;width:100%;padding:3px 0 8px}
.level-requirements .collection-counter{position:relative;display:grid;place-items:center;width:64px;height:64px;flex:none}
.level-requirements .sprite{width:56px;height:56px}
.level-requirements .collection-remaining{position:absolute;right:-5px;bottom:-4px;color:#fff;font:1000 23px/1 Nunito,sans-serif;text-shadow:0 2px 2px #064775,1px 0 #064775,-1px 0 #064775,0 -1px #064775}
.level-requirements .collection-memory{display:grid;place-items:center;border:2px solid #67d9ff;border-radius:16%;background:repeating-linear-gradient(45deg,#2377ad 0 8px,#328bc0 8px 16px)!important;color:#fff;font:1000 36px/1 Nunito,sans-serif;box-sizing:border-box}
.level-requirements .requirement-complete .collection-remaining{color:#8affb1}
#level-dialog .star-tasks-heading,#level-tasks-dialog .star-tasks-heading,#level-tasks-dialog .collection-heading{margin:0;font:900 14px/1.2 Nunito,sans-serif;color:#12566d}
#level-dialog #level-objectives .star-challenge{display:flex;align-items:center;gap:9px;text-align:left;padding:9px 10px}
#level-objectives .map-star{flex:none;width:24px;height:24px}
#level-tasks-dialog .tasks-note{margin:0;font-size:12px}
@media(max-height:620px){.level-requirements{gap:16px;padding:0 0 5px}.level-requirements .collection-counter{width:48px;height:48px}.level-requirements .sprite{width:43px;height:43px}.level-requirements .collection-remaining{font-size:20px}#level-dialog #level-objectives .star-challenge{padding:6px 8px}#level-tasks-dialog .tasks-paused{margin:0}}
/* Compact the paused task summary so its title and Resume remain inside short frames. */
@media(max-height:740px){
 #level-tasks-dialog .dialog-content{gap:5px;padding:24px 18px 18px}
 #level-tasks-dialog h2{font-size:22px;line-height:1.15}
 #level-tasks-dialog .tasks-paused{margin:0;font-size:11px;line-height:1.2}
 #level-task-list{gap:5px}
 #level-tasks-dialog .level-task-card{padding:6px 8px;gap:2px;line-height:1.2}
 #level-tasks-dialog .level-task-card strong{font-size:12px}
 #level-tasks-dialog .level-task-card span{font-size:11px;line-height:1.2}
 #level-tasks-dialog .level-task-card progress{height:6px;margin:2px 0}
 #level-tasks-dialog .level-requirements{padding:0 0 4px}
 #level-tasks-dialog .collection-counter{width:48px;height:48px}
 #level-tasks-dialog .level-requirements .sprite{width:43px;height:43px}
 #level-tasks-dialog .collection-remaining{font-size:20px}
 #level-tasks-dialog #tasks-resume{min-height:46px;height:46px;font-size:17px;flex-shrink:0}
 #level-tasks-dialog .tasks-note{font-size:11px;line-height:1.2}
}
@media(max-height:620px){#level-tasks-dialog .dialog-content{padding-top:16px;padding-bottom:10px}}

/* Backdrop-only dismissal copy; text inside panels keeps its normal casing. */
#over-dialog.continue-offer .result-home-hint{text-transform:uppercase;font-weight:1000;letter-spacing:.35px}


#quests-dialog .quest-objectives{margin:0;padding-left:18px;text-align:left;font-size:12px;line-height:1.4;color:#18566b}#quests-dialog .quest-objectives li+li{margin-top:4px}#quests-dialog .quest-objectives .done{color:#08734f;font-weight:900}

#quests-dialog #quest-list:has(.quest-objectives){grid-template-rows:none;grid-auto-rows:max-content;align-content:start}
#quests-dialog .quest-card:has(.quest-objectives){justify-content:flex-start;gap:8px}
#quests-dialog .quest-card:has(.quest-objectives)>*{flex-shrink:0}


/* One continuous frame avoids a seam between independently cropped halves. */
#app #tutorial-dialog{background:url("assets/menu-panel-v240.webp") center/100% 100% no-repeat}
#tutorial-dialog::before,#tutorial-dialog::after{content:none}

.reward-objectives li.reward-failed{background:#f4d4db;border-color:#d98191;opacity:.65;transition:background .15s,opacity .2s}

/* Endless and mini-games use the same run summary order and small-screen scrolling. */
#over-dialog:not(.adventure-results):not(.continue-offer) .result-content{overflow-y:auto;justify-content:safe center}
#over-dialog:not(.adventure-results):not(.continue-offer) #record{order:0}
#over-dialog:not(.adventure-results):not(.continue-offer) #final-score{order:1}
#over-dialog:not(.adventure-results):not(.continue-offer) .best-line{order:2}
#over-dialog:not(.adventure-results):not(.continue-offer) #result-survival{order:3}
#over-dialog:not(.adventure-results):not(.continue-offer) .result-coins{order:4}
#over-dialog:not(.adventure-results):not(.continue-offer) #result-progress{order:5;margin-top:10px}
#over-dialog:not(.adventure-results):not(.continue-offer) #result-xp-bar{order:6}
#over-dialog:not(.adventure-results):not(.continue-offer) #continue-ad{order:7;flex-shrink:0}
#over-dialog:not(.adventure-results):not(.continue-offer) #ad-status{order:8}
#over-dialog:not(.adventure-results):not(.continue-offer) .result-home-hint{order:9;flex-shrink:0}

/* First-play lessons stay on the playfield and never intercept a gesture. */
.mini-teaching{position:absolute;z-index:8;top:19%;left:7%;width:86%;margin:0;padding:6px 10px;box-sizing:border-box;text-align:center;color:#fff6c7;font:900 clamp(14px,3.5vw,18px)/1.3 Nunito,sans-serif;text-shadow:0 2px 4px #001526,0 0 12px #001526;pointer-events:none;background:linear-gradient(90deg,transparent,#062d4dbb 20%,#062d4dbb 80%,transparent);border-radius:16px}
dialog[data-paused="true"]>.mini-teaching{visibility:hidden}

#over-dialog:not(.adventure-results):not(.continue-offer) #adventure-continue{order:7;width:min(260px,100%);min-height:54px;align-self:center;margin-top:8px;flex-shrink:0}
#over-dialog .result-home-hint:empty{display:none}

.bomb-art{background:url('assets/slice-bomb-v239.webp') center/contain no-repeat!important}
.bomb-particles{position:absolute;inset:0;pointer-events:none;z-index:30;overflow:hidden}.bomb-particles i{position:absolute;border-radius:50%;box-shadow:0 0 9px #ffdf75}
/* Larger Continue actions retain the gold artwork's proportions. */
#app #over-dialog :is(#continue-ad,#adventure-continue),
#app #tutorial-dialog #tutorial-next,
body #age-dialog #age-continue{
 width:min(100%,320px);max-width:100%;height:auto;min-height:76px;aspect-ratio:3;
 flex-shrink:0;margin:10px auto 0;padding:12px 20px;font-size:25px;line-height:1.15;
 background-size:contain;touch-action:manipulation;
}
#app #over-dialog #continue-ad strong{font-size:25px;line-height:1.15}
#app #over-dialog #continue-ad span{font-size:14px;line-height:1.2}
#board-guide .board-guide-continue{width:min(100%,260px);min-height:60px;padding:12px 20px;font-size:22px;touch-action:manipulation}
/* Content-sized run results remove the empty portrait panel above/below Continue.
   Top/bottom artwork slices preserve the painted frame rather than stretching it. */
#app #over-dialog:not(.adventure-results):not(.continue-offer){
 width:min(400px,calc(100vw - 24px));height:fit-content;min-height:0;max-height:calc(100dvh - 32px);
 background:transparent;isolation:isolate;
}
#over-dialog:not(.adventure-results):not(.continue-offer)::before,
#over-dialog:not(.adventure-results):not(.continue-offer)::after{
 content:'';position:absolute;left:0;right:0;height:50%;z-index:-1;pointer-events:none;
 background:url('assets/menu-panel-v240.webp') center top/100% auto no-repeat;
}
#over-dialog:not(.adventure-results):not(.continue-offer)::before{top:0}
#over-dialog:not(.adventure-results):not(.continue-offer)::after{bottom:0;background-position:center bottom}
#app #over-dialog:not(.adventure-results):not(.continue-offer) .result-content{
 height:auto;max-height:calc(100dvh - 32px);padding:28px 24px 24px;gap:6px;justify-content:flex-start;overflow-y:auto;
}
#app #over-dialog:not(.continue-offer) #ad-status:empty,
#app #over-dialog:not(.continue-offer) .result-home-hint:empty{display:none}
@media(max-width:360px), (max-height:600px){
 #app #over-dialog :is(#continue-ad,#adventure-continue),#app #tutorial-dialog #tutorial-next,body #age-dialog #age-continue{min-height:68px;font-size:22px;margin-top:8px}
 #app #over-dialog #continue-ad strong{font-size:22px}
 #app #over-dialog:not(.adventure-results):not(.continue-offer) .result-content{padding:22px 20px 20px;gap:4px}
}
