/* ============================================================================
   Tetris - styles
   ----------------------------------------------------------------------------
   Sizing model: CSS decides how big the board box is, JS reads the resulting
   box and sizes the canvas backing store to match (x devicePixelRatio). So
   every breakpoint below silently re-resolutions the game. There are no magic
   numbers shared between this file and script.js.

   Backgrounds are flat colours throughout. No gradients.
   ==========================================================================*/

:root {
  --bg:         #080b14;
  --panel:      #131b2c;
  --edge:       #24314c;
  --edge-soft:  #1a2338;
  --text:       #e8eefb;
  --dim:        #8492ad;
  --accent:     #4cc9f0;
  --accent-ink: #04121b;
  --win:        #4ade80;
  --lose:       #f87171;
  --field:      #0a1020;

  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* An author `display` beats the UA's [hidden] rule, and several components
   here set one. Keep the attribute authoritative everywhere. */
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: block;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ============================================================
   Screens: boot, menu, help, scores, settings, game.
   One <section class="screen"> is visible at a time; `hidden`
   does the hiding so it stays correct for assistive tech too.
   ============================================================ */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.screen.is-active { display: block; }

.screen--boot.is-active,
.screen--menu.is-active,
.screen--game.is-active {
  display: grid;
  place-items: center;
  padding: 16px;
}

.screen.is-entering > * { animation: screenIn .3s cubic-bezier(.2, .9, .3, 1); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* -- Boot ---------------------------------------------------- */

.boot { text-align: center; width: min(320px, 82vw); }

/* Four blocks that drop in like a piece landing */
.boot__logo, .menu__logo {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  width: 62px;
  margin: 0 auto 18px;
}
.boot__logo span, .menu__logo span {
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--accent);
  animation: blockDrop 1.6s cubic-bezier(.2, 1.4, .4, 1) infinite;
  animation-delay: calc(var(--i) * .11s);
}
.boot__logo span:nth-child(2), .menu__logo span:nth-child(2) { background: #a855f7; }
.boot__logo span:nth-child(3), .menu__logo span:nth-child(3) { background: #f97316; }
.boot__logo span:nth-child(4), .menu__logo span:nth-child(4) { background: #4ade80; }
@keyframes blockDrop {
  0%, 60%, 100% { transform: translateY(0);     opacity: 1;   }
  20%           { transform: translateY(-11px); opacity: .55; }
}

.boot__title {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: .34em;
  text-indent: .34em;
  text-transform: uppercase;
  color: var(--text);
}
.boot__sub {
  margin: 0 0 26px;
  font-size: 10px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--dim);
}

.boot__bar {
  height: 5px;
  background: #0d1424;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--edge-soft);
}
.boot__fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition: width .25s ease;
}
.boot__status {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--dim);
  min-height: 1.2em;
}

/* -- Main menu ----------------------------------------------- */

.menu { width: min(340px, 86vw); text-align: center; }

.menu__head { margin-bottom: 26px; }
.menu__title {
  margin: 0 0 6px;
  font-size: clamp(30px, 9vw, 40px);
  letter-spacing: .3em;
  text-indent: .3em;
  text-transform: uppercase;
}
.menu__tag { margin: 0; font-size: 12px; color: var(--dim); }

.menu__nav { display: grid; gap: 9px; }

.mbtn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 13px 15px;
  cursor: pointer;
  transition: transform .12s ease, border-color .15s, background .15s;
}
.mbtn:hover {
  border-color: rgba(76, 201, 240, .55);
  background: #18223a;
  transform: translateX(3px);
}
.mbtn:active { transform: scale(.985); }

.mbtn__icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  height: 30px;
  font-size: 13px;
  border-radius: 8px;
  background: rgba(76, 201, 240, .12);
  color: var(--accent);
}
.mbtn__label { display: flex; flex-direction: column; gap: 2px; }
.mbtn__label em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--dim);
}

