/* ==========================================================================
   CQM2 v2.2.0 Design-Token & Full-Bleed Observatory System (`src/styles/tokens.css`)
   - Self-hosted SIL OFL 1.1 Variable Inter + JetBrains Mono WOFF2 (`font-display: swap`)
   - Strict CSP Cleanliness & Zero Override Hacks
   - Full-Bleed `100vw x 100vh` 4K Cosmogonic Canvas + Translucent Glassmorphic HUD
   - Fluid responsive ergonomics from 320px mobile edge-sheets to 3840x2160 4K UHD
   - Strict `tabular-nums` alignment on all live scientific readouts
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
}

:root {
  --bg-void: #050913;
  --bg-panel: #0b1221;
  --bg-elevated: #111b30;
  --bg-hover: #182642;
  --bg-glass: rgba(6, 9, 18, 0.84);
  --bg-glass-deep: rgba(4, 6, 14, 0.91);
  --border-subtle: #1f3154;
  --border-strong: #2f4b7c;
  --border-glass: rgba(56, 189, 248, 0.22);

  --text-primary: #eaf1fb;
  --text-secondary: #a8bdd9;
  --text-muted-hud: #7e95b4;
  --text-accent-cyan: #22d3ee;
  --text-accent-gold: #fbbf24;
  --text-accent-emerald: #34d399;
  --text-accent-violet: #c084fc;
  --text-danger: #f87171;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs: clamp(0.75rem, 0.72rem + 0.12vw, 0.84rem);
  --fs-sm: clamp(0.84rem, 0.80rem + 0.16vw, 0.94rem);
  --fs-base: clamp(0.94rem, 0.90rem + 0.20vw, 1.06rem);
  --fs-lg: clamp(1.10rem, 1.02rem + 0.35vw, 1.32rem);
  --fs-xl: clamp(1.35rem, 1.20rem + 0.65vw, 1.85rem);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --touch-min: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.cqm-cosmos-body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #14041d;
  user-select: none;
}

a {
  color: var(--text-accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--text-accent-gold);
}

:focus-visible {
  outline: 2px solid var(--text-accent-gold);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 1200;
  background: var(--text-accent-gold);
  color: #050913;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

.mono,
code,
pre,
.metric-val,
.hud-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   1. Full-Bleed 4K WebGL2 Cosmos Canvas & 8-Stage Cosmic Boot Loader
   ========================================================================== */

#c {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  z-index: 0;
  touch-action: none;
  cursor: grab;
}

#c:active {
  cursor: grabbing;
}

#cqm-boot {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 42%, #240836 0%, #0a0414 68%, #04020a 100%);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#cqm-boot.boot-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-rings {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.boot-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid transparent;
}

.boot-ring-outer {
  inset: 0;
  border-top-color: #22d3ee;
  border-right-color: rgba(192, 132, 252, 0.5);
  animation: cqmSpinCw 2.6s linear infinite;
}

.boot-ring-mid {
  inset: 11px;
  border-bottom-color: #f472b6;
  border-left-color: rgba(52, 211, 153, 0.55);
  animation: cqmSpinCcw 1.9s linear infinite;
}

.boot-ring-inner {
  inset: 22px;
  border-top-color: #fbbf24;
  animation: cqmSpinCw 1.3s linear infinite;
}

.boot-glyph {
  font-size: 24px;
  color: #f8fafc;
  text-shadow: 0 0 14px rgba(34, 211, 238, 0.8);
}

@keyframes cqmSpinCw {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cqmSpinCcw {
  to {
    transform: rotate(-360deg);
  }
}

.boot-brand {
  font-family: var(--font-mono);
  font-size: clamp(0.88rem, 1.5vw, 1.24rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #f8fafc;
  text-align: center;
  margin-bottom: 4px;
}

.boot-sub {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #a8bdd9;
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 20px;
}

.boot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 140px));
  gap: 8px;
  max-width: 92vw;
}

