/* ────────────────────────────────────────────────
   Mobile / portrait responsive overrides
   Activated when body has .is-mobile (set by ScaledStage)
   ──────────────────────────────────────────────── */

body.is-mobile {
  overflow-y: auto;
  overflow-x: hidden;
}
body.is-mobile .stage-wrap {
  position: relative;
  display: block;
  min-height: 100vh;
  overflow: visible;
}
body.is-mobile .mobile-shell {
  width: 100%;
  min-height: 100vh;
  position: relative;
}
body.is-mobile .stage {
  width: 100%;
  height: auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Backplate / starfield: fixed to viewport so it stays during scroll on lobby */
body.is-mobile .backplate {
  position: fixed;
  inset: 0;
  z-index: 0;
}
body.is-mobile .backplate::before {
  clip-path: polygon(0 0, 100% 0, 100% 40%, 0 50%);
  width: 100%;
}
body.is-mobile .backplate::after {
  clip-path: polygon(0 50%, 100% 40%, 100% 100%, 0 100%);
  width: 100%;
  right: 0;
  left: 0;
}
body.is-mobile .starfield { position: fixed; }
body.is-mobile .planet {
  position: fixed;
  width: 280px;
  height: 280px;
}
body.is-mobile .scanlines,
body.is-mobile .crt-glow { position: fixed; }

/* Corner brackets + hud: smaller, fixed */
body.is-mobile .corner-bracket { width: 32px; height: 32px; }
body.is-mobile .cb-tl { top: 10px; left: 10px; }
body.is-mobile .cb-tr { top: 10px; right: 10px; }
body.is-mobile .cb-bl { bottom: 10px; left: 10px; }
body.is-mobile .cb-br { bottom: 10px; right: 10px; }

body.is-mobile .hud-corner {
  font-size: 10px;
  letter-spacing: 0.12em;
  gap: 8px;
}
body.is-mobile .hud-tl { top: 14px; left: 24px; }
body.is-mobile .hud-tr { top: 14px; right: 24px; }
body.is-mobile .hud-credits { font-size: 11px; }

/* Side slashes: hide on mobile (clutter) */
body.is-mobile .side-slashes { display: none; }

/* ── Mobile prototype controls: shrink + reflow ── */
body.is-mobile .controls {
  top: 50px;
  bottom: auto;
  right: 8px;
  left: 8px;
  font-size: 10px;
  gap: 4px;
  padding: 6px 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100vw - 16px);
}
body.is-mobile .controls button {
  padding: 4px 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
}
body.is-mobile .controls .label { display: none; }

/* ───── State isolation on mobile (lobby state) ── */
body.is-mobile [data-state="lobby"] .player-panel,
body.is-mobile [data-state="lobby"] .title-block,
body.is-mobile [data-state="lobby"] .rank-badge,
body.is-mobile [data-state="lobby"] .roster,
body.is-mobile [data-state="lobby"] .center-pillar,
body.is-mobile [data-state="lobby"] .launch-bar,
body.is-mobile [data-state="lobby"] .hud-corner,
body.is-mobile [data-state="lobby"] .corner-bracket,
/* Same isolation for overlay states (lobby2 / collection / draft / auction / post / court) */
body.is-mobile [data-state="lobby2"] .player-panel,
body.is-mobile [data-state="lobby2"] .title-block,
body.is-mobile [data-state="lobby2"] .rank-badge,
body.is-mobile [data-state="lobby2"] .roster,
body.is-mobile [data-state="lobby2"] .center-pillar,
body.is-mobile [data-state="lobby2"] .hud-corner,
body.is-mobile [data-state="lobby2"] .corner-bracket,
body.is-mobile [data-state="collection"] .player-panel,
body.is-mobile [data-state="collection"] .title-block,
body.is-mobile [data-state="collection"] .rank-badge,
body.is-mobile [data-state="collection"] .roster,
body.is-mobile [data-state="collection"] .center-pillar,
body.is-mobile [data-state="collection"] .hud-corner,
body.is-mobile [data-state="collection"] .corner-bracket,
body.is-mobile [data-state="draft"] .player-panel,
body.is-mobile [data-state="draft"] .title-block,
body.is-mobile [data-state="draft"] .rank-badge,
body.is-mobile [data-state="draft"] .roster,
body.is-mobile [data-state="draft"] .center-pillar,
body.is-mobile [data-state="draft"] .hud-corner,
body.is-mobile [data-state="draft"] .corner-bracket,
body.is-mobile [data-state="auction"] .player-panel,
body.is-mobile [data-state="auction"] .title-block,
body.is-mobile [data-state="auction"] .rank-badge,
body.is-mobile [data-state="auction"] .roster,
body.is-mobile [data-state="auction"] .center-pillar,
body.is-mobile [data-state="auction"] .hud-corner,
body.is-mobile [data-state="auction"] .corner-bracket,
body.is-mobile [data-state="post"] .player-panel,
body.is-mobile [data-state="post"] .title-block,
body.is-mobile [data-state="post"] .rank-badge,
body.is-mobile [data-state="post"] .roster,
body.is-mobile [data-state="post"] .center-pillar,
body.is-mobile [data-state="post"] .hud-corner,
body.is-mobile [data-state="post"] .corner-bracket,
body.is-mobile [data-state="court"] .player-panel,
body.is-mobile [data-state="court"] .title-block,
body.is-mobile [data-state="court"] .rank-badge,
body.is-mobile [data-state="court"] .roster,
body.is-mobile [data-state="court"] .center-pillar,
body.is-mobile [data-state="court"] .hud-corner,
body.is-mobile [data-state="court"] .corner-bracket {
  display: none !important;
}

