/* Native mobile title menu — conversational card under the wordmark.
 * Compresses to fit the viewport (no page scroll, no inner scroll).
 * Landscape (~844×390) keeps Solo / Online on one row.
 */

html.is-touch #title-screen[data-page="home"] {
  justify-content: center;
  overflow: hidden;
}

html.is-touch .mpage[data-for="home"] {
  width: 100%;
  max-width: none;
  min-height: 0;
  max-height: 100%;
  padding:
    calc(var(--home-stack-pad-top, 8px) + env(safe-area-inset-top, 0px))
    max(10px, env(safe-area-inset-right, 0px))
    var(--home-stack-pad-bottom, calc(40px + env(safe-area-inset-bottom, 0px)))
    max(10px, env(safe-area-inset-left, 0px));
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

html.is-touch .mpage[data-for="home"] .game-title {
  width: max-content;
  max-width: 92vw;
  margin: 0;
  text-align: center;
  line-height: .92;
}

html.is-touch .mpage[data-for="home"] .gt-main {
  font-size: var(--home-title-size, clamp(32px, 9vw, 48px));
}

html.is-touch .mpage[data-for="home"] .game-title small {
  display: block;
  margin-top: .12em;
  letter-spacing: .55em;
  font-size: .34em;
}

html.is-touch .site-strip {
  width: min(720px, 100%);
  gap: 6px;
  margin: var(--home-stack-gap, 6px) auto 0;
}
html.is-touch .site-card {
  min-height: var(--home-card-h, 48px);
  padding: 6px 8px;
  min-width: 0;
}
html.is-touch .site-intel { font-size: 10px; line-height: 1.3; }

html.is-touch .mpage[data-for="home"] .subtitle {
  width: 100%;
  margin: 4px 0;
  text-align: center;
  text-indent: 0;
  font-size: clamp(10px, 2.6vw, 13px);
  letter-spacing: .2em;
  color: var(--tone-8f989f);
  opacity: .9;
}

html.is-touch .mobile-menu,
html.is-touch .menu-grid {
  display: flex;
  flex-direction: column;
  gap: var(--home-stack-gap, 6px);
  width: min(720px, 100%);
  margin: var(--home-stack-gap, 6px) auto 0;
}

html.is-touch .menu-grid .mrow {
  display: grid;
}

html.is-touch .menu-grid .mtile {
  min-height: var(--home-tile-h, 44px);
  padding: 8px 12px;
  font-size: clamp(13px, 3.2vw, 16px);
}

html.is-touch .menu-grid .mtile.ghost {
  min-height: 44px;
  padding: 8px 12px;
}

html.is-touch .menu-grid .mtile:active {
  transform: scale(.992);
  filter: brightness(.94);
}

@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch #title-screen[data-page="home"] .mpage[data-for="home"] {
    display: flex;
    flex-direction: column;
    padding-top: calc(4px + env(safe-area-inset-top, 0px));
    padding-bottom: var(--home-stack-pad-bottom, 36px);
  }

  html.is-touch #title-screen .mpage[data-for="home"] .subtitle,
  html.is-touch #title-screen .mpage[data-for="home"] .site-intel,
  html.is-touch #title-screen .mpage[data-for="home"] .site-strip-note {
    display: none;
  }
  html.is-touch .menu-grid .mtile {
    min-height: 52px;
    padding: 6px 10px;
    font-size: clamp(12px, 2.6vw, 14px);
  }
  html.is-touch #title-screen[data-page="home"] .ask-answers .mrow-ask .mt-note {
    display: block !important;
    font-size: 10px;
    line-height: 1.25;
    min-height: 0;
  }
}

/* Corner readouts: tuck into safe-area, stay out of the menu list. */
html.is-touch #title-screen[data-page="home"] .best-line.corner-stat,
html.is-touch #title-screen[data-page="home"] #studio-credit.corner-stat {
  font-size: 9px;
  letter-spacing: .1em;
  line-height: 1.5;
  opacity: .72;
  bottom: max(4px, env(safe-area-inset-bottom, 0px));
}

html.is-touch #title-screen[data-page="home"] .best-line.corner-stat {
  left: max(6px, env(safe-area-inset-left, 0px));
  max-width: 46vw;
}

