/* Sudoku Cubes: small phones, short screens, landscape and desktop. */
@media (max-width: 359px) {
  .screen { padding-left: 8px; padding-right: 8px; }
  .pill { min-width: 54px; padding-right: 8px; font-size: 14px; }
  .pill img { width: 24px; height: 24px; }
  .icon-btn, .icon-btn img { width: 40px; height: 40px; }
  .title-block b { font-size: 18px; }
  .tool img { width: 38px; height: 38px; }
  .tool { font-size: 12px; }
  .pad { gap: 3px; }
  .btn.big { min-height: 56px; font-size: 21px; }
  .level-grid { gap: 8px; }
}
@media (max-height: 640px) {
  .cube-stage { display: none; }
  .mascot-home { display: none; }
  .tools { margin: 4px 0; }
  .tool span { display: none; }
  .tool .badge { top: -4px; }
  .key { max-height: 54px; }
  .hud { min-height: 26px; }
  .hearts img { width: 22px; height: 22px; }
  .home-actions { gap: 9px; }
}
/* Landscape phones: board on the left, controls on the right. */
@media (orientation: landscape) and (max-height: 520px) {
  #play { display: none; }
  #play.active { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; column-gap: 12px; }
  #play .bar { grid-column: 2; grid-row: 1; }
  #play .hud { grid-column: 2; grid-row: 2; }
  #play .board-wrap { grid-column: 1; grid-row: 1 / span 4; height: 100%; }
  #play .tools { grid-column: 2; grid-row: 3; display: grid; align-self: end; }
  #play .pad { grid-column: 2; grid-row: 4; grid-template-columns: repeat(5, 1fr); }
  #play .board-wrap { width: calc(100vh - 16px - var(--safe-top) - var(--safe-bottom)); }
  .tool span { display: none; }
  .key { max-height: 64px; aspect-ratio: 1; }
  #home.active { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto auto; column-gap: 20px; }
  #home .home-top { grid-column: 1 / span 2; }
  #home .hero { grid-column: 1; grid-row: 2 / span 3; }
  #home .home-actions { grid-column: 2; grid-row: 2; align-self: center; }
  #home .home-stats { grid-column: 2; grid-row: 3; }
  #home .credit { grid-column: 2; grid-row: 4; }
  .level-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (min-width: 700px) and (min-height: 700px) {
  .level-grid { grid-template-columns: repeat(6, 1fr); }
  .pad { gap: 8px; max-width: 560px; margin: 0 auto; width: 100%; }
  .tools { max-width: 480px; margin-left: auto; margin-right: auto; width: 100%; }
  .mascot-home { right: 20px; width: 140px; height: 140px; }
}
