.home-mode>.hud,.home-mode>.progress-hud,.home-mode>.prep-screen,.home-mode>.battle-bottom,.home-mode>#speed,.home-mode>#arena{display:none}
.home-screen{position:absolute;inset:0;z-index:12;display:flex;flex-direction:column;align-items:stretch;padding:max(3.6dvh,env(safe-area-inset-top)) 4.5% 0;overflow:hidden;container-type:size;background:radial-gradient(ellipse at 50% 47%,#45aafa80,transparent 55%),linear-gradient(155deg,#6440e9 0%,#3856e6 35%,#168bf0 76%,#28a7ec 100%)}
.home-screen:before{content:"";position:absolute;z-index:-1;inset:-15%;background:url('../assets/mark.svg') 0 0/82px 82px;opacity:.055;transform:rotate(-15deg);pointer-events:none}
.home-top{display:grid;grid-template-columns:50px 1fr 1fr 42px;gap:9px;align-items:center;flex-shrink:0;height:52px;z-index:1}
.home-top button{padding:0;border:3px solid #26243e;border-radius:13px;background:#3ab78e;box-shadow:inset 0 2px #b3f6c8,0 3px #25223d70}
.home-avatar{position:relative;width:50px;height:52px}.home-avatar>[data-menu-icon]{display:block;height:100%;overflow:hidden;border-radius:9px}
.home-level{position:absolute;bottom:-7px;right:-7px;min-width:22px;height:22px;display:grid;place-items:center;background:#ffce52;border:2px solid #382d3f;border-radius:8px;color:#45302d;font-size:11px;text-shadow:0 1px #fff7}
.home-resource{position:relative;min-width:0;height:36px;background:#282e70;border:2px solid #363065;border-radius:20px;display:flex;align-items:center;justify-content:center;gap:5px;padding:2px 8px 2px 4px;box-shadow:inset 0 2px #737bd24d,0 2px #25223d50}
.home-resource strong{font-size:clamp(14px,4cqw,22px);white-space:nowrap;text-shadow:0 2px #1c1d48}.home-resource small{position:absolute;bottom:-15px;left:0;right:0;text-align:center;color:#c0d9ff;font-weight:900;letter-spacing:1px;font-size:7px}
.home-resource #home-coin,.home-resource>[data-menu-icon]{display:block;width:26px;height:26px;flex-shrink:0}.home-resource .ui-icon{width:26px;height:26px}
.home-top .home-settings{width:42px;height:42px;background:#ffce53;box-shadow:inset 0 2px #fff2a6,inset 0 -3px #c4872c,0 3px #25223d70;padding:3px}
.home-settings>[data-menu-icon]{display:block;width:100%;height:100%}
.menu-art{display:inline-flex;align-items:center;justify-content:center;container-type:size;width:100%;height:100%;pointer-events:none;vertical-align:middle;flex-shrink:0}
.menu-sprite{display:block;flex-shrink:0;width:min(100cqw,calc(100cqh * var(--menu-ratio)));aspect-ratio:var(--menu-ratio);background-image:url('../assets/menu/menu-icons-v1-61771bdc268f.webp');background-repeat:no-repeat}
.home-brand{text-align:center;flex-shrink:0;margin:17px 0 3px;line-height:1}.home-brand>p{margin:0 0 7px;font-size:7px;font-weight:900;letter-spacing:2px;color:#d8d5ff}
.home-brand h1{font-size:clamp(37px,12.7cqw,64px);letter-spacing:1.5px;margin:0;font-weight:1000;color:#fff4cb;-webkit-text-stroke:2.5px #292344;paint-order:stroke fill;text-shadow:0 4px #292344,0 7px #20215550;transform:rotate(-2deg)}
.home-brand h1 span{color:#ffce46}.home-brand>span{display:block;margin-top:8px;font-size:8px;font-weight:900;letter-spacing:2.6px;color:#c8eaff}
.home-chapter{display:flex;flex-direction:column;flex:1;min-height:0;position:relative;margin-top:12px}
.home-chapter-heading{text-align:center;flex-shrink:0;z-index:2}.home-chapter-tag{font-size:7px;font-weight:900;letter-spacing:1.5px;color:#e6d7ff;background:#29245f66;border:1px solid #a398e355;border-radius:12px;padding:4px 12px;display:inline-block}
.home-chapter-heading h2{font-size:clamp(20px,6.5cqw,34px);margin:7px 0 5px;line-height:1.05;-webkit-text-stroke:1.8px #25213e;text-shadow:0 2px #25213e;letter-spacing:0}
.home-chapter-heading p{font-size:10px;font-weight:900;margin:0;color:#d8edff;text-shadow:0 1px #24499c}.home-chapter-heading p span{font-size:7px;margin:0 8px;color:#ffdb72}
.home-scene{position:relative;flex:1;min-height:0;margin-top:0}
.home-halo{position:absolute;inset:10% 7% 2%;background:radial-gradient(ellipse,#86fff53b,transparent 68%);filter:blur(9px);border-radius:50%;pointer-events:none}
.home-island{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 10px 0 #18245b26);pointer-events:none}

.home-shortcut{position:absolute;top:13%;width:48px;height:60px;padding:3px 3px 15px;background:linear-gradient(#7656cfaa,#304ca466);border:2px solid #33357580;border-radius:12px;box-shadow:inset 0 2px #b9c0ff33,0 3px #28256a33;color:white;text-shadow:0 2px #25213e}
.home-shortcut>[data-menu-icon]{display:block;height:100%;width:100%;filter:drop-shadow(0 2px #2224)}.home-shortcut small{position:absolute;bottom:4px;left:0;right:0;font-size:8px;font-weight:900}.home-help{left:-1%}.home-skills{right:-1%}
.home-wave-ribbon{flex-shrink:0;align-self:center;display:flex;align-items:center;justify-content:center;gap:9px;background:linear-gradient(#f7d679,#e5af45);border:2px solid #4e3b43;border-radius:9px;box-shadow:inset 0 2px #ffedb8,0 3px #23377866;padding:5px 13px;transform:rotate(-2deg);z-index:2;margin-top:-5px;min-width:54%}
.home-wave-ribbon>span{font-size:7px;font-weight:1000;letter-spacing:.5px;color:#6e4834}.home-wave-ribbon strong{font-size:17px;font-weight:1000;color:#fff8d5;-webkit-text-stroke:1px #493341;paint-order:stroke fill;text-shadow:0 1px #493341}
.home-complete{position:absolute;left:50%;top:62%;transform:translate(-50%,-50%) rotate(-12deg);background:#df385e;border:4px solid #42273b;box-shadow:inset 0 0 0 3px #ff7790,0 4px #261b3d55;border-radius:12px;padding:9px 14px;font-size:25px;white-space:nowrap;z-index:3}
.home-milestones{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));flex-shrink:0;position:relative;gap:18px;padding:0 6%;margin:14px 0 0;height:86px}
.home-trail{position:absolute;left:18%;right:18%;top:25px;height:5px;border-radius:4px;background:#b4c9ff44;overflow:hidden}.home-trail>div{height:100%;background:#a4f5bd;border-radius:4px;transition:width .3s}
.home-milestone{position:relative;display:flex;flex-direction:column;align-items:center;min-width:0;border:0;background:none;padding:0;text-shadow:0 2px #25305e}
.home-milestone>[data-menu-icon]{display:block;width:57px;height:48px;filter:drop-shadow(0 3px #18265d44);transition:transform .15s}.home-milestone strong{font-size:12px;font-weight:1000;white-space:nowrap}.home-milestone small{font-size:8px;color:#bfdcff;font-weight:900;white-space:nowrap;margin-top:3px}.home-milestone.completed small{color:#bbffc9}.home-milestone.completed>[data-menu-icon]{filter:drop-shadow(0 0 6px #caff96a0)}.home-milestone.upcoming:before{content:"";position:absolute;top:-2px;width:60px;height:53px;background:#e2e99925;border:1px solid #f7eacb55;border-radius:12px}
.home-launch{display:flex;flex-direction:column;align-items:center;justify-content:center;flex-shrink:0;margin:3px 0 17px;gap:5px}
.home-launch>p{font-size:9px;font-weight:900;color:#d0e9ff;margin:0 0 3px;text-align:center;line-height:1.3}.home-launch>small{font-size:8px;color:#cbecff;font-weight:bold;margin-top:2px}
.home-launch .home-play{display:flex;align-items:center;justify-content:center;gap:11px;width:74%;min-height:64px;padding:6px 12px;border:3px solid #252239;border-radius:18px;background:linear-gradient(#3bf060,#20c846);box-shadow:inset 0 4px #a5ffae,inset 0 -5px #15922f,0 5px #1c397475;color:#fffdf2}
.home-play>[data-menu-icon]{display:block;width:38px;height:40px;filter:drop-shadow(0 2px #1e6f3e55)}.home-play>strong{font-size:clamp(22px,7cqw,36px);-webkit-text-stroke:1.5px #253127;paint-order:stroke fill;text-shadow:0 2px #253127;line-height:1;white-space:nowrap}
.home-nav{display:grid;grid-template-columns:repeat(3,1fr);height:70px;flex-shrink:0;position:relative;margin:0 -5% 0;padding:0 4% max(5px,env(safe-area-inset-bottom));background:#242946;border-top:3px solid #171c32;box-shadow:0 -3px #1a2c6a44}
.home-nav button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;border:0;background:transparent;border-radius:12px 12px 0 0;padding:3px 6px;color:#d9e8ff;text-shadow:0 2px #121a32}.home-nav button>[data-menu-icon]{display:block;height:37px;width:46px;filter:drop-shadow(0 2px #0005)}.home-nav button>strong{font-size:10px;letter-spacing:.3px}.home-nav .active{background:linear-gradient(#5066c8,#344b9a);border:2px solid #1b2545;margin-top:-10px;color:#fff3a9;padding-top:5px;box-shadow:inset 0 3px #8ca2f17a}.home-nav .active>[data-menu-icon]{width:51px;height:44px}
.home-profile-art{height:95px;width:95px;margin:0 auto 15px;background:linear-gradient(#6c53a8,#394989);border:3px solid #392e49;border-radius:18px;padding:5px;box-shadow:inset 0 2px #ccb6eb66}
.home-stat-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin:12px 0}.home-stat-grid>div{background:#dfbb8c;border:2px solid #865d41;border-radius:10px;padding:10px 6px;text-align:center}.home-stat-grid strong{display:block;font-size:22px;color:#54392e}.home-stat-grid small{font-size:9px;font-weight:bold;color:#795137}.home-stat-grid .currency{font-size:20px}
.arsenal-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:12px -6px}.arsenal-card{display:flex;flex-direction:column;align-items:center;background:#e1be8e;border:2px solid #77503c;border-radius:12px;padding:9px 7px;text-align:center;color:#51382f}.arsenal-card>.weapon-art{width:76px;height:90px}.arsenal-card h3{font-size:12px;margin:7px 0 5px}.arsenal-card p{font-size:9px;margin:0;line-height:1.4}.arsenal-card small{font-size:9px;color:#76523a;font-weight:bold;margin-top:5px}.home-modal-icon{display:block;width:88px;height:78px;margin:0 auto 12px}
@media(max-height:730px){.home-screen{padding-top:max(2.8dvh,env(safe-area-inset-top))}.home-top{height:43px;grid-template-columns:43px 1fr 1fr 36px;gap:7px}.home-avatar{width:43px;height:44px}.home-top .home-settings{width:36px;height:36px}.home-resource{height:32px}.home-resource strong{font-size:14px}.home-resource #home-coin,.home-resource>[data-menu-icon],.home-resource .ui-icon{width:23px;height:23px}.home-resource small{font-size:6px;bottom:-12px}.home-brand{margin-top:14px}.home-brand>p{font-size:6px;margin-bottom:5px}.home-brand h1{font-size:39px}.home-brand>span{font-size:6px;margin-top:6px}.home-chapter{margin-top:8px}.home-chapter-heading h2{font-size:22px;margin:5px 0 4px}.home-chapter-heading p{font-size:8px}.home-chapter-tag{font-size:6px;padding:3px 10px}.home-shortcut{width:41px;height:52px}.home-shortcut small{font-size:7px}.home-wave-ribbon{padding:3px 10px;min-width:57%}.home-wave-ribbon strong{font-size:14px}.home-wave-ribbon>span{font-size:6px}.home-milestones{height:70px;margin-top:10px;gap:10px}.home-milestone>[data-menu-icon]{width:46px;height:40px}.home-milestone strong{font-size:10px}.home-milestone small{font-size:7px}.home-milestone.upcoming:before{height:44px;width:50px}.home-trail{top:21px}.home-launch{margin:2px 0 12px;gap:3px}.home-launch>p{font-size:8px;margin-bottom:2px}.home-launch>small{font-size:7px}.home-launch .home-play{min-height:53px;border-radius:15px}.home-play>strong{font-size:clamp(20px,7cqw,25px)}.home-play>[data-menu-icon]{width:29px;height:32px}.home-nav{height:61px}.home-nav button>[data-menu-icon]{height:31px;width:38px}.home-nav button>strong{font-size:9px}.home-nav .active>[data-menu-icon]{height:38px;width:45px}.home-complete{font-size:19px}}
.location-switch{display:flex;align-items:center;justify-content:center;gap:14px;height:30px}
.location-switch button{display:grid;place-items:center;width:32px;height:30px;padding:0 0 3px;border:2px solid #34315f;border-radius:10px;background:linear-gradient(#b6eeff,#72bce9);box-shadow:inset 0 2px #e2f7ff,0 2px #25223d70;color:#31365e;font-size:30px;line-height:1}
.location-switch button:disabled{opacity:.3;box-shadow:none;cursor:default}
.home-screen[data-location="swamp"]{background:radial-gradient(ellipse at 50% 47%,#58c6ac70,transparent 55%),linear-gradient(155deg,#3f316e 0%,#365d76 35%,#257d7c 76%,#439e88 100%)}
.home-screen[data-location="swamp"] .home-halo{background:radial-gradient(ellipse,#b1f8ad44,transparent 68%)}
.home-screen[data-location="citadel"]{background:radial-gradient(ellipse at 50% 47%,#8bdcf855,transparent 57%),linear-gradient(155deg,#283b79 0%,#4261a2 38%,#447faa 76%,#72adc9 100%)}
.home-screen[data-location="citadel"] .home-halo{background:radial-gradient(ellipse,#b2e9ff60,transparent 68%)}
.chill-status{position:absolute;z-index:9;top:22%;left:50%;transform:translateX(-50%);padding:5px 10px;border:2px solid #6088ac;border-radius:10px;background:#d9f5ffed;color:#31587b;font-size:clamp(8px,2.2cqw,12px);font-weight:900;white-space:nowrap;box-shadow:0 2px #3c668333;pointer-events:none}

/* Persistent star coins and first-clear chests share one reward visual language. */
.home-top{grid-template-columns:46px minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 38px;gap:6px}
.home-avatar{width:46px;height:48px}.home-top .home-settings{width:38px;height:40px}
.home-resource{gap:3px;padding:2px 5px 2px 2px}.home-resource strong{font-size:clamp(11px,3.2cqw,18px)}
.home-resource #home-coin,.home-resource>[data-menu-icon],.home-resource .ui-icon{width:23px;height:23px}
.star-coin{display:block;width:29px;height:29px;object-fit:contain;flex-shrink:0;pointer-events:none}
.home-top .home-star-resource{border:2px solid #333063;border-radius:20px;padding:2px 5px 2px 2px;background:linear-gradient(#5b438f,#3b3575);height:36px;box-shadow:inset 0 2px #c2b5f63b,0 2px #25223d50;gap:3px}
.home-star-resource small{color:#cdf6ff}.home-star-resource .star-coin{width:26px;height:26px;filter:drop-shadow(0 1px #151733)}
.home-milestone.chest-ready small{color:#d0ff9c;font-weight:1000}
.home-milestone.chest-ready>[data-menu-icon]{filter:drop-shadow(0 0 8px #b7ff9c);animation:chest-ready 2.5s ease-in-out infinite}
.home-milestone.chest-ready:after{content:'!';position:absolute;right:12%;top:-2px;display:grid;place-items:center;width:18px;height:18px;border:2px solid #292944;border-radius:50%;background:#f8cc50;font-size:11px;text-shadow:0 1px #876136;color:white}
.home-milestone.chest-claimed>[data-menu-icon]{filter:drop-shadow(0 2px #18265d44);opacity:.7}.home-milestone.chest-claimed small{color:#bce4d6}
.home-milestone.chest-locked>[data-menu-icon]{filter:saturate(.4) brightness(.85) drop-shadow(0 2px #18265d44)}
.star-amount{display:inline-flex;align-items:center;justify-content:center;gap:7px;white-space:nowrap}.star-amount .star-coin{width:36px;height:36px}.star-amount strong{font-size:28px;line-height:1}
.chest-prize{display:flex;justify-content:center;margin:15px 0;color:#eefcff;text-shadow:0 2px #393157}
.chest-prize .star-amount{background:linear-gradient(#6d539f,#4a3e7c);padding:8px 24px 8px 16px;border:2px solid #333657;border-radius:14px;box-shadow:inset 0 2px #dacbff44}
.reward-note{font-size:11px!important;line-height:1.45;color:#765b50!important}
.reward-chest-glow{filter:drop-shadow(0 0 12px #ffdc83)}
.reward-reveal{display:flex;justify-content:center;margin:4px 0 16px}.reward-reveal .star-coin{width:112px;height:112px;filter:drop-shadow(0 0 16px #a6eaff);animation:coin-reveal .5s ease-out}
.wallet-heading{display:flex;align-items:center;justify-content:center;gap:7px;margin-bottom:12px}.wallet-heading h2{margin:0!important;font-size:25px!important}.wallet-heading>.star-coin{width:43px;height:43px}
.wallet-balance{margin:12px auto 16px;display:flex;justify-content:center;color:#44396f}.wallet-balance .star-amount strong{font-size:40px}.wallet-balance .star-coin{width:48px;height:48px}
.wallet-rewards{display:flex;flex-direction:column;gap:7px;margin:15px 0}.wallet-rewards>div{display:flex;align-items:center;justify-content:space-between;gap:8px;background:#dec398;border:1px solid #aa805c;border-radius:9px;padding:8px;color:#594132;font-size:12px}.wallet-rewards strong{white-space:nowrap;color:#4d3f78}
.act-reward{display:flex;flex-direction:column;align-items:center;gap:8px;margin:15px 0;padding:13px 8px;background:#5e4e91;border:2px solid #343258;border-radius:14px;color:#fff}.act-reward small{font-size:10px;color:#d4efff;text-align:center}
@keyframes chest-ready{0%,65%,100%{transform:translateY(0)}75%{transform:translateY(-3px)}85%{transform:translateY(0)}92%{transform:translateY(-2px)}}
@keyframes coin-reveal{from{transform:scale(.65) rotate(-18deg);opacity:0}to{transform:scale(1) rotate(0);opacity:1}}
@media(max-height:730px){.home-top{grid-template-columns:39px minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 33px;gap:5px}.home-avatar{width:39px;height:42px}.home-top .home-settings{width:33px;height:35px}.home-top .home-star-resource{height:32px}.home-resource #home-coin,.home-resource>[data-menu-icon],.home-resource .ui-icon{width:21px;height:21px}.home-star-resource .star-coin{width:23px;height:23px}.home-milestone.chest-ready:after{width:16px;height:16px;font-size:10px}}
@media(prefers-reduced-motion:reduce){.home-milestone.chest-ready>[data-menu-icon],.reward-reveal .star-coin{animation:none}}
/* Native dialogs enter the top layer, so size them against the game viewport. */
#modal{width:min(90vw,50.625dvh,558px);max-height:85dvh;overflow-x:hidden}
#modal-content{min-width:0;overflow-wrap:anywhere}
@media(max-height:480px){#modal{padding:14px}#modal h2{font-size:23px}.wallet-heading{flex-wrap:wrap}}
@media(max-height:480px){
 .home-top{grid-template-columns:29px minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 25px;height:34px;gap:3px}
 .home-avatar{width:29px;height:32px}.home-level{min-width:17px;height:17px;font-size:9px;bottom:-4px;right:-4px}
 .home-top .home-settings{width:25px;height:27px;padding:2px}
 .home-resource,.home-top .home-star-resource{height:26px;padding:2px;gap:2px}
 .home-resource strong{font-size:9px}.home-resource small{font-size:5px;bottom:-9px}
 .home-resource #home-coin,.home-resource>[data-menu-icon],.home-resource .ui-icon{width:14px;height:14px}
 .home-star-resource .star-coin{width:16px;height:16px}
}

.home-screen[data-location="forge"]{background:radial-gradient(ellipse at 50% 47%,#f6a05a55,transparent 57%),linear-gradient(155deg,#3a284e,#68465e 38%,#a36254 76%,#c78a61)}.home-screen[data-location="forge"] .home-halo{background:radial-gradient(ellipse,#ffbe6d66,transparent 68%)}.chill-status.burn-status{color:#ffdf9c;background:#653627e6;border-color:#ce8249}

.home-screen[data-location="reef"]{background:linear-gradient(155deg,#273f64,#3b8c9b 60%,#78c5b1)}.home-screen[data-location="crypt"]{background:linear-gradient(155deg,#604b68,#ac8053 65%,#dfb86f)}.home-screen[data-location="storm"]{background:linear-gradient(155deg,#292345,#5c548e 60%,#8c8db1)}.home-screen[data-location="rift"]{background:radial-gradient(ellipse at 50% 45%,#a042b466,transparent 65%),linear-gradient(155deg,#22172f,#48366b 65%,#965aa2)}