html.is-touch #title-screen[data-page="home"] #studio-credit.corner-stat {
  right: max(6px, env(safe-area-inset-right, 0px));
  max-width: 46vw;
}

@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch #title-screen[data-page="home"] .best-line.corner-stat,
  html.is-touch #title-screen[data-page="home"] #studio-credit.corner-stat {
    font-size: 8px;
    max-width: 38vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.is-touch .menu-grid .mtile {
    transition-duration: .01ms;
  }
}

/* ---------------------------------------------------------------------------
   Co-op — one clear path per card; cut the essay copy on glass.
   --------------------------------------------------------------------------- */
html.is-touch .mpage[data-for="coop"] {
  width: 100%;
  max-width: none;
  align-items: stretch;
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
}

html.is-touch .mpage[data-for="coop"] .mpage-title {
  margin: 6px 0 4px;
  font-size: clamp(22px, 6vw, 30px);
}

html.is-touch .mpage[data-for="coop"] > .menu-col {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: 100%;
  max-width: none;
  margin: 0;
  padding:
    12px max(10px, env(safe-area-inset-right, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
  background: linear-gradient(
    180deg,
    rgba(4, 6, 9, 0),
    rgba(4, 6, 9, .94) 28%,
    rgba(4, 6, 9, .98)
  );
}

html.is-touch .mpage[data-for="coop"] > .menu-col .mbtn {
  width: min(520px, 100%);
  min-width: 0;
  margin: 0 auto;
}

/* Clear the fixed Back dock so Host / Join never sit under it. */
html.is-touch .mpage[data-for="coop"] {
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

html.is-touch .cc-status {
  margin-top: 8px;
  margin-bottom: 4px;
  max-width: min(520px, 100%);
}

html.is-touch .cc-check span {
  font-size: 12px;
  line-height: 1.35;
}

@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch .mpage[data-for="coop"] .mpage-title {
    margin: 2px 0 2px;
    font-size: clamp(18px, 5vh, 24px);
  }
  html.is-touch .cc-check {
    min-height: 36px;
    gap: 6px;
  }
  html.is-touch .cc-check span {
    font-size: 10px;
    white-space: normal;
  }
  html.is-touch #coop-input {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 16px;
  }
  html.is-touch .mpage[data-for="coop"] {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
  html.is-touch .mpage[data-for="coop"] > .menu-col {
    padding-top: 6px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  }
  html.is-touch .mpage[data-for="coop"] > .menu-col .mbtn {
    width: min(360px, 100%);
    min-height: 44px;
    font-size: 13px;
  }
  html.is-touch .cc-status {
    margin-top: 4px;
    font-size: 10px;
  }
}

/* ---------------------------------------------------------------------------
   Loadout / night — readable cards, cosmetics not crushed, Back always clear.
   --------------------------------------------------------------------------- */
html.is-touch .mpage[data-for="loadout"],
html.is-touch .mpage[data-for="night"] {
  width: 100%;
  max-width: none;
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(10px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

html.is-touch .mpage[data-for="loadout"] .mpage-title,
html.is-touch .mpage[data-for="night"] .mpage-title {
  margin: 6px 0 8px;
  font-size: clamp(18px, 5.2vw, 28px);
  letter-spacing: .22em;
}

html.is-touch #cosmetic-loadout {
  width: min(520px, 100%);
  margin: 10px auto 0;
}

html.is-touch #cosmetic-title {
  font-size: 10px;
  letter-spacing: .18em;
  margin: 0 0 8px;
}

html.is-touch #cosmetic-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

html.is-touch .cosmetic-card {
  min-height: 56px;
  padding: 10px;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
}

html.is-touch .cosmetic-swatch {
  width: 28px;
  height: 28px;
}

html.is-touch .cosmetic-name {
  font-size: 11px;
  letter-spacing: .08em;
}

html.is-touch .cosmetic-description,
html.is-touch .cosmetic-meter {
  display: none;
}

html.is-touch .cosmetic-progress {
  margin-top: 4px;
  font-size: 8px;
}

html.is-touch #cosmetic-feedback {
  min-height: 0;
  margin-top: 4px;
  font-size: 9px;
}

html.is-touch #callsign-row {
  width: min(520px, 100%);
  min-height: 48px;
  margin: 10px auto 8px;
}

