/* Touch ergonomics for the existing public Arcade, suite-design-2026-09-06-v2.
   Load last. No palette, typography family, artwork, shell or game-rule changes. */

:root {
  --touch-safe-top: env(safe-area-inset-top, 0px);
  --touch-safe-right: env(safe-area-inset-right, 0px);
  --touch-safe-bottom: env(safe-area-inset-bottom, 0px);
  --touch-safe-left: env(safe-area-inset-left, 0px);
}

/* Keep the current desktop gutters; give notches and the home indicator room. */
.suite-topbar {
  --touch-header-inline: 36px;
  --touch-header-top: 22px;
  padding-top: max(var(--touch-header-top), var(--touch-safe-top));
  padding-left: max(var(--touch-header-inline), var(--touch-safe-left));
  padding-right: max(var(--touch-header-inline), var(--touch-safe-right));
}
#arcade-root {
  --touch-page-inline: 24px;
  padding-left: max(var(--touch-page-inline), var(--touch-safe-left));
  padding-right: max(var(--touch-page-inline), var(--touch-safe-right));
  padding-bottom: max(12px, var(--touch-safe-bottom));
}

/* Long usernames, game labels and flex/grid children may shrink and wrap. */
.arcade-heading > div,
.arcade-player-bar > div,
.arcade-main-grid > *,
.arcade-game-grid > *,
.lounge-layout > *,
.lounge-games > *,
.lounge-match-top > *,
.lounge-room-row > *,
.lounge-aim > *,
.bud-layout > *,
.bud-bottom > *,
.squad-units > * { min-width: 0; }
.arcade-heading h1,
.arcade-player-bar h2,
.arcade-card-copy,
.lounge-choice,
.lounge-roster span,
.lounge-person,
.lounge-room-row strong,
.squad-energy,
.bud-section-heading { overflow-wrap: anywhere; }
.arcade-tabs { flex-wrap: wrap; }
.arcade-tabs > button { flex: 0 1 auto; }
.arcade-player-actions,
.bud-header-actions { flex-shrink: 0; }
.lounge-panel select,
.bud-dialog select { width: 100%; min-width: 0; max-width: 100%; }
.lounge-promote select { margin-left: 0; margin-top: 6px; }

/* Standard controls keep a real 44px hit area. The fitted 8×8 board is exempt. */
.arcade-shell button:not(.lounge-square),
.arcade-dialog button,
.bud-dialog button,
.bud-dialog summary,
.weed-piece-guide summary { min-height: 44px; }
.arcade-touch-controls button,
.arcade-icon-button,
.bud-header-actions button,
.lounge-message button { min-width: 44px; }
.lounge-message button { min-height: 44px; padding: 8px; vertical-align: middle; }
.lounge-panel input[type="range"] { min-height: 44px; }
.arcade-preference-row input { height: 44px; }
.arcade-preference-row > span:first-child { min-width: 0; }
.arcade-switch { flex-shrink: 0; }

/* Text fields nested in 14px labels must not inherit that small field type. */
.arcade-shell input:not([type="checkbox"]):not([type="range"]),
.arcade-shell select,
.arcade-shell textarea,
.arcade-dialog input:not([type="checkbox"]):not([type="range"]),
.arcade-dialog select,
.arcade-dialog textarea,
.bud-dialog input,
.bud-dialog select,
.bud-dialog textarea { font-size: 16px; }

/* Native dialog focus/escape behavior stays intact. A short viewport scrolls. */
.arcade-dialog,
.bud-dialog {
  box-sizing: border-box;
  inset: var(--touch-safe-top) var(--touch-safe-right) var(--touch-safe-bottom) var(--touch-safe-left);
  max-height: calc(100vh - 24px - var(--touch-safe-top) - var(--touch-safe-bottom));
  max-height: calc(100dvh - 24px - var(--touch-safe-top) - var(--touch-safe-bottom));
  overscroll-behavior: contain;
  scroll-padding-block: 16px;
}
.arcade-dialog { width: min(1000px, calc(100vw - 24px - var(--touch-safe-left) - var(--touch-safe-right))); }
.bud-dialog { width: min(1120px, 96vw, calc(100vw - 24px - var(--touch-safe-left) - var(--touch-safe-right))); }
.arcade-dialog :is(input, select, textarea, button, summary),
.bud-dialog :is(input, select, textarea, button, summary) { scroll-margin-block: 16px; }
.arcade-overlay { overflow: auto; overscroll-behavior: contain; }
.arcade-overlay > * { flex-shrink: 0; }
.arcade-touch-controls { flex-wrap: wrap; }
.arcade-touch-controls > [data-directions] { flex: 0 0 auto; flex-wrap: nowrap; }
.arcade-touch-controls > [data-action="primary"] { min-width: 96px; margin-left: auto; white-space: normal; }
.arcade-touch-controls button,
.arcade-stage canvas,
.bud-scene canvas,
.lounge-canvas[data-drag-aim] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
/* Do not block scrolling, text selection or pinch zoom on the document. */

