:root {
  color-scheme: dark;
  --bg-0: #07111b;
  --bg-1: #0a1321;
  --bg-2: #0d1827;
  --panel: rgba(11, 18, 28, 0.78);
  --panel-border: rgba(120, 185, 255, 0.18);
  --panel-glow: rgba(93, 240, 255, 0.16);
  --text: #eff6ff;
  --muted: #8fa4bd;
  --blue: #79c2ff;
  --cyan: #5df0ff;
  --green: #6dff9d;
  --yellow: #ffd56d;
  --red: #ff8799;
  --violet: #a68eff;
  --floor: rgba(255, 255, 255, 0.05);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  --ease: 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(93, 240, 255, 0.18), transparent 20%),
    radial-gradient(circle at 85% 14%, rgba(166, 142, 255, 0.16), transparent 18%),
    radial-gradient(circle at 50% 100%, rgba(109, 255, 157, 0.12), transparent 22%),
    linear-gradient(180deg, #050b13 0%, #08111b 42%, #050811 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 32%, transparent 92%);
}

.ops-shell {
  width: min(1320px, calc(100vw - 28px));
  height: 100vh;
  margin: 0 auto;
  padding: 12px 0;
}

.ops-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(560px, 1.22fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "sidebar arena"
    "floor floor";
  gap: 14px;
  height: 100%;
}

.ops-sidebar {
  grid-area: sidebar;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 18px 0 0;
}

.ops-hero {
  display: grid;
  gap: 12px;
  align-items: start;
  max-width: 420px;
}

.ops-kicker,
.lane-kicker {
  margin: 0;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
}

.ops-hero h1 {
  margin: 10px 0 0;
  font-size: clamp(32px, 3.8vw, 60px);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.ops-lede {
  max-width: 36ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.ops-button,
.ops-mini-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease);
}

.ops-button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #02131d;
  font-weight: 700;
}

.ops-button:hover,
.ops-mini-link:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 185, 255, 0.36);
}

.ops-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 26px;
  max-width: 360px;
}

.ops-controls {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: none;
  align-content: start;
  align-self: end;
  padding-top: 0;
}

.arena-shell,
.floor-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(11, 18, 28, 0.9), rgba(8, 14, 23, 0.82));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.summary-row {
  display: grid;
  gap: 6px;
  align-content: start;
}

.summary-label {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1;
}

.summary-value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.floor-panel {
  grid-area: floor;
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  max-height: min(320px, 34vh);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

#inactive-lane {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.arena-shell {
  grid-area: arena;
  padding: 20px 20px 18px;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 22px;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}

.build-bay,
.active-chamber,
.floor-yard {
  position: relative;
}

.build-bay {
  width: min(460px, calc(100% - 28px));
  margin: 0 auto;
  display: grid;
  gap: 0;
  align-content: start;
  overflow: visible;
}

.build-bay.has-preview {
  min-height: 0;
}

.build-queue {
  position: relative;
  display: grid;
  gap: 0;
  justify-items: center;
  margin-bottom: 0;
}

.build-queue-title {
  margin: 0 0 10px;
  color: rgba(232, 243, 255, 0.82);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.build-queue-stack {
  position: relative;
  width: 100%;
  min-height: 122px;
}

.build-queue-stack > .unit-card {
  position: absolute;
  left: 50%;
  top: 0;
  width: min(400px, calc(100% - 28px));
  transform: translateX(-50%) translateY(var(--queue-shift, 0px)) scale(var(--queue-scale, 1));
  opacity: var(--queue-opacity, 1);
  z-index: var(--queue-z, 1);
}

.build-forge {
  position: relative;
  min-height: 148px;
  padding: 10px;
  margin-top: -10px;
  border: 1px solid rgba(255, 213, 109, 0.26);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 213, 109, 0.09), rgba(255, 213, 109, 0.03));
  box-shadow:
    0 0 0 1px rgba(255, 213, 109, 0.06),
    0 0 40px rgba(255, 213, 109, 0.08);
  display: grid;
  align-items: center;
}

.build-forge.has-preview {
  min-height: 0;
  padding: 10px 12px;
}

.build-forge::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 213, 109, 0.24);
  pointer-events: none;
}

.build-forge.has-preview::before {
  inset: 6px;
}

.build-forge > .unit-card,
.build-forge > .empty-card {
  width: 100%;
  max-width: 100%;
}

.active-chamber {
  height: 100%;
  padding: 8px 8px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: grid;
  align-items: center;
}