html.is-touch #callsign-reroll {
  min-width: 44px;
  min-height: 44px;
}

html.is-touch .mpage[data-for="loadout"] .action-bar,
html.is-touch .mpage[data-for="treatments"] .action-bar,
html.is-touch .mpage[data-for="night"] .action-bar {
  width: 100%;
  max-width: none;
}

html.is-touch .mpage[data-for="loadout"] .action-bar .mbtn,
html.is-touch .mpage[data-for="treatments"] .action-bar .mbtn,
html.is-touch .mpage[data-for="night"] .action-bar .mbtn {
  min-height: 48px;
}

html.is-touch .mpage[data-for="loadout"] .action-bar .mbtn.back,
html.is-touch .mpage[data-for="treatments"] .action-bar .mbtn.back,
html.is-touch .mpage[data-for="night"] .action-bar .mbtn.back {
  min-width: 110px;
  flex: 0 0 110px;
}

@media (max-width: 520px) and (min-height: 501px) {
  html.is-touch #persona-grid .p-card {
    min-height: 78px;
    grid-template-columns: 80px minmax(0, 1fr);
  }
  html.is-touch .p-card .p-shot {
    min-height: 78px;
  }
  html.is-touch .p-card .p-body {
    padding: 6px 10px;
  }
  html.is-touch #cosmetic-loadout {
    margin-top: 6px;
  }
  html.is-touch .cosmetic-card {
    min-height: 48px;
    padding: 8px;
  }
}

html.is-touch #diff-grid .diff-card {
  padding: 12px 14px;
  border-left-width: 4px;
}

html.is-touch #diff-grid .dc-line {
  font-size: 12px;
  line-height: 1.35;
}

@media (orientation: landscape) and (max-height: 500px) {
  html.is-touch .mpage[data-for="loadout"],
  html.is-touch .mpage[data-for="night"] {
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
  html.is-touch .mpage[data-for="loadout"] .mpage-title,
  html.is-touch .mpage[data-for="night"] .mpage-title {
    margin: 2px 0 6px;
    font-size: 16px;
    letter-spacing: .18em;
  }
  html.is-touch #cosmetic-loadout {
    width: min(720px, 100%);
    margin-top: 6px;
  }
  html.is-touch #cosmetic-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  html.is-touch .cosmetic-card {
    min-height: 48px;
    padding: 8px;
    gap: 8px;
    grid-template-columns: 22px minmax(0, 1fr);
  }
  html.is-touch .cosmetic-swatch {
    width: 22px;
    height: 22px;
  }
  html.is-touch .cosmetic-name {
    font-size: 10px;
  }
  html.is-touch .cosmetic-progress,
  html.is-touch #cosmetic-feedback {
    display: none;
  }
  html.is-touch #callsign-row {
    width: min(560px, 72vw);
    min-height: 44px;
    margin-top: 6px;
    margin-bottom: 6px;
  }
  html.is-touch .mpage[data-for="loadout"] .action-bar,
  html.is-touch .mpage[data-for="treatments"] .action-bar,
  html.is-touch .mpage[data-for="night"] .action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    z-index: 8;
    padding-top: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  html.is-touch .mpage[data-for="loadout"] .action-bar .mbtn,
  html.is-touch .mpage[data-for="treatments"] .action-bar .mbtn,
  html.is-touch .mpage[data-for="night"] .action-bar .mbtn {
    min-height: 44px;
  }
  html.is-touch .mpage[data-for="loadout"] .action-bar .mbtn.back,
  html.is-touch .mpage[data-for="treatments"] .action-bar .mbtn.back,
  html.is-touch .mpage[data-for="night"] .action-bar .mbtn.back {
    min-width: 96px;
    flex: 0 0 auto;
  }
}

/* ---------------------------------------------------------------------------
   Credits — long legal scroll with a persistent Back dock and readable type.
   --------------------------------------------------------------------------- */
html.is-touch #title-screen[data-page="credits"],
html.is-touch #title-screen[data-page="legal"] {
  scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