@media (max-width: 560px) {
  .boot-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

.boot-tile {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(11, 18, 33, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.24);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.boot-tile-0 { border-left: 3px solid #22d3ee; }
.boot-tile-1 { border-left: 3px solid #34d399; }
.boot-tile-2 { border-left: 3px solid #a3e635; }
.boot-tile-3 { border-left: 3px solid #f472b6; }
.boot-tile-4 { border-left: 3px solid #fbbf24; }
.boot-tile-5 { border-left: 3px solid #c084fc; }
.boot-tile-6 { border-left: 3px solid #fb7185; }
.boot-tile-7 { border-left: 3px solid #38bdf8; }

.boot-k {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #94a3b8;
}

.boot-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
}

/* ==========================================================================
   2. Top-Center Mini-World Pill & Cosmological Toast Banner
   ========================================================================== */

#cqm-mini-entry {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(76, 33, 74, 0.88), rgba(104, 57, 34, 0.88));
  box-shadow: 0 4px 20px rgba(217, 119, 6, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: #fef3c7;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#cqm-mini-entry:hover {
  transform: translateX(-50%) scale(1.03);
  border-color: #fbbf24;
  box-shadow: 0 4px 26px rgba(251, 191, 36, 0.45);
}

#cqm-mini-entry.mini-active {
  background: linear-gradient(135deg, rgba(6, 95, 70, 0.92), rgba(14, 116, 144, 0.92));
  border-color: #34d399;
  color: #ecfdf5;
}

#sec {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 31;
  padding: 4px 13px;
  border-radius: 999px;
  background: rgba(6, 10, 22, 0.86);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sec.toast-visible {
  opacity: 1;
}

/* ==========================================================================
   3. Floating Observatory Columns (`#ui`, `#ui-col-left`, `#ui-col-right`)
   ========================================================================== */

#ui {
  position: fixed;
  inset: 8px 8px 96px 8px;
  z-index: 20;
  display: grid;
  grid-template-columns: clamp(192px, 16vw, 236px) 1fr clamp(268px, 23vw, 344px);
  gap: 10px;
  pointer-events: none;
}

#ui.panels-hidden #ui-col-left,
#ui.panels-hidden #ui-col-right,
#ui.panels-hidden .edge-collapse-btn {
  opacity: 0;
  pointer-events: none;
}

.hud-col {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.32) transparent;
}

#ui-col-left {
  grid-column: 1;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

#ui-col-right {
  grid-column: 3;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

#ui-col-left.col-collapsed {
  transform: translateX(calc(-100% - 14px));
  opacity: 0;
  pointer-events: none;
}

#ui-col-right.col-collapsed {
  transform: translateX(calc(100% + 14px));
  opacity: 0;
  pointer-events: none;
}

.hud-card {
  pointer-events: auto;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(71, 108, 155, 0.28);
  border-radius: 7px;
  padding: 8px 9px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.52);
  color: var(--text-primary);
}

.hud-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.hud-card-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: #00e5ff;
  text-transform: uppercase;
}

.hud-card-title-muted {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #8da2c0;
  text-transform: uppercase;
}

.hud-chev-btn {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hud-chev-btn:hover {
  border-color: #22d3ee;
  color: #ffffff;
}

.hud-card.card-collapsed .hud-card-body {
  display: none;
}

/* Edge Collapse Tabs (`◀` / `▶`) */
.edge-collapse-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 24;
  width: 18px;
  height: 42px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(6, 10, 20, 0.84);
  color: #94a3b8;
  font-size: 10px;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edge-collapse-btn:hover {
  color: #22d3ee;
  border-color: #22d3ee;
}

#cqm-edge-left {
  left: clamp(202px, calc(16vw + 10px), 246px);
}

#cqm-edge-left.edge-docked {
  left: 6px;
}

#cqm-edge-right {
  right: clamp(278px, calc(23vw + 10px), 354px);
}

