/* Compact public room and post-match screens for touch devices. */
@media (max-width:760px) and (orientation:portrait) {
 /* Reserve space for the existing two stacked, 48px touch actions. */
 body[data-app-state="RESULTS"] #overlay.match-summary-overlay {--match-footer-space:152px}
 body[data-app-state="ROOM_BROWSER"] #room-browser {
  position:fixed;
  inset:0;
  box-sizing:border-box;
  width:100%;
  max-height:100dvh;
  padding:0;
  overflow:hidden;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .screen-body {
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:38px 42px auto auto auto minmax(150px,1fr);
  grid-template-areas:"shell" "nav" "heading" "toolbar" "loadout" "rooms";
  align-content:stretch;
  gap:5px;
  width:100%;
  height:100dvh;
  max-height:100dvh;
  padding:calc(env(safe-area-inset-top) + 5px) 8px calc(env(safe-area-inset-bottom) + 5px);
  overflow:hidden;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .frame-driver-shell-header {
  grid-area:shell;
  display:flex;
  min-width:0;
  min-height:0;
  height:38px;
  flex-direction:row;
  align-items:center;
  justify-content:space-between;
  padding:2px 5px;
  border:1px solid #17627a;
  background:#061722ed;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .main-menu-brand .screen-eyebrow {display:none}
 body[data-app-state="ROOM_BROWSER"] #room-browser .main-menu-brand h2 {margin:0;font-size:15px;letter-spacing:.12em}
 body[data-app-state="ROOM_BROWSER"] #room-browser .hangar-header-actions {display:flex;flex-wrap:nowrap;align-items:center;gap:4px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #wallet-display {display:flex;gap:5px;font-size:8px;white-space:nowrap}
 body[data-app-state="ROOM_BROWSER"] #room-browser .hangar-header-actions>button {min-width:34px;min-height:32px;height:32px;padding:3px 5px;font-size:8px}

 body[data-app-state="ROOM_BROWSER"] #room-browser #main-menu-nav {
  position:static;
  z-index:auto;
  grid-area:nav;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:4px;
  width:100%;
  height:42px;
  min-height:42px;
  margin:0;
  padding:3px;
  box-shadow:none;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser #main-menu-nav button {
  display:flex;
  min-width:0;
  min-height:34px;
  height:34px;
  flex-direction:row;
  gap:3px;
  padding:3px;
  font-size:8px;
  line-height:1;
  white-space:nowrap;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser #main-menu-nav button i {font-size:11px}

 body[data-app-state="ROOM_BROWSER"] #room-browser .screen-body>header:not(.frame-driver-shell-header) {
  grid-area:heading;
  display:flex;
  min-width:0;
  min-height:37px;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  margin:0;
  padding:2px 3px;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .screen-body>header .screen-eyebrow {margin:0 0 1px;font-size:7px}
 body[data-app-state="ROOM_BROWSER"] #room-browser .screen-body>header h1 {margin:0;font-size:17px;line-height:1.05;letter-spacing:.1em}
 body[data-app-state="ROOM_BROWSER"] #room-browser #rooms-hangar {min-width:66px;min-height:36px;padding:4px 7px;font-size:9px}

 body[data-app-state="ROOM_BROWSER"] #room-browser .browser-toolbar {
  grid-area:toolbar;
  display:flex;
  min-width:0;
  min-height:42px;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  margin:0;
  padding:3px 5px;
  border:1px solid #17627a;
  background:#071b27ed;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser #browser-status {
  position:absolute;
  width:1px;
  height:1px;
  margin:-1px;
  padding:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .online-actions {display:flex;flex:1;align-items:center;justify-content:flex-end;gap:6px;min-width:0;margin:0}
 body[data-app-state="ROOM_BROWSER"] #room-browser .online-actions label {display:flex;align-items:center;gap:4px;min-width:0;margin:0;font-size:9px;white-space:nowrap}
 body[data-app-state="ROOM_BROWSER"] #room-browser #online-mode {box-sizing:border-box;width:66px;min-width:66px;height:36px;min-height:36px;padding:3px;font-size:10px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #quick-play {box-sizing:border-box;width:auto;min-width:98px;min-height:38px;padding:4px 8px;font-size:10px}

 body[data-app-state="ROOM_BROWSER"] #room-browser .saved-loadout {
  grid-area:loadout;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto 54px;
  gap:3px;
  min-width:0;
  min-height:0;
  margin:0;
  padding:5px;
  border:1px solid #17627a;
  background:#071b27ed;
  overflow:hidden;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .saved-loadout>span {font-size:8px;line-height:1.1;letter-spacing:.12em}
 body[data-app-state="ROOM_BROWSER"] #room-browser #browser-loadout-items {display:flex;gap:4px;min-width:0;min-height:0;padding:0 0 3px;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:thin}
 body[data-app-state="ROOM_BROWSER"] #room-browser #browser-loadout-items .saved-loadout-item {box-sizing:border-box;display:grid;flex:0 0 78px;grid-template-rows:34px minmax(0,1fr);align-content:center;justify-items:center;gap:1px;min-width:78px;min-height:50px;height:50px;padding:2px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #browser-loadout-items .saved-loadout-item img {width:30px;height:32px;object-fit:contain}
 body[data-app-state="ROOM_BROWSER"] #room-browser #browser-loadout-items .saved-loadout-item span {display:block;max-width:100%;overflow:hidden;font-size:6px;line-height:1;text-overflow:ellipsis;white-space:nowrap}
 body[data-app-state="ROOM_BROWSER"] #room-browser .saved-loadout>p {display:none}

 body[data-app-state="ROOM_BROWSER"] #room-browser .room-browser-columns {
  grid-area:rooms;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:minmax(144px,auto) auto;
  gap:6px;
  min-width:0;
  min-height:0;
  margin:0;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .room-browser-columns>section,
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create {
  box-sizing:border-box;
  min-width:0;
  min-height:0;
  margin:0;
  padding:7px;
  border:1px solid #17627a;
  background:#061722ed;
 }

 body[data-app-state="ROOM_BROWSER"] #room-browser .room-list-heading {display:flex;align-items:center;justify-content:space-between;gap:5px;margin:0 0 5px;padding-bottom:5px;border-bottom:1px solid #164b60}
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-list-heading h2,
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create h2 {margin:0;font-size:10px;line-height:1.15;letter-spacing:.1em}
 body[data-app-state="ROOM_BROWSER"] #room-browser #refresh-rooms {min-height:34px;padding:4px 7px;font-size:9px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list {display:grid;align-content:start;gap:5px;min-height:0;max-height:none;margin:0;overflow:visible}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card {box-sizing:border-box;display:grid;grid-template-columns:minmax(0,1fr) 70px;grid-template-rows:auto auto auto auto;grid-template-areas:"name join" "mode join" "map join" "population join" "ai join" "status join";gap:3px 6px;width:100%;height:auto;min-height:70px;max-height:none;margin:0;padding:6px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>h3 {grid-area:name;min-width:0;margin:0;font-size:11px;line-height:1.2}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>.room-card-mode {grid-area:mode}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>.room-card-map {grid-area:map}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>.room-card-population {grid-area:population}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>.room-card-ai-level {grid-area:ai}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>.room-card-status {grid-area:status;text-align:left}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-list>.room-card>button {grid-area:join;align-self:center;min-width:0;min-height:40px;padding:4px;font-size:9px;white-space:normal}
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-card-mode,
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-card-map,
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-card-population,
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-card-ai-level,
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-card-status {font-size:8px;line-height:1.2}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:"title title" "name name" "mode map" "duration ai" "difficulty balance" "submit submit";align-content:start;gap:5px 6px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create h2 {grid-area:title;padding-bottom:5px;border-bottom:1px solid #164b60}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-name-field {grid-area:name}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-mode-field {grid-area:mode}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-map-field {grid-area:map}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-duration-field {grid-area:duration}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-ai-fill-field {grid-area:ai}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-ai-level-field {grid-area:difficulty}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-team-balance-field {grid-area:balance}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create>button {grid-area:submit;min-height:42px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create label {display:flex;min-width:0;flex-direction:column;gap:3px;margin:0;font-size:8px;line-height:1.15}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create input:not([type="checkbox"]),
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create select {box-sizing:border-box;width:100%;min-width:0;min-height:38px;padding:5px 6px;font-size:11px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-ai-fill-field {display:flex;flex-direction:row;align-items:center;gap:5px;min-height:38px}
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create .room-ai-fill-field input {width:18px;height:18px}

 body[data-app-state="ROOM_LOBBY"] #room-lobby {position:fixed;inset:0;box-sizing:border-box;padding:0;overflow:hidden}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body {
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto auto minmax(170px,1fr) auto auto;
  grid-template-areas:"head" "info" "roster" "loadout" "footer";
  gap:6px;
  width:100%;
  height:100dvh;
  max-height:100dvh;
  padding:calc(env(safe-area-inset-top) + 8px) 10px calc(env(safe-area-inset-bottom) + 8px);
  overflow:hidden;
 }

 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body>header {grid-area:head;display:flex;min-width:0;min-height:42px;align-items:center;justify-content:space-between;gap:8px;margin:0;padding:0 0 6px;border-bottom:1px solid #17627a}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body>header .screen-eyebrow {margin:0 0 2px;font-size:7px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body>header h1 {margin:0;overflow:hidden;font-size:18px;line-height:1.1;text-overflow:ellipsis}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-leave {min-width:68px;min-height:38px;padding:4px 7px;font-size:9px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .lobby-info-row {grid-area:info;display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:center;gap:8px;min-width:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-status,
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-details {min-width:0;margin:0;font-size:9px;line-height:1.2}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-status {color:#d4edf3}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .lobby-settings {display:grid;justify-items:end;gap:2px;min-width:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-details {color:#93bfcb;text-align:right}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-team-label:not([hidden]) {display:flex;align-items:center;gap:4px;margin:0;font-size:8px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-team-label select {min-height:28px;padding:2px 4px;font-size:9px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-roster {grid-area:roster;display:flex;min-width:0;min-height:0;margin:0;overflow:hidden}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-columns {display:grid;flex:1 1 0;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr));align-content:stretch;gap:5px;width:100%;height:100%;min-width:0;min-height:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-panel {box-sizing:border-box;display:flex;min-width:0;min-height:0;flex-direction:column;margin:0;padding:6px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-panel h3 {flex:none;margin:0 0 4px;font-size:10px;line-height:1.15}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-player-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:2px 8px;min-width:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-player-name {min-width:0;overflow:hidden;padding:3px 4px;background:#030a1170;color:#d8edf2;font-size:10px;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-panel .ai-slots {flex:none;margin:3px 0 0;padding:5px 6px;font-size:8px;line-height:1.2;border-radius:2px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .saved-loadout {grid-area:loadout;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 36px;gap:2px;min-width:0;margin:0;padding:4px;border:1px solid #17627a;background:#061722ed;overflow:hidden}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .saved-loadout>span {font-size:8px;letter-spacing:.12em}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items {display:flex;gap:4px;min-width:0;min-height:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items .saved-loadout-item {box-sizing:border-box;display:grid;flex:0 0 62px;grid-template-rows:24px minmax(0,1fr);justify-items:center;gap:1px;min-width:62px;min-height:34px;height:34px;padding:1px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items .saved-loadout-item img {width:22px;height:23px;object-fit:contain}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items .saved-loadout-item span {max-width:100%;overflow:hidden;font-size:6px;line-height:1;text-overflow:ellipsis;white-space:nowrap}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout {display:none}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items {height:36px;min-height:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .lobby-footer {display:flex;min-width:0;min-height:40px;align-items:center;justify-content:space-between;gap:8px;margin:0;padding-top:4px;border-top:1px solid #17627a}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-ready-status {min-width:0;margin:0;font-size:9px;line-height:1.2}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-start {min-width:112px;min-height:40px;padding:5px 8px;font-size:10px}

 body[data-app-state="RESULTS"] #overlay.match-summary-overlay {
  display:block;
  place-items:initial;
  box-sizing:border-box;
  padding:calc(env(safe-area-inset-top) + 6px) 8px calc(env(safe-area-inset-bottom) + var(--match-footer-space,72px));
  scroll-padding-bottom:calc(env(safe-area-inset-bottom) + var(--match-footer-space,72px));
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
 }

 body[data-app-state="RESULTS"] .match-summary-screen {display:flex;box-sizing:border-box;width:100%;height:auto;max-height:none;min-height:100%;flex-direction:column;gap:7px;overflow:visible}
 body[data-app-state="RESULTS"] .match-summary-header {grid-template-columns:34px minmax(0,1fr) 34px;min-height:64px}
 body[data-app-state="RESULTS"] .match-summary-banner {width:30px;height:46px;margin-left:2px}
 body[data-app-state="RESULTS"] .match-summary-banner.red {margin-right:2px}
 body[data-app-state="RESULTS"] .match-summary-kicker {font-size:7px;letter-spacing:.14em}
 body[data-app-state="RESULTS"] .match-summary-header h1 {font-size:30px;letter-spacing:.12em}
 body[data-app-state="RESULTS"] .match-summary-header #matchmessage {margin:4px 0 0;font-size:8px;letter-spacing:.1em}
 body[data-app-state="RESULTS"] .match-reward-summary,
 body[data-app-state="RESULTS"] .match-overview,
 body[data-app-state="RESULTS"] .match-result-panel {flex:none;min-width:0;padding:6px}
 body[data-app-state="RESULTS"] .match-reward-summary>.match-reward-heading {margin:0 0 4px;font-size:9px}
 body[data-app-state="RESULTS"] .match-reward-list {grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}
 body[data-app-state="RESULTS"] .match-reward-item {grid-template-columns:22px minmax(0,1fr);gap:4px;min-width:0;min-height:38px;padding:3px}
 body[data-app-state="RESULTS"] .match-reward-item img,
 body[data-app-state="RESULTS"] .match-reward-icon {width:20px;height:20px;font-size:13px}
 body[data-app-state="RESULTS"] .match-reward-copy {gap:2px}
 body[data-app-state="RESULTS"] .match-reward-copy strong {overflow:visible;font-size:7px;letter-spacing:-.02em;line-height:1.05;text-overflow:clip;white-space:normal}
 body[data-app-state="RESULTS"] .match-reward-copy b {font-size:10px}
 body[data-app-state="RESULTS"] .match-overview-grid {grid-template-columns:repeat(2,minmax(0,1fr));min-height:0}
 body[data-app-state="RESULTS"] .match-team-score {grid-column:1/-1;grid-template-columns:minmax(0,1fr) 26px minmax(0,1fr);padding:3px 4px 7px;border-right:0;border-bottom:1px solid #1b4858}
 body[data-app-state="RESULTS"] .match-team-mark {font-size:22px}
 body[data-app-state="RESULTS"] .match-team-copy b {font-size:24px}
 body[data-app-state="RESULTS"] .match-overview-stat {min-height:58px;padding:4px}
 body[data-app-state="RESULTS"] .match-team-comparison {grid-column:1/-1;grid-template-columns:minmax(0,1fr);gap:4px;padding:6px 2px 0;border-top:1px solid #1b4858}
 body[data-app-state="RESULTS"] .match-score-bar {grid-template-columns:58px minmax(0,1fr) 22px;gap:5px;font-size:8px}
 body[data-app-state="RESULTS"] .match-result-panel {display:flex;min-height:0;flex-direction:column;gap:5px}
 body[data-app-state="RESULTS"] .match-result-panel>.match-section-heading {display:flex;flex:none;align-items:center;justify-content:space-between;gap:5px;margin:0}
 body[data-app-state="RESULTS"] .result-scroll-hint {color:#8ab5c4;font-size:7px;font-weight:500;letter-spacing:.03em;white-space:nowrap}
 body[data-app-state="RESULTS"] #results.match-scoreboard {box-sizing:border-box;flex:none;min-height:0;max-height:190px;overflow-x:auto;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-x pan-y;scrollbar-width:thin}
 body[data-app-state="RESULTS"] .match-table {width:max(100%,620px);min-width:620px;font-size:10px}
 body[data-app-state="RESULTS"] .match-table th,
 body[data-app-state="RESULTS"] .match-table td {height:21px;padding:2px 5px}
 body[data-app-state="RESULTS"] .match-table th {height:22px;padding:2px 5px}
 body[data-app-state="RESULTS"] .match-table thead th {font-size:8px}
 body[data-app-state="RESULTS"] .match-table .column-pilot {height:21px;gap:5px}
 body[data-app-state="RESULTS"] .match-table .column-pilot img {width:17px;height:17px}
 body[data-app-state="RESULTS"] .scoreboard-pilot-copy {gap:5px}
 body[data-app-state="RESULTS"] .scoreboard-pilot-copy strong {font-size:8px}
 body[data-app-state="RESULTS"] .scoreboard-pilot-copy small {font-size:7px}
 body[data-app-state="RESULTS"] .match-summary-footer {position:static;z-index:auto;display:grid;grid-template-columns:minmax(0,1fr);min-height:0;margin-top:0;padding:2px 0 0;background:transparent;}
 body[data-app-state="RESULTS"] .match-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;width:100%;margin:0}
 body[data-app-state="RESULTS"] .match-actions button {box-sizing:border-box;min-width:0;min-height:42px;padding:7px 5px;font-size:9px;letter-spacing:.05em}
}

@media (orientation:landscape) and (max-height:550px) and (min-width:761px) and (max-width:1200px) {
 body[data-app-state="ROOM_BROWSER"] #room-browser .screen-body {max-height:100dvh;overflow:hidden}
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-browser-columns {min-height:0;overflow:hidden}
 body[data-app-state="ROOM_BROWSER"] #room-browser .room-browser-columns>section,
 body[data-app-state="ROOM_BROWSER"] #room-browser #room-create {min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}

 body[data-app-state="ROOM_LOBBY"] #room-lobby {padding:0;overflow:hidden}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body {
  box-sizing:border-box;
  display:grid;
  grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);
  grid-template-rows:auto auto minmax(0,1fr) auto;
  grid-template-areas:"head head" "info info" "roster roster" "loadout footer";
  gap:5px 8px;
  width:100%;
  height:100dvh;
  max-height:100dvh;
  padding:calc(env(safe-area-inset-top) + 5px) 10px calc(env(safe-area-inset-bottom) + 5px);
  overflow:hidden;
 }

 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body>header {grid-area:head;min-height:34px;margin:0;padding:0 0 4px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .screen-body>header h1 {font-size:15px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-leave {min-height:32px;height:32px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .lobby-info-row {grid-area:info;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:8px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-status,
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-details {font-size:9px;line-height:1.1}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-roster {grid-area:roster;display:flex;min-height:0;overflow:hidden}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-columns {display:grid;flex:1 1 0;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr);height:auto;min-width:0;min-height:0;gap:5px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-panel {display:flex;min-width:0;min-height:0;flex-direction:column;padding:4px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-panel h3 {font-size:10px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-player-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:1px 6px;min-width:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-player-name {box-sizing:border-box;min-width:0;min-height:22px;padding:4px 3px;font-size:9px;line-height:1.15}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .team-panel .ai-slots {margin-top:2px;padding:4px;font-size:7px;line-height:1.1}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .saved-loadout {display:grid;grid-area:loadout;grid-template-columns:minmax(0,1fr);grid-template-rows:8px 26px;gap:2px;min-height:0;padding:3px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .saved-loadout>span {font-size:7px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items {height:26px;min-height:0}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items .saved-loadout-item {flex-basis:45px;min-width:45px;height:31px;min-height:31px;grid-template-rows:24px 7px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items .saved-loadout-item img {width:24px;height:24px;min-width:24px;min-height:24px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout-items .saved-loadout-item span {font-size:5px}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-loadout {display:none}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .lobby-settings #room-team-label {justify-self:end}
 body[data-app-state="ROOM_LOBBY"] #room-lobby .lobby-footer {display:flex;grid-area:footer;box-sizing:border-box;width:100%;height:42px;min-width:0;min-height:42px;align-items:center;justify-content:flex-end;gap:6px;margin:0;border:0;padding:0;overflow:hidden}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #lobby-ready-status {min-width:0;margin:0;font-size:8px;line-height:1.15}
 body[data-app-state="ROOM_LOBBY"] #room-lobby #room-start {min-height:42px}

 body[data-app-state="RESULTS"] #overlay.match-summary-overlay {place-items:start center;padding:4px;overflow-x:hidden;overflow-y:auto}
 body[data-app-state="RESULTS"] .match-summary-screen {display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto minmax(180px,1fr) auto;gap:5px;width:100%;height:auto;max-height:none;min-height:100%;overflow:visible}
 body[data-app-state="RESULTS"] .match-summary-header {min-height:46px}
 body[data-app-state="RESULTS"] .match-summary-banner {width:28px;height:38px}
 body[data-app-state="RESULTS"] .match-summary-header h1 {font-size:28px}
 body[data-app-state="RESULTS"] .match-reward-summary,
 body[data-app-state="RESULTS"] .match-overview,
 body[data-app-state="RESULTS"] .match-result-panel {padding:5px}
 body[data-app-state="RESULTS"] .match-reward-summary>.match-reward-heading {margin-bottom:3px;font-size:8px}
 body[data-app-state="RESULTS"] .match-reward-list {grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}
 body[data-app-state="RESULTS"] .match-reward-item {grid-template-columns:17px minmax(0,1fr);gap:3px;min-height:27px;padding:1px 3px;font-size:7px}
 body[data-app-state="RESULTS"] .match-reward-item img,
 body[data-app-state="RESULTS"] .match-reward-icon {width:15px;height:15px;font-size:10px}
 body[data-app-state="RESULTS"] .match-reward-copy {gap:1px}
 body[data-app-state="RESULTS"] .match-reward-copy strong {overflow:hidden;font-size:7px;line-height:1;text-overflow:ellipsis;white-space:nowrap}
 body[data-app-state="RESULTS"] .match-reward-copy b {font-size:9px}
 body[data-app-state="RESULTS"] .match-overview {padding:3px}
 body[data-app-state="RESULTS"] .match-overview-grid {grid-template-columns:1.2fr .8fr .8fr 1fr;min-height:44px}
 body[data-app-state="RESULTS"] .match-team-score {grid-column:auto;grid-template-columns:minmax(0,1fr) 20px minmax(0,1fr);padding:0 4px;border-right:1px solid #1b4858;border-bottom:0}
 body[data-app-state="RESULTS"] .match-team-mark {font-size:19px}
 body[data-app-state="RESULTS"] .match-team-copy b {font-size:20px}
 body[data-app-state="RESULTS"] .match-overview-stat {min-height:40px;gap:2px;padding:1px}
 body[data-app-state="RESULTS"] .match-overview-stat>strong {font-size:8px}
 body[data-app-state="RESULTS"] .match-overview-stat>b {font-size:11px}
 body[data-app-state="RESULTS"] .overview-icon {font-size:16px}
 body[data-app-state="RESULTS"] .match-team-comparison {grid-column:1/-1;grid-template-columns:auto minmax(0,1fr) minmax(0,1fr);padding:3px 0 0}
 body[data-app-state="RESULTS"] .match-result-panel {min-height:180px}
 body[data-app-state="RESULTS"] #results.match-scoreboard {max-height:61px;min-height:0}
 body[data-app-state="RESULTS"] .match-table th,
 body[data-app-state="RESULTS"] .match-table td {height:19px;padding:1px 4px}
 body[data-app-state="RESULTS"] .match-table .column-pilot {height:19px}
 body[data-app-state="RESULTS"] .match-table .column-pilot img {width:15px;height:15px}
 body[data-app-state="RESULTS"] .match-summary-footer {position:sticky;bottom:0;z-index:5;display:block;box-sizing:border-box;min-height:42px;padding:3px 0;background:#06131df5;border-top:1px solid #17627a;backdrop-filter:blur(6px)}
 body[data-app-state="RESULTS"] .match-summary-brand,
 body[data-app-state="RESULTS"] .match-summary-spacer {display:none}
 body[data-app-state="RESULTS"] .match-actions {display:flex;flex-wrap:nowrap;justify-content:center;gap:6px;width:100%;margin:0}
 body[data-app-state="RESULTS"] .match-actions button {flex:1;max-width:220px;min-width:0;min-height:40px;padding:5px;font-size:9px}
}

/* Match results use stacked stat cards on mobile, with normal page scrolling. */
@media (max-width:760px), (orientation:landscape) and (max-height:550px) and (min-width:761px) and (max-width:1200px) {
 body[data-app-state="RESULTS"] #overlay.match-summary-overlay {display:block;place-items:initial;box-sizing:border-box;padding-bottom:calc(env(safe-area-inset-bottom) + var(--match-footer-space,72px));overflow-x:hidden;overflow-y:auto;scroll-padding-bottom:calc(env(safe-area-inset-bottom) + var(--match-footer-space,72px))}
 body[data-app-state="RESULTS"] .match-summary-screen {display:flex;width:100%;height:auto;max-height:none;min-height:0;flex-direction:column;gap:7px;overflow:visible}
 body[data-app-state="RESULTS"] #match-final-score-mobile:not([hidden]),
 body[data-app-state="RESULTS"] #personal-match-highlight:not([hidden]) {box-sizing:border-box;flex:none;min-width:0;padding:6px;border:1px solid var(--result-border);background:#040e17ef;box-shadow:inset 0 0 20px #24a9c40a}
 body[data-app-state="RESULTS"] #match-final-score-mobile:not([hidden]) {display:block}
 body[data-app-state="RESULTS"] #personal-match-highlight:not([hidden]) {display:grid;gap:5px}
 body[data-app-state="RESULTS"] #match-final-score-mobile .match-section-heading,
 body[data-app-state="RESULTS"] #personal-match-highlight .match-section-heading {margin:0 0 4px;font-size:9px}
 body[data-app-state="RESULTS"] #match-final-score-mobile .match-team-score {grid-template-columns:minmax(0,1fr) 22px minmax(0,1fr);padding:2px 4px 0;border:0}
 body[data-app-state="RESULTS"] #match-final-score-mobile .match-team-mark {font-size:20px}
 body[data-app-state="RESULTS"] #match-final-score-mobile .match-team-copy b {font-size:22px}
 body[data-app-state="RESULTS"] #personal-match-highlight .match-player-card {margin:0;padding:6px 8px}
 body[data-app-state="RESULTS"] #match-overview .match-team-score {display:none}
 body[data-app-state="RESULTS"] .match-result-panel {display:flex;flex:none;min-height:0;flex-direction:column;gap:5px}
 body[data-app-state="RESULTS"] #results.match-scoreboard {display:block;flex:none;min-height:0;max-height:none;overflow:visible}
 body[data-app-state="RESULTS"] .match-table {display:none}
 body[data-app-state="RESULTS"] .match-player-cards {display:grid;gap:7px}
 body[data-app-state="RESULTS"] .match-summary-footer {position:fixed;inset-inline:8px;bottom:env(safe-area-inset-bottom);z-index:25;box-sizing:border-box;min-height:64px;margin:0;padding:6px 10px max(6px,env(safe-area-inset-bottom));border-top:1px solid #245264;background:#04101bee;backdrop-filter:blur(10px)}
 body[data-app-state="RESULTS"] .match-actions button {min-height:44px}
}