.active-chamber::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: calc(50% - min(200px, 40vw) - 18px);
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(93, 240, 255, 0.1), rgba(93, 240, 255, 0.45), rgba(93, 240, 255, 0.08));
  pointer-events: none;
}

.active-chamber::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  right: calc(50% - min(200px, 40vw) - 18px);
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(93, 240, 255, 0.1), rgba(93, 240, 255, 0.45), rgba(93, 240, 255, 0.08));
  pointer-events: none;
}

.chamber-stack {
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: center;
  min-height: 0;
  padding-top: 0;
}

.chamber-label {
  width: min(400px, 80vw);
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 0;
  background: transparent;
  color: rgba(232, 243, 255, 0.84);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  justify-self: center;
}

.floor-yard {
  margin-top: 0;
  padding-top: 2px;
  min-height: 0;
  overflow: hidden;
}

.floor-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 0;
  width: 100%;
}

.floor-search-shell {
  flex: 1 1 auto;
}

.floor-search-shell input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  user-select: text;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  outline: none;
}

.floor-search-shell input:focus {
  border-color: rgba(120, 185, 255, 0.34);
  box-shadow: 0 0 0 4px rgba(120, 185, 255, 0.08);
}

.floor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: max-content;
  gap: 6px;
  margin-top: 0;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  overscroll-behavior: contain;
  contain: layout paint;
  padding-right: 2px;
  align-content: start;
}

.floor-grid .unit-card {
  width: 100%;
  min-width: 0;
  align-self: start;
}

.floor-meta {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.floor-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.floor-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.floor-filter.active {
  color: var(--text);
  border-color: rgba(120, 185, 255, 0.22);
  background: rgba(120, 185, 255, 0.1);
}

.unit-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease),
    opacity var(--ease),
    box-shadow var(--ease);
  width: min(400px, 80vw);
  cursor: pointer;
  will-change: transform, opacity;
}

