/* Release pass: readable instructions and stable first-screen actions.
 * Keep browser zoom available; prevent rotation from independently inflating text. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 480px) {
  .masthead .wordmark { min-height: 44px; }
  .game-screen .module-instruction { font-size: 13px; line-height: 1.5; }
  .game-screen .pressure-panel #radio-text { font-size: 14px; line-height: 1.45; }
  .field-narrator .pressure-action #threat-detail { font-size: 13px; line-height: 1.45; }
  .game-screen .instruction-tag { font-size: 13px; line-height: 1.5; }
  .game-screen .note-readout .note-footer,
  .game-screen .note-readout .note-percent { font-size: 12px; }
  .game-screen .tool-card > b { font-size: 13px; }
  .game-status { padding-top: max(5px, env(safe-area-inset-top)); }
  .home-screen .commander-brief p { font-size: 13px; line-height: 1.5; }
  .home-screen .music-kit-choice button { font-size: 13px; }
  .home-screen .home-copy .tagline { font-size: 13px; }
  .audio-settings {
    inset: max(54px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) auto auto;
    max-height: calc(100dvh - 72px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
  }
  .audio-settings-title { position: sticky; top: -12px; z-index: 1; background: #24353c; }
  .audio-settings label { min-height: 56px; }
  .audio-settings small { font-size: 12px; }
  .retake-command p, .retake-support p { font-size: 13px; line-height: 1.4; }
  .retake-action-bar > div > span { font-size: 12px; line-height: 1.4; }
  .retake-entry { font-size: 13px; }
  .retake-arena-label { font-size: 12px; }
  /* Play again stays before the optional online account/score block. */
  .result-screen .result-actions { order: 1; }
  .result-screen .result-ranking { order: 2; margin: 8px 0; text-align: left; }
  .result-screen .result-stats { order: 3; }
  .result-screen .combat-summary { order: 4; }
  .result-screen .friend-reaction { order: 5; }
  .result-screen .result-rank-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .result-screen .result-rank-actions:has([data-rank-submit][hidden]) { grid-template-columns: minmax(0,1fr); }
  .result-screen .result-ranking button { min-height: 48px; }
  .result-screen .rank-card > div > span { overflow-wrap: anywhere; }
  .leaderboard-intro, .rank-player-name { font-size: 13px; }
  .leaderboard-entry small { font-size: 12px; }
  .leaderboard-disclaimer { font-size: 12px; }
  #instructions .rules span { font-size: 14px; }
}
@media (orientation: landscape) and (max-height: 480px) and (max-width: 1000px) {
  /* Explicit grid positions avoid an empty half-row after adding the account bar. */
  .home-screen .home-copy { grid-column: 1; grid-row: 1; order: 0; }
  .home-screen .home-visual { grid-column: 2; grid-row: 1; order: 0; }
  .home-screen .online-panel { grid-column: 1 / -1; grid-row: 2; order: 0; }
  .home-screen .music-kit { grid-column: 1 / -1; grid-row: 3; order: 0; }
  .result-screen .result-ranking { grid-column: 1 / -1; grid-row: 5; }
  .result-screen :is(.result-actions,.result-stats,.combat-summary,.friend-reaction) { order: 0; }
  /* A whole scrap, including both handwritten lines, fits below the pinned clock. */
  .game-screen .password-note { min-height: 154px; padding: 12px 16px; }
  .game-screen .note-code-window { margin: 6px 0; min-height: 40px; }
}
@media (orientation: landscape) and (max-height: 480px) and (max-width: 700px) {
  .home-screen { display: flex; flex-direction: column; padding-top: 8px; }
  .home-screen > * { width: 100%; }
  .home-screen .home-copy { min-height: 0; padding: 48px 16px 16px; }
  .home-screen .mission-copy { display: grid; grid-template-columns: minmax(0,1fr) 160px; column-gap: 18px; align-items: center; }
  .home-screen .mission-side, .home-screen .home-copy h1, .home-screen .tagline { grid-column: 1; }
  .home-screen .home-copy h1 { margin: 6px 0 8px; }
  .home-screen .mission-time { font-size: 48px; }
  .home-screen .mission-title { font-size: 30px; }
  .home-screen .home-actions { grid-column: 2; grid-row: 1 / 4; grid-template-columns: minmax(0,1fr); gap: 10px; margin: 0; }
  .home-screen .home-actions .button { min-height: 48px; padding: 8px 12px; }
  .home-screen .online-panel { order: 1; }
  .home-screen .home-visual { order: 2; }
  .home-screen .music-kit { order: 3; }
  .flash-retake-screen { column-gap: 10px; }
  .flash-retake-screen .retake-round-strip { margin-bottom: 6px; }
  .flash-retake-screen .retake-mission h1 { font-size: 21px; }
  .flash-retake-screen .retake-mission { margin-bottom: 5px; }
  .flash-retake-screen .retake-arena { height: 210px; }
  .flash-retake-screen .retake-support { grid-column: 1 / -1; grid-row: 8; }
  .flash-retake-screen .retake-action-bar { flex-wrap: wrap; gap: 6px; }
  .flash-retake-screen .retake-entry { width: 100%; }
}