html.is-touch .mpage[data-for="credits"],
html.is-touch .mpage[data-for="legal"] {
  width: 100%;
  max-width: none;
  padding:
    calc(12px + env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    calc(120px + env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  scroll-padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

html.is-touch .mpage[data-for="credits"] .mpage-title {
  margin: 4px 0 10px;
  font-size: clamp(18px, 5.4vw, 26px);
  letter-spacing: .18em;
}

html.is-touch .credits-body {
  padding: 16px 14px 28px;
}

html.is-touch .credits-body p,
html.is-touch .credits-body li {
  font-size: 13px;
  line-height: 1.65;
}

html.is-touch .legal-lead {
  margin-bottom: 16px !important;
  padding-bottom: 14px;
  font-size: 13px !important;
}

html.is-touch .legal-toc li {
  margin: 0 0 8px;
  min-height: 28px;
}

html.is-touch .legal-toc a {
  overflow-wrap: break-word;
  word-break: normal;
}

html.is-touch .legal-section {
  scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

@media (orientation: landscape) and (max-height: 500px) {
  html.is-touch .mpage[data-for="credits"] {
    padding:
      calc(6px + env(safe-area-inset-top, 0px))
      max(10px, env(safe-area-inset-right, 0px))
      calc(96px + env(safe-area-inset-bottom, 0px))
      max(10px, env(safe-area-inset-left, 0px));
    scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
  html.is-touch .legal-lead {
    margin-bottom: 6px !important;
    padding-bottom: 6px;
    font-size: 12px !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  html.is-touch .legal-toc li {
    margin: 0 0 2px;
    min-height: 0;
    line-height: 1.35;
  }
  html.is-touch .mpage[data-for="credits"] .mpage-title {
    margin: 0 0 6px;
    font-size: 18px;
  }
  html.is-touch .credits-body {
    padding: 10px 14px 20px;
  }
  html.is-touch .credits-body p,
  html.is-touch .credits-body li {
    font-size: 12px;
    line-height: 1.55;
  }
  html.is-touch .legal-toc {
    margin-bottom: 12px;
    padding: 8px 12px 10px;
  }
  html.is-touch .legal-toc h3 {
    margin-bottom: 6px;
  }
  html.is-touch .legal-toc ol {
    columns: 2 180px;
  }
}

/* ---------------------------------------------------------------------------
   Cache Index — archive grid that does not crush the pause chrome.
   --------------------------------------------------------------------------- */
html.is-touch #cache-index-screen {
  background: var(--steel-900);
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    max(8px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
}

html.is-touch #cache-index-screen .cache-index-panel {
  width: min(720px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
  overflow: hidden;
}

html.is-touch .cache-index-head {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 10px;
  padding-bottom: 8px;
  background: inherit;
}

html.is-touch .cache-index-head h2 {
  font-size: clamp(20px, 6vw, 28px);
}

html.is-touch .cache-index-head .pbtn {
  min-width: 88px;
  min-height: 44px;
  flex: 0 0 auto;
}

html.is-touch .cache-index-copy {
  flex: 0 0 auto;
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.4;
}

html.is-touch .cache-index-grid {
  flex: 1 1 auto;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding: 0 0 4px;
}

html.is-touch .cache-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  min-height: 0;
  padding: 8px;
}

html.is-touch .cache-card img {
  grid-row: 1 / 4;
  aspect-ratio: 1.5 / 1;
  height: 100%;
  object-fit: contain;
  background: var(--tone-12161a);
}

html.is-touch .cache-card.locked img {
  filter: grayscale(.88) brightness(.48) contrast(1.05) opacity(.9);
}

html.is-touch .cache-card h3 {
  margin: 0;
  font-size: 13px;
}

html.is-touch .cache-card p {
  font-size: 11px;
}

@media (orientation: landscape) and (max-height: 500px) {
  html.is-touch #cache-index-screen .cache-index-panel {
    width: min(840px, 100%);
    padding: 8px 10px;
  }
  html.is-touch .cache-index-head h2 {
    font-size: 18px;
  }
  html.is-touch .cache-index-copy {
    display: none;
  }
  html.is-touch .cache-index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  html.is-touch .cache-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 8px;
    padding: 6px;
  }
  html.is-touch .cache-card img {
    grid-row: 1 / 4;
    aspect-ratio: 1.4 / 1;
    height: 100%;
  }
  html.is-touch .cache-card h3 {
    margin: 0;
    font-size: 12px;
  }
  html.is-touch .cache-card p {
    font-size: 10px;
  }
}

/* ---------------------------------------------------------------------------
   Rotate prompt — keep the hierarchy obvious; secondary CTA readable.
   --------------------------------------------------------------------------- */
html.is-touch #rotate-hint {
  gap: 14px;
  padding:
    max(28px, env(safe-area-inset-top, 0px))
    max(24px, env(safe-area-inset-right, 0px))
    max(28px, env(safe-area-inset-bottom, 0px))
    max(24px, env(safe-area-inset-left, 0px));
}

html.is-touch #rotate-hint .rotate-title {
  font-size: clamp(18px, 5.2vw, 22px);
}

html.is-touch #rotate-hint .rotate-sub {
  font-size: 13px;
  max-width: min(320px, 88vw);
  color: var(--paper-dim);
}

