/* One visible playfield. The board, canvas and release button keep their original
   elements during rotation, so the same pointer and shot remain in progress. */
.wheel-match { --play-height: 100vh; }
@supports (height: 100svh) {
  .wheel-match { --play-height: 100svh; }
}
@media (max-width: 680px), (max-width: 1000px) and (max-height: 540px) {
  .wheel-match .mast {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .wheel-match .mast-inner { min-height: 44px; padding-block: 0; flex-wrap: nowrap; }
  .wheel-match .wordmark { font-size: 18px; }
  .wheel-match .mast nav { flex-wrap: nowrap; gap: 3px; }
  .wheel-match .nav-button { min-width: 44px; }
  .wheel-match .nav-button > [aria-hidden] { font-size: 19px; }
  .wheel-match .nav-button:first-child > [aria-hidden] { width: 20px; line-height: 18px; }
  .wheel-match .nav-button > [data-i18n] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .wheel-match main {
    display: flex;
    flex-direction: column;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .wheel-match #storageNotice { order: 1; }
  .wheel-match .match { display: flex; flex-direction: column; padding-block: 5px 14px; }
  .wheel-match .match-title { order: 1; margin: 14px 4px 0; }
  .wheel-match .play-grid {
    /* Budget for the two illustrations after navigation, turn, gutters and Shoot. */
    --available: calc(var(--play-height) - 155px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    --board-size: calc(var(--available) * .54);
    --wheel-size: calc(var(--available) * .43);
    width: 100%;
    padding: 6px;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: var(--cream);
    gap: 5px 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "player round"
      "board board"
      "stage stage"
      "fire fire"
      "forecast forecast"
      "sliders sliders"
      "bag bag"
      "status status"
      "wheelhead wheelhead"
      "hint hint"
      "maphead maphead"
      "dock dock"
      "roster roster";
  }
  .wheel-match :is(.board-card, .turn-panel, #turn, #wheelDock, .wild-wheel) { display: contents; }
  .wheel-match #turn > h2 {
    grid-area: player;
    align-self: center;
    margin: 0;
    padding-inline: 2px;
    font-size: 17px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .wheel-match #turn > .eyebrow {
    grid-area: round;
    justify-self: end;
    align-self: center;
    background: var(--lilac);
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0;
  }
  .wheel-match .mode-name { display: none; }
  .wheel-match .board {
    grid-area: board;
    justify-self: center;
    width: min(100%, var(--board-size));
  }
  .wheel-match .token { font-size: clamp(10px, calc(var(--board-size) * .052), 18px); }
  .wheel-match .wild-wheel[data-scene] .wild-wheel-stage {
    grid-area: stage;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .wheel-match .wild-wheel-stage canvas {
    width: min(100%, 322px, var(--wheel-size));
    margin-inline: auto;
  }
  .wheel-match .wild-wheel-fire { grid-area: fire; min-height: 44px; }
  .wheel-match .wild-wheel-prediction { grid-area: forecast; }
  .wheel-match .wild-wheel-sliders { grid-area: sliders; }
  .wheel-match .wheel-bag { grid-area: bag; }
  .wheel-match .turn-status { grid-area: status; }
  .wheel-match .wild-wheel-header { grid-area: wheelhead; }
  .wheel-match .wild-wheel > .hint { grid-area: hint; }
  .wheel-match .board-heading { grid-area: maphead; margin: 6px 0 0; }
  .wheel-match .board-foot { grid-area: dock; margin: 0; }
  .wheel-match .roster { grid-area: roster; margin-top: 4px; }
}

@media (orientation: landscape) and (max-width: 1000px) and (max-height: 540px) {
  .wheel-match .play-grid {
    --board-size: calc(var(--play-height) - 94px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    --wheel-size: calc((var(--play-height) - 146px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .94);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "player round"
      "board stage"
      "board fire"
      "maphead forecast"
      "dock sliders"
      "status bag"
      "roster wheelhead"
      "roster hint";
  }
}