.mbtn--primary { background: #16243c; border-color: rgba(76, 201, 240, .4); }
.mbtn--primary:hover { background: #1b2c48; }
.mbtn--primary .mbtn__icon { background: var(--accent); color: var(--accent-ink); }

.mbtn--danger { margin-top: 4px; border-color: rgba(248, 113, 113, .3); }
.mbtn--danger .mbtn__icon { background: rgba(248, 113, 113, .14); color: var(--lose); }
.mbtn--danger:hover { border-color: rgba(248, 113, 113, .6); }

.menu__foot {
  margin-top: 22px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--dim);
}
.menu__foot strong {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0;
  color: var(--accent);
}

/* -- Sub-pages: help, scores, settings ----------------------- */

.page {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 0 16px calc(28px + env(safe-area-inset-bottom));
}

.page__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 12px;
  background: var(--bg);
}
.page__head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.back {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  font: inherit; font-size: 22px; line-height: 1;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.back:hover { background: #1d2740; border-color: rgba(76, 201, 240, .5); }

.page__body { display: grid; gap: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card--flush { padding: 4px 16px; }

.card h3 {
  margin: 0 0 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
}
.card p { margin: 0; font-size: 13px; line-height: 1.65; color: #c3cde0; }
.card b { color: var(--text); }

.note { margin-top: 10px !important; font-size: 11.5px !important; color: var(--dim) !important; }

.bullets { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.75; color: #c3cde0; }
.bullets b { color: var(--text); }

/* definition rows used by the control lists */
.kv { margin: 0; display: grid; gap: 7px; }
.kv > div {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}
.kv dt {
  flex: 0 0 104px;
  display: flex;
  gap: 4px;
  align-items: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
}
.kv dd { margin: 0; color: #c3cde0; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left;
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  padding: 8px 6px;
  border-bottom: 1px solid var(--edge);
}
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--edge-soft); color: #c3cde0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child, .tbl th:first-child { padding-left: 0; }
.tbl td:last-child,  .tbl th:last-child  { padding-right: 0; text-align: right; }

.tbl--scores td:nth-child(2) {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
}
.tbl--scores tr.is-top td:nth-child(2) { color: var(--accent); }
.tbl--scores td:first-child { color: var(--dim); width: 26px; }
.tbl--scores .won::after {
  content: "WON";
  margin-left: 7px;
  font-size: 8px;
  letter-spacing: .1em;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(74, 222, 128, .16);
  color: var(--win);
  vertical-align: middle;
}

.empty {
  padding: 22px 0;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
}

.best-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  border-radius: var(--radius);
  background: #16243c;
  border: 1px solid rgba(76, 201, 240, .28);
}
.best-hero__label {
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--dim);
}
.best-hero__value {
  font-family: var(--mono);
  font-size: 34px;
  color: var(--accent);
}

/* -- Settings controls --------------------------------------- */

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--edge-soft);
  cursor: pointer;
}
.row:last-child { border-bottom: 0; }

.row__text { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.row__text em { font-style: normal; font-size: 11px; color: var(--dim); }

/* checkbox styled as a switch */
.sw {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 44px; height: 25px;
  margin: 0;
  border-radius: 99px;
  background: #0d1424;
  box-shadow: inset 0 0 0 1px var(--edge);
  position: relative;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease;
}
.sw::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: #5a6784;
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1), background .2s;
}
.sw:checked {
  background: #16344a;
  box-shadow: inset 0 0 0 1px rgba(76, 201, 240, .6);
}
.sw:checked::after { transform: translateX(19px); background: var(--accent); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: flex; gap: 6px; }
.seg__btn {
  flex: 1;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--dim);
  background: #0d1424;
  border: 1px solid var(--edge);
  border-radius: 9px;
  padding: 9px 0;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.seg__btn:hover { color: var(--text); border-color: rgba(76, 201, 240, .4); }
.seg__btn[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   Game screen
   ============================================================ */

.game {
  display: grid;
  grid-template-columns: 168px auto 168px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "hold  board next"
    "stats board next";
  gap: 14px;
  align-items: start;
}

.panel--hold  { grid-area: hold;  }
.panel--stats { grid-area: stats; }
.panel--next  { grid-area: next;  }
.board-wrap   { grid-area: board; }
.pad          { display: none;    }

/* -- Panels -------------------------------------------------- */

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 12px;
}

.panel__title {
  margin: 0 0 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}

.mini {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--field);
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px var(--edge-soft);
}
.mini--tall { aspect-ratio: 1 / 2.3; }