#cqm-edge-right.edge-docked {
  right: 6px;
}

/* ==========================================================================
   4. Left Column Cards: TELEMETRY (`#sP`), SORTING FIELDS (`#algoP`), `#perf-hud`
   ========================================================================== */

.tel-metric {
  margin-bottom: 5px;
}

.tel-metric:last-child {
  margin-bottom: 0;
}

.tel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.tel-k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #7c93b2;
}

.tel-v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.spark-canvas {
  display: block;
  width: 100%;
  height: 15px;
  border-radius: 3px;
  background: rgba(2, 4, 12, 0.85);
}

/* 25 Sorting Fields List (`#algoP`) */
.algo-hdr-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.algo-mini-btn {
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.78);
  color: #cbd5e1;
  border-radius: 4px;
  padding: 2px 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.algo-mini-btn:hover,
.algo-mini-btn.active {
  border-color: #22d3ee;
  color: #22d3ee;
  background: rgba(8, 47, 73, 0.65);
}

.algo-list-scroll {
  max-height: clamp(128px, 20vh, 235px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.algo-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid rgba(51, 65, 85, 0.45);
  background: rgba(10, 15, 28, 0.86);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.algo-row:hover {
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
}

.algo-row.algo-active {
  border-color: #22d3ee;
  background: rgba(8, 47, 73, 0.58);
  color: #ffffff;
}

.algo-name-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.algo-prog-bar {
  width: 36px;
  height: 4px;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  overflow: hidden;
}

.algo-prog-bar::-webkit-progress-bar {
  background: rgba(30, 41, 59, 0.9);
  border-radius: 999px;
}

.algo-prog-bar::-webkit-progress-value {
  background: linear-gradient(90deg, #22d3ee, #a855f7);
  border-radius: 999px;
}

.algo-prog-bar::-moz-progress-bar {
  background: linear-gradient(90deg, #22d3ee, #a855f7);
  border-radius: 999px;
}

/* 25 Rainbow Hue Diamond Indicators (CSP-clean, zero inline style) */
.algo-hue-0  { color: #ff4d6d; }
.algo-hue-1  { color: #ff6b4a; }
.algo-hue-2  { color: #ff8c42; }
.algo-hue-3  { color: #ffa93a; }
.algo-hue-4  { color: #ffd13b; }
.algo-hue-5  { color: #d9f94d; }
.algo-hue-6  { color: #9ef05a; }
.algo-hue-7  { color: #52e575; }
.algo-hue-8  { color: #2dd4a8; }
.algo-hue-9  { color: #22d3ee; }
.algo-hue-10 { color: #38bdf8; }
.algo-hue-11 { color: #60a5fa; }
.algo-hue-12 { color: #818cf8; }
.algo-hue-13 { color: #a78bfa; }
.algo-hue-14 { color: #c084fc; }
.algo-hue-15 { color: #e879f9; }
.algo-hue-16 { color: #f472b6; }
.algo-hue-17 { color: #fb7185; }
.algo-hue-18 { color: #fda4af; }
.algo-hue-19 { color: #fcd34d; }
.algo-hue-20 { color: #6ee7b7; }
.algo-hue-21 { color: #67e8f9; }
.algo-hue-22 { color: #93c5fd; }
.algo-hue-23 { color: #d8b4fe; }
.algo-hue-24 { color: #f9a8d4; }

/* Performance & Hardware Tier Readout (`#perf-hud`) */
#perf-hud {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  line-height: 1.42;
  color: #cbd5e1;
}

.perf-top-line {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.perf-fps-good {
  color: #34d399;
}

.perf-fps-mid {
  color: #fbbf24;
}

.perf-fps-low {
  color: #c084fc;
}

.perf-sub-line {
  color: #94a3b8;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.perf-tier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
}

.tier-pill {
  padding: 3px 6px;
  min-height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(71, 85, 105, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  text-align: center;
}

.tier-pill:hover {
  color: #f8fafc;
  border-color: #38bdf8;
}

.tier-pill.tier-active {
  background: rgba(8, 47, 73, 0.78);
  border-color: #22d3ee;
  color: #22d3ee;
  font-weight: 700;
}

/* ==========================================================================
   5. Right Column Cards: OBSERVATORY, SORTING · FIELD, SIM · SETTINGS, 3 Live Brains
   ========================================================================== */

.obs-tab-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 2px;
  border-radius: 5px;
  background: rgba(2, 6, 16, 0.82);
  border: 1px solid rgba(51, 65, 85, 0.48);
  margin-bottom: 6px;
}

.obs-tab-btn {
  padding: 4px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #7c93b2;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.obs-tab-btn:hover {
  color: #e2e8f0;
}

.obs-tab-btn.obs-tab-active {
  background: rgba(8, 55, 78, 0.72);
  border-color: rgba(34, 211, 238, 0.45);
  color: #22d3ee;
}

.obs-page {
  display: none;
  flex-direction: column;
  gap: 5px;
  max-height: clamp(148px, 22vh, 265px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.3) transparent;
}

.obs-page.obs-page-active {
  display: flex;
}

.obs-chart-canvas {
  display: block;
  width: 100%;
  height: 68px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid rgba(51, 65, 85, 0.42);
  background: rgba(2, 4, 14, 0.88);
}

/* Active Sorting Field & Lore Card (`#alg`) */
.alg-active-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 2px;
}

.alg-active-stats {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: #94a3b8;
  margin-bottom: 5px;
}

#g-alg {
  display: block;
  width: 100%;
  height: 18px;
  border-radius: 3px;
  background: rgba(2, 4, 14, 0.9);
  margin-bottom: 6px;
}

.alg-sector-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #e2e8f0;
}

.alg-omega-line {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: #cbd5e1;
}

.alg-omega-tri {
  color: #fbbf24;
}

/* Sim Settings 2-Column Readout (`#hud-vsr`) */
.vsr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 10px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
}

.vsr-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.vsr-k {
  color: #6e84a3;
  flex-shrink: 0;
}

.vsr-v {
  color: #f1f5f9;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 3 Live Brains Square Canvases (`APEX`, `MECHA`, `GLYPH`) */
.brains-3-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.brain-live-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  border: 1px solid rgba(71, 108, 155, 0.35);
  background: rgba(3, 5, 14, 0.92);
}

/* ==========================================================================
   6. Bottom-Center 3-Row Floating Dock (`#cqm-bottom-stack`)
   ========================================================================== */

#cqm-bottom-stack {
  position: fixed;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: calc(100vw - 12px);
  pointer-events: none;
}

.dock-strip {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 12px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(6, 9, 18, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(71, 108, 155, 0.28);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}

.dock-strip::-webkit-scrollbar {
  display: none;
}

.dock-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  min-height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(71, 85, 105, 0.42);
  background: rgba(13, 20, 36, 0.86);
  color: #dbe7f6;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.dock-pill:hover {
  background: rgba(24, 38, 66, 0.95);
  border-color: #38bdf8;
  color: #ffffff;
}

.dock-pill.dock-pill-warm .dock-ico {
  color: #fb923c;
}

.dock-pill.dock-pill-active {
  background: rgba(6, 78, 59, 0.72);
  border-color: #34d399;
  color: #6ee7b7;
}

.dock-pill.dock-pill-entropy {
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.42);
}

.dock-pill.dock-pill-chaos {
  color: #a3e635;
  border-color: rgba(163, 230, 53, 0.42);
}

.dock-pill.dock-pill-xno {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.42);
}

.dock-pill.dock-pill-danger:hover {
  border-color: #f87171;
  color: #fca5a5;
}

#bar-shell {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 12px);
  padding: 3px 5px;
  border-radius: 8px;
  background: rgba(5, 8, 16, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(71, 108, 155, 0.32);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}

#bar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

#bar::-webkit-scrollbar {
  display: none;
}

.bar-arrow-btn {
  flex-shrink: 0;
  width: 24px;
  height: 26px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(71, 85, 105, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}

.bar-arrow-btn:hover {
  border-color: #22d3ee;
  color: #22d3ee;
}

/* ==========================================================================
   7. Center-HUD Floating Glassmorphic Studio Modal (`#cqm-studio-modal`)
   ========================================================================== */

#cqm-studio-modal {
  position: fixed;
  inset: 52px clamp(12px, 8vw, 180px) 106px clamp(12px, 8vw, 180px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: rgba(7, 12, 24, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.78);
  overflow: hidden;
  user-select: text;
}

#cqm-studio-modal.modal-closed {
  display: none;
}

.studio-modal-hdr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(11, 18, 33, 0.96);
  border-bottom: 1px solid var(--border-subtle);
}

.studio-nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.studio-tab-btn {
  padding: 5px 10px;
  min-height: 30px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.studio-tab-btn.studio-tab-active {
  border-color: #22d3ee;
  color: #22d3ee;
  background: rgba(8, 47, 73, 0.65);
}

.studio-close-btn {
  padding: 5px 12px;
  min-height: 30px;
  border-radius: 5px;
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(127, 29, 29, 0.38);
  color: #fecaca;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.studio-close-btn:hover {
  border-color: #f87171;
  color: #ffffff;
}

.studio-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

/* ==========================================================================
   8. Mobile Edge-Sheet Tabs & Coarse-Pointer Thumb Joysticks (`<= 900px`)
   ========================================================================== */

#cqm-mobile-sheet-bar {
  display: none;
}

#cqm-touch-pads {
  display: none;
}

@media (max-width: 900px) {
  #ui {
    inset: 80px 6px 102px 6px;
    grid-template-columns: 1fr;
  }

  .edge-collapse-btn {
    display: none;
  }

  #cqm-mobile-sheet-bar {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: flex;
    gap: 5px;
    max-width: calc(100vw - 12px);
  }

  #cqm-mini-entry {
    top: 44px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    padding: 4px 11px;
    font-size: 10.5px;
    white-space: nowrap;
  }

  #cqm-mini-entry:hover {
    transform: translateX(-50%);
  }

  #ui-col-left,
  #ui-col-right {
    grid-column: 1;
    display: none;
    max-height: calc(100dvh - 188px);
  }

  #ui-col-left.mob-sheet-open,
  #ui-col-right.mob-sheet-open {
    display: flex;
    transform: none;
    opacity: 1;
  }

  #cqm-studio-modal {
    inset: 80px 6px 102px 6px;
  }

  .dock-pill {
    min-height: 30px;
    padding: 5px 9px;
  }
}

@media (pointer: coarse) {
  #cqm-touch-pads.touch-enabled {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 106px;
    z-index: 22;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }
}

.touch-joy-pad {
  pointer-events: auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(6, 10, 22, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(226, 232, 240, 0.75);
  touch-action: none;
}

/* ==========================================================================
   9. Companion Pages, Studios, Tables, Dials & Command Palette (Shared)
   ========================================================================== */

.error-banner {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--text-danger);
  background: rgba(127, 29, 29, 0.88);
  color: var(--text-primary);
  font-size: var(--fs-xs);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cqm-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7, #6d28d9);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: var(--fs-sm);
}

.brand-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  max-width: 100%;
}

.pill-badge.honesty-pill {
  border-color: var(--border-strong);
  color: var(--text-accent-gold);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-accent-cyan);
}

.btn-primary {
  background: #0369a1;
  border-color: #38bdf8;
  color: #ffffff;
}

.btn-primary:hover {
  background: #0284c7;
}

.btn-gold {
  background: #78350f;
  border-color: #fbbf24;
  color: #fef3c7;
}

.btn-start {
  justify-content: flex-start;
  text-align: left;
}

.select-input,
.text-input {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  max-width: 100%;
}

.textarea-input {
  width: 100%;
  min-height: 84px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  resize: vertical;
}

.panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  min-width: 0;
}

.panel-card h2,
.panel-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: var(--fs-lg);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-width: 0;
}

.kpi-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text-accent-cyan);
  overflow-wrap: anywhere;
}

.dial-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-bottom: 12px;
}

.dial-slider {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 30px;
  accent-color: var(--text-accent-cyan);
  cursor: pointer;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--bg-elevated);
}

.status-pass {
  color: var(--text-accent-emerald);
  font-weight: 700;
}

.status-warn {
  color: var(--text-accent-gold);
  font-weight: 700;
}

.status-fenced {
  color: var(--text-danger);
  font-weight: 700;
}

.hidden-panel {
  display: none;
}

.mb-18 { margin-bottom: 18px; }
.mb-14 { margin-bottom: 14px; }
.mb-10 { margin-bottom: 10px; }
.mt-10 { margin-top: 10px; }
.my-14 { margin: 14px 0; }

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

.flex-col-gap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-muted-xs {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-secondary);
}

.code-block {
  background: var(--bg-void);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  font-size: var(--fs-sm);
}

.dl-term {
  color: var(--text-accent-cyan);
  font-weight: 700;
  margin-top: 14px;
}

.fft-canvas {
  width: 110px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-void);
}

/* WildBeyond Quantum & Chaos Lab */
.wildbeyond-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.wildbeyond-canvas {
  width: 100%;
  height: 280px;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #030711;
}

/* Command Palette Dialog (Ctrl+K) */
.cmd-dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-primary);
  padding: 18px;
  width: min(560px, 92vw);
}

