/* Fluid foundation */
.phone-shell{width:min(100vw,430px);height:min(100dvh,932px);min-height:0}.home-content{padding-left:clamp(12px,4.6vw,20px);padding-right:clamp(12px,4.6vw,20px)}.grid{width:min(88vw,370px);max-height:42dvh}.pieces{min-height:52px}.dock button{min-width:0}.dock b{white-space:nowrap}.topbar{padding-left:clamp(12px,5vw,20px);padding-right:clamp(12px,5vw,20px)}dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow:auto}

/* Narrow phones */
@media(max-width:374px){.top-gems{min-width:50px!important;padding:0 7px!important}.hero-copy{left:16px}.hero-copy h1{font-size:34px}.home-content{gap:4px}.stats-row{padding:6px 8px}.stat+ .stat{padding-left:8px}.stat strong{font-size:13px}.level-card{min-height:40px}.level-card>b{display:none}.play-button{min-height:46px;font-size:17px}.dock{gap:0}.dock span{font-size:15px}.dock b{font-size:4.5px}.game-topbar{padding-left:8px;padding-right:8px;grid-template-columns:35px 1fr 1fr auto}.game-topbar strong{font-size:17px}.header-gems{min-width:45px;padding:0 6px}.game-goal{max-width:96%;overflow:hidden;text-overflow:ellipsis}.grid{width:min(91vw,330px)}.boosters{margin-left:8px;margin-right:8px;gap:3px}.boosters button{padding:4px}.boosters button b{font-size:5px}.pieces{margin-left:10px;margin-right:10px;gap:7px}}

/* Short phones: 375 × 667 and below */
@media(max-height:700px) and (orientation:portrait){.city-art{bottom:42%}.hero-copy{top:17%}.hero-copy p{display:none}.home-content{height:66%;gap:4px}.goal-card{display:none}.social-row{display:grid}.progress-row{margin-top:1px}.stats-row{padding-top:6px;padding-bottom:6px}.level-card{min-height:39px;padding-top:4px;padding-bottom:4px}.play-button{min-height:44px}.utility-links{min-height:15px}.dock span{line-height:17px}.grid{width:min(68dvh,86vw,320px)}.game-goal{margin:2px auto 5px}.level-progress{margin-bottom:4px}.pieces{height:55px;margin-top:4px;margin-bottom:3px}.boosters{margin-bottom:2px}.energy-track{height:7px}}
@media(max-height:610px) and (orientation:portrait){.hero-copy{top:14%}.social-row,.stats-row{display:none}.home-content{height:63%}.level-card{margin-top:auto}.grid{width:min(63dvh,82vw,285px)}.placement-help{display:none}.pieces{height:48px}.boosters button small{display:none}.boosters{height:37px}.energy{margin-top:0}.pregame-goals{margin-top:18px}.pregame-content h2{font-size:38px}}

/* Tall phones */
@media(min-height:860px) and (orientation:portrait){.home-content{height:55%;gap:9px}.hero-copy{top:25%}.grid{max-width:380px}.pieces{height:112px}.game-goal{margin-bottom:13px}}

/* Landscape gameplay uses two columns */
@media(orientation:landscape) and (max-height:600px){body{overflow:hidden}.phone-shell{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0}.home-screen .city-art{inset:0 45% 0 0}.home-screen .ambient-shade{background:linear-gradient(90deg,#07152c22 25%,#09152dcc 56%,#081329 100%)}.hero-copy{top:29%;left:5%}.home-content{left:46%;height:100%;padding-top:max(12px,env(safe-area-inset-top));justify-content:center}.home-content .goal-card{display:none}.topbar{width:46%}.home-screen .brand{display:none}.dock{margin-top:2px}.game-topbar{position:absolute;left:0;top:0;width:56%;z-index:2}.level-progress{position:absolute;left:5%;top:60px;width:45%;margin:0}.mode-chip{left:5%;right:auto;top:76px}.game-goal{position:absolute;left:4%;top:88px;margin:0}.grid{position:absolute;left:4%;top:108px;width:min(67dvh,46vw);max-height:none;margin:0}.placement-help{display:none}.pieces{position:absolute;right:3%;top:62px;width:38%;height:31%;margin:0}.boosters{position:absolute;right:3%;top:52%;width:38%;margin:0}.energy{position:absolute;right:3%;top:72%;width:38%;margin:0}.pregame-content{padding:15px}.pregame-goals{width:54%;margin-top:15px}.pregame-brand{top:5%}}

/* Desktop framing */
@media(min-width:700px) and (min-height:700px){body{padding:20px}.phone-shell{border-radius:36px;border:7px solid #1b2941;box-shadow:0 35px 100px #020817dd,0 0 0 1px #ffffff10}.phone-shell::after{content:"";position:absolute;z-index:20;bottom:7px;left:50%;translate:-50% 0;width:110px;height:4px;border-radius:5px;background:#ffffff35;pointer-events:none}.dock button:hover,.leaderboard-button:hover,.level-card:hover{color:#fff;filter:brightness(1.15)}}

/* Touch accessibility */
@media(pointer:coarse){button{touch-action:manipulation}.dock button{min-height:36px}.cell.valid-anchor{cursor:pointer}.setting-row,.setting-link{min-height:46px}}
