/* Board-first layout. CSS-only sizing: no resize loop or extra animation work. */
:root {
  --compact-height:100vh;
  --compact-board-size:min(calc(100vw - 4px - env(safe-area-inset-left) - env(safe-area-inset-right)),820px,max(260px,calc(var(--compact-height) - 180px - env(safe-area-inset-top) - env(safe-area-inset-bottom))));
  --cell:calc((var(--compact-board-size) - 18px) / 8);
}
@supports(height:100dvh){:root{--compact-height:100dvh}}
body{display:block}
.game{width:100%;max-width:840px;margin:0 auto;padding:6px 2px;overflow:visible}
.game>.world-rank,.game .hud>.stars,.game .hud>#profileBtn,#goalText,#taskHint{display:none}
.hud{display:grid;grid-template-columns:36px minmax(0,1fr) 86px;gap:6px}
.hud>#lobbyBtn{grid-column:1;grid-row:1;width:36px;height:36px;min-width:36px}
.hud>.score-pill{grid-column:2;grid-row:1}
.hud>.moves-pill{grid-column:3;grid-row:1}
.hud-pill{height:36px;min-width:0;transform:none;padding:3px 6px;gap:6px}
.hud>.score-pill{justify-content:flex-start;border:0;background:transparent}
.hud>.moves-pill{flex-direction:row;line-height:normal}
.hud-pill span{font-size:10px;letter-spacing:.3px}
.hud-pill strong{font-size:19px;line-height:1.1}
.level-line{margin:6px 4px 4px;align-items:center;gap:8px}
.level-line b{font-size:15px}.level-line .resources{gap:12px;font-size:13px}
.task-progress{margin:0 2px 6px;padding:6px 8px}
.task-progress-head{font-size:12px;line-height:1.35;align-items:flex-start;gap:6px}
#taskLabel{min-width:0;overflow-wrap:anywhere}#taskValue{flex-shrink:0;max-width:48%;text-align:right;font-variant-numeric:tabular-nums}
.task-track{height:4px;margin-top:4px}
.play-area{width:100%;display:flex;flex-direction:column;gap:6px}
.board-frame{width:var(--compact-board-size);max-width:100%;padding:1px;border-width:1px;border-radius:12px;flex-shrink:0;align-self:center}
.board{gap:2px;grid-template-columns:repeat(8,var(--cell));grid-template-rows:repeat(8,var(--cell))}
.tile{width:var(--cell);height:var(--cell)}
.fruit-icon{font-size:clamp(20px,calc(var(--cell) * .84),70px)}
.power-rail{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));width:var(--compact-board-size);max-width:100%;gap:5px;order:2;align-self:center}
.power-rail .power{width:100%;min-width:0;min-height:44px;height:44px;font-size:22px;border-width:1px;padding:4px;border-radius:10px}
.power-rail .power span,.power-rail #adBtn small{display:none}
.power-rail .power small{font-size:10px;top:2px;right:3px;max-width:65%;overflow:hidden;text-overflow:ellipsis}
.power-rail.compact-controls{display:grid;grid-template-columns:repeat(5,minmax(0,1fr)) repeat(3,30px);gap:2px;margin:0;align-items:center}
.compact-controls #soundToggle,.compact-controls #restartBtn,.compact-controls #reportBugBtn{display:grid;place-items:center;width:30px;min-width:30px;min-height:44px;height:44px;margin:0;padding:0;font-size:16px}
.compact-controls #restartBtn .ui-icon{width:17px;height:17px}
.bottom-bar{display:block;max-width:700px;margin:3px auto 0;padding:0 4px}
.bottom-bar #statusText{font-size:11px;line-height:1.4;overflow-wrap:anywhere}
.lobby-actions>.compact-login{display:flex;justify-content:center;align-items:center;gap:8px;grid-column:1/-1;width:100%;min-height:44px;color:#b9f6e5;border:1px solid #76cbbb55}
.lobby-actions>.compact-login[hidden]{display:none!important}
.compact-login .ui-icon{width:18px;height:18px;flex-shrink:0}.cloud-save-state{margin:12px 0 0;overflow-wrap:anywhere}
.lobby-rank .rank-avatar{display:block;width:34px;height:34px;object-fit:cover;border-radius:10px;margin:0 0 7px;border:1px solid #a9ead944}
.lobby-rank .rank-avatar[hidden]{display:none}
/* Preserve the rival preview while giving the playable duel board more room. */
@media(max-width:799px){
 .duel-shell{padding-left:4px;padding-right:4px}
 .duel-top{padding:4px 0;gap:6px}.duel-top h2{font-size:16px}.duel-status{font-size:11px;margin:0 auto 4px;min-height:16px}
 .duel-boards{gap:6px}.duel-pane{padding:4px}.duel-pane.rival{grid-template-columns:88px 1fr;column-gap:8px}
 .duel-pane.own .duel-grid{max-width:580px}.duel-pane.own .duel-tile{font-size:clamp(23px,8.6vw,54px)}
 .duel-pane .duel-note{font-size:11px;margin:4px 0}.duel-pane header{margin-bottom:4px}.duel-timer{font-size:21px}
 .duel-content>.duel-actions{margin:6px 0}
}
