/* War in the Void — view-specific styles (menus, settings). Base design system lives in base.css. */

/* body.has-bars (base.css) already reserves space for the fixed bars */
.view {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* ---- home ---- */
.view-home {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--topbar-h) - var(--bottombar-h) - var(--safe-top) - var(--safe-bot));
  justify-content: center;
  text-align: center;
}

.home-hero { margin-bottom: 28px; }

.home-title {
  /* sized so "WAR IN THE VOID" stays on one line down to ~320px wide */
  font-size: clamp(24px, 7vw, 64px);
  letter-spacing: 0.1em;
  margin: 0;
  line-height: 1.05;
  white-space: nowrap;
}

.home-tagline {
  margin: 10px 0 0;
  opacity: 0.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
}

.home-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
}

.btn-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 20px;
  min-height: 56px;
}

.btn-menu-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.btn-menu-sub {
  font-size: 12px;
  opacity: 0.65;
}

.home-foot { margin-top: 28px; font-size: 12px; }

/* landscape: two-column menu so it fits without scrolling */
:root[data-orient="landscape"] .home-menu {
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
:root[data-orient="landscape"] .btn-menu:first-child {
  grid-column: 1 / -1;
}

/* ---- dev world sandbox ---- */
body.fullscreen-view .bottombar { display: none; }
body.fullscreen-view { padding-bottom: 0 !important; }

.view-devworld {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.devworld-stage { position: absolute; inset: 0; }
.devworld-stage canvas { touch-action: none; }

.devworld-hud {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  left: 10px;
  right: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  pointer-events: none;
  font-size: 12px;
  color: var(--text-dim);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.devworld-stat {
  background: rgba(8, 8, 15, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-variant-numeric: tabular-nums;
}

.devworld-hint { margin-left: auto; opacity: 0.75; }

/* ---- match chrome: minimap, control groups, box select ---- */
.match-minimap {
  position: fixed;
  z-index: 40;
  width: 144px;
  height: 144px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  background: var(--bg);
  touch-action: none;
  image-rendering: pixelated;
}
:root[data-orient="landscape"] .match-minimap {
  left: 10px;
  bottom: calc(var(--safe-bot) + 10px);
}
:root[data-orient="portrait"] .match-minimap {
  right: 10px;
  top: calc(var(--safe-top) + 46px);
  width: 118px;
  height: 118px;
}

.cg-strip {
  position: fixed;
  z-index: 40;
  display: flex;
  gap: 6px;
}
/* Portrait: vertical strip, left edge, vertically centered — clear of the
   bottom HUD band (playtest: horizontal strip collided with bottom menus).
   Landscape: short screens can't fit a vertical strip next to the minimap,
   so it goes horizontal along the top-center. */
:root[data-orient="portrait"] .cg-strip {
  flex-direction: column;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}
:root[data-orient="landscape"] .cg-strip {
  flex-direction: row;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--safe-top) + 44px);
}

.cg-slot {
  position: relative;
  width: 48px;
  height: 44px;
  padding: 2px 4px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  box-shadow: var(--bevel-up);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  cursor: pointer;
}
.cg-slot:active { box-shadow: var(--bevel-down); }
.cg-slot.is-empty { opacity: 0.38; }
.cg-slot.is-assigned-flash { border-color: var(--accent); box-shadow: 0 0 8px var(--accent-line); }
.cg-num {
  position: absolute;
  top: 1px;
  left: 4px;
  font-size: 9px;
  color: var(--text-mute);
}
.cg-count { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cg-type { font-size: 8px; letter-spacing: 0.08em; color: var(--text-dim); }

.match-boxbtn {
  position: fixed;
  z-index: 40;
  width: 48px;
  height: 48px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text-dim);
  box-shadow: var(--bevel-up);
  font-size: 20px;
  cursor: pointer;
}
.match-boxbtn.is-armed {
  border-color: var(--good);
  color: var(--good);
  box-shadow: 0 0 8px rgba(62, 196, 109, 0.5);
}
:root[data-orient="landscape"] .match-boxbtn {
  left: 164px; /* beside the minimap; selection panel is bottom-center */
  bottom: calc(var(--safe-bot) + 10px);
}
:root[data-orient="portrait"] .match-boxbtn {
  left: 10px;
  top: calc(var(--safe-top) + 46px); /* mirrors the minimap, clear of bottom HUD */
}

.match-vignette {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  box-shadow: inset 0 0 70px 14px rgba(255, 77, 94, 0.55);
  opacity: 0;
  transition: opacity 0.25s;
}
.match-vignette.is-hit { opacity: 1; }

/* tap-to-jump event notifications: a centered stack of small tappable cards.
   The container ignores pointer events so it never blocks the game; the cards
   opt back in so they can be tapped to snap the camera to the event. */
/* idle-worker button (SC2-style). Portrait: above the selection panel,
   bottom-left (the minimap lives top-right there). Landscape: perched ON TOP
   of the bottom-left minimap so they never overlap. */
.match-idle {
  position: absolute; z-index: 41;
  left: calc(var(--safe-left) + 10px);
  bottom: calc(var(--safe-bot) + 96px);
  display: flex; align-items: center; gap: 6px;
  min-width: 52px; min-height: 44px; padding: 6px 12px;
  background: rgba(16, 16, 28, 0.9);
  border: 1px solid var(--faction, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--bevel-up), var(--shadow-1);
  color: var(--text); font-size: 18px; line-height: 1;
  cursor: pointer;
}
.match-idle:active { background: rgba(40, 40, 64, 0.9); }
.match-idle.is-hidden { display: none; }
/* landscape: the minimap owns the bottom-left corner (144px + 10px margin) —
   sit the button directly above its top edge */
:root[data-orient="landscape"] .match-idle {
  bottom: calc(var(--safe-bot) + 162px);
}
.match-idle-ico { font-size: 18px; }
.match-idle-count {
  font-size: 13px; font-weight: 800;
  color: var(--faction, var(--accent-bright));
}

/* floating combat / resource text: rises and fades from its world spot */
.match-floats {
  position: absolute; inset: 0; z-index: 39;
  pointer-events: none; overflow: hidden;
}
.match-float {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 15px; font-weight: 800; letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  will-change: transform, opacity;
  animation: match-float-rise 1s ease-out forwards;
}
@keyframes match-float-rise {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  15%  { opacity: 1; transform: translate(-50%, -55%) scale(1.05); }
  30%  { transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .match-float { animation: match-float-fade 1s ease-out forwards; }
  @keyframes match-float-fade { 0% { opacity: 1; } 100% { opacity: 0; } }
}

.match-notifs {
  position: absolute;
  /* below the top HUD band (resources / control-group strip / minimap) so
     the alerts never overlap those controls, in either orientation */
  top: calc(120px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  max-width: 90vw;
}
.match-notif {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #3a3a5a;
  background: rgba(20, 20, 32, 0.92);
  color: #eaeaf6;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  animation: mn-in 0.18s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.match-notif:active { transform: scale(0.96); }
.match-notif.mn-ok { border-color: var(--good, #3ec46d); }
.match-notif.mn-error { border-color: #ff5b5b; background: rgba(48, 20, 26, 0.94); }
.match-notif .mn-jump { opacity: 0.55; font-size: 12px; }
@keyframes mn-in { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }

.match-boxrect {
  position: absolute;
  z-index: 45;
  border: 1px solid var(--good);
  background: rgba(62, 196, 109, 0.12);
  pointer-events: none;
  display: none;
}

/* ---- skirmish difficulty picker ---- */
.diff-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.diff-btn { flex: 1 1 auto; min-width: 72px; opacity: 0.6; }
.diff-btn.is-active {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent-bright);
  box-shadow: 0 0 8px var(--accent-line);
}

/* ---- multiplayer ---- */
.mp-status {
  text-align: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  border: 1px solid var(--line-soft);
  font-size: 13px;
}
.mp-status.mp-error { color: var(--danger); border-color: var(--danger); }
.mp-status.mp-good { color: var(--good); border-color: var(--good); }

.mp-code {
  text-align: center;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--accent-bright);
  padding: 12px 0 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px var(--accent-line);
}

.mp-join-row { display: flex; gap: 10px; align-items: stretch; }
.mp-code-input {
  flex: 1 1 auto;
  min-width: 0;            /* KEY: let the input shrink so the button stays on-row */
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--bg-elev-2);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.mp-code-input::placeholder { letter-spacing: 0.14em; color: var(--text-mute); }
.mp-join-row .btn { flex: 0 0 auto; white-space: nowrap; }
/* host card: "List in the Match Browser" toggle */
.mp-list-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; cursor: pointer; }
.mp-list-chk { width: 18px; height: 18px; accent-color: #5b8cff; }
/* match browser: public room rows */
.mp-browser { display: flex; flex-direction: column; gap: 6px; }
.mp-lobby-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #2c2c46; border-radius: 8px; background: #14141f; padding: 8px 10px;
}
.mp-lobby-info { flex: 1; min-width: 0; }
.mp-lobby-host { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-lobby-meta { font-size: 12px; }
.mp-lobby-join { flex: 0 0 auto; }

/* in-match net status (stall / resync) */
.match-netstatus {
  position: fixed;
  z-index: 58;
  left: 50%;
  top: calc(var(--safe-top) + 54px);
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: var(--radius);
  background: rgba(8, 8, 15, 0.9);
  border: var(--border-w) solid var(--warn);
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.match-netstatus.is-hidden { display: none; }

/* ---- forms (settings) ---- */
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  min-height: 44px;
}

.form-label {
  flex: 0 0 130px;
  font-size: 14px;
  opacity: 0.85;
}

.form-row input[type="range"] { flex: 1; min-height: 44px; }
.form-row input[type="text"] { flex: 1; }

/* ---- skirmish lobby ---- */
.view-lobby { max-width: 760px; margin: 0 auto; }
.lob-wrap { display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }
.lob-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lob-head h2 { margin: 0; }
.lob-back { flex: none; }
.lob-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #7a7fa5; margin-top: 4px; }

.lob-maps { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.lob-map {
  flex: none; width: 120px; border: 1px solid #34345a; border-radius: 10px;
  background: #16162a; padding: 6px; cursor: pointer; text-align: center;
}
.lob-map.is-sel { border-color: #7c9bff; box-shadow: 0 0 0 1px #7c9bff inset; }
.lob-map-thumb { width: 108px; height: 108px; border-radius: 6px; background: #07070d; image-rendering: pixelated; display: block; }
.lob-map-name { font-size: 12px; font-weight: 700; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lob-map-meta { font-size: 11px; color: #8b90b5; }

.lob-slots { display: flex; flex-direction: column; gap: 6px; }
.lob-slot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid #2c2c46; border-radius: 8px; background: #14141f; padding: 8px 10px;
}
.lob-team-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid #0006; }
.lob-slot-who { font-weight: 700; min-width: 34px; }
.lob-sel {
  appearance: none; background: #1b1b2c; color: #e0e0f0; border: 1px solid #34345a;
  border-radius: 7px; padding: 6px 8px; font-size: 13px; min-height: 40px; flex: 1; min-width: 92px;
}
.lob-x {
  appearance: none; margin-left: auto; flex: none; border: 1px solid #5a3040; background: #241820;
  color: #ff8a9a; border-radius: 7px; width: 36px; height: 36px; cursor: pointer; font-size: 13px;
}
.lob-add { align-self: flex-start; }
.lob-start { margin-top: 8px; }
/* online lobby: read-only slot values + guest waiting note */
.nlb-fac-ro { display: inline-flex; align-items: center; opacity: 0.85; }
.nlb-wait { text-align: center; padding: 10px 0; }