@media (max-width: 760px) {
  .lounge-games { grid-template-columns: 1fr; }
  .lounge-choice { min-height: 88px; }
  .lounge-choice .weed-card-art { float: right; margin-left: 12px; }
  .lounge-match-top,
  .lounge-room-row,
  .squad-heading,
  .bud-header { flex-wrap: wrap; }
  .lounge-room-row > :last-child { flex-shrink: 0; }
  .lounge-aim { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lounge-aim > label { grid-column: 1 / -1; }
  .lounge-field { min-width: 0; }
  .lounge-chat-form { flex-wrap: wrap; }
  .lounge-chat-form :is(input,select) { flex: 1 1 180px; width: auto; }
  .lounge-chat-form button { flex: 0 0 auto; margin-left: auto; }
  .squad-walk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .squad-walk > [data-pass] { grid-column: 1 / -1; margin-left: 0; }
  .squad-energy { white-space: normal; }
  .lounge-sound label { flex: 1 1 96px; }
  .lounge-sound input[type="range"] { min-width: 90px; }
}

@media (max-width: 680px) {
  /* A full-width native player uses the available phone display without crop. */
  .arcade-player,
  .bud-dialog {
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .arcade-player {
    padding-top: var(--touch-safe-top);
    padding-right: var(--touch-safe-right);
    padding-bottom: var(--touch-safe-bottom);
    padding-left: var(--touch-safe-left);
  }
  .arcade-player-bar { flex-wrap: wrap; }
  .arcade-player-actions { margin-left: auto; }
  .arcade-hud { flex-wrap: wrap; }
  .arcade-hud > [data-hud-status] { min-width: 0; overflow-wrap: anywhere; text-align: center; }
  .arcade-stage { aspect-ratio: 8 / 5; max-height: none; }
  .arcade-overlay { justify-content: flex-start; }
  .arcade-overlay h2 { font-size: clamp(24px, 7vw, 36px); }
  .arcade-overlay > .arcade-kicker { margin-bottom: 8px; }
  .arcade-overlay p { margin: 10px 0 14px; }
  .arcade-touch-controls { gap: 10px; }
  .arcade-touch-controls > [data-directions] { gap: 6px; }
  .arcade-control-copy { line-height: 1.5; }
  .bud-dialog {
    padding-top: max(18px, var(--touch-safe-top));
    padding-right: max(15px, var(--touch-safe-right));
    padding-bottom: max(20px, var(--touch-safe-bottom));
    padding-left: max(15px, var(--touch-safe-left));
  }
  .bud-scene,
  .bud-scene canvas { max-height: none; }
  .bud-scene canvas { height: auto; aspect-ratio: 40 / 31; }
  .bud-name-row,
  .bud-section-heading,
  .bud-visitor,
  .bud-rename { flex-wrap: wrap; }
  .bud-rename input { flex: 1 1 160px; width: auto; }
  .bud-rename button { margin-left: auto; }
}

@media (max-width: 600px) {
  .suite-topbar { --touch-header-inline: 20px; --touch-header-top: 18px; flex-wrap: wrap; gap: 10px; }
  #arcade-root { --touch-page-inline: 8px; }
  .arcade-heading { flex-wrap: wrap; }
  .arcade-heading > .arcade-outline { margin-left: auto; }
  .arcade-score-table { table-layout: fixed; }
  .arcade-score-table th,
  .arcade-score-table td { overflow-wrap: anywhere; }
}

@media (max-width: 380px) {
  .arcade-touch-controls > [data-directions] { flex: 1 1 100%; justify-content: space-between; }
  .arcade-touch-controls > [data-action="primary"] { flex: 1 1 120px; }
  .bud-care-actions,
  .bud-pots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bud-vitals { grid-template-columns: 1fr; }
}

/* Landscape phones keep movement/fire alongside the complete, undistorted field.
   Instructions remain below; the dialog may scroll at large text/short heights. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1000px) {
  .arcade-player:not([data-motion="true"]) {
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    padding: var(--touch-safe-top) var(--touch-safe-right) var(--touch-safe-bottom) var(--touch-safe-left);
  }
  .arcade-player:not([data-motion="true"])[open] { display: grid; grid-template-columns: minmax(0, 1fr) 176px; align-content: start; }
  .arcade-player-bar,
  .arcade-hud,
  .arcade-control-copy,
  .arcade-player-note { grid-column: 1 / -1; }
  .arcade-player-bar { padding: 8px 12px; }
  .arcade-player-bar h2 { font-size: 19px; }
  .arcade-hud { padding: 6px 12px; }
  .arcade-stage {
    grid-column: 1;
    width: min(100%, max(160px, calc((100vh - 160px - var(--touch-safe-top) - var(--touch-safe-bottom)) * 1.6)));
    width: min(100%, max(160px, calc((100dvh - 160px - var(--touch-safe-top) - var(--touch-safe-bottom)) * 1.6)));
    aspect-ratio: 8 / 5;
    max-height: none;
    align-self: start;
  }
  .arcade-touch-controls { grid-column: 2; padding: 8px 12px; align-content: start; justify-content: stretch; gap: 8px; }
  .arcade-touch-controls > [data-directions] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 6px; }
  .arcade-touch-controls > [data-action] { width: 100%; margin-left: 0; }
  .arcade-overlay { justify-content: flex-start; padding: 12px; }
  .arcade-overlay h2 { font-size: 26px; }
  .arcade-overlay p { font-size: 14px; margin: 8px 0 12px; }
  .bud-dialog { padding: max(14px, var(--touch-safe-top)) max(15px, var(--touch-safe-right)) max(20px, var(--touch-safe-bottom)) max(15px, var(--touch-safe-left)); }
}

.community-report{max-width:480px;padding:24px}.community-report h2{font-size:26px;line-height:1.2}.community-report label{display:grid;gap:8px;margin:20px 0}.community-report .lounge-row{margin-top:20px}.lounge-message button+button{margin-left:4px}