/* ───── LOBBY mobile ────────────────────────────── */
body.is-mobile .lobby {
  position: relative;
  inset: auto;
  padding: 16px 16px 96px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 50;
}
body.is-mobile .lobby-title-strip {
  height: auto;
  padding: 10px 12px;
  flex-direction: row;
  flex-wrap: wrap;
  margin-bottom: 6px;
  gap: 8px;
}
body.is-mobile .lobby-title-strip .lts-left,
body.is-mobile .lobby-title-strip .lts-right {
  font-size: 9px;
  letter-spacing: 0.16em;
  gap: 6px;
}
body.is-mobile .lobby-title-strip .lts-right { order: 3; }
body.is-mobile .lobby-title-strip .lts-mid { gap: 6px; flex: 1; justify-content: center; }
body.is-mobile .lobby-title-strip .big { font-size: 18px; letter-spacing: 0.18em; }
body.is-mobile .lobby-title-strip .sub { font-size: 9px; letter-spacing: 0.18em; }

body.is-mobile .lobby-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
body.is-mobile .lobby-col-left,
body.is-mobile .lobby-col-mid,
body.is-mobile .lobby-col-right { gap: 14px; }

body.is-mobile .lobby-section-h {
  padding: 8px 12px;
}
body.is-mobile .lobby-section-h .lbl {
  font-size: 13px;
  letter-spacing: 0.18em;
}
body.is-mobile .lobby-section-h .meta {
  font-size: 10px;
  letter-spacing: 0.12em;
}
body.is-mobile .lobby-section-h .ghost-btn {
  font-size: 10px;
  padding: 6px 10px;
  letter-spacing: 0.16em;
}

/* Pilot card: portrait shorter, stats below */
body.is-mobile .lobby-pilot-portrait { height: 280px; }
body.is-mobile .lobby-pilot-codestrip { font-size: 10px; }
body.is-mobile .lobby-pilot-stats {
  padding: 14px 16px 16px;
  gap: 12px;
}
body.is-mobile .lobby-pilot-name .jp { font-size: 26px; }
body.is-mobile .lobby-pilot-name .en { font-size: 11px; letter-spacing: 0.22em; }
body.is-mobile .lobby-pilot-row { gap: 8px; }
body.is-mobile .metric-lbl { font-size: 9px; letter-spacing: 0.18em; }
body.is-mobile .metric-val { font-size: 16px; }
body.is-mobile .metric-val .suf { font-size: 10px; }
body.is-mobile .lobby-pilot-title { padding: 8px 12px; gap: 8px; }
body.is-mobile .lobby-pilot-title .lbl { font-size: 9px; letter-spacing: 0.16em; }
body.is-mobile .lobby-pilot-title .ribbon { font-size: 16px; }

