/* Phone controls frame the play area and respect the notch and home indicator. */
button{touch-action:manipulation}
.shop-controls{position:static}
.collection-badge{position:absolute;top:7px;right:8px;padding:3px 7px;border-radius:8px;background:#174c57ed;color:#efffe9;font:12px/1.3 Tahoma,sans-serif;pointer-events:none}
.shop-card{position:relative}
@media(max-width:700px),(max-width:1400px) and (any-pointer:coarse){
 :root{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px);--edge:12px;--profile-width:220px;--profile-height:52px;--resource-width:100%;--resource-height:42px;--resource-icon:26px;--counter-font:20px;--side-size:44px;--build-width:90px;--build-height:90px;--dhikr-height:100px;--dhikr-button-height:76px;--play-top:112px;--play-bottom:100px}
 html,body{overscroll-behavior:none}
 #viewport{inset:calc(var(--safe-top) + var(--play-top)) 0 calc(var(--safe-bottom) + var(--play-bottom))}
 .topbar{inset:calc(var(--safe-top) + 6px) calc(var(--safe-right) + 10px) auto calc(var(--safe-left) + 10px);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:52px 42px;gap:4px;align-items:center;pointer-events:none}
 .brand{width:220px;height:52px;max-width:100%;justify-self:start}
 .brand-level{font-size:18px;border-width:2px}
 .brand strong{font-size:22px}.brand>div:not(.profile-xp){left:25%;right:9%;top:26%;height:40%}
 .profile-xp{left:26%;top:67%;width:63%;height:3px}
 .wallet{width:100%;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;direction:ltr}
 .resource{width:100%;height:42px;grid-template-columns:26px minmax(0,1fr)}
 .resource>div{padding:5px 4px;border-radius:6px}
 .resource strong{font-size:20px;line-height:1.25;font-weight:700;white-space:nowrap}
 .resource-symbol,.resource.gems .resource-symbol{position:relative;left:auto;bottom:auto;width:30px;height:36px;justify-self:center}
 .resource.gems .resource-symbol{width:24px;height:34px}.gold-symbol{font-size:30px}
 .garden-stats,.save-status{display:none}
 .scene-vignette{opacity:.25}
 .left-actions{left:calc(var(--safe-left) + 10px);top:calc(var(--safe-top) + var(--play-top) + 4px);gap:8px}
 .left-actions button{width:44px;height:44px}
 .toolbar{right:calc(var(--safe-right) + 10px);left:auto;top:calc(var(--safe-top) + var(--play-top) + 4px);bottom:auto;gap:8px}
 .toolbar .tool:not(#open-shop){width:44px;height:44px;min-height:44px}
 .toolbar .tool:not(#open-shop)>img{width:40px;height:40px}
 .toolbar #open-inventory{display:grid;place-items:center}
 .toolbar #open-inventory .inventory-art{position:static;display:block;width:40px;height:40px;overflow:visible;clip:auto}
 .inventory-art img{width:100%;height:100%}
 .toolbar .tool-divider{display:none}
 #inventory-count{font-size:12px;min-width:20px;height:20px;line-height:20px;top:-2px;right:-4px}
 #open-shop{left:calc(var(--safe-left) + 8px);bottom:calc(var(--safe-bottom) + 103px);width:90px;height:90px;font-size:22px}
 #open-shop>span{font-size:22px}
 .camera-controls{left:auto;right:calc(var(--safe-right) + 12px);top:auto;bottom:calc(var(--safe-bottom) + 114px);gap:6px}
 .camera-controls button,.camera-controls #recenter{width:44px;height:44px;min-width:44px;font-size:28px;border-radius:12px;background:#123c47df;border:1px solid #a8e9dc8c}
 .camera-controls img{width:30px;height:32px}
 .dhikr-dock{left:calc(var(--safe-left) + 12px);right:calc(var(--safe-right) + 12px);bottom:var(--safe-bottom);width:auto;max-width:none;height:100px;background-position:center 4px;background-size:100% 75px}
 .dhikr-buttons{display:flex;direction:ltr;gap:0;height:76px}
 .dhikr,.dhikr:nth-child(n+4),.dhikr-3,.dhikr-4{width:auto!important;height:76px;flex:1;min-width:44px;grid-column:auto!important}
 .dhikr-orb{width:146%;height:146%}
 .dhikr small{font-size:14px;width:22px;height:22px;line-height:22px;top:0;right:0}
 .dock-note{display:inline-block;max-width:100%;font-size:12px;line-height:18px;padding:2px 8px;white-space:normal;background:#10353bd9}
 .shop{width:calc(100vw - var(--safe-left) - var(--safe-right) - 24px);height:min(650px,calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px));max-height:none;aspect-ratio:auto;top:calc(50% + (var(--safe-top) - var(--safe-bottom))/2);padding:18px 16px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:44px 64px minmax(0,1fr) 48px;grid-template-areas:'heading' 'categories' 'items' 'controls';gap:8px;border-radius:24px}
 .shop::before{background-size:100% 100%}.shop::after{background-size:100% 100%;opacity:.7}
 .shop-surface{inset:10px;border-radius:20px;box-shadow:inset 0 0 30px #efffff40;background:linear-gradient(145deg,#caeceeed,#75bfc8f5)}
 .shop .panel-heading{position:relative;grid-area:heading;display:flex;align-items:center;justify-content:space-between;gap:8px;z-index:4;min-height:0;padding:0}
 .shop .panel-heading>div{position:static;clip:auto;width:auto;height:auto;overflow:visible}
 .shop .panel-heading h1{margin:0;color:#144954;font-size:21px;line-height:1.3}
 .shop .panel-heading .eyebrow{display:none}
 .shop .crystal-close{position:static;width:44px;height:44px;min-width:44px;min-height:44px;flex-shrink:0;filter:none}
 .shop .category-tabs{grid-area:categories;position:relative;inset:auto;height:64px;width:100%;padding:0;gap:5px;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;align-items:stretch;z-index:3}
 .shop .category-tabs button{flex:1 0 46px;min-width:46px;min-height:56px;padding:3px 2px;display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:10px;gap:2px;background-size:100% 100%}
 .shop .category-tabs img{width:40px;height:34px;max-height:34px;margin:0}
 .shop .category-tabs span{position:static;clip:auto;width:auto;height:auto;overflow:visible;font:14px/20px Tahoma,sans-serif;color:#153f4e;text-shadow:0 1px #efffff}
 .shop .category-tabs button[aria-pressed=true]{transform:none;box-shadow:inset 0 0 0 2px #effff9;filter:brightness(1.1)}
 .shop .shop-list,.shop[data-page-size='4'] .shop-list{position:relative;grid-area:items;inset:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);height:auto;min-height:0;gap:8px;overflow:auto;overscroll-behavior:contain}
 .shop[data-page-size='2'] .shop-list{grid-template-rows:minmax(0,1fr)}
 .shop .shop-card,.shop[data-page-size='4'] .shop-card{min-height:0;gap:5px;padding:8px;border-radius:14px}
 .shop .shop-card>img{height:0;min-height:0;flex:1;object-fit:contain}
 .shop .shop-card h2{position:static;clip:auto;width:100%;height:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;text-align:center;color:#164653;font:14px/20px Tahoma,sans-serif;flex-shrink:0}
 .shop .shop-card button,.shop .shop-card button[data-owned]{height:44px;min-height:44px;width:100%;font-size:16px;gap:6px;padding:5px 8px}
 .shop .currency{width:20px;height:20px;font-size:20px}.shop .currency img{width:26px;height:26px}.shop .currency.gems img{width:22px;height:29px}
 .collection-badge{top:6px;right:6px;padding:3px 6px;font-size:12px}
 .shop-controls{grid-area:controls;position:relative;display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;z-index:5;direction:rtl}
 .shop-inventory{position:static;inset:auto;width:104px;min-width:104px;height:44px;min-height:44px;padding:5px 8px;font-size:14px;transform:none}
 .shop .shop-pagination{position:static;inset:auto;display:flex;align-items:center;justify-content:space-between;gap:3px;flex:1;height:44px;min-width:0;pointer-events:auto;direction:ltr}
 .shop .shop-pagination button,.shop #shop-previous,.shop #shop-next{position:static;inset:auto;width:44px;height:44px;min-height:44px;min-width:44px;padding:5px;flex-shrink:0}
 .shop #shop-page-label{position:static;inset:auto;display:block;width:auto;min-width:40px;height:32px;line-height:32px;flex:1;font-size:14px;margin:0;background:#174955d9}
 .empty-inventory{grid-column:1/-1;grid-row:1/-1;font-size:16px;line-height:1.6;padding:12px}
 .selected-panel{left:50%;bottom:calc(var(--safe-bottom) + 106px);width:calc(100vw - var(--safe-left) - var(--safe-right) - 24px);max-width:560px;max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 230px);overflow-y:auto;overscroll-behavior:contain;padding:18px 20px;background:linear-gradient(145deg,#d6f2f0f7,#8fc8d0f7);border:2px solid #defff0;border-radius:22px}
 .selected-heading{gap:10px}.selected-heading h2{font-size:22px;line-height:1.35}.selected-heading .icon-button{width:44px;height:44px;min-width:44px}
 .selected-content{gap:12px;align-items:center}.selected-image{width:100px;height:128px;max-width:36%;object-fit:contain}
 .selected-details{min-width:0;flex:1}.item-description{font-size:15px;line-height:1.6;margin:8px 0}
 .level-chips{gap:5px;margin:6px 0}.level-chips span{width:28px;height:5px}
 .selected-panel .primary{min-height:44px;padding:8px;font-size:14px;line-height:1.5;gap:6px;white-space:normal}
 .action-icon{width:26px;height:30px}.selected-actions{gap:12px;min-height:44px;margin-top:12px;padding-top:8px}
 .selected-actions button{min-height:44px;font-size:15px;gap:8px}.selected-actions img{width:30px;height:32px}
 .placement-bar{bottom:calc(var(--safe-bottom) + 8px);width:calc(100vw - var(--safe-left) - var(--safe-right) - 20px);max-width:520px;min-width:0;padding:14px 16px;gap:10px 18px;display:flex;flex-wrap:wrap;border-radius:20px;background:linear-gradient(#245f6df7,#103b48fa)}
 .placement-bar>div:first-child{flex-basis:100%;text-align:center}.placement-bar strong{font-size:20px;line-height:1.4}.placement-bar>div>span{font-size:14px;line-height:1.5}
 .placement-nudges{display:none}.placement-bar .art-confirm{min-height:44px;min-width:140px;flex-direction:row;gap:10px;margin:0 auto;padding:5px 12px}
 .art-confirm img{width:44px;height:34px}.art-confirm span{font-size:16px}
 .placement-bar .art-cancel{width:44px;height:44px;min-width:44px;margin:0 auto}
 .placing .dhikr-dock,.placing #open-shop{visibility:hidden;pointer-events:none}
 .placing .camera-controls{bottom:calc(var(--safe-bottom) + 174px)}
 dialog,#castle-dialog{width:calc(100vw - var(--safe-left) - var(--safe-right) - 24px);max-width:560px;max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 28px);padding:58px 22px 22px;border-radius:22px;overscroll-behavior:contain}
 dialog h2,#castle-dialog h2{font-size:26px;line-height:1.4;margin:0 0 18px}
 .dialog-close{left:14px;top:10px;width:44px;height:44px;min-width:44px}
 .eyebrow,.castle-heading .eyebrow{font-size:14px}.setting-row{font-size:16px;line-height:1.5;min-height:52px;padding:12px 0;gap:16px}
 .setting-row input{width:26px;height:26px}.settings-note strong{font-size:18px}.settings-note p,#progress-dialog p,#messages-dialog p{font-size:16px;line-height:1.7}.settings-note{padding-top:16px}
 dialog .primary{font-size:16px;min-height:44px}
 .castle-comparison{grid-template-columns:minmax(0,1fr) 22px minmax(0,1fr);gap:5px;margin:0 0 14px}.castle-stage{padding:8px 4px}
 .castle-stage figcaption{font-size:14px;gap:4px}.castle-stage figcaption strong{font-size:14px;padding:3px 5px}.castle-arrow{font-size:24px}
 #castle-image,#castle-next-image{height:140px}.castle-complete #castle-image{height:170px}
 #castle-content{font-size:16px;line-height:1.6;margin-bottom:12px}.castle-purchase{padding-top:12px}
 #upgrade-castle{font-size:16px;min-height:48px;gap:12px;padding:10px}.castle-cost{font-size:14px}.castle-cost b{font-size:22px}
 #castle-affordability{font-size:14px;line-height:1.6}
 #toast{top:calc(var(--safe-top) + 110px);max-width:calc(100vw - 24px);min-width:0;font-size:14px;line-height:1.5;padding:10px 14px}
}
@media(max-width:360px){
 .resource strong{font-size:18px}.shop{padding:16px 13px;gap:6px}.shop .panel-heading h1{font-size:19px}
 .shop-controls{gap:6px}.shop-inventory{width:94px;min-width:94px}.shop .shop-pagination button,.shop #shop-previous,.shop #shop-next{padding:7px}
 .selected-panel{padding:14px}.selected-image{width:80px;height:108px}.selected-heading h2{font-size:20px}
}
@media(max-width:700px) and (max-height:600px) and (orientation:landscape),(max-width:1400px) and (any-pointer:coarse) and (max-height:600px) and (orientation:landscape){
 :root{--play-top:66px;--play-bottom:86px;--dhikr-height:86px;--dhikr-button-height:64px}
 .topbar{display:flex;flex-direction:row;justify-content:space-between;gap:14px;height:48px;align-items:center;direction:ltr}
 .brand{width:190px;height:45px;flex-shrink:0}.brand strong{font-size:20px}.brand-level{font-size:17px}
 .wallet{width:min(52vw,420px);height:40px;flex-shrink:1}.resource{height:40px}
 .left-actions{top:calc(var(--safe-top) + 66px);gap:5px}.toolbar{top:calc(var(--safe-top) + 66px);gap:5px}
 #open-shop{width:76px;height:76px;bottom:calc(var(--safe-bottom) + 6px);font-size:20px}
 .camera-controls{left:calc(var(--safe-left) + 94px);right:auto;bottom:calc(var(--safe-bottom) + 20px)}
 .dhikr-dock{left:auto;right:calc(var(--safe-right) + 12px);width:min(52vw,460px,calc(100vw - var(--safe-left) - var(--safe-right) - 258px));height:86px}
 .dhikr-buttons,.dhikr,.dhikr:nth-child(n+4),.dhikr-3,.dhikr-4{height:64px}
 .dock-note{font-size:12px;line-height:16px;padding:0 8px}
 .shop{width:min(760px,calc(100vw - var(--safe-left) - var(--safe-right) - 92px));height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);padding:12px 16px;grid-template-rows:36px 54px minmax(0,1fr) 44px;gap:6px}
 .shop .panel-heading h1{font-size:20px}.shop .category-tabs{height:54px}.shop .category-tabs button{min-height:50px;flex-basis:54px;flex-direction:row;gap:5px}.shop .category-tabs img{width:32px;height:32px}
 .shop[data-page-size='4'] .shop-list{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:minmax(0,1fr)}
 .shop .shop-card,.shop[data-page-size='4'] .shop-card{padding:6px;gap:3px}.collection-badge{top:4px;right:4px;padding:2px 5px}
 .selected-panel{bottom:calc(var(--safe-bottom) + 8px);width:min(560px,calc(100vw - 160px));max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 80px);padding:12px 16px}
 .selected-image{height:90px}.selected-heading h2{font-size:20px}.selected-actions{margin-top:6px;padding-top:4px}.item-description{margin:4px 0}
 .placement-bar{left:auto;right:calc(var(--safe-right) + 10px);bottom:calc(var(--safe-bottom) + 8px);transform:none;width:min(440px,60vw);padding:10px 14px;gap:6px 12px}
 .placing .camera-controls{bottom:calc(var(--safe-bottom) + 20px)}
 #castle-image,#castle-next-image{height:95px}.castle-complete #castle-image{height:120px}
 #toast{top:calc(var(--safe-top) + 62px)}
}