.cmd-dialog::backdrop {
  background: rgba(2, 6, 15, 0.76);
}

.cmd-input {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-void);
  color: var(--text-primary);
  font-size: var(--fs-base);
  margin-bottom: 12px;
}

/* Static Reference Pages (`docs.html`, `specs.html`, `bible.html`, `glossary.html`, `downloads.html`) */
.doc-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.cqm-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

/* ==========================================================================
   10. v3.0.0 Complete Original-CQM Fidelity Extensions
       - Scrollable 16-Metric Left Telemetry + Economy Section (`#sP`)
       - Roman Tally `⛓ ACCESS` & `◈ STAGE II` (`UwU`) Cipher Puzzle Dialogs
       - Top-Center `SUPERHERO` HUD (`#cqm-superhero-hud`)
       - `🧪 SANDBOX` Phyla & World-System Matrix
       - `⚙ SET` 6-Tab Settings & Keyboard Shortcut Matrix
       - `ARCHON` 5 Archons + `PRIME Super Neural` (4×27 = 108 Cards) + `MEGA 4D`
       - `XYLOS` `{7,3}` Poincaré Hyperbolic Disk + 6 ADR-0018 Organs
       - `NHI OBS` 9-Panel Mind Readout Grid & Satellite Lab Visuals
   ========================================================================== */