/* Squad: 2 cols on portrait, stacked vertical cards */
body.is-mobile .lobby-squad-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
}
body.is-mobile .lobby-mech {
  grid-template-columns: 1fr;
  grid-template-rows: 110px auto;
}
body.is-mobile .lobby-mech-img { min-height: 110px; border-right: 0; border-bottom: 1px solid color-mix(in srgb, var(--pos-c, var(--c-left)) 35%, transparent); }
body.is-mobile .lobby-mech-pos { font-size: 11px; padding: 1px 6px; }
body.is-mobile .lobby-mech-ovr { font-size: 16px; padding: 1px 6px; }
body.is-mobile .lobby-mech-ovr em { font-size: 7px; }
body.is-mobile .lobby-mech-body { padding: 8px 10px 9px; }
body.is-mobile .lobby-mech-model { font-size: 13px; letter-spacing: 0.06em; }
body.is-mobile .lobby-mech-callsign { font-size: 9px; }
body.is-mobile .lm-stat { grid-template-columns: 22px 1fr 22px; gap: 4px; height: 12px; }
body.is-mobile .lm-stat-lbl { font-size: 8px; }
body.is-mobile .lm-stat-val { font-size: 9px; }
body.is-mobile .lobby-mech-ability { font-size: 8px; }

/* Terrain card */
body.is-mobile .lobby-terrain {
  padding: 12px 14px;
  gap: 12px;
  flex-wrap: wrap;
}
body.is-mobile .terrain-thumb { width: 90px; height: 60px; }
body.is-mobile .terrain-planet { width: 36px; height: 36px; top: -16px; right: 8px; }
body.is-mobile .terrain-label { font-size: 9px; letter-spacing: 0.18em; }
body.is-mobile .terrain-name { font-size: 18px; letter-spacing: 0.1em; margin: 1px 0 2px; }
body.is-mobile .terrain-sub { font-size: 11px; letter-spacing: 0.12em; }
body.is-mobile .terrain-rolls { font-size: 9px; gap: 6px; }
body.is-mobile .terrain-rolls .dot { width: 8px; height: 8px; }

/* Queue cards */
body.is-mobile .queue-list { padding: 10px; gap: 6px; }
body.is-mobile .qc-body { padding: 10px 12px; gap: 4px; }
body.is-mobile .qc-mark { width: 4px; }
body.is-mobile .qc-h { gap: 8px; flex-wrap: wrap; }
body.is-mobile .qc-label { font-size: 15px; letter-spacing: 0.14em; }
body.is-mobile .qc-sub { font-size: 10px; letter-spacing: 0.12em; }
body.is-mobile .qc-desc { font-size: 11px; }
body.is-mobile .qc-meta { gap: 12px; flex-wrap: wrap; }
body.is-mobile .qc-meta span { font-size: 8px; letter-spacing: 0.18em; }
body.is-mobile .qc-meta b { font-size: 12px; }
body.is-mobile .qc-arrow { width: 24px; font-size: 14px; }

/* Deploy bar: sticky at bottom of viewport */
body.is-mobile .lobby-deploy-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  height: 76px;
  z-index: 60;
  background: rgba(2, 6, 10, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.22);
  display: flex;
  flex-direction: row;
}
body.is-mobile .ldb-info {
  padding: 10px 14px;
  gap: 0;
  min-width: 0;
}
body.is-mobile .ldb-label { font-size: 9px; letter-spacing: 0.22em; }
body.is-mobile .ldb-mode { font-size: 18px; letter-spacing: 0.1em; }
body.is-mobile .ldb-meta { font-size: 9px; letter-spacing: 0.12em; margin-top: 2px; }
body.is-mobile .deploy-btn {
  padding: 0 24px 0 30px;
  margin-right: 0;
  clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%);
  gap: 10px;
}
body.is-mobile .db-glyph { font-size: 32px; }
body.is-mobile .db-label b { font-size: 22px; letter-spacing: 0.1em; }
body.is-mobile .db-label em { font-size: 9px; letter-spacing: 0.14em; }

/* ───── VS SCREEN mobile (vertical split) ──────── */
body.is-mobile [data-state="vs"] .stage,
body.is-mobile [data-state="found"] .stage {
  height: 100vh;
  min-height: 100vh;
}

body.is-mobile .title-block {
  position: fixed;
  top: 38px;
  width: calc(100vw - 32px);
  z-index: 70;
}
body.is-mobile .title-line {
  font-size: 38px;
  letter-spacing: 0.08em;
  -webkit-text-stroke-width: 2px;
}
body.is-mobile .title-sub {
  font-size: 11px;
  letter-spacing: 0.32em;
  margin-top: 4px;
}