html.is-touch #rotate-anyway {
  min-height: 46px;
  padding: 12px 18px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--tone-b0a898);
  opacity: .92;
  border-color: rgba(190, 160, 110, .4);
}

/* ---------------------------------------------------------------------------
   Supreme mobile pass (0.16.8) — dock clearance, readable titles, card names.
   --------------------------------------------------------------------------- */

/* Fixed Back|Next docks must clear callsign / last interactive content without
   requiring the player to discover a hidden scroll. */
html.is-touch .mpage[data-for="loadout"],
html.is-touch .mpage[data-for="treatments"],
html.is-touch .mpage[data-for="night"] {
  padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  scroll-padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px));
}

html.is-touch #callsign-row {
  margin-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

html.is-touch .soldier-detail {
  scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* Narrow dossier names must wrap, not clip to OPER / ENGI. */
html.is-touch .p-card .p-name,
html.is-touch .p-card .p-role {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  letter-spacing: .08em;
}

html.is-touch .p-card .p-body {
  min-width: 0;
  overflow: visible;
}

/* Page titles stay readable even when short-height rules try to crush them.
   Conversational .ask-q headings keep their own size — this floor is for
   dossier pages (loadout, credits), not the one question on the card. */
html.is-touch .mpage-title:not(.ask-q) {
  font-size: clamp(14px, 3.6vw, 22px) !important;
  letter-spacing: .22em;
  line-height: 1.25;
  min-height: 22px;
}

html.is-touch .legal-toc a {
  min-height: 44px;
  padding: 8px 0;
  font-size: 13px;
  line-height: 1.35;
}

@media (orientation: landscape) and (max-height: 500px) {
  html.is-touch .mpage[data-for="loadout"],
  html.is-touch .mpage[data-for="treatments"],
  html.is-touch .mpage[data-for="night"] {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }
  html.is-touch #callsign-row {
    margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  /* Short landscape: all five dossiers on one visible row instead of the
     150px horizontal scroller — hunting sideways on a 667px screen was the
     audit's density finding. Squarer portraits keep the row inside the short
     viewport's height budget. */
  html.is-touch #persona-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 8px;
    overflow-x: visible;
    padding-bottom: 0;
  }
  html.is-touch #persona-grid .p-card {
    min-height: 104px;
    min-width: 0;
    max-width: none;
  }
  html.is-touch .p-card .p-shot {
    aspect-ratio: 1 / 1;
    min-height: 64px;
  }
  html.is-touch .p-card .p-body {
    padding: 7px 8px 9px;
  }
  html.is-touch .p-card .p-name {
    font-size: 11px;
    letter-spacing: .06em;
  }
  html.is-touch .p-card .p-role {
    margin-top: 3px;
    font-size: 10.5px;
  }
  html.is-touch .mpage-title {
    font-size: 14px !important;
    letter-spacing: .16em;
  }
}