.tel-scroll-body {
  max-height: clamp(168px, 26vh, 310px);
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 211, 238, 0.35) transparent;
}

.tel-section-div {
  margin: 7px 0 4px;
  padding-top: 5px;
  border-top: 1px solid rgba(71, 108, 155, 0.32);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fbbf24;
  text-transform: uppercase;
}

.tel-compact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(51, 65, 85, 0.32);
}

.tel-compact-row .tel-v {
  font-size: 10.5px;
}

.tel-badge-honest {
  color: #34d399;
  font-size: 9.5px;
}

/* Top-Center Superhero Mode HUD (`⛓ ACCESS` Unlocked) */
#cqm-superhero-hud {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 33;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(12, 24, 48, 0.92), rgba(58, 22, 72, 0.92));
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 6px 24px rgba(34, 211, 238, 0.28);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #f8fafc;
}

#cqm-superhero-hud.hidden-panel {
  display: none;
}

@media (max-width: 960px) {
  #cqm-superhero-hud {
    top: 88px;
    width: calc(100vw - 24px);
    max-width: 440px;
    justify-content: center;
    border-radius: 12px;
    padding: 6px 8px;
    gap: 5px;
  }
}

.hero-stat-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(6, 78, 59, 0.65);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
  font-weight: 700;
}

