/* Reserve space for the stake and primary action in a Telegram game frame.
   Short viewports keep secondary results, rules and replays accessible by scrolling. */
@media (max-width: 720px) {
  .game-heading, .room-head, .marquee {
    min-height: clamp(48px, 10dvh, 88px);
    padding: 5px 10px;
    margin-block: 0 6px;
  }
  :is(.game-heading,.room-head,.marquee) h1 {
    font-size: clamp(24px, min(7vw,5dvh), 38px);
    line-height: 1.05;
    margin-block: 0;
  }
  .room-head { gap: 2px; }
  .room-head .game-links button { min-height: 32px; }
  #game .game-layout, .room .workbench { gap: 6px; }
  .arena, .room, main#game { padding-top: 4px; }
  .arena { margin-block-start: 0; }
  .arena .game-kicker { margin: 0; }
  .top-inner, .bar-inner, .mast-inner, .masthead-inner {
    min-height: 40px;
    height: auto;
    padding-block: 3px;
  }
  /* Cap the square pitch and vault dial without changing their geometry. */
  .game-layout .screen-frame {
    width: min(100%, clamp(180px, calc(100dvh - 360px), 500px));
    margin-inline: auto;
  }
  .room .dial-well { width: min(100%, clamp(150px, 32dvh, 355px)); }
  .game .cast { width: min(100%, max(195px, calc((100dvh - 321px) * 1.48))); margin-inline: auto; }
  :is(#spin,#action) { height: clamp(44px,8dvh,66px); min-height: 44px; }
}
@media (max-width: 720px) and (max-height: 600px) {
  .game-heading, .room-head, .marquee { min-height: 46px; }
  .room-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .room-head h1 { align-self: center; }
  .room-head .game-links { margin: 0; }
  .game-layout .mapbox { grid-row: auto; }
}

@media (orientation: landscape) and (max-height: 550px) {
  .top-inner,.bar-inner,.mast-inner,.masthead-inner {height:36px;min-height:36px;padding-block:1px;}
  main#game,.room,.arena,main.game { padding: 2px 6px 8px; margin: 0 auto; }
  .game-heading,.marquee,.room-head {
    min-height: 38px; padding: 3px 8px; margin-block:0 4px;
  }
  .game-heading h1,.marquee h1,.room-head h1 {font-size:25px; line-height:1; margin:0;}
  .room-head { display:flex; justify-content:space-between; align-items:center; }
  .room-head .game-links { margin:0; }
  .workbench, .game-layout, .arena .cabinet { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:8px;align-items:start; }
  .room .dial-well { width:min(100%,max(136px,calc(100dvh - 170px))); }
  .game-layout .screen-frame { width:min(100%,max(138px,calc(100dvh - 158px))); margin-inline:auto; }
  .game-layout .sideline {display:flex;flex-direction:column;gap:4px;}
  .game-layout .sideline .mapbox { order:1; }
  .game-layout .bankroll,.game-layout .actions { padding:4px; margin:0; }
  .game-layout .actions {display:grid;grid-template-columns:1fr;gap:4px;}
  .arena .wallet-stats,.arena .play-controls {padding:4px; margin:0;}
  .arena .console {display:block; }
  .arena .play-controls {display:flex; flex-wrap:wrap;gap:4px; }
  .arena .game-kicker {font-size:8px; line-height:1; margin:0;}

  :is(#spin,#skip,#action,#step) { min-height:44px; height:44px; }
  .game .cabinet {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    align-items: start;
    gap: 3px 7px;
    max-width: 850px;
    width: 100%;
  }
  .game .cast {
    grid-area: 1 / 1 / 4 / 2;
    width: min(100%, calc((100dvh - 113px) * 1.35));
    max-width: none;
    margin-block: 0;
  }
  .game .crown-rack,.game .message-rail,.game .console { grid-column: 2; width: 100%; min-width: 0; margin: 0; }
  .game .console { display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:4px; }
  .game .console .stake-block,.game .console .spin-well {grid-column:1 / -1;}

  main.game { width:min(98vw,900px); }
  .game .crown-rack { display:flex; flex-wrap:wrap; justify-content:space-around; gap:4px; }
  .game .reel-window { aspect-ratio:1.64; }
  .game .message-rail { min-height:24px; padding-block:2px; }
}
