/* The heading, coach and tools occupy their own grid tracks. */
.game-shell,
.game-shell:has(>.member-bar) {
  --top-inset: max(4px, env(safe-area-inset-top));
  --side-inset: max(6px, env(safe-area-inset-left));
  height: 100svh;
  height: 100dvh;
  padding: var(--top-inset) max(6px, env(safe-area-inset-right))
    max(4px, env(safe-area-inset-bottom)) var(--side-inset);
  margin-inline: auto;
  grid-template-areas: "brand" "heading" "stage" "tools";
  grid-template-rows: 44px auto minmax(0, 1fr) auto;
  row-gap: 2px;
}

.game-shell > .wordmark {
  grid-area: brand;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  font-size: 13px;
  letter-spacing: .4px;
  white-space: nowrap;
}

.game-shell > .member-bar {
  grid-area: brand;
  justify-self: end;
  justify-content: flex-end;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.game-shell > .header { grid-area: heading; }
.game-shell > .stage-wrap { grid-area: stage; }
.game-shell > .controls { grid-area: tools; }

.game-shell .title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  margin: 0 0 4px;
}

.game-shell .title-row h1 {
  justify-self: start;
  font-size: clamp(22px, 6vw, 30px);
  letter-spacing: .2px;
  margin: 0;
}

.game-shell .title-row h1:is(:lang(en), :lang(ja)) {
  font-size: 18px;
  line-height: 1.15;
  white-space: normal;
}

.game-shell .title-row h1:lang(en) > span::before {
  content: " ";
  white-space: pre;
}

.game-shell .scoreboard .mode-pill {
  align-self: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  font-size: 11px;
  white-space: nowrap;
}

.game-shell .top-actions { position: static; gap: 4px; }
.game-shell .scoreboard { gap: 4px; }
.game-shell .scoreboard,
.game-shell .score-card { min-height: 50px; }
.game-shell .score-card,
.game-shell .score-card.best { min-width: 0; padding: 2px 4px; }
.game-shell .score-card.best #record-gap {
  white-space: normal;
  overflow-wrap: anywhere;
}
.game-shell .next-card { width: min(22%, 86px); }
.game-shell .next-card > span { left: 5px; top: 2px; }

.game-shell #next-preview { padding-top: 8px; }
.game-shell .member-bar .member-open { min-height: 44px; }

.game-shell .stage-wrap {
  height: min(100%, calc((100vw - 12px) * 590 / 420), 590px);
  max-width: 100%;
}

.game-shell .controls {
  max-width: 100%;
  padding: 0;
}
.game-shell .controls .chef {
  grid-template-rows: minmax(22px, auto) minmax(16px, auto);
  row-gap: 1px;
  margin: 0 0 2px;
}
.game-shell .controls .chef #chef-line { padding-block: 2px; }
.game-shell .controls .chef #instruction { min-height: 16px; line-height: 16px; }
.game-shell .control-row { gap: 5px; }
.game-shell .footer-links {
  gap: 3px;
  padding: 0;
}
.game-shell .footer-links > :is(button, a) {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding-inline: 5px;
  touch-action: manipulation;
}
.game-shell .footer-links > span:not(.version) { display: none; }
.modal-panel .close-btn,
.modal-panel .text-btn { min-width: 44px; min-height: 44px; }

/* The lower margin contains the bowl rim and the remaining-ingredients label.
   Shift the label up over the front face when the handset is turned sideways. */
@media (orientation: landscape) and (max-height: 460px) and (min-width: 700px) {
  .game-shell,
  .game-shell:has(>.member-bar) {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 37%);
    grid-template-areas: "stage brand" "stage heading" "stage tools" "stage .";
    grid-template-rows: 44px auto auto minmax(0, 1fr);
    column-gap: 12px;
  }

  .game-shell .title-row h1 { font-size: 23px; }
  .game-shell .stage-wrap {
    aspect-ratio: 420 / 570;
    overflow: hidden;
  }
  .game-shell canvas {
    position: absolute;
    inset: -2.1% 0 auto;
    height: 103.51%;
  }
  .game-shell .round-info { bottom: 18px; }
}

@media (max-width: 380px) {
  .game-shell > .wordmark small { display: none; }
}

@media print {
  .game-shell .footer-links > :is(button, a) { display: none; }
}