/* Cipher Puzzle Dialogs (`⛓ ACCESS` & `◈ STAGE II`) */
.cipher-dialog {
  border: 1px solid #38bdf8;
  border-radius: var(--radius-md);
  background: rgba(7, 12, 24, 0.96);
  color: var(--text-primary);
  padding: 20px;
  width: min(480px, 92vw);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
}

.cipher-dialog::backdrop {
  background: rgba(3, 5, 14, 0.78);
}

.cipher-tally-hint {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(251, 191, 36, 0.38);
  color: #fde68a;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.cipher-status {
  min-height: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  margin: 8px 0;
}

/* Sub-Tab Bar inside Studio Panels (`ARCHON` / `PRIME NEURAL` / `SET`) */
.subtab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.subtab-btn {
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.subtab-btn.subtab-active {
  border-color: #22d3ee;
  background: rgba(8, 47, 73, 0.72);
  color: #22d3ee;
}

/* Archon 5 Sovereign Cards & PRIME Super Neural 27-Card Grid */
.archon-5-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.archon-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.neural-27-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.neural-card {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(11, 18, 33, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.26);
  font-family: var(--font-mono);
  font-size: 11px;
}

.neural-card-title {
  color: #38bdf8;
  font-weight: 700;
  margin-bottom: 3px;
}

/* 101 Pantheons Glyph Matrix */
.pantheon-101-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: rgba(4, 7, 16, 0.85);
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.pantheon-glyph-tile {
  padding: 5px 4px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}

.pantheon-glyph-tile:hover,
.pantheon-glyph-tile.apex-tile {
  border-color: #fbbf24;
  color: #fef08a;
  background: rgba(120, 53, 15, 0.42);
}

.glyph-sym {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

/* Xylos Poincaré Hyperbolic Disk + 6 ADR-0018 Organs */
.xylos-split-grid {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

@media (max-width: 760px) {
  .xylos-split-grid {
    grid-template-columns: 1fr;
  }
}

.poincare-canvas {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: radial-gradient(circle at 50% 50%, #0d1b36 0%, #040711 75%, #020308 100%);
}

.organ-row {
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: 7px;
}

.organ-hdr {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.organ-prog {
  width: 100%;
  height: 7px;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  overflow: hidden;
}

.organ-prog::-webkit-progress-bar {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 999px;
}

.organ-prog::-webkit-progress-value {
  background: linear-gradient(90deg, #34d399, #22d3ee, #c084fc);
  border-radius: 999px;
}

/* NHI OBS 9-Panel Mind Readout Grid */
.nhi-9-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.nhi-mind-card {
  padding: 9px 11px;
  border-radius: 6px;
  background: rgba(11, 19, 36, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.nhi-mind-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: #22d3ee;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* Sandbox Phyla Stepper & World System Toggles */
.sandbox-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.phyla-stepper-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.sys-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 7px;
}

.sys-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.mega4d-canvas {
  width: 100%;
  height: 190px;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(192, 132, 252, 0.4);
  background: #040610;
  margin-top: 8px;
}

/* Satellite Lab SVG Visualization Frames */
.lab-svg-frame {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #040814;
  margin: 10px 0 16px;
}

.honesty-callout {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid #fbbf24;
  background: rgba(120, 53, 15, 0.25);
  color: #fef3c7;
  margin-bottom: 18px;
  font-size: var(--fs-sm);
}

/* CQM-25 v1.0.0 Canonical Profile & 150-Peer ALife Comparative Catalog */
.cqm-svg-figure {
  margin: 14px 0 20px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: #0f172a;
}

.cqm-svg-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.cqm-svg-caption {
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: #334155;
  font-family: var(--font-mono);
}

.cqm-svg-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.cqm-archive-details {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.cqm-archive-details > summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-accent-cyan);
}

.alife-catalog-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
}

.alife-catalog-controls input,
.alife-catalog-controls select {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.alife-catalog-controls input {
  flex: 2;
  min-width: 240px;
}

.alife-catalog-controls select {
  flex: 1;
  min-width: 200px;
}

.alife-catalog-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin: 8px 0 16px;
}

.alife-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.alife-catalog-grid article {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.alife-catalog-grid article[hidden] {
  display: none;
}

.alife-catalog-grid article .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-accent-cyan);
}

.alife-catalog-grid article h2 {
  font-size: var(--fs-lg);
  margin: 8px 0 10px;
  color: var(--text-primary);
}

.alife-catalog-grid article .badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: var(--text-accent-emerald);
  margin-bottom: 8px;
}

.alife-catalog-grid article .badge.partial {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--text-accent-gold);
}

.alife-catalog-grid article .note {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.alife-catalog-grid article details {
  font-size: var(--fs-xs);
  color: var(--text-muted-hud);
  margin-bottom: 12px;
}

.alife-catalog-grid article details summary {
  cursor: pointer;
  color: var(--text-secondary);
}

.alife-catalog-grid article a {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* CQM-25 Canonical 25-Axis Profile Styles (Strict CSP, Zero !important) */
.cqm25-law,
.cqm25-notice,
.cqm25-method {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  padding: 18px 22px;
  margin: 20px 0;
}

.cqm25-law {
  border-left: 4px solid var(--text-accent-cyan);
}

.cqm25-notice,
.cqm25-method.provisional {
  border-left: 4px solid var(--text-accent-gold);
}

.cqm25-filters {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--border-subtle);
  padding: 16px;
  border-radius: var(--radius-md);
  margin: 22px 0 12px;
  background: var(--bg-panel);
}

@media (max-width: 900px) {
  .cqm25-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cqm25-filters label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cqm25-filters input,
.cqm25-filters select,
.cqm25-filters button {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 42px;
  padding: 8px 10px;
}

.cqm25-filters button {
  align-self: end;
  cursor: pointer;
}

.cqm25-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 720px) {
  .cqm25-grid {
    grid-template-columns: 1fr;
  }
}

.cqm25-grid .axis {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  padding: 20px;
  min-width: 0;
}

.cqm25-grid .axis[hidden],
p[hidden] {
  display: none;
}

.cqm25-grid .axis-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cqm25-grid .number {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-accent-cyan);
  font-variant-numeric: tabular-nums;
}

.cqm25-grid .kind {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.72rem;
  color: var(--text-muted-hud);
}

.cqm25-grid .tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  margin-bottom: 10px;
}

.cqm25-grid .tags span {
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: var(--bg-elevated);
}

.cqm25-grid .bounded-test {
  color: var(--text-accent-emerald);
}

.cqm25-grid .implemented {
  color: var(--text-accent-cyan);
}

.cqm25-grid .mixed {
  color: var(--text-accent-gold);
}

.cqm25-grid .unassessed {
  color: var(--text-secondary);
}

.cqm25-grid .finding {
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  font-size: var(--fs-sm);
}

.cqm25-grid .uncalibrated {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-accent-gold);
}

.estimate-table {
  overflow-x: auto;
  margin-top: 16px;
}

.estimate-table table,
.crosswalk {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.estimate-table th,
.estimate-table td,
.crosswalk th,
.crosswalk td {
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.estimate-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-accent-gold);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms;
    animation-duration: 0.001ms;
  }
}