body.is-mobile .center-pillar {
  position: fixed;
  left: 50%;
  top: 50vh;
  transform: translate(-50%, -50%);
  width: auto;
  z-index: 30;
}
body.is-mobile .vs-mark { font-size: 96px; }
body.is-mobile .vs-mark .v,
body.is-mobile .vs-mark .s {
  transform: none;
  z-index: auto;
}
body.is-mobile .terrain { font-size: 10px; letter-spacing: 0.24em; }
body.is-mobile .terrain b { font-size: 16px; letter-spacing: 0.12em; margin-top: 2px; }

/* Player panels: top half / bottom half */
body.is-mobile .player-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  height: 50vh;
  display: flex;
  flex-direction: column;
}
body.is-mobile .player-panel.left {
  top: 0;
  left: 0;
}
body.is-mobile .player-panel.right {
  top: 50vh;
  right: 0;
  flex-direction: column-reverse;
}

body.is-mobile .portrait-wrap {
  height: 45vh;
  width: 100%;
}
body.is-mobile .portrait-frame,
body.is-mobile .portrait-tint {
  clip-path: none !important;
}
body.is-mobile .portrait-edge { display: none; }

/* Stats overlay over portrait */
body.is-mobile .stats {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  margin-top: 0;
  padding: 8px 16px 8px;
  width: 100%;
  gap: 2px;
  background: linear-gradient(180deg, transparent, rgba(2,6,10,0.92));
  align-items: stretch !important;
  z-index: 6;
}
body.is-mobile .player-panel.right .stats {
  top: 0;
  bottom: auto;
  background: linear-gradient(0deg, transparent, rgba(2,6,10,0.92));
}
body.is-mobile .stat-row {
  height: 26px;
  padding: 0 10px !important;
  font-size: 11px;
  letter-spacing: 0.12em;
  clip-path: none !important;
  border-left: 2px solid var(--c-left);
  border-right: 0;
  background: rgba(2,6,10,0.4);
}
body.is-mobile .player-panel.right .stat-row {
  border-right: 2px solid var(--c-right);
  border-left: 0;
}
body.is-mobile .stat-row .label { font-size: 9px; letter-spacing: 0.14em; }
body.is-mobile .row-team .icon { width: 14px; height: 14px; margin-right: 6px; }
body.is-mobile .player-panel.right .row-team .icon { margin-left: 6px; margin-right: 0; }
body.is-mobile .row-rp .val { font-size: 13px; }
body.is-mobile .row-rp .rp-suffix { font-size: 9px; }
body.is-mobile .row-name { font-size: 15px; }
body.is-mobile .row-loc { font-size: 11px; }
body.is-mobile .title-ribbon { height: 22px; }
body.is-mobile .ribbon-bg { font-size: 11px; letter-spacing: 0.12em; }
body.is-mobile .ribbon-level { font-size: 11px; padding: 0 6px; }

/* Rank badge: shrink + reposition */
body.is-mobile .rank-badge {
  top: auto;
  bottom: 8vh;
  width: 64px;
  height: 64px;
}
body.is-mobile .player-panel.left .rank-badge { right: 12px; bottom: 11vh; }
body.is-mobile .player-panel.right .rank-badge { left: 12px; top: 8vh; bottom: auto; }
body.is-mobile .rank-badge .rank-label { font-size: 7px; letter-spacing: 0.18em; top: 6px; }
body.is-mobile .rank-badge .rank-emblem { inset: 14px; }
body.is-mobile .rank-badge .rank-emblem svg { width: 36px; height: 36px; }
body.is-mobile .rank-badge .rank-name { font-size: 10px; bottom: 9px; }

/* Roster: hide on mobile (too cluttered) */
body.is-mobile .roster { display: none; }

