/* ZyrodeX Terminal — over-engineered spatial desk (Insider only).
   Inspired by: ui-ux-pro-max OLED + data-dense dashboard;
   21st HUD Area Chart (corner frames / telemetry), Hud Status, Candle TF chrome.
   No heavy backdrop-filter. Brand: cyan #22D3EE + gold metal + navy void. */

body.zx-term-mode {
  --term-gold: #c9a227;
  --term-cyan: #22d3ee;
  --term-panel: rgba(6, 10, 20, 0.94);
  --term-void: #02040a;
  background:
    radial-gradient(ellipse 90% 55% at 78% 18%, rgba(34, 211, 238, 0.09), transparent 55%),
    radial-gradient(ellipse 70% 50% at 12% 80%, rgba(201, 162, 39, 0.06), transparent 50%),
    linear-gradient(180deg, #03060f 0%, var(--term-void) 55%, #010208 100%);
  color-scheme: dark;
}

body.zx-term-mode .site-header {
  background: rgba(2, 4, 10, 0.78);
  border-bottom-color: rgba(34, 211, 238, 0.16);
}

/* Subtle scanline (cyberpunk cue, low cost — not blur) */
body.zx-term-mode .zx-terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(34, 211, 238, 0.35) 3px
  );
}

.zx-terminal {
  position: relative;
  min-height: calc(100vh - 72px);
  isolation: isolate;
  overflow: clip;
}

.zx-terminal-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.zx-terminal-3d.is-flat {
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.05), transparent 40%),
    linear-gradient(0deg, #050910, #02040a);
}

.zx-terminal-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.zx-terminal-chrome {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 78px 1fr;
  min-height: calc(100vh - 72px);
  gap: 0;
}

@media (max-width: 900px) {
  .zx-terminal-chrome { grid-template-columns: 1fr; }
  body.zx-term-mode .zx-terminal::after { opacity: 0.02; }
}

/* Module rail — targeting / HUD chrome */
.zx-mod-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 92px 12px 28px;
  border-right: 1px solid rgba(34, 211, 238, 0.2);
  background:
    linear-gradient(180deg, rgba(4, 8, 18, 0.96), rgba(4, 8, 18, 0.82)),
    repeating-linear-gradient(0deg, transparent, transparent 11px, rgba(34, 211, 238, 0.03) 12px);
  box-shadow: inset -12px 0 28px rgba(34, 211, 238, 0.04);
}

@media (max-width: 900px) {
  .zx-mod-rail {
    flex-direction: row;
    justify-content: flex-start;
    padding: 76px 16px 12px;
    border-right: none;
    border-bottom: 1px solid rgba(34, 211, 238, 0.18);
    overflow-x: auto;
  }
}

.zx-mod {
  width: 52px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: rgba(8, 14, 28, 0.7);
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: border-color 0.2s, color 0.2s, box-shadow 0.25s, transform 0.25s;
  cursor: pointer;
}

.zx-mod span.icon {
  font-size: 1rem;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.45);
}

.zx-mod.active {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.7);
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.18), inset 0 0 22px rgba(34, 211, 238, 0.08);
  transform: translateY(-1px);
}

.zx-mod.soon {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.zx-mod.soon .icon { color: var(--term-gold); text-shadow: 0 0 10px rgba(201, 162, 39, 0.35); }

.zx-terminal-stage {
  padding: 88px 24px 56px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .zx-terminal-stage { padding: 18px 12px 40px; }
}

.zx-term-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  transform-style: preserve-3d;
}

.zx-term-bar h1 {
  margin: 6px 0 0;
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: clamp(1.85rem, 3.6vw, 2.75rem);
  letter-spacing: -0.035em;
  font-weight: 600;
  text-shadow: 0 0 40px rgba(34, 211, 238, 0.12);
}

.zx-term-bar h1 .gold {
  color: var(--term-gold);
  font-weight: 500;
  text-shadow: 0 0 24px rgba(201, 162, 39, 0.25);
}

.zx-brand-lock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
}

.zx-brand-lock::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.zx-term-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--muted);
}

.zx-term-meta b { color: var(--cyan); font-weight: 500; }

/* Status rail — Candle TF / Hud Status language */
.zx-status-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.06), rgba(8, 12, 22, 0.9) 40%, rgba(201, 162, 39, 0.05));
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.zx-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(34, 211, 238, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
}

.zx-pill b { color: var(--text); font-weight: 600; }
.zx-pill.is-live b { color: #4ade80; }
.zx-pill.is-blocked b { color: #f87171; }
.zx-pill.is-import b { color: var(--term-gold); }
.zx-pill.is-gold b { color: var(--term-gold); }

.zx-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.zx-pill.is-live .dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.zx-pill.is-blocked .dot { background: #f87171; box-shadow: 0 0 8px #f87171; animation: none; }
.zx-pill.is-import .dot { background: var(--term-gold); box-shadow: 0 0 8px rgba(201, 162, 39, 0.7); }

.zx-disclaimer,
.zx-method {
  position: relative;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(201, 162, 39, 0.32);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.09), rgba(6, 10, 20, 0.95));
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.zx-method {
  border-color: rgba(34, 211, 238, 0.22);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.07), rgba(6, 10, 20, 0.95));
}