/* iPhone SE / 360-wide: site strip, death panel, loadout titles stay readable. */
@media (max-width: 380px) {
  html.is-touch .site-strip { gap: 5px; }
  html.is-touch .site-card {
    min-height: 70px;
    padding: 8px 7px;
  }
  html.is-touch .site-intel {
    font-size: 10px;
    letter-spacing: .04em;
  }
  html.is-touch .mpage[data-for="loadout"] .mpage-title,
  html.is-touch .mpage[data-for="night"] .mpage-title {
    font-size: 16px;
    letter-spacing: .14em;
  }
}

html.is-touch #gameover-screen {
  padding:
    calc(10px + env(safe-area-inset-top, 0px))
    max(10px, env(safe-area-inset-right, 0px))
    calc(10px + env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
}
html.is-touch #gameover-screen .panel {
  width: min(520px, 100%);
  max-height: min(94vh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 12px));
  overflow-y: auto;
  padding: 14px 12px;
}
html.is-touch #gameover-screen .panel h2 {
  font-size: clamp(22px, 7vw, 34px);
}
html.is-touch #gameover-screen .panel .mbtn {
  min-height: 44px;
}
@media (max-width: 380px) {
  html.is-touch #gameover-screen .panel h2 { font-size: 22px; }
  html.is-touch #pause-screen .panel.pause-panel h2 { font-size: 24px; }
}

/* Conversational deploy — title + one card. Keep the wordmark in view. */
html.is-touch .ask-card {
  width: min(540px, 100%);
  margin-top: var(--home-stack-gap, 6px);
  padding: 14px 12px 10px;
}
html.is-touch .ask-card .menu-grid,
html.is-touch .ask-card .mobile-menu {
  width: 100%;
  margin: 0;
}
html.is-touch .ask-q,
html.is-touch .ask-q.mpage-title {
  font-size: clamp(20px, 6vw, 28px) !important;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
html.is-touch .mpage[data-for="night"] #diff-grid .diff-card {
  min-height: 48px;
}
html.is-touch #title-screen[data-page="home"] .chrome-settings,
html.is-touch #title-screen[data-page="night"] .chrome-settings,
html.is-touch #title-screen[data-page="site"] .chrome-settings,
html.is-touch #title-screen[data-page="ready"] .chrome-settings,
html.is-touch #title-screen[data-page="online"] .chrome-settings,
html.is-touch #title-screen[data-page="coop"] .chrome-settings,
html.is-touch #title-screen[data-page="lobby"] .chrome-settings { display: none; }

@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch .ask-card { padding: 8px 10px 6px; margin-top: 4px; }
  html.is-touch .ask-kicker { display: none; }
  html.is-touch .ask-q,
  html.is-touch .ask-q.mpage-title {
    font-size: 18px !important;
    margin-bottom: 6px;
  }
  html.is-touch .mrow-ask { grid-template-columns: 1fr 1fr; }
  html.is-touch .mrow-ask-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html.is-touch .ask-more { min-height: 44px; margin-top: 2px; }
  html.is-touch .mpage[data-for="night"] #diff-grid .diff-card {
    min-height: 44px;
    padding: 8px 10px;
  }
}

/* Online step, Ready, More — one card, no title scroll, trial line stays visible. */
html.is-touch #title-screen[data-page="online"],
html.is-touch #title-screen[data-page="ready"],
html.is-touch #title-screen[data-page="more"],
html.is-touch #title-screen[data-page="night"],
html.is-touch #title-screen[data-page="site"],
html.is-touch #title-screen[data-page="coop"] {
  overflow: hidden;
}

html.is-touch .mpage[data-for="online"],
html.is-touch .mpage[data-for="ready"],
html.is-touch .mpage[data-for="more"],
html.is-touch .mpage[data-for="coop"] {
  width: 100%;
  max-width: none;
  max-height: 100%;
  overflow: hidden;
  padding:
    calc(8px + env(safe-area-inset-top, 0px))
    max(10px, env(safe-area-inset-right, 0px))
    calc(12px + env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
  justify-content: center;
}

html.is-touch .home-online-price {
  max-width: none;
  margin: 0 0 6px;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
}
html.is-touch .home-online-more {
  max-width: none;
  margin: 0 0 8px;
  padding: 0;
}

html.is-touch .home-subscribe {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin: 0 0 8px;
}
html.is-touch .home-subscribe[hidden] { display: none !important; }

html.is-touch .home-trial-status {
  margin: 0 0 8px;
  font-size: 11px;
}

html.is-touch .mpage[data-for="online"] .mrow-ask-3 {
  grid-template-columns: 1fr;
}

html.is-touch .ready-recap {
  font-size: 14px;
  margin-bottom: 12px;
}
html.is-touch .ready-adjust {
  flex-wrap: wrap;
  gap: 4px 8px;
}
html.is-touch .ready-adjust .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 8px;
}