.unit-card.primary-app {
  border-color: rgba(109, 255, 157, 0.28);
  background:
    linear-gradient(180deg, rgba(109, 255, 157, 0.09), rgba(109, 255, 157, 0.03)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  box-shadow:
    0 0 0 1px rgba(109, 255, 157, 0.08),
    0 18px 48px rgba(109, 255, 157, 0.08);
}

.unit-card.primary-app .unit-bar {
  display: none;
}

.unit-card.primary-app .unit-core {
  grid-template-areas: "title actions";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 54px;
}

.unit-card.primary-app .unit-topline,
.unit-card.primary-app .unit-actions {
  align-self: center;
}

.unit-card.primary-app .unit-actions {
  min-height: 0;
}

.unit-card:hover {
  transform: translateY(-1px);
}

.unit-card.draggable {
  cursor: grab;
}

.unit-card.dragging {
  opacity: 0.8;
  transform: scale(0.98);
}

.unit-card.transitioning {
  animation-duration: 420ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-fill-mode: both;
}

.unit-card.transition-inactive-to-building,
.unit-card.transition-active-to-building {
  animation-name: unitToBuild;
}

.unit-card.transition-building-to-active,
.unit-card.transition-inactive-to-active {
  animation-name: unitToActive;
}

.unit-card.transition-active-to-inactive,
.unit-card.transition-building-to-inactive {
  animation-name: unitToArchive;
}

.unit-card.snap-back {
  animation: unitSnapBack 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.build-bay.drop-ready .build-forge {
  border-color: rgba(109, 255, 157, 0.36);
  box-shadow: 0 0 44px rgba(109, 255, 157, 0.14);
}

.build-bay.drop-blocked .build-forge {
  border-color: rgba(255, 135, 153, 0.4);
  box-shadow: 0 0 44px rgba(255, 135, 153, 0.14);
}

.build-bay.drop-blocked .build-forge::after {
  content: "STOP";
  position: absolute;
  top: 14px;
  right: 18px;
  color: var(--red);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.build-bay.drop-blocked .build-forge > .unit-card,
.build-bay.drop-blocked .build-forge > .empty-card {
  transform: scale(1.01);
}

.unit-card.building {
  border-color: rgba(255, 213, 109, 0.3);
  background: linear-gradient(180deg, rgba(255, 213, 109, 0.14), rgba(255, 213, 109, 0.04));
  box-shadow: 0 0 30px rgba(255, 213, 109, 0.1);
  animation: buildPulse 1.5s ease-in-out infinite;
}

.build-bay .unit-card.building {
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(255, 213, 109, 0.08),
    0 0 28px rgba(255, 213, 109, 0.14);
}

.unit-card.queued {
  border-color: rgba(255, 213, 109, 0.18);
  background: linear-gradient(180deg, rgba(255, 213, 109, 0.08), rgba(255, 213, 109, 0.02));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.unit-card.queued:hover {
  transform: translateX(-50%) translateY(var(--queue-shift, 0px)) scale(var(--queue-scale, 1));
}

.unit-card.active {
  border-color: rgba(109, 255, 157, 0.18);
}

.unit-card.inactive {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  opacity: 1;
  filter: none;
}

.unit-core {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "bar actions";
  align-items: center;
  gap: 6px 10px;
  padding: 7px 10px;
  min-height: 46px;
}

.unit-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  grid-area: title;
}

.unit-domain {
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.unit-dot.green {
  color: var(--green);
  background: currentColor;
  animation: liveBlink 1.8s ease-in-out infinite;
}

.unit-dot.cyan {
  color: var(--cyan);
  background: currentColor;
  animation: liveBlink 1.8s ease-in-out infinite;
}

.unit-dot.yellow {
  color: var(--yellow);
  background: currentColor;
  animation: buildBlink 0.9s ease-in-out infinite;
}

.unit-dot.gray {
  color: rgba(255, 255, 255, 0.35);
  background: currentColor;
}

.unit-bar {
  grid-area: bar;
  position: relative;
  width: 184px;
  max-width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.unit-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
}

.unit-card.active .unit-bar > span {
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.unit-card.building .unit-bar > span {
  background: linear-gradient(90deg, var(--yellow), #fff3b0);
}

.unit-card.inactive .unit-bar > span {
  background: transparent;
}

.empty-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.unit-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unit-pill {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.unit-primary-pill {
  color: rgba(215, 255, 226, 0.92);
  border-color: rgba(109, 255, 157, 0.24);
  background: rgba(109, 255, 157, 0.12);
}

.ops-mini-link,
.ops-mini-button {
  min-height: 22px;
  padding: 0 8px;
  font-size: 10px;
}

.unit-status {
  color: #dfe9f7;
  border-color: rgba(120, 185, 255, 0.14);
  background: rgba(120, 185, 255, 0.08);
}

.unit-status.merged {
  color: #e7f7eb;
  border-color: rgba(109, 255, 157, 0.18);
  background: rgba(109, 255, 157, 0.1);
}

.unit-status.review {
  color: #fff1d7;
  border-color: rgba(255, 196, 92, 0.24);
  background: rgba(255, 196, 92, 0.12);
}

.unit-status.closed {
  color: #ffd7d7;
  border-color: rgba(255, 120, 120, 0.2);
  background: rgba(255, 120, 120, 0.1);
}

.unit-status.rebuild {
  color: #fff1d7;
  border-color: rgba(255, 172, 92, 0.22);
  background: rgba(255, 172, 92, 0.11);
}

.unit-status.building {
  color: #fff4c8;
  border-color: rgba(255, 213, 109, 0.22);
  background: rgba(255, 213, 109, 0.1);
}

.ops-mini-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease);
}

.ops-mini-button:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 185, 255, 0.36);
}

.empty-card {
  display: grid;
  grid-auto-rows: min-content;
  gap: 8px;
  align-content: center;
  justify-items: center;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 14px;
  color: var(--muted);
}

@media (max-width: 960px) {
  body {
    overflow: auto;
    height: auto;
  }

  .ops-shell {
    height: auto;
    padding: 14px 0 22px;
  }

  .ops-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "sidebar"
      "arena"
      "floor";
    height: auto;
  }

  .ops-sidebar,
  .arena-shell,
  .floor-panel {
    height: auto;
  }

  .unit-core {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "bar"
      "actions";
  }

  .unit-actions {
    justify-content: space-between;
  }

  .active-chamber::before {
    left: 6px;
  }

  .active-chamber::after {
    right: 6px;
  }

  .floor-grid {
    overflow: visible;
    max-height: none;
    grid-template-columns: 1fr;
  }
}

.preview-modal {
  width: min(1080px, calc(100vw - 42px));
  max-height: calc(100vh - 42px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--text);
}

.preview-modal::backdrop {
  background: rgba(3, 7, 12, 0.72);
  backdrop-filter: blur(8px);
}

.preview-modal-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(10, 17, 27, 0.96), rgba(7, 13, 21, 0.96));
  box-shadow: var(--shadow);
  padding: 26px;
}

.preview-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.preview-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.preview-modal-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cyan);
}