/* Hold flashes when you swap */
.panel--hold.flash { animation: panelFlash .32s ease-out; }
@keyframes panelFlash {
  0%   { box-shadow: 0 0 0 0 rgba(76, 201, 240, .55); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 14px rgba(76, 201, 240, 0); border-color: var(--edge); }
}

/* -- Stats --------------------------------------------------- */

.stats { margin: 0; }

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--edge-soft);
}
.stat:last-child { border-bottom: 0; }

.stat dt {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}
.stat dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  transition: color .3s ease;
}

.stat dd.bump { animation: bump .34s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump {
  0%   { transform: scale(1)    translateY(0);    color: var(--accent); }
  35%  { transform: scale(1.28) translateY(-2px); color: #fff;          }
  100% { transform: scale(1)    translateY(0);    color: var(--text);   }
}

/* -- Goal meter ---------------------------------------------- */

.goal { margin-top: 10px; }
.goal__label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}
.goal__label span:last-child { font-family: var(--mono); letter-spacing: 0; }

.goal__track {
  position: relative;
  height: 7px;
  background: var(--field);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--edge-soft);
}
.goal__fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition: width .45s cubic-bezier(.2, .9, .3, 1);
}

/* -- Pause button in the Next panel -------------------------- */

.sound {
  margin-top: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  background: #10243a;
  border: 1px solid rgba(76, 201, 240, .3);
  border-radius: 8px;
  padding: 7px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.sound:hover { background: #16344a; }

/* -- Board --------------------------------------------------- */

.board-wrap {
  position: relative;
  aspect-ratio: 1 / 2;
  /* Height-driven on desktop so the board always fits the window. */
  height: min(620px, calc(100vh - 48px));
  will-change: transform;   /* screen shake is written here from JS */
}

.board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #080d1a;
  border-radius: var(--radius);
}

/* Frame that reacts to danger, drawn over the canvas edge */
.board-frame {
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 1px);
  border: 1px solid var(--edge);
  pointer-events: none;
  transition: box-shadow .3s ease, border-color .3s ease;
  z-index: 2;
}
.board-wrap.danger .board-frame {
  border-color: rgba(248, 113, 113, .65);
  animation: danger 1s ease-in-out infinite;
}
@keyframes danger {
  0%, 100% { box-shadow: inset 0 0 30px rgba(248, 113, 113, .14); }
  50%      { box-shadow: inset 0 0 60px rgba(248, 113, 113, .36); }
}

/* -- Overlay ------------------------------------------------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(8, 12, 22, .92);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: overlayIn .25s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.overlay__card {
  max-width: 280px;
  animation: cardIn .38s cubic-bezier(.2, 1.3, .35, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

.overlay__title {
  margin: 0 0 8px;
  font-size: clamp(24px, 6.5vw, 32px);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.overlay[data-state="pause"] .overlay__title { color: var(--accent); }
.overlay[data-state="win"]   .overlay__title { color: var(--win);  animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.overlay[data-state="lose"]  .overlay__title { color: var(--lose); animation: shakeIn .45s ease-out; }

@keyframes pop {
  0%   { transform: scale(.6); opacity: 0; }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes shakeIn {
  0%, 100% { transform: translateX(0);    }
  20%      { transform: translateX(-9px); }
  45%      { transform: translateX(7px);  }
  70%      { transform: translateX(-4px); }
}

.overlay__msg {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--dim);
}

.overlay__actions { display: grid; gap: 8px; justify-items: center; }

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 99px;
  padding: 11px 22px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover  { filter: brightness(1.08); }
.btn:active { transform: scale(.95); }

.btn--ghost {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--edge);
  padding: 9px 18px;
  font-weight: 600;
}
.btn--ghost:hover { color: var(--text); border-color: var(--accent); filter: none; }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: #1a2338;
  border: 1px solid #2c3854;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text);
}

/* -- Touch pad ----------------------------------------------- */