/* Launch bar: bottom of viewport */
body.is-mobile .launch-bar {
  position: fixed;
  top: auto;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 8px 18px;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.18em;
  z-index: 100;
}
body.is-mobile [data-state="vs"] .launch-bar {
  animation: launchInMobile 500ms ease 1400ms both;
}
@keyframes launchInMobile {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
body.is-mobile .launch-bar .count { font-size: 18px; min-width: 18px; }

/* Match found banner */
body.is-mobile .found-banner { font-size: 36px; letter-spacing: 0.14em; }
body.is-mobile .found-banner .sub { font-size: 12px; letter-spacing: 0.24em; margin-top: 6px; }

/* ───── SEARCHING mobile ───────────────────────── */
body.is-mobile [data-state="searching"] .player-panel.left,
body.is-mobile [data-state="searching"] .player-panel.right {
  opacity: 0;
  pointer-events: none;
}

body.is-mobile .radar {
  width: 86vw;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  height: auto;
}
body.is-mobile .radar .ring.r2 { inset: 12%; }
body.is-mobile .radar .ring.r3 { inset: 24%; }
body.is-mobile .radar .ring.r4 { inset: 36%; }

body.is-mobile .search-status { width: 90vw; }
body.is-mobile .search-status .lock { font-size: 11px; letter-spacing: 0.22em; margin-bottom: 8px; }
body.is-mobile .search-status .title { font-size: 22px; letter-spacing: 0.14em; }
body.is-mobile .search-status .sub { font-size: 11px; letter-spacing: 0.18em; margin-top: 6px; }

body.is-mobile .search-log {
  position: fixed;
  top: auto;
  bottom: 92px;
  right: auto;
  left: 16px;
  width: calc(100vw - 32px);
  font-size: 10px;
  text-align: left;
  line-height: 1.6;
  max-height: 90px;
  overflow: hidden;
}

body.is-mobile .search-bar {
  position: fixed;
  bottom: 22px;
  width: calc(100vw - 32px);
  z-index: 95;
}
body.is-mobile .search-bar .meta {
  font-size: 9px;
  letter-spacing: 0.12em;
  margin-top: 6px;
}

/* ── Bottom nav (replaces deploy bar on mobile) ── */
body.is-mobile .lobby.has-bnav .lobby-grid { padding-bottom: 0; }
body.is-mobile .bnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 78px;
  padding: 0 8px;
  z-index: 60;
}
body.is-mobile .bnav-bg {
  clip-path: polygon(
    0 0,
    calc(50% - 64px) 0,
    calc(50% - 50px) 18px,
    calc(50% + 50px) 18px,
    calc(50% + 64px) 0,
    100% 0,
    100% 100%,
    0 100%
  );
}
body.is-mobile .bnav-item { gap: 4px; padding: 8px 0; }
body.is-mobile .bnav-ico svg { width: 20px; height: 20px; }
body.is-mobile .bnav-lbl { font-size: 9px; letter-spacing: 0.2em; }

body.is-mobile .bnav-globe-aura {
  top: -38px;
  width: 100px;
  height: 100px;
  margin-left: -50px;
}
body.is-mobile .bnav-globe {
  top: -34px;
  width: 80px;
  height: 80px;
  margin-left: -40px;
}
body.is-mobile .bnav-globe-lbl {
  font-size: 10px;
  letter-spacing: 0.26em;
  margin-top: 42px;
}

/* Mission picker on mobile: full-screen modal */
body.is-mobile .mp-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
}
body.is-mobile .mp-modal {
  width: calc(100vw - 24px);
  max-height: calc(100vh - 100px);
  margin-bottom: 78px;
}
body.is-mobile .mp-h {
  padding: 12px 14px;
  gap: 10px;
}
body.is-mobile .mp-title {
  font-size: 16px;
  letter-spacing: 0.2em;
  padding-right: 0;
}
body.is-mobile .mp-tag { font-size: 9px; letter-spacing: 0.18em; }
body.is-mobile .mp-list { padding: 12px; gap: 8px; }
body.is-mobile .mp-body { padding: 12px 14px; gap: 4px; }
body.is-mobile .mp-label { font-size: 18px; letter-spacing: 0.12em; }
body.is-mobile .mp-jp { font-size: 11px; letter-spacing: 0.1em; }
body.is-mobile .mp-desc { font-size: 11px; }
body.is-mobile .mp-meta { gap: 14px; flex-wrap: wrap; }
body.is-mobile .mp-meta span { font-size: 9px; letter-spacing: 0.18em; }
body.is-mobile .mp-meta b { font-size: 12px; }
body.is-mobile .mp-arrow { width: 36px; font-size: 14px; }
body.is-mobile .mp-foot {
  padding: 8px 14px;
  font-size: 9px;
  letter-spacing: 0.18em;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Tweaks panel mobile ── */
body.is-mobile .twk-panel {
  width: calc(100vw - 16px);
  max-width: 280px;
}