.zx-disclaimer p,
.zx-method p {
  margin: 8px 0 0;
  font-size: 0.84rem;
  color: var(--silver);
  line-height: 1.65;
}

.zx-method ul {
  margin: 10px 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.zx-method li { margin-bottom: 4px; }
.zx-method li b { color: var(--text); }
.zx-disclaimer b,
.zx-method b { color: var(--text); }

.zx-hud-grid {
  display: grid;
  grid-template-columns: 1.85fr 0.9fr;
  gap: 16px;
  perspective: 1600px;
}

@media (max-width: 980px) {
  .zx-hud-grid { grid-template-columns: 1fr; }
}

.zx-hud-panel {
  position: relative;
  padding: 16px 16px 14px;
  border: 1px solid rgba(34, 211, 238, 0.32);
  /* B4: denser opaque HUD so 3D never washes out table text */
  background: linear-gradient(165deg, rgba(8, 12, 22, 0.97), rgba(4, 7, 14, 0.96));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.65),
    0 0 28px rgba(34, 211, 238, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(201, 162, 39, 0.08);
  transform: translateZ(0);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  filter: none;
}

.zx-table,
.zx-table td,
.zx-table th,
.zx-ticker,
.zx-amt,
.zx-side {
  text-shadow: none;
  filter: none;
  opacity: 1;
}

.zx-hud-panel[data-depth="2"] { transform: translateY(6px); }

/* Corner brackets — HUD Area Chart language */
.zx-hud-panel::before,
.zx-hud-panel::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.85;
  pointer-events: none;
  z-index: 2;
}
.zx-hud-panel::before { top: 5px; left: 5px; border-width: 1.5px 0 0 1.5px; }
.zx-hud-panel::after { bottom: 5px; right: 5px; border-width: 0 1.5px 1.5px 0; }

.zx-hud-panel.is-gold-edge { border-color: rgba(201, 162, 39, 0.34); }
.zx-hud-panel.is-gold-edge::before,
.zx-hud-panel.is-gold-edge::after { border-color: var(--term-gold); }

.zx-hud-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.zx-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.zx-tabs { display: flex; flex-wrap: wrap; gap: 6px; }

.zx-tab {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid rgba(34, 211, 238, 0.18);
  color: var(--muted);
  text-decoration: none;
  background: rgba(0, 0, 0, 0.32);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.zx-tab.active,
.zx-tab:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);
}

.zx-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.zx-filters input[type="search"],
.zx-filters input[type="date"] {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(34, 211, 238, 0.2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 8px 10px;
}

/* Dense desk table */
.zx-table-wrap {
  overflow-x: auto;
  margin-top: 2px;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .zx-terminal-stage { padding: 76px 16px 40px; }
  .zx-table { font-size: 0.72rem; }
  .zx-table th, .zx-table td { padding: 8px 10px; white-space: nowrap; }
  .zx-hud-grid { gap: 12px; }
}

.zx-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.zx-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.07em;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.18);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: rgba(6, 10, 20, 0.98);
  z-index: 1;
}

.zx-table td {
  font-size: 0.72rem;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.zx-table tbody tr:hover td {
  background: rgba(34, 211, 238, 0.05);
}

.zx-table .zx-amt {
  color: var(--term-gold);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.zx-table .zx-ticker {
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.zx-table .zx-side { color: var(--text); font-weight: 600; }
.zx-table .zx-rank { color: var(--muted); width: 2.2rem; }

.zx-table tr.zx-row-flash td { animation: zxFlash 1.15s ease; }

@keyframes zxFlash {
  0% { background: rgba(34, 211, 238, 0.22); }
  100% { background: transparent; }
}

.zx-table a { color: var(--cyan); text-decoration: none; }
.zx-table a:hover { text-decoration: underline; }
.zx-table .mono { color: var(--text); font-variant-numeric: tabular-nums; }

.zx-entity-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  max-height: 320px;
  overflow-y: auto;
}

.zx-entity-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
}

.zx-entity-list a { color: var(--text); text-decoration: none; }
.zx-entity-list a:hover { color: var(--cyan); }

.zx-empty {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.zx-trows { margin-top: 10px; }
.zx-trow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.zx-trow .k { color: var(--muted); }
.zx-trow .v { color: var(--cyan); font-variant-numeric: tabular-nums; }

.zx-entity-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.zx-legend {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
}

.zx-legend span b { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .zx-table tr.zx-row-flash td { animation: none; }
  .zx-mod, .zx-tab { transition: none; }
}