.pad__btn {
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 0;
  height: 100%;
  min-height: 38px;
  cursor: pointer;
  transition: transform .08s ease, background .08s ease;
}
.pad__btn:active { transform: translateY(2px); background: #1e2a44; }
.pad__btn--alt  { font-size: 12px; letter-spacing: .1em; color: var(--dim); }
.pad__btn--drop {
  font-size: 14px;
  letter-spacing: .18em;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}
.pad__btn--drop:active { background: #3bb4da; }

/* -- Accessibility helper ------------------------------------ */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet and narrow desktop: shrink the rails before the board. */
@media (max-width: 900px) {
  .game { grid-template-columns: 132px auto 132px; gap: 10px; }
  .stat dd { font-size: 15px; }
}

/* ------------------------------------------------------------
   Phones. The game screen becomes a full-height column:

       row 1  auto           HUD strip: hold | stats | next
       row 2  minmax(0, 1fr) board, fills whatever is left
       row 3  auto           control pad

   The board takes the middle row's height and derives its own
   width from the 1:2 aspect ratio, so the HUD and every control
   stay on screen at any phone size, with no shared constant.
   ------------------------------------------------------------ */
@media (max-width: 720px), (pointer: coarse) and (max-width: 900px) {
  .screen--game.is-active { display: block; padding: 0; }

  .game {
    width: 100%;
    max-width: 520px;
    height: 100vh;                 /* fallback for engines without dvh */
    height: 100dvh;                /* dvh: survives the collapsing URL bar */
    margin: 0 auto;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "hold  stats next"
      "board board board"
      "pad   pad   pad";
    gap: 8px;
    align-items: stretch;
  }

  .board-wrap {
    height: 100%;                  /* fills the 1fr row */
    width: auto;
    max-width: 100%;
    aspect-ratio: 1 / 2;
    margin: 0 auto;
    align-self: center;
    justify-self: center;
  }

  .pad {
    display: grid;
    grid-area: pad;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(38px, 1fr);
    gap: 6px;
    max-height: 148px;
  }
  .pad__btn--alt  { grid-column: span 2; }
  .pad__btn--drop { grid-column: span 4; }

  .panel { padding: 8px; }
  .panel__title { font-size: 9px; margin-bottom: 6px; letter-spacing: .16em; }

  .panel--hold { width: 70px; }
  .panel--next { width: 124px; }
  .mini        { width: 100%; aspect-ratio: 1 / 1; }
  .mini--tall  { aspect-ratio: 3 / 1.05; }   /* JS lays the queue out sideways */

  .stat    { padding: 2px 0; }
  .stat dt { font-size: 9px; }
  .stat dd { font-size: 14px; }
  .goal    { margin-top: 6px; }

  .sound { margin-top: 7px; font-size: 9px; padding: 5px; }
  .sound__text { display: none; }

  .page { padding: 0 12px calc(24px + env(safe-area-inset-bottom)); }
  .kv dt { flex: 0 0 86px; }
  .best-hero__value { font-size: 28px; }
  .overlay__msg { font-size: 12px; }
}

/* Very short phones: trim the HUD so the board keeps a usable size. */
@media (max-height: 700px) and (max-width: 720px) {
  .panel--hold { width: 58px; }
  .panel--next { width: 110px; }
  .stat dd { font-size: 13px; }
  .pad { max-height: 122px; gap: 5px; }
}

/* Landscape phones: pad beside the board instead of under it. */
@media (max-height: 560px) and (orientation: landscape) {
  /* The portrait block above may not have matched (wide viewport, fine
     pointer), so claim the full screen here too rather than inheriting the
     centred, padded desktop shell and overflowing it. */
  .screen--game.is-active { display: block; padding: 0; }

  .game {
    max-width: none;
    height: 100vh;
    height: 100dvh;
    /* Landscape notches eat the sides, so respect the safe area there too. */
    padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "hold  board pad"
      "stats board next";
    gap: 8px;
    align-items: stretch;
  }
  .panel--hold, .panel--next { width: 104px; }
  .mini--tall { aspect-ratio: 3 / 1.05; }
  .board-wrap { height: 100%; width: auto; max-width: 100%; align-self: center; margin: 0 auto; }
  .pad {
    display: grid;              /* the phone block may not have matched here */
    grid-area: pad;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(34px, 1fr);
    max-height: none;
    align-content: start;
  }
  .pad__btn--alt, .pad__btn--drop { grid-column: span 2; }
}

@media (prefers-reduced-motion: reduce) {
  .boot__logo span, .menu__logo span { animation: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