.preview-modal-head h2 {
  margin: 12px 0 0;
  font-size: 42px;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.preview-modal-host {
  margin: 12px 0 0;
  color: var(--muted);
}

.preview-modal-state {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #02131d;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
}

.preview-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.preview-modal-panel {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
}

.preview-modal-panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.modal-list,
.modal-detail-list {
  display: grid;
  gap: 8px;
}

.modal-row,
.modal-detail-item {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-row strong,
.modal-detail-item strong {
  color: var(--text);
}

.empty-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  letter-spacing: -0.03em;
}

.empty-card .empty-copy {
  margin: 0;
  max-width: 34ch;
}

.task-modal {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 32px;
  background:
    radial-gradient(circle at 14% 14%, rgba(93, 240, 255, 0.11), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(166, 142, 255, 0.1), transparent 20%),
    linear-gradient(180deg, rgba(10, 17, 27, 0.98), rgba(7, 13, 21, 0.96));
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.task-modal::backdrop {
  background: rgba(3, 7, 12, 0.78);
  backdrop-filter: blur(10px);
}

.task-modal-frame {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 20px;
  padding: 28px 28px 24px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(11, 18, 28, 0.86), rgba(8, 14, 23, 0.84));
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 26px;
  cursor: pointer;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease);
}

.modal-close:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 185, 255, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

.task-modal-head {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  padding-right: 54px;
}

.modal-eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.task-modal-head h2 {
  margin: 10px 0 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 0.96;
}

.modal-summary {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-state {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.state-pill.live,
.state-pill.ready {
  background: rgba(109, 255, 157, 0.14);
  color: #d2ffe2;
}

.state-pill.review {
  background: rgba(93, 240, 255, 0.14);
  color: #d7fbff;
}

.state-pill.merged {
  background: rgba(191, 164, 255, 0.14);
  color: #f0e7ff;
}

.state-pill.archived,
.state-pill.development {
  background: rgba(255, 255, 255, 0.05);
  color: #d7dfdb;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab,
.button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease),
    color var(--ease);
}

.tab.active,
.button.primary {
  border-color: rgba(93, 240, 255, 0.28);
  background: linear-gradient(135deg, rgba(93, 240, 255, 0.2), rgba(121, 194, 255, 0.18));
  color: #dffcff;
}

.tab:hover,
.button:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 185, 255, 0.3);
  color: var(--text);
}

.modal-panels {
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.panel-stack {
  display: grid;
  gap: 22px;
}

.info-section {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
}

.info-section + .info-section {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.info-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d7fbff;
}

.info-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(93, 240, 255, 0.28), rgba(93, 240, 255, 0.02));
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.runtime-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-shell {
  display: grid;
  gap: 12px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 156px));
  justify-content: start;
  gap: 12px;
}

.gallery-card {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
}

.gallery-card.active {
  border-color: rgba(93, 240, 255, 0.42);
  box-shadow: 0 0 0 1px rgba(93, 240, 255, 0.12), 0 0 24px rgba(93, 240, 255, 0.08);
}

.gallery-card-media {
  display: block;
  aspect-ratio: 1.08 / 1;
  overflow: hidden;
}

.gallery-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card-copy {
  padding: 8px 10px 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  min-height: 46px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-stack {
  color: var(--muted);
}

@keyframes liveBlink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

@keyframes buildBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@keyframes buildPulse {
  0%,
  100% {
    box-shadow: 0 0 28px rgba(255, 213, 109, 0.08);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 213, 109, 0.18);
  }
}

@keyframes unitToBuild {
  0% {
    opacity: 0.45;
    transform: translateY(26px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes unitToActive {
  0% {
    opacity: 0.55;
    transform: translateY(-20px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes unitToArchive {
  0% {
    opacity: 0.5;
    transform: translateY(-18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes unitSnapBack {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  35% {
    transform: translate3d(0, -16px, 0) scale(1.02);
  }
  65% {
    transform: translate3d(0, 8px, 0) scale(0.99);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@media (max-width: 1100px) {
  .ops-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-controls,
  .ops-summary {
    max-width: none;
  }

  .arena-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .ops-shell {
    width: min(100vw - 28px, 100%);
    padding: 28px 0 56px;
  }

  .ops-hero {
    grid-template-columns: 1fr;
  }

  .ops-summary {
    grid-template-columns: 1fr;
  }

  .task-modal-head {
    grid-template-columns: 1fr;
  }

  .floor-controls {
    flex-direction: column;
    align-items: stretch;
  }
}
