.loading-screen{place-items:center;padding:20px}.loading-shell{width:min(94vw,700px)}.loading-shell .hub-modal-inner{min-height:280px}.loading-brand{width:92px;height:92px;margin-bottom:10px}.loading-brand img{width:100%;height:100%;object-fit:contain}.loading-shell .hub-modal-text{margin-bottom:24px}
.menu-screen{place-items:center;padding:calc(18px + var(--safe-top)) 14px calc(18px + var(--safe-bottom))}.menu-shell{width:min(94vw,560px);display:flex;flex-direction:column;align-items:center;gap:18px}.menu-toolbar{width:100%;display:grid;grid-template-columns:64px 1fr 64px;align-items:center;gap:12px}.menu-toolbar .hub-button{justify-self:center}.menu-best{justify-self:center;min-width:150px;padding:8px 20px;text-align:center}.menu-best small{display:block;color:#805e42;font-size:15px;line-height:1}.menu-best strong{display:block;margin-top:3px;color:#2b78b7;font-size:29px;line-height:1;text-shadow:0 2px 0 #b6d7df}.menu-panel{width:100%;padding:12px}.menu-panel-inner{min-height:420px;padding:34px 26px;display:flex;flex-direction:column;align-items:center;justify-content:center}.menu-items{position:relative;width:210px;height:110px;margin-bottom:10px}.menu-items img{position:absolute;width:92px;height:92px;object-fit:contain;filter:drop-shadow(0 7px 4px rgba(0,0,0,.2))}.menu-items .coin{left:0;bottom:0;transform:rotate(-11deg)}.menu-items .cash{left:60px;top:0;z-index:2}.menu-items .diamond{right:0;bottom:2px;transform:rotate(10deg)}.game-logo{text-align:center;margin-bottom:22px}.game-logo span,.game-logo b{display:block;line-height:.83}.game-logo span{font-size:clamp(48px,13vw,72px);color:#fff;text-shadow:0 5px 0 #1877c8,0 10px 10px rgba(0,0,0,.16)}.game-logo b{margin-top:11px;color:#ffd34f;font-size:clamp(31px,9vw,50px);text-shadow:0 4px 0 #a56b0c}.game-logo small{display:block;margin-top:13px;color:#805e42;font-size:15px;letter-spacing:.12em}.menu-copy{margin:22px 0 0;color:#805e42;font-size:18px;text-align:center;line-height:1.2}.menu-footer{color:rgba(255,255,255,.62);font-size:13px;letter-spacing:.12em;text-shadow:0 2px 2px rgba(0,0,0,.25)}
.game-screen{padding:calc(10px + var(--safe-top)) 10px calc(10px + var(--safe-bottom))}.portrait-game-shell{position:relative;width:min(100%,580px);height:100%;margin:auto;display:grid;grid-template-rows:auto 1fr auto;gap:8px;align-items:center}.match-hud{position:relative;width:calc(100% - var(--hud-pause-reserve));min-height:110px;margin:4px var(--hud-pause-reserve) 0 0;justify-self:start;padding:10px 12px;display:grid;grid-template-columns:minmax(0,1.55fr) minmax(90px,.82fr) minmax(78px,.66fr);gap:10px;align-items:stretch}.hud-island{position:relative;min-width:0;min-height:88px}.goals-wing{padding:20px 10px 8px}.money-center{padding:20px 8px 7px;text-align:center}.moves-wing{padding:20px 8px 7px;text-align:center}.goal-items{height:100%;display:grid;grid-template-columns:repeat(3,1fr);gap:3px;align-items:center}.goal-item{display:flex;min-width:0;flex-direction:column;align-items:center;justify-content:center;gap:0}.goal-icon{width:42px;height:42px;display:grid;place-items:center}.goal-icon img,.goal-icon .asset-item{width:100%;height:100%;object-fit:contain}.goal-item>b{color:#805e42;font-size:20px;line-height:1;text-shadow:0 2px 0 rgba(255,255,255,.75)}.money-center #score-value{display:block;color:#fff;font-size:33px;line-height:1;text-shadow:0 3px 0 #0b4684}.money-center small{display:block;margin-top:2px;color:#fff;font-size:10px;line-height:1;text-shadow:0 2px 0 #0b4684}.money-visual{display:none}.moves-wing #moves-value{display:block;color:#a65d22;font-size:48px;line-height:1;text-shadow:0 3px 0 #fff,0 5px 0 rgba(119,69,23,.22)}.hud-pause{position:absolute!important;right:calc(0px - var(--hud-pause-reserve));top:50%;bottom:auto;transform:translateY(-50%);width:var(--hud-pause-size)!important;height:var(--hud-pause-size)!important;flex-basis:var(--hud-pause-size)!important}.hud-pause:hover{transform:translateY(calc(-50% - 2px))}.hud-pause:active{transform:translateY(calc(-50% + 2px)) scale(.98)}.hud-pause .hub-button-icon-image{width:50px;height:50px;flex-basis:50px}
.board-stage{position:relative;align-self:center;justify-self:center;display:grid;place-items:center;min-height:0}.portrait-combo{position:absolute;z-index:12;top:-10px;left:50%;transform:translate(-50%,-100%);min-width:92px;padding:5px 13px;border-radius:16px;background:rgba(17,48,80,.82);border:2px solid rgba(255,218,128,.5);text-align:center;opacity:0;transition:.2s ease}.portrait-combo.visible{opacity:1}.portrait-combo span{display:block;color:#fff;font-size:9px}.portrait-combo b{display:block;color:#ffd451;font-size:23px;line-height:.9}.portrait-toast{position:absolute;bottom:-22px;left:50%;transform:translateX(-50%);color:rgba(255,255,255,.65);font-size:11px;white-space:nowrap;text-shadow:0 2px 2px rgba(0,0,0,.3)}
.powerup-area{position:relative;width:min(100%,500px);justify-self:center;padding:0}.powerup-dock{width:100%;min-height:78px;padding:10px 12px;display:flex;align-items:center;justify-content:space-evenly;gap:7px}.powerup-button{position:relative;width:58px;aspect-ratio:1;border:1px solid transparent;border-radius:20px;border-image-source:var(--ui-cream);border-image-slice:128 fill;border-image-width:19px;border-image-repeat:stretch;background:var(--ui-cream-center) center/100% 100% no-repeat;padding:4px;display:grid;place-items:center;appearance:none;filter:drop-shadow(0 3px 0 rgba(108,73,35,.2));transition:transform .12s ease,filter .12s ease}.powerup-button:hover{transform:translateY(-2px)}.powerup-button:active,.powerup-button.active{transform:translateY(2px) scale(.96)}.powerup-icon{width:48px;height:48px;display:grid;place-items:center}.powerup-icon img{width:100%;height:100%;object-fit:contain}.powerup-button>b{position:absolute;right:-5px;bottom:-5px;min-width:26px;height:26px;padding:0 6px;border-radius:99px;background:linear-gradient(180deg,#ffe27a,#e59a1d);border:2px solid #fff0c4;color:#fff;font-size:16px;line-height:22px;text-align:center;text-shadow:0 2px 0 #9d6511;box-shadow:0 3px 0 #9d6511}
.stats-grid{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:22px}.stat-card{padding:16px 12px;text-align:center}.stat-card.hero{grid-column:1/-1}.stat-card span{display:block;color:#805e42;font-size:16px}.stat-card b{display:block;margin-top:3px;color:#2b78b7;font-size:31px;text-shadow:0 2px 0 #b6d7df}.modal-hero-icon{width:84px;height:84px;margin-bottom:7px}.modal-hero-icon img{width:100%;height:100%;object-fit:contain}.result-score{margin-top:20px;text-align:center}.result-score small{display:block;color:#805e42;font-size:16px}.result-score b{display:block;color:#2b78b7;font-size:40px;text-shadow:0 3px 0 #b6d7df}.result-details{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}.result-details>div{padding:12px;border-radius:16px;background:rgba(255,244,214,.7);text-align:center}.result-details span{display:block;color:#805e42;font-size:13px}.result-details b{display:block;color:#2b78b7;font-size:25px}.settings-modal-inner{justify-content:flex-start;min-height:520px;padding-top:58px}.settings-title{margin-bottom:24px}.settings-actions{margin-top:22px}.pause-actions{display:flex;flex-direction:column;align-items:center;gap:12px;width:100%;margin-top:25px}.pause-actions .hub-button{max-width:100%}
@media(max-width:430px){.portrait-game-shell{width:100%;--hud-pause-size:52px;--hud-pause-gap:6px;--hud-pause-bottom-padding:5px}.match-hud{width:calc(100% - var(--hud-pause-reserve));margin-right:var(--hud-pause-reserve);min-height:98px;padding:8px 9px;grid-template-columns:minmax(0,1.5fr) minmax(82px,.8fr) minmax(70px,.62fr);gap:7px}.hud-island{min-height:80px}.goals-wing{padding:18px 6px 6px}.money-center,.moves-wing{padding:18px 5px 5px}.hub-chip{top:-12px;min-width:74px;height:32px;padding:0 14px;font-size:17px}.goal-icon{width:36px;height:36px}.goal-item>b{font-size:18px}.money-center #score-value{font-size:28px}.money-center small{font-size:8px}.moves-wing #moves-value{font-size:42px}.hud-pause{right:calc(0px - var(--hud-pause-reserve));top:50%;bottom:auto;transform:translateY(-50%);width:var(--hud-pause-size)!important;height:var(--hud-pause-size)!important;flex-basis:var(--hud-pause-size)!important}.hud-pause .hub-button-icon-image{width:45px;height:45px;flex-basis:45px}.powerup-area{padding:0}.powerup-dock{min-height:70px;padding:8px 9px;gap:4px}.powerup-button{width:50px;border-radius:17px}.powerup-icon{width:43px;height:43px}.powerup-button>b{right:-5px;bottom:-5px;min-width:23px;height:23px;font-size:14px;line-height:19px}.menu-panel-inner{min-height:390px;padding:28px 20px}.menu-copy{font-size:16px}}
@media(max-height:690px) and (orientation:portrait){.game-screen{padding-top:6px;padding-bottom:6px}.portrait-game-shell{gap:4px}.match-hud{min-height:90px;margin-top:1px}.hud-island{min-height:72px}.goal-icon{width:32px;height:32px}.goal-item>b{font-size:16px}.money-center #score-value{font-size:25px}.moves-wing #moves-value{font-size:37px}.powerup-dock{min-height:62px}.powerup-button{width:45px}.powerup-icon{width:39px;height:39px}.portrait-toast{display:none}}
@media(orientation:landscape) and (max-height:520px){.game-screen{padding:6px}.portrait-game-shell{width:min(96vw,860px);grid-template-columns:190px 1fr 190px;grid-template-rows:1fr;gap:14px}.match-hud{width:100%;min-height:0;height:92%;margin:0;grid-column:1;grid-row:1;display:flex;flex-direction:column;padding:10px;gap:10px}.hud-island{flex:1;min-height:0}.hud-pause{right:auto;left:50%;top:auto;bottom:-2px;transform:translate(-50%,100%)}.hud-pause:hover{transform:translate(-50%,calc(100% - 2px))}.hud-pause:active{transform:translate(-50%,calc(100% + 2px)) scale(.98)}.board-stage{grid-column:2;grid-row:1}.powerup-area{grid-column:3;grid-row:1;width:100%;height:92%;padding:0}.powerup-dock{height:100%;min-height:0;flex-direction:column}.powerup-button{width:min(10vh,54px)}}
.ui-hidden{display:none!important}
.portrait-combo.active{opacity:1}
.goal-item.complete{opacity:.42;filter:saturate(.5)}
.moves-wing.danger{animation:movesDanger .75s ease-in-out infinite alternate}
@keyframes movesDanger{to{filter:brightness(1.08) saturate(1.16)}}
.money-center.money-pop{animation:moneyPop .28s ease}
@keyframes moneyPop{50%{transform:translateY(-2px) scale(1.025)}}
.powerup-button.disabled{opacity:.42;filter:grayscale(.5);pointer-events:none}
.portrait-combo.blast{animation:comboBlast .62s cubic-bezier(.18,1.25,.3,1)}
.portrait-combo.tone-gold b{color:#ffd451}.portrait-combo.tone-mint b{color:#91ffc3}.portrait-combo.tone-epic b{color:#d4a6ff}.portrait-combo.tone-legendary b{color:#fff19b}
@keyframes comboBlast{0%{transform:translate(-50%,-100%) scale(.72);opacity:0}28%{transform:translate(-50%,-100%) scale(1.16);opacity:1}100%{transform:translate(-50%,-100%) scale(1)}}

/* Compact modal sizing */
#pause-modal .hub-modal{width:min(88vw,410px)}
#result-modal .hub-modal{width:min(90vw,450px)}
#scores-modal .hub-modal{width:min(90vw,460px)}
#settings-modal .hub-modal{width:min(92vw,500px)}

#pause-modal .hub-modal-inner,
#result-modal .hub-modal-inner,
#scores-modal .hub-modal-inner{padding-left:28px;padding-right:28px}

#settings-modal .hub-modal-inner{padding-left:30px;padding-right:30px}

@media(max-width:600px){
  #pause-modal .hub-modal{width:min(90vw,390px)}
  #result-modal .hub-modal{width:min(92vw,420px)}
  #scores-modal .hub-modal{width:min(92vw,430px)}
  #settings-modal .hub-modal{width:min(94vw,470px)}
  #pause-modal .hub-modal-inner,
  #result-modal .hub-modal-inner,
  #scores-modal .hub-modal-inner{padding-left:20px;padding-right:20px}
  #settings-modal .hub-modal-inner{padding-left:22px;padding-right:22px}
}


/* Main menu full-height panel */
.menu-screen{
  place-items:stretch center;
  padding:calc(12px + var(--safe-top)) 14px calc(12px + var(--safe-bottom));
}
.menu-shell{
  width:min(94vw,560px);
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:0;
}
.menu-panel{
  width:100%;
  height:100%;
  min-height:0;
  padding:12px;
  display:flex;
}
.menu-panel-inner{
  width:100%;
  height:100%;
  min-height:0;
  padding:24px 24px 30px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
}
.menu-toolbar{
  width:100%;
  flex:0 0 auto;
  display:grid;
  grid-template-columns:64px minmax(0,1fr) 64px;
  align-items:center;
  gap:12px;
}
.menu-main-content{
  width:100%;
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:18px 0 8px;
}
.menu-copy,.menu-footer{display:none!important}
@media(max-width:430px){
  .menu-screen{padding:calc(8px + var(--safe-top)) 8px calc(8px + var(--safe-bottom))}
  .menu-panel{padding:9px}
  .menu-panel-inner{min-height:0;padding:18px 16px 24px}
  .menu-toolbar{grid-template-columns:56px minmax(0,1fr) 56px;gap:8px}
  .menu-toolbar .hub-button{width:56px;height:56px;flex-basis:56px}
  .menu-toolbar .hub-button-icon-image{width:50px;height:50px;flex-basis:50px}
  .menu-best{min-width:0;padding:7px 12px}
  .menu-main-content{padding-top:12px}
}
@media(max-height:690px) and (orientation:portrait){
  .menu-panel-inner{padding-top:14px;padding-bottom:18px}
  .menu-main-content{padding-top:8px}
  .menu-items{transform:scale(.9);margin-bottom:0}
  .game-logo{margin-bottom:16px}
}


/* Title images */
.loading-shell{width:min(94vw,720px)}
.loading-shell .hub-modal-inner{min-height:320px;justify-content:center}
.game-title-image{display:block;max-width:100%;height:auto;object-fit:contain;filter:drop-shadow(0 10px 12px rgba(0,0,0,.16))}
.loading-title-image{width:min(80vw,430px);margin:0 auto 10px}
.loading-caption{margin-top:2px}
.menu-title-image{width:min(82vw,460px);margin:0 auto}
.game-logo{width:100%;display:flex;justify-content:center;align-items:center;margin-bottom:18px}
@media(max-width:430px){
  .loading-shell .hub-modal-inner{min-height:290px}
  .loading-title-image{width:min(84vw,360px);margin-bottom:8px}
  .menu-title-image{width:min(86vw,380px)}
}
@media(max-height:690px) and (orientation:portrait){
  .menu-title-image{width:min(78vw,350px)}
  .loading-title-image{width:min(72vw,340px)}
}


/* Open main menu: no modal/frame */
.menu-screen{
  place-items:stretch center;
  padding:calc(14px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
}
.menu-shell-open{
  width:min(94vw,560px);
  height:100%;
  min-height:0;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  align-items:stretch;
  gap:12px;
}
.menu-shell-open .menu-toolbar{
  width:100%;
  display:grid;
  grid-template-columns:64px minmax(0,1fr) 64px;
  align-items:center;
  gap:12px;
}
.menu-shell-open .menu-best{
  justify-self:center;
  min-width:154px;
  padding:8px 20px;
}
.menu-shell-open .menu-main-content{
  width:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:8px 0 7vh;
}
.menu-shell-open .game-logo{
  width:100%;
  margin:0 0 clamp(20px,4vh,34px);
}
.menu-shell-open .menu-title-image{
  width:min(88vw,500px);
}
@media(max-width:430px){
  .menu-screen{padding:calc(10px + var(--safe-top)) 10px calc(12px + var(--safe-bottom))}
  .menu-shell-open{width:100%;gap:8px}
  .menu-shell-open .menu-toolbar{grid-template-columns:56px minmax(0,1fr) 56px;gap:8px}
  .menu-shell-open .menu-toolbar .hub-button{width:56px;height:56px;flex-basis:56px}
  .menu-shell-open .menu-toolbar .hub-button-icon-image{width:50px;height:50px;flex-basis:50px}
  .menu-shell-open .menu-best{min-width:0;padding:7px 12px}
  .menu-shell-open .menu-main-content{padding-bottom:5vh}
  .menu-shell-open .menu-title-image{width:min(92vw,410px)}
}
@media(max-height:690px) and (orientation:portrait){
  .menu-shell-open .menu-main-content{padding-bottom:1vh}
  .menu-shell-open .menu-title-image{width:min(78vw,360px)}
  .menu-shell-open .game-logo{margin-bottom:16px}
}


/* Final loading sizing and powerup count contrast */
.loading-screen{place-items:center;padding:20px}
.loading-shell{
  width:min(88vw,540px)!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  filter:none!important;
}
.loading-content{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:18px 10px;
  background:transparent;
}
.loading-title-image{
  width:min(58vw,300px)!important;
  margin:0 auto 8px!important;
  filter:drop-shadow(0 7px 0 rgba(4,28,71,.42)) drop-shadow(0 12px 8px rgba(0,0,0,.26))!important;
}
.loading-caption{
  margin:0 0 4px;
  color:#fff;
  font-size:clamp(28px,5vw,42px);
  line-height:1;
  text-shadow:0 3px 0 #14599d,0 6px 6px rgba(0,0,0,.3);
}
.loading-status{
  margin:0 0 20px;
  color:#fff2d6;
  font-size:clamp(16px,2.6vw,22px);
  line-height:1.1;
  text-align:center;
  text-shadow:0 2px 0 rgba(72,40,15,.72),0 4px 4px rgba(0,0,0,.24);
}
.loading-progress{width:min(82vw,430px)}
.loading-progress .hub-progress-caption,
.loading-progress .hub-progress-value{
  color:#fff!important;
  text-shadow:0 2px 0 #14599d,0 4px 4px rgba(0,0,0,.25)!important;
}
.powerup-button>b{
  color:#6b3900!important;
  font-weight:900!important;
  text-shadow:0 1px 0 rgba(255,255,255,.82)!important;
  background:linear-gradient(180deg,#fff0a3,#efaa27)!important;
  border-color:#8f5708!important;
  box-shadow:0 3px 0 #7d4600,0 5px 5px rgba(0,0,0,.2)!important;
}
@media(max-width:430px){
  .loading-title-image{width:min(62vw,250px)!important}
  .loading-content{padding:12px 6px}
  .loading-status{margin-bottom:16px}
  .loading-progress{width:min(86vw,360px)}
  .powerup-button>b{font-size:15px!important}
}
@media(max-height:520px) and (orientation:landscape){
  .loading-title-image{width:min(38vw,260px)!important}
  .loading-status{margin-bottom:10px}
  .loading-content{padding:8px}
}


/* Moves padding + slightly larger powerups */
.moves-wing{
  padding:4px!important;
  display:flex;
  align-items:center;
  justify-content:center;
}
.powerup-dock{
  min-height:86px!important;
  padding:10px 12px!important;
  gap:7px!important;
}
.powerup-button{
  width:64px!important;
  border-radius:21px!important;
}
.powerup-icon{
  width:54px!important;
  height:54px!important;
}
@media(max-width:430px){
  .moves-wing{padding:4px!important}
  .powerup-dock{min-height:78px!important;padding:9px!important;gap:5px!important}
  .powerup-button{width:56px!important;border-radius:19px!important}
  .powerup-icon{width:48px!important;height:48px!important}
}
@media(max-height:690px) and (orientation:portrait){
  .powerup-dock{min-height:70px!important}
  .powerup-button{width:50px!important}
  .powerup-icon{width:44px!important;height:44px!important}
}
@media(orientation:landscape) and (max-height:520px){
  .moves-wing{padding:4px!important}
  .powerup-button{width:min(11vh,60px)!important}
  .powerup-icon{width:min(9.5vh,52px)!important;height:min(9.5vh,52px)!important}
}


/* No status copy below the board */
.portrait-toast,.status-toast{display:none!important}


.menu-screen{position:absolute}

/* Seeded campaign level map */
.levels-screen{
  padding:calc(10px + var(--safe-top)) 10px calc(10px + var(--safe-bottom));
  place-items:stretch center;
}
.levels-shell{
  width:min(96vw,760px);
  height:100%;
  min-height:0;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  gap:10px;
}
.levels-toolbar{
  display:grid;
  grid-template-columns:64px minmax(0,1fr) 64px;
  align-items:center;
  gap:10px;
}
.levels-title-block{
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  text-shadow:0 3px 0 #0b4684,0 5px 4px rgba(0,0,0,.2);
}
.levels-title-block strong{font-size:clamp(28px,5vw,44px);line-height:.95;color:#fff}
.levels-title-block span{margin-top:4px;font-size:clamp(12px,2vw,17px);color:#ffd66f;letter-spacing:.04em}
.levels-summary{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(120px,1.15fr) minmax(0,1fr);
  gap:8px;
  align-items:stretch;
}
.levels-summary-chip,.levels-chapter-chip{
  min-height:58px;
  padding:9px 14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.levels-summary small,.levels-chapter-chip small{font-size:11px;line-height:1;color:#805e42}
.levels-summary b,.levels-chapter-chip b{margin-top:3px;font-size:22px;line-height:1;color:#2479bd;text-shadow:0 2px 0 #fff}
.levels-chapter-chip small{color:#fff;text-shadow:0 2px 0 #0b4684}
.levels-chapter-chip b{color:#fff;text-shadow:0 2px 0 #0b4684}
.levels-map{
  min-height:0;
  padding:10px;
  display:flex;
}
.levels-map-inner{
  width:100%;
  min-height:0;
  padding:14px;
  display:grid;
  grid-template-rows:minmax(0,1fr) auto;
  gap:10px;
  overflow:hidden;
}
.level-grid{
  --level-grid-columns:5;
  --level-grid-rows:4;
  --level-grid-gap:10px;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  padding:4px;
  display:grid;
  grid-template-columns:repeat(var(--level-grid-columns),minmax(0,1fr));
  grid-template-rows:repeat(var(--level-grid-rows),minmax(0,1fr));
  gap:var(--level-grid-gap);
  align-content:stretch;
  justify-content:stretch;
  overflow:hidden;
}
.level-card{
  --level-card-frame:var(--ui-blue);
  position:relative;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  padding:8px 5px 7px;
  border:1px solid transparent;
  border-radius:18px;
  border-image-source:var(--level-card-frame);
  border-image-slice:114 fill;
  border-image-width:22px;
  border-image-repeat:stretch;
  background:var(--ui-blue-center) center/100% 100% no-repeat;
  color:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:clamp(3px,.8vh,8px);
  appearance:none;
  filter:drop-shadow(0 4px 0 rgba(7,39,83,.52)) drop-shadow(0 7px 4px rgba(0,0,0,.18));
  transition:transform .14s ease,filter .14s ease,opacity .14s ease;
  overflow:hidden;
}
.level-card::after{
  content:"";
  position:absolute;
  inset:12px;
  z-index:0;
  border-radius:10px;
  background:rgba(21,113,189,.08);
  pointer-events:none;
}
.level-card>*{position:relative;z-index:1}
.level-card:not(:disabled):hover{
  transform:scale(1.025);
  filter:brightness(1.06) drop-shadow(0 4px 0 rgba(7,39,83,.52)) drop-shadow(0 7px 4px rgba(0,0,0,.18));
}
.level-card:not(:disabled):active{
  transform:translateY(3px) scale(.985);
  filter:brightness(.98) drop-shadow(0 1px 0 rgba(7,39,83,.52)) drop-shadow(0 4px 3px rgba(0,0,0,.16));
}
.level-card.completed::after{background:rgba(39,184,95,.18)}
.level-card.locked{
  cursor:not-allowed;
  opacity:.68;
  filter:grayscale(.72) brightness(.78) drop-shadow(0 3px 0 rgba(22,29,39,.48));
}
.level-number{
  display:grid;
  place-items:center;
  min-height:0;
  color:#fff;
  font-size:clamp(28px,4.4vh,42px);
  font-weight:900;
  line-height:1;
  letter-spacing:-1px;
  text-shadow:0 3px 0 #0b4684,0 5px 4px rgba(0,0,0,.22);
}
.level-card.completed .level-number{text-shadow:0 3px 0 #176d43,0 5px 4px rgba(0,0,0,.22)}
.level-lock-icon{
  position:relative;
  display:block;
  width:clamp(27px,4.1vh,38px);
  height:clamp(25px,3.7vh,34px);
  margin-top:clamp(4px,.7vh,8px);
  border-radius:8px;
  background:#e8edf0;
  box-shadow:0 3px 0 #87939c,0 5px 5px rgba(0,0,0,.16);
}
.level-lock-icon::before{
  content:"";
  position:absolute;
  left:50%;
  top:clamp(-18px,-2.2vh,-13px);
  width:68%;
  aspect-ratio:1;
  border:5px solid #e8edf0;
  border-bottom:0;
  border-radius:15px 15px 0 0;
  transform:translateX(-50%);
  box-sizing:border-box;
  filter:drop-shadow(0 2px 0 #87939c);
}
.level-lock-icon i{
  position:absolute;
  left:50%;
  top:30%;
  width:7px;
  height:38%;
  border-radius:99px;
  background:#65727d;
  transform:translateX(-50%);
}
.level-stars{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:clamp(1px,.35vw,4px);
  min-height:clamp(23px,3.6vh,32px);
  line-height:1;
}
.level-stars .level-star{
  display:block;
  width:clamp(22px,28%,32px);
  height:auto;
  aspect-ratio:1 / 1;
  object-fit:contain;
  flex:0 1 auto;
  pointer-events:none;
  user-select:none;
  transform:translateZ(0);
  filter:grayscale(1) brightness(.88) opacity(.58) drop-shadow(0 2px 0 rgba(4,45,92,.28));
  transition:filter .14s ease,transform .14s ease,opacity .14s ease;
}
.level-stars .level-star.earned{
  filter:grayscale(0) brightness(1.04) opacity(1) drop-shadow(0 2px 0 rgba(123,73,6,.42)) drop-shadow(0 4px 3px rgba(0,0,0,.18));
  transform:scale(1.06);
}
.level-card.locked .level-stars .level-star{
  filter:grayscale(1) brightness(.72) opacity(.48) drop-shadow(0 2px 0 rgba(0,0,0,.2));
}
.levels-pagination{
  display:grid;
  grid-template-columns:58px minmax(0,1fr) 58px;
  align-items:center;
  gap:10px;
}
.levels-pagination>span{text-align:center;color:#805e42;font-size:17px;text-shadow:0 2px 0 #fff}
.levels-pagination .hub-button:disabled{filter:grayscale(.7);opacity:.45;cursor:not-allowed}
.level-page-arrow{position:relative;z-index:2;color:#fff;font-size:52px;line-height:.7;text-shadow:0 3px 0 rgba(0,0,0,.28)}
.goal-item.is-empty{display:none}
.goal-items:has(.goal-item.is-empty){display:flex;justify-content:center;gap:10px}
.goal-items:has(.goal-item.is-empty) .goal-item{width:min(34%,70px)}
.result-level-label{margin-top:-4px;color:#805e42;font-size:16px;line-height:1}
.result-stars{display:flex;justify-content:center;gap:7px;margin:8px 0 4px}
.result-stars span{font-size:38px;line-height:1;color:#c8c1b5;text-shadow:0 3px 0 #8d867d;transform:scale(.9)}
.result-stars span.earned{color:#ffd14f;text-shadow:0 3px 0 #a66712;animation:resultStarPop .4s cubic-bezier(.18,1.35,.3,1) both}
.result-stars span:nth-child(2){animation-delay:.08s}
.result-stars span:nth-child(3){animation-delay:.16s}
@keyframes resultStarPop{from{opacity:0;transform:scale(.3) rotate(-18deg)}to{opacity:1;transform:scale(1) rotate(0)}}

@media(max-width:560px){
  .levels-shell{width:100%;gap:7px}
  .levels-toolbar{grid-template-columns:56px minmax(0,1fr) 56px;gap:7px}
  .levels-toolbar .hub-button{width:56px;height:56px;flex-basis:56px}
  .levels-toolbar .hub-button-icon-image{width:49px;height:49px;flex-basis:49px}
  .levels-summary{gap:5px}
  .levels-summary-chip,.levels-chapter-chip{min-height:52px;padding:7px 8px}
  .levels-summary small,.levels-chapter-chip small{font-size:9px}
  .levels-summary b,.levels-chapter-chip b{font-size:19px}
  .levels-map{padding:8px}
  .levels-map-inner{padding:9px;gap:7px}
  .level-grid{--level-grid-columns:4;--level-grid-rows:5;--level-grid-gap:8px;padding:3px}
  .level-card{padding:6px 3px 5px;border-radius:14px;border-image-width:18px}
  .level-number{min-height:39px;font-size:34px}
  .level-lock-icon{width:34px;height:31px}
  .level-lock-icon::before{top:-16px;width:22px;height:22px;border-width:5px}
  .level-stars{gap:1px;min-height:24px}
  .level-stars .level-star{width:clamp(21px,29%,25px)}
  .levels-pagination{grid-template-columns:52px minmax(0,1fr) 52px;gap:6px}
  .levels-pagination .hub-button{width:52px;height:52px;flex-basis:52px}
  .levels-pagination>span{font-size:14px}
}
@media(max-height:700px) and (orientation:portrait){
  .levels-screen{padding-top:6px;padding-bottom:6px}
  .levels-title-block strong{font-size:28px}
  .levels-summary-chip,.levels-chapter-chip{min-height:46px;padding:5px 8px}
  .levels-map-inner{padding:8px}
  .level-grid{--level-grid-columns:4;--level-grid-rows:5;--level-grid-gap:6px;padding:2px}
  .level-card{padding:4px 2px;border-image-width:16px;gap:3px}
  .level-number{min-height:34px;font-size:30px}
  .level-lock-icon{width:30px;height:27px;margin-top:5px}
  .level-lock-icon::before{top:-14px;width:20px;height:20px;border-width:5px}
  .level-lock-icon i{top:8px;height:10px}
  .level-stars .level-star{width:clamp(19px,27%,23px)}
}
@media(orientation:landscape) and (max-height:520px){
  .levels-screen{padding:6px}
  .levels-shell{width:min(98vw,1000px);grid-template-columns:180px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:8px}
  .levels-toolbar{grid-column:1;grid-row:1 / span 2;display:flex;flex-direction:column;justify-content:center}
  .levels-title-block{margin:6px 0 12px}
  .levels-summary{grid-column:2;grid-row:1}
  .levels-map{grid-column:2;grid-row:2}
  .level-grid{--level-grid-columns:5;--level-grid-rows:4;--level-grid-gap:7px;padding:2px}
  .levels-map-inner{padding:8px}
  .level-card{padding:4px 2px;border-image-width:16px;gap:3px}
  .level-number{min-height:34px;font-size:30px}
  .level-lock-icon{width:30px;height:27px;margin-top:5px}
  .level-lock-icon::before{top:-14px;width:20px;height:20px;border-width:5px}
  .level-lock-icon i{top:8px;height:10px}
  .level-stars .level-star{width:clamp(19px,27%,23px)}
}

@media(orientation:landscape) and (min-width:900px) and (max-height:520px){
  .level-grid{--level-grid-columns:10;--level-grid-rows:2;--level-grid-gap:8px}
}


/* Result modal information cards */
#result-modal .hub-modal-inner{
  gap:0;
  padding-top:26px;
  padding-bottom:24px;
}
.result-header-card{
  width:100%;
  display:grid;
  grid-template-columns:68px minmax(0,1fr);
  align-items:center;
  gap:12px;
  padding:10px 14px;
  border:3px solid rgba(183,132,61,.32);
  border-radius:18px;
  background:rgba(255,248,225,.68);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.78),0 4px 0 rgba(118,76,30,.12);
}
.result-header-card .modal-hero-icon{
  width:66px;
  height:66px;
  margin:0;
}
.result-header-copy{min-width:0;text-align:left}
.result-header-copy .hub-modal-title{
  margin:0 0 5px;
  font-size:clamp(28px,7vw,39px);
  text-align:left;
}
.result-header-copy .hub-modal-text{
  margin:0;
  font-size:clamp(14px,3.4vw,18px);
  text-align:left;
}
.result-info-grid{
  width:100%;
  display:grid;
  grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);
  gap:10px;
  margin-top:12px;
}
.result-subcard{
  min-width:0;
  min-height:84px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:11px 10px;
  border:3px solid rgba(30,106,170,.25);
  border-radius:17px;
  background:rgba(255,255,255,.58);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.82),0 4px 0 rgba(22,76,121,.1);
  text-align:center;
}
.result-level-card{
  border-color:rgba(179,124,38,.32);
  background:rgba(255,237,180,.42);
}
.result-level-label{
  margin:0;
  color:#805e42;
  font-size:15px;
  line-height:1;
}
.result-stars{margin:8px 0 0;gap:4px}
.result-stars span{font-size:31px}
.result-score{
  margin:0;
  border-color:rgba(32,115,183,.34);
  background:rgba(207,235,255,.48);
}
.result-score small{font-size:13px}
.result-score b{
  max-width:100%;
  margin-top:4px;
  font-size:34px;
  line-height:1;
}
.result-details{
  width:100%;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:10px;
}
.result-details>div{
  min-height:76px;
  padding:10px 8px;
  border-radius:17px;
  background:rgba(255,255,255,.58);
}
.result-details span{font-size:12px}
.result-details b{margin-top:4px;font-size:23px;line-height:1}
.result-actions{
  width:100%;
  margin-top:15px;
  padding-top:14px;
  border-top:3px solid rgba(183,132,61,.2);
}
@media(max-width:430px){
  #result-modal .hub-modal-inner{padding-top:20px;padding-bottom:19px}
  .result-header-card{grid-template-columns:56px minmax(0,1fr);gap:9px;padding:9px 10px;border-radius:15px}
  .result-header-card .modal-hero-icon{width:54px;height:54px}
  .result-header-copy .hub-modal-title{font-size:27px}
  .result-header-copy .hub-modal-text{font-size:13px}
  .result-info-grid,.result-details{gap:7px}
  .result-subcard{min-height:72px;padding:8px 6px;border-radius:14px}
  .result-stars{gap:2px;margin-top:6px}
  .result-stars span{font-size:27px}
  .result-score b{font-size:29px}
  .result-details>div{min-height:65px;padding:8px 5px;border-radius:14px}
  .result-details span{font-size:10px}
  .result-details b{font-size:20px}
  .result-actions{margin-top:11px;padding-top:11px}
}
@media(max-height:610px) and (orientation:portrait){
  #result-modal .hub-modal-inner{padding-top:16px;padding-bottom:14px}
  .result-header-card{padding:6px 9px}
  .result-header-card .modal-hero-icon{width:46px;height:46px}
  .result-info-grid{margin-top:7px}
  .result-subcard{min-height:61px;padding:6px}
  .result-details{margin-top:7px}
  .result-details>div{min-height:57px;padding:6px}
  .result-actions{margin-top:8px;padding-top:8px}
}


/* Polished result heading typography */
.result-header-copy .hub-modal-title{
  font-family:"Lilita One",system-ui,sans-serif;
  font-weight:400;
  letter-spacing:.2px;
  color:#2b78b7;
  text-shadow:
    0 1px 0 #d9edf4,
    0 2px 0 #b8dce8,
    0 3px 0 #8bbfd2,
    0 5px 0 rgba(15,76,119,.28),
    0 7px 5px rgba(25,61,84,.18);
}
.result-header-copy .hub-modal-text{
  font-family:"Lilita One",system-ui,sans-serif;
  font-weight:400;
  letter-spacing:.15px;
  color:#805e42;
  text-shadow:
    0 1px 0 rgba(255,255,255,.95),
    0 2px 0 rgba(255,244,214,.9),
    0 3px 0 rgba(176,128,73,.18),
    0 4px 3px rgba(84,54,25,.12);
}


/* Main menu game modes */
.menu-mode-actions{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.menu-mode-actions .hub-button{flex:none}
#endless-button .hub-button-label{font-size:34px}
#endless-button .hub-button-icon-image--inline{width:43px;height:43px;flex-basis:43px}
#result-modal.endless-result #result-stars{display:none}
#result-modal.endless-result .result-level-card{justify-content:center}
#game-shell[data-mode="endless"] .money-center small{letter-spacing:.04em}
@media(max-width:430px){
  .menu-mode-actions{gap:7px}
  #endless-button .hub-button-label{font-size:27px}
  #endless-button .hub-button-icon-image--inline{width:38px;height:38px;flex-basis:38px}
}
@media(max-height:690px) and (orientation:portrait){
  .menu-shell-open .menu-title-image{width:min(72vw,300px)}
  .menu-shell-open .game-logo{margin-bottom:10px}
  .menu-mode-actions{gap:5px}
}
@media(max-height:520px) and (orientation:landscape){
  .menu-mode-actions{flex-direction:row;gap:10px}
  .menu-mode-actions .hub-button{width:176px}
  .menu-shell-open .game-logo{margin-bottom:10px}
}


/* Blue campaign level frames */
.level-card{
  --level-card-frame:var(--ui-blue);
  border-radius:20px;
  border-image-source:var(--ui-blue);
  border-image-slice:114 fill;
  background:var(--ui-blue-center) center/100% 100% no-repeat;
  overflow:hidden;
}
.level-card::after{
  inset:12px;
  border-radius:12px;
  background:rgba(255,255,255,.025);
}
.level-card.completed::after{background:rgba(39,184,95,.14)}
.level-card.locked::after{background:rgba(7,37,79,.18)}
.levels-chapter-chip.hub-frame-blue{
  border-radius:22px;
  overflow:hidden;
  border-image-source:var(--ui-blue);
  border-image-slice:114 fill;
  border-image-width:24px;
  background-image:var(--ui-blue-center);
}
.levels-chapter-chip.hub-frame-blue small,
.levels-chapter-chip.hub-frame-blue b{
  color:#fff;
  text-shadow:0 2px 0 #0b4684,0 4px 3px rgba(0,0,0,.16);
}
@media(max-width:560px){
  .level-card{border-radius:16px}
  .levels-chapter-chip.hub-frame-blue{border-radius:18px;border-image-width:20px}
}


/* Main menu title sizing + spacing */
.menu-shell-open .menu-title-image{
  width:min(76vw,420px);
}
.menu-shell-open .game-logo{
  margin-bottom:clamp(34px,5.5vh,52px);
}
@media(max-width:430px){
  .menu-shell-open .menu-title-image{
    width:min(78vw,340px);
  }
  .menu-shell-open .game-logo{
    margin-bottom:30px;
  }
}
@media(max-height:690px) and (orientation:portrait){
  .menu-shell-open .menu-title-image{
    width:min(68vw,280px);
  }
  .menu-shell-open .game-logo{
    margin-bottom:24px;
  }
}
@media(max-height:520px) and (orientation:landscape){
  .menu-shell-open .menu-title-image{
    width:min(46vw,320px);
  }
  .menu-shell-open .game-logo{
    margin-bottom:20px;
  }
}


/* Result stars use the same image asset as level select */
.result-stars{display:flex;align-items:center;justify-content:center;gap:8px;margin:8px 0 4px}
.result-stars .result-star{
  width:52px;
  height:52px;
  object-fit:contain;
  flex:0 0 52px;
  transform:scale(.92);
  filter:grayscale(1) brightness(.72) opacity(.58) drop-shadow(0 3px 0 rgba(64,57,48,.28));
}
.result-stars .result-star.earned{
  filter:drop-shadow(0 4px 0 rgba(145,91,12,.4)) drop-shadow(0 7px 5px rgba(90,48,0,.2));
  animation:resultStarImagePop .42s cubic-bezier(.18,1.35,.3,1) both;
}
.result-stars .result-star:nth-child(2){animation-delay:.08s}
.result-stars .result-star:nth-child(3){animation-delay:.16s}
@keyframes resultStarImagePop{
  from{opacity:0;transform:scale(.28) rotate(-18deg)}
  to{opacity:1;transform:scale(1) rotate(0)}
}
@media(max-width:430px){
  .result-stars{gap:5px}
  .result-stars .result-star{width:44px;height:44px;flex-basis:44px}
}
@media(max-height:520px) and (orientation:landscape){
  .result-stars{gap:4px;margin-top:5px}
  .result-stars .result-star{width:38px;height:38px;flex-basis:38px}
}

/* Result level card: keep large image stars properly centered */
#result-modal .result-level-card{
  min-height:104px;
  padding:10px 8px 13px;
  justify-content:center;
}
#result-modal .result-level-label{
  flex:0 0 auto;
  margin-bottom:3px;
}
#result-modal .result-stars{
  flex:0 0 auto;
  margin:2px 0 0;
  transform:translateY(-1px);
}
@media(max-width:430px){
  #result-modal .result-level-card{
    min-height:100px;
    padding:9px 7px 12px;
  }
  #result-modal .result-stars{
    margin-top:1px;
    transform:translateY(-1px);
  }
}

/* Final result star sizing */
.result-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px;
    margin: 8px 0 4px;
}

.result-stars .result-star {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex: 0 0 52px;
    transform: scale(.92);
    filter: grayscale(1) brightness(.72) opacity(.58) drop-shadow(0 3px 0 rgba(64, 57, 48, .28));
}


/* Scores modal: use the Treasure Room title asset instead of trophy + text heading */
#scores-modal .scores-brand-header{
  position:relative;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  margin:2px 0 6px;
}
#scores-modal .scores-brand-title{
  display:block;
  width:min(78%,270px);
  max-height:104px;
  object-fit:contain;
  filter:drop-shadow(0 3px 0 rgba(66,50,33,.16));
}
#scores-modal .scores-accessible-title{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  border:0!important;
}
@media(max-width:430px){
  #scores-modal .scores-brand-title{
    width:min(80%,235px);
    max-height:90px;
  }
}


/* Juicy goal collection: board item -> HUD goal */
.goal-flight-layer{
  position:fixed;
  inset:0;
  z-index:2500;
  pointer-events:none;
  overflow:visible;
}
.goal-fly-token{
  position:fixed;
  z-index:2;
  object-fit:contain;
  pointer-events:none;
  will-change:transform,opacity;
  filter:
    drop-shadow(0 4px 2px rgba(0,0,0,.28))
    drop-shadow(0 0 7px rgba(255,240,170,.5));
}
.goal-impact-spark{
  position:fixed;
  z-index:1;
  width:7px;
  height:7px;
  border-radius:50%;
  pointer-events:none;
  transform:translate(-50%,-50%);
  animation:goalImpactSpark .62s cubic-bezier(.16,.78,.2,1) forwards;
  box-shadow:0 0 5px rgba(255,255,255,.6);
}
.goal-impact-spark.diamond{
  width:9px;
  height:9px;
  border-radius:1px;
  clip-path:polygon(50% 0,64% 36%,100% 50%,64% 64%,50% 100%,36% 64%,0 50%,36% 36%);
}
@keyframes goalImpactSpark{
  0%{opacity:1;transform:translate(-50%,-50%) scale(.35) rotate(0)}
  28%{opacity:1;transform:translate(-50%,-50%) scale(1.05) rotate(20deg)}
  100%{opacity:0;transform:translate(calc(-50% + var(--gx)),calc(-50% + var(--gy))) scale(.1) rotate(var(--grot))}
}
.goal-item.goal-hit .goal-icon{
  animation:goalIconHit .34s cubic-bezier(.18,1.45,.3,1);
}
.goal-item .goal-icon .asset-item{
  transform-origin:center;
}
.goal-item> b.goal-count-pop{
  animation:goalCountPop .38s cubic-bezier(.16,1.45,.25,1);
}
.goal-item.goal-complete-pop{
  animation:goalCompletePop .58s cubic-bezier(.17,1.25,.24,1);
}
@keyframes goalIconHit{
  0%{transform:scale(1)}
  28%{transform:scale(.82) rotate(-6deg)}
  58%{transform:scale(1.24) rotate(4deg)}
  100%{transform:scale(1) rotate(0)}
}
@keyframes goalCountPop{
  0%{transform:scale(1);filter:brightness(1)}
  38%{transform:scale(1.42) translateY(-2px);filter:brightness(1.25)}
  72%{transform:scale(.94)}
  100%{transform:scale(1);filter:brightness(1)}
}
@keyframes goalCompletePop{
  0%{transform:scale(1)}
  35%{transform:scale(1.12) rotate(-2deg)}
  62%{transform:scale(.97) rotate(1deg)}
  100%{transform:scale(1)}
}
@media (prefers-reduced-motion:reduce){
  .goal-item.goal-hit .goal-icon,
  .goal-item> b.goal-count-pop,
  .goal-item.goal-complete-pop{
    animation:none!important;
  }
}


.hub-chip{
  top:-24px!important;
}


/* 384px mobile HUD fit */
.hud-pause{
  inline-size:var(--hud-pause-size)!important;
  block-size:var(--hud-pause-size)!important;
  width:var(--hud-pause-size)!important;
  height:var(--hud-pause-size)!important;
  min-width:var(--hud-pause-size)!important;
  max-width:var(--hud-pause-size)!important;
  min-height:var(--hud-pause-size)!important;
  max-height:var(--hud-pause-size)!important;
  flex:0 0 var(--hud-pause-size)!important;
  aspect-ratio:1 / 1!important;
  padding:0!important;
  box-sizing:border-box!important;
}

@media(max-width:390px){
  .portrait-game-shell{
    --hud-pause-size:46px;
    --hud-pause-gap:5px;
  }

  .match-hud{
    width:calc(100% - var(--hud-pause-reserve));
    margin-right:var(--hud-pause-reserve);
    min-height:88px;
    padding:7px 6px;
    grid-template-columns:minmax(0,1.42fr) minmax(72px,.78fr) minmax(58px,.58fr);
    gap:5px;
  }

  .hud-island{
    min-height:72px;
    min-width:0;
  }

  .goals-wing{
    padding:15px 4px 4px;
  }

  .money-center{
    padding:15px 3px 4px;
    min-width:0;
    overflow:hidden;
  }

  .moves-wing{
    padding:4px!important;
    min-width:0;
    overflow:hidden;
  }

  .goal-items{
    gap:1px;
  }

  .goal-item{
    min-width:0;
    overflow:visible;
  }

  .goal-icon{
    width:30px;
    height:30px;
  }

  .goal-item>b{
    max-width:100%;
    font-size:14px;
    letter-spacing:-.35px;
    white-space:nowrap;
  }

  .money-center #score-value{
    max-width:100%;
    font-size:clamp(20px,6.3vw,24px);
    letter-spacing:-.7px;
    white-space:nowrap;
  }

  .money-center small{
    margin-top:2px;
    font-size:7px;
    letter-spacing:-.15px;
    white-space:nowrap;
  }

  .moves-wing #moves-value{
    font-size:34px;
    line-height:.95;
  }

  .hub-chip{
    top:-24px!important;
    min-width:58px;
    height:27px;
    padding:0 9px;
    border-radius:16px;
    border-image-width:15px;
    font-size:13px;
    letter-spacing:-.15px;
  }

  .hud-pause{
    right:calc(0px - var(--hud-pause-reserve));
    top:50%;
    transform:translateY(-50%);
    --border-size:18px;
  }

  .hud-pause .hub-button-icon-image{
    width:38px;
    height:38px;
    flex:0 0 38px;
  }

  .powerup-dock{
    min-height:70px!important;
    padding:7px 6px!important;
    gap:3px!important;
  }

  .powerup-button{
    width:50px!important;
    border-radius:17px!important;
  }

  .powerup-icon{
    width:43px!important;
    height:43px!important;
  }

  .powerup-button>b{
    right:-4px;
    bottom:-4px;
    min-width:21px;
    height:21px;
    padding:0 4px;
    font-size:12px!important;
    line-height:17px;
  }
}

@media(max-width:360px){
  .portrait-game-shell{
    --hud-pause-size:43px;
    --hud-pause-gap:4px;
  }

  .match-hud{
    padding-inline:5px;
    grid-template-columns:minmax(0,1.4fr) minmax(66px,.76fr) minmax(54px,.56fr);
    gap:4px;
  }

  .goal-icon{
    width:27px;
    height:27px;
  }

  .goal-item>b{
    font-size:13px;
  }

  .money-center #score-value{
    font-size:20px;
  }

  .moves-wing #moves-value{
    font-size:31px;
  }

  .hub-chip{
    min-width:54px;
    padding-inline:7px;
    font-size:12px;
  }

  .hud-pause .hub-button-icon-image{
    width:35px;
    height:35px;
    flex-basis:35px;
  }
}

/* Keep HUD chips visible when offset above their islands */
@media(max-width:390px){
  .hud-island,
  .goals-wing,
  .money-center,
  .moves-wing{
    overflow:visible!important;
  }
}


/* CASH HUD — compact numeric display */
#score-value{
  font-size:clamp(20px,3.3vw,31px)!important;
  line-height:.9!important;
  letter-spacing:-1.4px!important;
  max-width:100%!important;
  white-space:nowrap!important;
  overflow:visible!important;
  transform:scaleX(.94);
  transform-origin:center;
}

.money-center #score-value,
.cash-value,
.hud-cash-value{
  font-size:clamp(20px,3.3vw,31px)!important;
  line-height:.9!important;
  letter-spacing:-1.4px!important;
}

@media(max-width:390px){
  #score-value,
  .money-center #score-value,
  .cash-value,
  .hud-cash-value{
    font-size:clamp(17px,5.2vw,23px)!important;
    letter-spacing:-1px!important;
    transform:scaleX(.92);
  }
}


/* ECONOMY + SHOP V1 */
.money-center #score-value,#score-value{
  font-size:clamp(19px,3vw,27px)!important;
  line-height:.92!important;
  letter-spacing:-1px!important;
  white-space:nowrap!important;
  transform:scaleX(.94);
  transform-origin:center;
}

.menu-toolbar{
  grid-template-columns:64px minmax(118px,.9fr) minmax(118px,1fr) 64px!important;
  gap:9px!important;
}
.menu-currency,.menu-best{min-width:0!important;min-height:62px;padding:7px 10px!important}
.menu-currency{display:flex;align-items:center;justify-content:center;gap:6px}
.menu-currency>img{width:38px;height:38px;object-fit:contain;flex:0 0 38px;filter:drop-shadow(0 3px 2px rgba(0,0,0,.2))}
.menu-currency div,.menu-best{min-width:0}
.menu-currency small,.menu-best small{display:block;color:#805e42;font-size:10px!important;line-height:1;white-space:nowrap}
.menu-currency strong,.menu-best strong{display:block;margin-top:3px;color:#2b78b7;font-size:clamp(20px,4vw,27px)!important;line-height:1;white-space:nowrap;text-shadow:0 2px 0 #b6d7df}
.coin-balance-pop{animation:coinBalancePop .34s cubic-bezier(.16,1.3,.24,1)}
@keyframes coinBalancePop{0%{transform:scale(1)}42%{transform:scale(1.22)}72%{transform:scale(.96)}100%{transform:scale(1)}}

#shop-modal .hub-modal{width:min(94vw,620px)}
#shop-modal .shop-modal-inner{max-height:min(88vh,760px);justify-content:flex-start;padding:58px 24px 24px;overflow:hidden}
.shop-header{width:100%;display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:15px}
.shop-header .hub-modal-title{margin:0;font-size:clamp(27px,5vw,39px);text-align:left}
.shop-balance{min-width:142px;padding:7px 12px;display:flex;align-items:center;justify-content:center;gap:7px;flex:0 0 auto}
.shop-balance img{width:38px;height:38px;object-fit:contain}
.shop-balance small{display:block;color:#fff;font-size:9px;line-height:1;text-shadow:0 2px 0 #0b4684}
.shop-balance b{display:block;margin-top:2px;color:#fff;font-size:25px;line-height:1;text-shadow:0 2px 0 #0b4684}
.shop-grid{width:100%;overflow:auto;padding:4px 3px 8px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;scrollbar-width:thin}
.shop-card{min-width:0;min-height:205px;padding:13px 12px 12px;display:grid;grid-template-columns:72px minmax(0,1fr);grid-template-rows:1fr auto;align-items:center;gap:7px 10px;position:relative}
.shop-card-wide{grid-column:1/-1}
.shop-powerup-image{width:68px;height:68px;object-fit:contain;filter:drop-shadow(0 5px 3px rgba(0,0,0,.2))}
.shop-card-copy{min-width:0}
.shop-card-copy strong{display:block;color:#2b78b7;font-size:21px;line-height:1;text-shadow:0 2px 0 #b6d7df}
.shop-card-copy small{display:block;min-height:30px;margin-top:4px;color:#805e42;font-size:12px;line-height:1.15}
.shop-card-copy span{display:block;margin-top:6px;color:#805e42;font-size:11px}
.shop-card-copy span b{color:#2b78b7;font-size:16px}
.shop-buy{grid-column:1/-1;width:100%!important;height:49px!important;min-height:49px!important;padding-inline:10px!important;display:flex;align-items:center;justify-content:center;gap:11px}
.shop-buy .hub-button-label{font-size:22px!important}
.shop-price{display:flex;align-items:center;gap:3px;color:#fff;text-shadow:0 2px 0 rgba(85,60,10,.45)}
.shop-price img{width:28px;height:28px;object-fit:contain}
.shop-price b{font-size:18px}
.shop-buy.cannot-afford{filter:saturate(.62) brightness(.9)}
.shop-card.shop-bought{animation:shopBought .42s cubic-bezier(.18,1.18,.22,1)}
.shop-card.shop-denied{animation:shopDenied .32s ease}
@keyframes shopBought{0%{transform:scale(1)}40%{transform:scale(1.035)}72%{transform:scale(.99)}100%{transform:scale(1)}}
@keyframes shopDenied{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}55%{transform:translateX(5px)}80%{transform:translateX(-2px)}}

.result-details{grid-template-columns:repeat(3,minmax(0,1fr))!important}
.result-coins-card{display:flex!important;flex-direction:column;align-items:center;justify-content:center}
.result-coins-value-wrap{display:flex;align-items:center;justify-content:center;gap:4px;margin-top:3px}
.result-coins-value-wrap img{width:26px;height:26px;object-fit:contain}
#result-coins-value{color:#b77811!important}
#result-coins-value.reward-empty{opacity:.5}

@media(max-width:520px){
  .menu-toolbar{grid-template-columns:52px minmax(90px,.9fr) minmax(90px,1fr) 52px!important;gap:6px!important}
  .menu-toolbar .hub-button{width:52px!important;height:52px!important;flex-basis:52px!important}
  .menu-toolbar .hub-button-icon-image{width:46px!important;height:46px!important;flex-basis:46px!important}
  .menu-currency,.menu-best{min-height:54px;padding:6px 7px!important}
  .menu-currency>img{width:31px;height:31px;flex-basis:31px}
  .menu-currency small,.menu-best small{font-size:8px!important}
  .menu-currency strong,.menu-best strong{font-size:19px!important}
  #shop-modal .shop-modal-inner{padding:54px 14px 16px}
  .shop-header{align-items:flex-start;flex-direction:column;gap:8px}
  .shop-balance{min-width:132px;align-self:flex-end;margin-top:-43px}
  .shop-grid{gap:8px}
  .shop-card{min-height:188px;padding:10px 8px;grid-template-columns:58px minmax(0,1fr);gap:6px}
  .shop-powerup-image{width:55px;height:55px}
  .shop-card-copy strong{font-size:17px}
  .shop-card-copy small{font-size:10px;min-height:27px}
  .shop-card-copy span{font-size:9px}
  .shop-buy{height:45px!important;min-height:45px!important}
  .shop-buy .hub-button-label{font-size:18px!important}
  .shop-price img{width:24px;height:24px}
  .shop-price b{font-size:15px}
  .result-details{gap:6px!important}
  .result-details span{font-size:9px!important}
  .result-details b{font-size:18px!important}
  .result-coins-value-wrap img{width:21px;height:21px}
  .money-center #score-value,#score-value{font-size:clamp(17px,5vw,22px)!important}
}


/* MAIN MENU SHOP VIEW V3 - fixed-stage sequential fade */
.menu-shell-open .menu-toolbar,
.menu-toolbar{
  grid-template-columns:64px minmax(0,1fr) 64px!important;
  gap:12px!important;
}
.menu-toolbar-left{
  position:relative;
  width:64px;
  height:64px;
  justify-self:center;
}
.menu-toolbar-left>.hub-button{
  position:absolute;
  inset:0;
  margin:auto;
  transform:none!important;
  will-change:opacity;
}
#menu-trophy-button{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .14s ease .14s,visibility 0s linear .14s;
}
#shop-back-button{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .14s ease,visibility 0s linear .14s;
}
.menu-screen.shop-view #menu-trophy-button{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .14s ease,visibility 0s linear .14s;
}
.menu-screen.shop-view #shop-back-button{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .14s ease .14s,visibility 0s linear .14s;
}
.menu-currency{
  justify-self:center;
  width:min(100%,210px);
  min-width:0!important;
  min-height:62px;
  padding:7px 14px!important;
}
.menu-main-content,
.menu-shop-content{
  grid-column:1;
  grid-row:2;
  width:100%;
  min-height:0;
  transform:none!important;
  will-change:opacity;
}
.menu-main-content{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .18s ease .18s,visibility 0s linear .18s;
}
.menu-shop-content{
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .18s ease,visibility 0s linear .18s;
  overflow:hidden;
}
.menu-screen.shop-view .menu-main-content{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .18s ease,visibility 0s linear .18s;
}
.menu-screen.shop-view .menu-shop-content{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .18s ease .18s,visibility 0s linear .18s;
}
.menu-shop-title{
  margin:0 0 clamp(10px,2vh,18px);
  color:#fff;
  font-size:clamp(28px,5vw,40px);
  line-height:1;
  text-align:center;
  text-shadow:0 4px 0 #1877c8,0 7px 7px rgba(0,0,0,.16);
}
.menu-shop-content .shop-grid{
  width:100%;
  height:auto;
  max-height:100%;
  overflow:hidden!important;
  padding:2px;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(3,minmax(0,1fr));
  gap:clamp(7px,1.5vh,11px);
  scrollbar-width:none;
}
.menu-shop-content .shop-card{
  min-width:0;
  min-height:0;
  height:100%;
  padding:clamp(8px,1.4vh,12px) clamp(8px,2vw,12px);
  display:grid;
  grid-template-columns:clamp(48px,12vw,68px) minmax(0,1fr);
  grid-template-rows:minmax(0,1fr) auto;
  align-items:center;
  gap:5px 8px;
}
.menu-shop-content .shop-card-wide{grid-column:1/-1}
.menu-shop-content .shop-powerup-image{
  width:clamp(48px,12vw,68px);
  height:clamp(48px,12vw,68px);
}
.menu-shop-content .shop-card-copy strong{font-size:clamp(16px,3.7vw,21px)}
.menu-shop-content .shop-card-copy small{min-height:0;margin-top:3px;font-size:clamp(9px,2.2vw,12px)}
.menu-shop-content .shop-card-copy span{margin-top:4px;font-size:clamp(8px,2vw,11px)}
.menu-shop-content .shop-card-copy span b{font-size:clamp(13px,3vw,16px)}
.menu-shop-content .shop-buy{
  height:clamp(38px,7vh,49px)!important;
  min-height:38px!important;
  padding-inline:8px!important;
  gap:8px;
}
.menu-shop-content .shop-buy .hub-button-label{font-size:clamp(16px,3.8vw,22px)!important}
.menu-shop-content .shop-price img{width:clamp(20px,5.5vw,28px);height:clamp(20px,5.5vw,28px)}
.menu-shop-content .shop-price b{font-size:clamp(13px,3.3vw,18px)}

@media(max-width:430px){
  .menu-shell-open .menu-toolbar,.menu-toolbar{
    grid-template-columns:56px minmax(0,1fr) 56px!important;
    gap:8px!important;
  }
  .menu-toolbar-left{width:56px;height:56px}
  .menu-currency{min-height:54px!important;padding:6px 10px!important}
  .menu-shop-title{margin-bottom:8px;font-size:29px}
  .menu-shop-content .shop-grid{gap:6px}
  .menu-shop-content .shop-card{padding:8px 7px;grid-template-columns:52px minmax(0,1fr);gap:4px 6px}
  .menu-shop-content .shop-powerup-image{width:50px;height:50px}
  .menu-shop-content .shop-card-copy small{font-size:9px}
  .menu-shop-content .shop-buy{height:40px!important;min-height:40px!important}
}

@media(max-height:600px) and (orientation:portrait){
  .menu-shop-title{font-size:25px;margin-bottom:5px}
  .menu-shop-content .shop-grid{gap:5px}
  .menu-shop-content .shop-card{padding:5px 7px;grid-template-columns:44px minmax(0,1fr);gap:2px 6px}
  .menu-shop-content .shop-powerup-image{width:42px;height:42px}
  .menu-shop-content .shop-card-copy strong{font-size:15px}
  .menu-shop-content .shop-card-copy small{display:none}
  .menu-shop-content .shop-card-copy span{margin-top:2px;font-size:8px}
  .menu-shop-content .shop-card-copy span b{font-size:12px}
  .menu-shop-content .shop-buy{height:34px!important;min-height:34px!important}
  .menu-shop-content .shop-buy .hub-button-label{font-size:15px!important}
  .menu-shop-content .shop-price img{width:19px;height:19px}
  .menu-shop-content .shop-price b{font-size:12px}
}

@media(orientation:landscape) and (max-height:600px){
  .menu-shop-content{justify-content:flex-start;padding-top:2px}
  .menu-shop-title{font-size:25px;margin-bottom:6px}
  .menu-shop-content .shop-grid{
    grid-template-columns:repeat(5,minmax(0,1fr));
    grid-template-rows:minmax(0,1fr);
    gap:7px;
  }
  .menu-shop-content .shop-card,
  .menu-shop-content .shop-card-wide{
    grid-column:auto;
    grid-template-columns:1fr;
    grid-template-rows:auto minmax(0,1fr) auto;
    text-align:center;
    padding:7px;
  }
  .menu-shop-content .shop-powerup-image{justify-self:center;width:min(14vh,58px);height:min(14vh,58px)}
  .menu-shop-content .shop-card-copy small{display:none}
  .menu-shop-content .shop-card-copy strong{font-size:15px}
  .menu-shop-content .shop-card-copy span{font-size:8px}
  .menu-shop-content .shop-buy{grid-column:auto;height:36px!important;min-height:36px!important}
  .menu-shop-content .shop-buy .hub-button-label{font-size:14px!important}
  .menu-shop-content .shop-price img{width:18px;height:18px}
  .menu-shop-content .shop-price b{font-size:12px}
}

/* Shop/main content share the same menu stage. */
.menu-shell-open .menu-main-content,
.menu-shell-open .menu-shop-content{
  grid-column:1;
  grid-row:2;
}
.menu-shop-content .shop-grid{
  flex:1 1 auto;
  min-height:0;
  height:100%;
}


/* Progressive move pressure */
.moves-wing{transition:filter .18s ease,transform .18s ease}
.moves-wing .moves-subtitle{display:block;position:absolute;left:50%;bottom:8px;transform:translateX(-50%);font-size:9px;font-weight:1000;letter-spacing:.12em;color:#9a6a43;opacity:.78;line-height:1}
.moves-wing.warning{filter:saturate(1.12) brightness(1.03)}
.moves-wing.warning #moves-value{animation:movesWarningPulse 1.15s ease-in-out infinite}
.moves-wing.danger{animation:movesDanger .58s ease-in-out infinite alternate;filter:saturate(1.28) brightness(1.05)}
.moves-wing.danger #moves-value{animation:movesCriticalPulse .58s ease-in-out infinite alternate}
.moves-wing.moves-hit{animation:movesHit .24s cubic-bezier(.2,.9,.25,1.35)!important}
@keyframes movesWarningPulse{50%{transform:scale(1.055)}}
@keyframes movesCriticalPulse{to{transform:scale(1.12)}}
@keyframes movesHit{0%{transform:scale(1)}45%{transform:scale(1.1)}100%{transform:scale(1)}}
@media(max-width:430px){.moves-wing .moves-subtitle{bottom:6px;font-size:8px}}


/* MortgageCalculator.org brand */
.mortgage-calculator-brand{
  position:absolute;
  left:50%;
  bottom:calc(8px + var(--safe-bottom));
  z-index:2;
  width:min(76vw,420px);
  transform:translateX(-50%);
  pointer-events:none;
  opacity:1;
  visibility:visible;
  transition:opacity .18s ease,visibility 0s linear 0s;
}
.mortgage-calculator-brand img{
  width:100%;
  height:auto;
  object-fit:contain;
}
.menu-screen.shop-view .mortgage-calculator-brand{
  opacity:0;
  visibility:hidden;
  transition:opacity .12s ease,visibility 0s linear .12s;
}
@media(max-width:430px){
  .mortgage-calculator-brand{
    bottom:calc(6px + var(--safe-bottom));
    width:min(82vw,340px);
  }
}
@media(max-height:560px){
  .mortgage-calculator-brand{
    bottom:calc(4px + var(--safe-bottom));
    width:min(62vw,320px);
  }
}