html.is-touch .mpage[data-for="online"] .action-bar,
html.is-touch .mpage[data-for="ready"] .action-bar,
html.is-touch .mpage[data-for="more"] .action-bar,
html.is-touch .mpage[data-for="coop"] .action-bar {
  width: 100%;
  margin-top: 10px;
}

html.is-touch .mpage[data-for="online"] .action-bar .mbtn,
html.is-touch .mpage[data-for="ready"] .action-bar .mbtn,
html.is-touch .mpage[data-for="more"] .action-bar .mbtn,
html.is-touch .mpage[data-for="coop"] .action-bar .mbtn {
  min-height: 48px;
}
html.is-touch .mpage[data-for="more"] .more-list .mtile { min-height: 44px; }
html.is-touch .mpage[data-for="coop"] .cc-input { min-height: 48px; }

@media (min-width: 560px) {
  html.is-touch .mpage[data-for="online"] .mrow-ask-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch .mpage[data-for="online"],
  html.is-touch .mpage[data-for="ready"],
  html.is-touch .mpage[data-for="more"],
  html.is-touch .mpage[data-for="coop"] {
    padding-top: calc(4px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  html.is-touch .home-online-price {
    font-size: 11px;
    line-height: 1.35;
    margin-bottom: 6px;
  }
  html.is-touch .mpage[data-for="more"] .mt-note {
    display: none;
  }
  html.is-touch .mpage[data-for="online"] .mrow-ask-3 .mtile {
    min-height: 58px;
    padding: 6px 8px;
  }
  html.is-touch .mpage[data-for="online"] .mrow-ask-3 .mt-note {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    margin-top: 2px;
  }
  html.is-touch .mpage[data-for="ready"] .ready-adjust {
    display: flex;
    margin-top: 4px;
  }
  html.is-touch .mpage[data-for="ready"] .ready-adjust .text-link {
    min-height: 44px;
    padding: 8px;
  }
  html.is-touch .mpage[data-for="more"] {
    overflow-y: auto;
    justify-content: flex-start;
  }
  html.is-touch .mpage[data-for="online"] .mrow-ask-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  html.is-touch .mpage[data-for="online"] .action-bar .mbtn,
  html.is-touch .mpage[data-for="ready"] .action-bar .mbtn {
    min-height: 44px;
  }
}

/* First-run briefing on a phone: whole card in the viewport, 44px Continue. */
html.is-touch #firstrun {
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    max(8px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
  align-items: flex-start;
}
html.is-touch #firstrun .fr-panel {
  width: min(520px, 100%);
  max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 12px;
}
html.is-touch #firstrun .fr-step { margin-top: 12px; }
html.is-touch #firstrun .fr-lead { font-size: 13px; line-height: 1.45; }
html.is-touch #firstrun .fr-wedge span { aspect-ratio: 1 / .85; }
html.is-touch #fr-continue { min-width: 0; width: 100%; min-height: 48px; }

@media (orientation: landscape) and (max-height: 520px) {
  html.is-touch #firstrun .fr-panel { padding: 8px 10px; }
  html.is-touch #firstrun .fr-step { margin-top: 8px; }
  html.is-touch #firstrun .fr-wedge span { aspect-ratio: 1 / .4; }
  html.is-touch #firstrun h2 { font-size: 22px; }
}

/* Installed PWA: notch and home indicator are always chrome. */
html.is-standalone.is-touch #title-screen[data-page="home"] .mpage[data-for="home"],
html.is-standalone.is-touch .mpage[data-for="online"],
html.is-standalone.is-touch .mpage[data-for="ready"],
html.is-standalone.is-touch .mpage[data-for="more"] {
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
