/* Reserve the entire hand and controls before sizing the board. */
main{height:100dvh;min-height:0;max-width:560px;display:flex;flex-direction:column;align-items:center;gap:5px;padding:calc(6px + env(safe-area-inset-top)) 18px calc(10px + env(safe-area-inset-bottom));overflow:visible}
main> *{flex-shrink:0}main>header{width:100%;height:40px;min-height:40px;margin:0}
.brand img{width:110px;height:40px}.game-tools{gap:6px}
.stage-bar{width:100%;height:28px;min-height:28px;margin:0;gap:8px}
#stage-select{min-height:28px;padding:3px 9px;border-radius:12px}#stage-number{font-size:13px}.wallet{min-height:28px;height:28px;padding:3px 10px;font-size:12px}
#star-targets{margin:0;width:100%;font-size:10px;line-height:1.35;min-height:0}
#missions{width:100%;min-height:34px;padding:3px 8px;margin:0;gap:6px}
.mission .gem{width:24px;height:24px}.mission b{font-size:13px}.mission small{font-size:9px}
.rule-row{width:100%;min-height:0;margin:0;font-size:10px;line-height:1.3}#stage-rule{font-size:10px;line-height:1.3}#encounter{font-size:10px}
#boss-meter{margin:0;height:5px}
.scorebar{width:100%;height:29px;min-height:29px;margin:0;align-items:center}.scorebar strong{font-size:24px}.combo-panel #combo{font-size:14px}
#board-wrap{margin:7px auto 9px;max-width:100%;touch-action:none}
#tray{width:100%;margin:0;gap:7px;height:62px;min-height:62px}.piece{height:62px;min-height:0;border-radius:17px;padding:3px}.mini{--tile:19px}#tray .mini{--tile:19px}
#assist-row{width:100%;margin:0;gap:8px;height:30px}#assist-row button{height:30px;padding:3px 12px;font-size:11px;min-height:0}
.next-row{width:100%;margin:0;gap:8px;height:44px}.next-box{height:44px;min-height:0;padding:4px 7px}#next{height:32px}#next .mini{--tile:10px}#burst{height:44px;min-height:0;width:120px}#burst small{font-size:12px}#burst .burst-symbol{font-size:25px}
.endless-mode .scorebar{height:57px;min-height:57px;margin:0}.endless-mode #score{font-size:40px!important}.endless-mode #missions{min-height:20px;height:20px;padding:0 0 3px}.endless-mode .endless-stats{font-size:10px}
main [hidden]{display:none!important}
@media(max-height:650px){main{gap:3px;padding-top:calc(4px + env(safe-area-inset-top));padding-bottom:calc(7px + env(safe-area-inset-bottom))}#tray{height:54px;min-height:54px}.piece{height:54px}#tray .mini{--tile:16px}#missions{min-height:30px}.mission .gem{width:21px;height:21px}.mission b{font-size:12px}.scorebar{height:25px;min-height:25px}#star-targets{font-size:9px}#board-wrap{margin-top:5px;margin-bottom:7px}.endless-mode .scorebar{height:50px;min-height:50px}.endless-mode #score{font-size:34px!important}}
/* Blooming keeps the scenery layer stable; only translucent edge light fades. */
#fever-rainbow{position:fixed;inset:0;z-index:0;pointer-events:none;opacity:0;transition:opacity .45s;mix-blend-mode:normal;background:radial-gradient(ellipse at 0 50%,#ffa0cd45,transparent 38%),radial-gradient(ellipse at 100% 50%,#82eed940,transparent 38%)}
.fever-active #fever-label{background:linear-gradient(100deg,#f27fbb,#9178dc,#39bcb6);color:white;border-color:#fff9;font-size:11px;font-weight:800}
.scene-paused #fever-rainbow{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){#fever-rainbow{transition:none}}

/* Long pieces must fit their tray without clipping on narrow phones. */
#tray .mini{--tile:min(19px,calc(42px / var(--shape-rows,1)),calc((100vw - 100px) / 3 / var(--shape-cols,1)))}
#next .mini{--tile:min(10px,calc(26px / var(--shape-rows,1)))}

/* Large clears avoid dozens of simultaneous SVG filter animations. */
.cell.clearing-lite{animation:clear-lite .4s ease-out forwards}
@keyframes clear-lite{to{opacity:0;transform:scale(.65)}}
