/* ==========================================================================
   tcptui — Industrial Cyber-Telemetry & Systems Engineering Design System
   ========================================================================== */

:root {
  --bg-void: #04060a;
  --bg-base: #070a10;
  --bg-panel: #0b1019;
  --bg-panel-elevated: #0f1623;
  --bg-surface: #131c2e;
  --bg-glass: rgba(6, 9, 15, 0.88);

  --line-dim: #162032;
  --line-mid: #23324d;
  --line-bright: rgba(0, 240, 255, 0.45);

  --text-bright: #f2f7fc;
  --text-main: #c9d6e8;
  --text-dim: #798da8;
  --text-muted: #4b5d78;

  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.14);
  --green: #00e676;
  --green-glow: rgba(0, 230, 118, 0.14);
  --amber: #ffb300;
  --amber-glow: rgba(255, 179, 0, 0.14);
  --crimson: #ff2e55;
  --crimson-glow: rgba(255, 46, 85, 0.15);
  --violet: #c084fc;
  --blue-sys: #1d4ed8;

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  background: var(--bg-void);
  color: var(--text-main);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-void);
  color: var(--text-main);
  line-height: 1.58;
  overflow-x: clip;
  position: relative;
}

/* Blueprint Micro-Grid Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 85% 45% at 50% -10%, rgba(0, 240, 255, 0.13), transparent 65%),
    radial-gradient(ellipse 45% 40% at 90% 15%, rgba(29, 78, 216, 0.11), transparent 60%),
    linear-gradient(to right, rgba(22, 32, 50, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(22, 32, 50, 0.45) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: all 0.15s ease;
}

code, pre, kbd, .mono {
  font-family: var(--font-mono);
}

.shell-wrap {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  border-left: 1px solid var(--line-dim);
  border-right: 1px solid var(--line-dim);
  background: rgba(4, 6, 10, 0.72);
}

/* ==========================================================================
   Top Telemetry Strip & Navigation Header
   ========================================================================== */
.telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 24px;
  background: #020306;
  border-bottom: 1px solid var(--line-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  overflow-x: auto;
  white-space: nowrap;
  gap: 16px;
}

.telemetry-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.telemetry-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-dim);
}

.navbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(29, 78, 216, 0.38));
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
}

.brand-tag {
  font-size: 0.66rem;
  padding: 2px 7px;
  background: var(--cyan-glow);
  color: var(--cyan);
  border: 1px solid rgba(0, 240, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 2px;
}

.nav-links a {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 5px 11px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.nav-links a:hover {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.06);
  border-color: rgba(0, 240, 255, 0.2);
}

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

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  background: var(--bg-panel);
  border: 1px solid var(--line-mid);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.15);
}

.hud-btn-primary {
  background: var(--cyan);
  color: #030712;
  border-color: var(--cyan);
  font-weight: 700;
}

.hud-btn-primary:hover {
  background: #5ff6ff;
  color: #030712;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.45);
}

/* ==========================================================================
   Hero Architecture Header (Compact & Punchy with Live Oscilloscope)
   ========================================================================== */
.hero-grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  border-bottom: 1px solid var(--line-dim);
  position: relative;
}

.hero-left {
  padding: 34px 36px 30px;
  border-right: 1px solid var(--line-dim);
  position: relative;
}

.corner-plus {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1;
  user-select: none;
  pointer-events: none;
}
.cp-tl { top: 8px; left: 10px; }
.cp-tr { top: 8px; right: 10px; }
.cp-bl { bottom: 8px; left: 10px; }
.cp-br { bottom: 8px; right: 10px; }

.section-coord {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-coord::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 2px;
  background: var(--cyan);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.8vw, 3.3rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--text-bright);
  margin-bottom: 14px;
}

.hero-headline .accent-stroke {
  color: var(--cyan);
  text-shadow: 0 0 28px rgba(0, 240, 255, 0.28);
}

.hero-lead {
  font-size: 0.95rem;
  color: var(--text-dim);
  max-width: 640px;
  margin-bottom: 22px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid var(--line-mid);
  background: var(--bg-panel);
  color: var(--text-bright);
  transition: all 0.16s ease;
}

.cta-btn-cyan {
  background: var(--cyan);
  color: #02060d;
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(0, 240, 255, 0.28);
}

.cta-btn-cyan:hover {
  background: #67f7ff;
  color: #02060d;
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.48);
}

.cta-btn:hover:not(.cta-btn-cyan) {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.06);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-dim);
  background: rgba(11, 16, 25, 0.75);
}

.metric-cell {
  padding: 10px 12px;
  border-right: 1px solid var(--line-dim);
}
.metric-cell:last-child {
  border-right: none;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-bright);
}

.metric-lbl {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Hero Right: Live EStats Oscilloscope + Package Deck */
.hero-right {
  padding: 34px 32px 30px;
  background: linear-gradient(180deg, rgba(11, 16, 25, 0.55) 0%, rgba(4, 6, 10, 0.92) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.oscilloscope-card {
  border: 1px solid var(--line-mid);
  background: #04070e;
  padding: 10px 12px;
  position: relative;
}

.osc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.osc-legend {
  white-space: nowrap;
  flex-shrink: 0;
}

#estats-canvas {
  width: 100%;
  height: 68px;
  display: block;
}

.install-deck {
  border: 1px solid var(--line-mid);
  background: #05080f;
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-dim);
  background: var(--bg-panel);
  padding: 0 10px;
}

.deck-tabs {
  display: flex;
  overflow-x: auto;
}

.deck-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.deck-tab:hover {
  color: var(--text-bright);
}

.deck-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: rgba(0, 240, 255, 0.05);
}

.deck-body {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.deck-cmd {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-bright);
  overflow-x: auto;
  white-space: nowrap;
}

.deck-cmd .ps-prompt {
  color: var(--cyan);
  margin-right: 8px;
  user-select: none;
}

.binary-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.binary-card {
  border: 1px solid var(--line-dim);
  background: var(--bg-panel);
  padding: 10px 12px;
}

.binary-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.binary-badge {
  font-size: 0.62rem;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: 1px solid var(--line-dim);
}

.binary-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ==========================================================================
   LIVE INTERACTIVE WORKSTATION (Browser TUI State Machine)
   ========================================================================== */
.workstation-section {
  padding: 28px 28px 36px;
  border-bottom: 1px solid var(--line-dim);
  background: radial-gradient(circle at 50% 35%, rgba(0, 240, 255, 0.05), transparent 70%);
}

.workstation-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  background: var(--bg-panel);
  border: 1px solid var(--line-mid);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.mode-btn kbd {
  font-size: 0.66rem;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--cyan);
  border: 1px solid var(--line-dim);
}

.mode-btn:hover {
  color: var(--text-bright);
  border-color: var(--cyan);
}

.mode-btn.active {
  background: var(--cyan-glow);
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.18);
}

.workstation-controls-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tui-select {
  height: 32px;
  padding: 0 10px;
  background: var(--bg-panel);
  color: var(--text-bright);
  border: 1px solid var(--line-mid);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  cursor: pointer;
}

/* The Interactive Terminal Frame */
.tui-viewport {
  --t-bg: #080b11;
  --t-fg: #d0d8e8;
  --t-dim: #73829c;
  --t-header: #00f0ff;
  --t-new: #00e676;
  --t-changed: #ffb300;
  --t-deleted: #ff2e55;
  --t-sel-bg: #00f0ff;
  --t-sel-fg: #030712;
  --t-marked: #d946ef;
  --t-bar-bg: #1d4ed8;
  --t-bar-fg: #ffffff;
  --t-border: #2a3b57;

  background: var(--t-bg);
  color: var(--t-fg);
  border: 1px solid var(--line-bright);
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.85), 0 0 40px -10px rgba(0, 240, 255, 0.22);
  font-family: var(--font-mono);
  font-size: 0.79rem;
  line-height: 1.44;
  position: relative;
  user-select: none;
  overflow: hidden;
}

.tui-viewport[data-theme="gruvbox"] {
  --t-bg: #1d2021;
  --t-fg: rgb(235, 219, 178);
  --t-dim: rgb(146, 131, 116);
  --t-header: rgb(184, 187, 38);
  --t-new: rgb(152, 151, 26);
  --t-changed: rgb(215, 153, 33);
  --t-deleted: rgb(204, 36, 29);
  --t-sel-bg: rgb(250, 189, 47);
  --t-sel-fg: rgb(40, 40, 40);
  --t-marked: rgb(211, 134, 155);
  --t-bar-bg: rgb(69, 133, 136);
  --t-bar-fg: rgb(235, 219, 178);
  --t-border: rgb(80, 73, 69);
}

.tui-viewport[data-theme="nord"] {
  --t-bg: #242933;
  --t-fg: rgb(216, 222, 233);
  --t-dim: rgb(143, 152, 168);
  --t-header: rgb(136, 192, 208);
  --t-new: rgb(163, 190, 140);
  --t-changed: rgb(235, 203, 139);
  --t-deleted: rgb(191, 97, 106);
  --t-sel-bg: rgb(129, 161, 193);
  --t-sel-fg: rgb(46, 52, 64);
  --t-marked: rgb(180, 142, 173);
  --t-bar-bg: rgb(94, 129, 172);
  --t-bar-fg: rgb(236, 239, 244);
  --t-border: rgb(76, 86, 106);
}

.tui-viewport[data-theme="solarized-dark"] {
  --t-bg: #002b36;
  --t-fg: rgb(131, 148, 150);
  --t-dim: rgb(88, 110, 117);
  --t-header: rgb(38, 139, 210);
  --t-new: rgb(133, 153, 0);
  --t-changed: rgb(181, 137, 0);
  --t-deleted: rgb(220, 50, 47);
  --t-sel-bg: rgb(42, 161, 152);
  --t-sel-fg: rgb(0, 43, 54);
  --t-marked: rgb(211, 54, 130);
  --t-bar-bg: rgb(7, 54, 66);
  --t-bar-fg: rgb(147, 161, 161);
  --t-border: rgb(88, 110, 117);
}

.tui-viewport[data-theme="solarized-light"] {
  --t-bg: #fdf6e3;
  --t-fg: rgb(101, 123, 131);
  --t-dim: rgb(147, 161, 161);
  --t-header: rgb(38, 139, 210);
  --t-new: rgb(133, 153, 0);
  --t-changed: rgb(181, 137, 0);
  --t-deleted: rgb(220, 50, 47);
  --t-sel-bg: rgb(38, 139, 210);
  --t-sel-fg: rgb(253, 246, 227);
  --t-marked: rgb(108, 113, 196);
  --t-bar-bg: rgb(147, 161, 161);
  --t-bar-fg: rgb(253, 246, 227);
  --t-border: rgb(88, 110, 117);
}

.tui-viewport[data-theme="light"] {
  --t-bg: #f8fafc;
  --t-fg: #0f172a;
  --t-dim: #64748b;
  --t-header: #0f172a;
  --t-new: #15803d;
  --t-changed: #b45309;
  --t-deleted: #b91c1c;
  --t-sel-bg: #1e40af;
  --t-sel-fg: #ffffff;
  --t-marked: #9333ea;
  --t-bar-bg: #2563eb;
  --t-bar-fg: #ffffff;
  --t-border: #cbd5e1;
}

.tui-viewport.crt-on::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
}

.wt-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #040609;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 12px;
  height: 32px;
  color: #8b9bb4;
  font-size: 0.72rem;
}

.wt-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.wt-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  margin-top: 6px;
  padding: 0 14px;
  background: var(--t-bg);
  color: var(--t-fg);
  border-top: 2px solid var(--cyan);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

.wt-win-btns {
  display: flex;
  gap: 14px;
  font-family: sans-serif;
  font-size: 0.78rem;
  color: #64748b;
}

.ratatui-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--t-bar-bg);
  color: var(--t-bar-fg);
  padding: 2px 10px;
  font-weight: 700;
  font-size: 0.76rem;
  white-space: nowrap;
  overflow-x: auto;
}

.ratatui-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ratatui-badge-app {
  background: rgba(0, 0, 0, 0.28);
  padding: 0 6px;
}

.ratatui-badge-paused {
  background: var(--t-changed);
  color: #000;
  padding: 0 6px;
}

.ratatui-badge-alert {
  background: var(--t-deleted);
  color: #fff;
  padding: 0 6px;
}

.tui-quickbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.26);
  border-bottom: 1px solid var(--t-border);
  font-size: 0.72rem;
}

.tui-preset-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.tui-mini-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--t-border);
  color: var(--t-fg);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.tui-mini-btn:hover,
.tui-mini-btn.active {
  border-color: var(--t-header);
  color: var(--t-header);
  background: rgba(0, 240, 255, 0.1);
}

.tui-inline-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--t-border);
  padding: 2px 8px;
  min-width: 260px;
}

.tui-inline-filter input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--t-fg);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  width: 100%;
}

.tui-body-container {
  position: relative;
  min-height: 360px;
  max-height: 410px;
  overflow-y: auto;
  overflow-x: auto;
}

.tui-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.77rem;
}

.tui-grid-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--t-bg);
  color: var(--t-header);
  font-weight: 700;
  text-align: left;
  padding: 5px 10px;
  border-bottom: 1px solid var(--t-border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.tui-grid-table th:hover {
  background: rgba(0, 240, 255, 0.08);
}

.tui-grid-table td {
  padding: 3px 10px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(128, 128, 128, 0.07);
  cursor: pointer;
}

.tui-grid-table tr.row-new {
  color: var(--t-new);
  font-weight: 600;
}

.tui-grid-table tr.row-changed {
  color: var(--t-changed);
}

.tui-grid-table tr.row-deleted {
  color: var(--t-deleted);
  text-decoration: line-through;
  opacity: 0.85;
}

.tui-grid-table tr.row-marked {
  color: var(--t-marked);
  font-weight: 600;
}

.tui-grid-table tr.row-selected {
  background: var(--t-sel-bg) !important;
  color: var(--t-sel-fg) !important;
  font-weight: 700;
}

.tui-grid-table tr:hover:not(.row-selected) {
  background: rgba(255, 255, 255, 0.04);
}

/* Right-Click Context Menu inside TUI */
.tui-ctx-menu {
  position: absolute;
  z-index: 28;
  background: var(--t-bg);
  border: 2px solid var(--t-header);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.9);
  min-width: 245px;
  display: none;
  flex-direction: column;
  padding: 4px 0;
}

.tui-ctx-menu.open {
  display: flex;
}

.tui-ctx-title {
  padding: 3px 10px 5px;
  border-bottom: 1px solid var(--t-border);
  color: var(--t-header);
  font-size: 0.71rem;
  font-weight: 700;
}

.tui-ctx-item {
  background: transparent;
  border: none;
  color: var(--t-fg);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 5px 12px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.tui-ctx-item:hover {
  background: var(--t-sel-bg);
  color: var(--t-sel-fg);
  font-weight: 700;
}

/* Ratatui Modal Overlay Inside Terminal */
.tui-modal-overlay {
  position: absolute;
  inset: 16px 36px;
  background: var(--t-bg);
  border: 2px solid var(--t-header);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.88);
  z-index: 20;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 18px;
  overflow-y: auto;
}

.tui-modal-overlay.open {
  display: flex;
}

.tui-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--t-border);
  padding-bottom: 8px;
  margin-bottom: 10px;
  color: var(--t-header);
  font-weight: 700;
}

.tui-modal-close {
  background: transparent;
  border: 1px solid var(--t-border);
  color: var(--t-fg);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 8px;
  cursor: pointer;
}

.ratatui-footer {
  border-top: 1px solid var(--t-border);
  padding: 5px 12px;
  font-size: 0.73rem;
  color: var(--t-dim);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ratatui-footer-hints span {
  margin-right: 12px;
  cursor: pointer;
}
.ratatui-footer-hints span:hover {
  color: var(--t-header);
}

.workstation-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.legend-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 9px;
  height: 9px;
  display: inline-block;
}

/* Floating Keystroke HUD */
.keystroke-hud {
  position: fixed;
  bottom: 20px;
  right: 24px;
  z-index: 200;
  background: rgba(4, 7, 14, 0.92);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 7px 14px;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.keystroke-hud.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   BENTO TELEMETRY GRID (Architectural & Feature Schematics)
   ========================================================================== */
.bento-section {
  border-bottom: 1px solid var(--line-dim);
}

.section-banner {
  padding: 36px 40px 28px;
  border-bottom: 1px solid var(--line-dim);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-banner h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.section-banner p {
  color: var(--text-dim);
  max-width: 520px;
  font-size: 0.94rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
}

.bento-cell {
  padding: 32px;
  border-right: 1px solid var(--line-dim);
  border-bottom: 1px solid var(--line-dim);
  position: relative;
  background: rgba(11, 16, 25, 0.45);
  transition: background 0.2s ease;
}

.bento-cell:hover {
  background: rgba(15, 22, 35, 0.8);
}

.col-7 { grid-column: span 7; }
.col-5 { grid-column: span 5; border-right: none; }
.col-4 { grid-column: span 4; }
.col-4:nth-child(3n) { border-right: none; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; border-right: none; }

.cell-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.bento-cell h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.bento-cell p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.arch-nodes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.arch-node {
  padding: 12px;
  border: 1px solid var(--line-mid);
  background: #060911;
  cursor: pointer;
  transition: all 0.15s ease;
}

.arch-node:hover,
.arch-node.active {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.07);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.15);
}

.arch-node-step {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--cyan);
  margin-bottom: 4px;
}

.arch-node-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-bright);
}

.arch-inspector {
  padding: 14px 16px;
  background: #04060b;
  border: 1px solid var(--line-dim);
  border-left: 3px solid var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-main);
  min-height: 92px;
}

.diff-sim-box {
  background: #04060b;
  border: 1px solid var(--line-dim);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.diff-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 4px;
  border-left: 3px solid transparent;
}

.diff-line.d-new {
  color: var(--green);
  background: var(--green-glow);
  border-left-color: var(--green);
}
.diff-line.d-chg {
  color: var(--amber);
  background: var(--amber-glow);
  border-left-color: var(--amber);
}
.diff-line.d-del {
  color: var(--crimson);
  background: var(--crimson-glow);
  border-left-color: var(--crimson);
  text-decoration: line-through;
}

/* ==========================================================================
   INTERACTIVE FILTER LANGUAGE ENGINE & AST PLAYGROUND
   ========================================================================== */
.filter-workstation {
  padding: 36px 40px 44px;
  border-bottom: 1px solid var(--line-dim);
}

.query-console {
  border: 1px solid var(--line-mid);
  background: #04070d;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  margin-bottom: 28px;
}

.query-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-dim);
  background: #070b14;
}

.query-prompt {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cyan);
  white-space: nowrap;
}

.query-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.query-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  white-space: nowrap;
}

.query-badge.ok {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(0, 230, 118, 0.35);
}

.query-badge.err {
  background: var(--crimson-glow);
  color: var(--crimson);
  border: 1px solid rgba(255, 46, 85, 0.35);
}

.query-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-dim);
  background: rgba(11, 16, 25, 0.7);
}

.chip-btn {
  background: #090e18;
  border: 1px solid var(--line-mid);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.chip-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.06);
}

.ast-ribbon {
  padding: 8px 18px;
  border-bottom: 1px solid var(--line-dim);
  background: #030509;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.ast-token {
  padding: 1px 7px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.22);
  color: var(--cyan);
}

.ast-op {
  padding: 1px 6px;
  background: rgba(255, 179, 0, 0.12);
  border: 1px solid rgba(255, 179, 0, 0.3);
  color: var(--amber);
  font-weight: 700;
}

.tech-table-wrap {
  max-height: 340px;
  overflow: auto;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tech-table th,
.tech-table td {
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-dim);
  white-space: nowrap;
}

.tech-table th {
  position: sticky;
  top: 0;
  background: #080c15;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.tech-table tbody tr:hover {
  background: rgba(0, 240, 255, 0.04);
}

/* ==========================================================================
   INTERACTIVE PHYSICAL KEYBOARD DECK
   ========================================================================== */
.keyboard-section {
  padding: 36px 40px 44px;
  border-bottom: 1px solid var(--line-dim);
}

.kb-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 24px;
  align-items: stretch;
}

.kb-chassis {
  background: #05080f;
  border: 1px solid var(--line-mid);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.kb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.kb-key {
  min-width: 46px;
  height: 44px;
  padding: 4px 8px;
  background: #0c121e;
  border: 1px solid #1e2b42;
  border-bottom: 3px solid #151f30;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}

.kb-key.w-wide { min-width: 74px; }
.kb-key.w-space { min-width: 210px; }

.kb-key.mapped {
  color: var(--text-bright);
  border-color: rgba(0, 240, 255, 0.38);
  background: rgba(0, 240, 255, 0.06);
}

.kb-key.mapped-action {
  color: var(--amber);
  border-color: rgba(255, 179, 0, 0.42);
  background: rgba(255, 179, 0, 0.07);
}

.kb-key.mapped-view {
  color: var(--green);
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.06);
}

.kb-key:hover,
.kb-key.active {
  transform: translateY(1px);
  border-color: var(--cyan);
  background: var(--cyan);
  color: #02050a;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.45);
}

.kb-inspector {
  background: var(--bg-panel);
  border: 1px solid var(--line-mid);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kb-big-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 54px;
  padding: 0 16px;
  background: #05080f;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 14px;
  box-shadow: 0 0 22px rgba(0, 240, 255, 0.2);
}

/* ==========================================================================
   CLI, CONFIG GENERATOR & FOOTER
   ========================================================================== */
.split-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line-dim);
}

.split-pane {
  padding: 36px 40px 44px;
  border-right: 1px solid var(--line-dim);
}
.split-pane:last-child {
  border-right: none;
}

.code-terminal {
  background: #04060b;
  border: 1px solid var(--line-mid);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #d1d9e6;
  overflow-x: auto;
  line-height: 1.55;
  white-space: pre;
}

.cfg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.cfg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #060911;
  border: 1px solid var(--line-dim);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.cfg-item input[type="number"],
.cfg-item select {
  background: var(--bg-panel);
  border: 1px solid var(--line-mid);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 6px;
  width: 110px;
}

.site-footer {
  padding: 32px 40px;
  background: #020306;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 20px;
}

/* ==========================================================================
   Responsive Architecture & Device Breakpoints
   ========================================================================== */

/* Universal grid and child blowout prevention */
.shell-wrap,
.hero-grid,
.hero-left,
.hero-right,
.bento-grid,
.bento-cell,
.split-section,
.split-pane,
.kb-layout,
.kb-chassis,
.kb-inspector,
.query-console,
.tech-table-wrap,
.tui-viewport,
.tui-body-container,
.install-deck,
.deck-body,
.deck-cmd,
.oscilloscope-card,
.binary-split,
.binary-card,
.workstation-section,
.workstation-toolbar,
.workstation-toolbar > div,
.section-banner > div,
.ast-ribbon,
.diff-sim-box,
.arch-inspector {
  min-width: 0;
  max-width: 100%;
}

.section-coord {
  max-width: 100%;
  flex-wrap: wrap;
}

.section-coord::before {
  flex-shrink: 0;
}

#tui-modal-content pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wt-tabs {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.wt-tab {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.wt-tab span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.wt-win-btns {
  flex-shrink: 0;
}

/* Mobile navigation drawer & toggler */
.mobile-menu-btn {
  display: none;
}

.mobile-nav-drawer {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--line-dim);
  background: rgba(4, 6, 10, 0.98);
  padding: 12px 16px 16px;
  gap: 6px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}

.mobile-nav-drawer a {
  display: block;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(22, 32, 50, 0.6);
  transition: all 0.15s ease;
}

.mobile-nav-drawer a:hover,
.mobile-nav-drawer a:active {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.35);
}

.mobile-nav-drawer .mobile-nav-cta {
  margin-top: 6px;
  text-align: center;
  background: var(--cyan);
  color: #02060d !important;
  font-weight: 700;
  border-color: var(--cyan);
}

.mobile-nav-drawer .mobile-nav-cta:hover {
  background: #62f6ff;
}

/* Visibility helpers */
.hide-xs,
.hide-sm,
.hide-md {
  display: inline-flex;
}

/* Layout polish */
.shell-wrap {
  width: 100%;
  overflow-x: clip;
}
.kb-chassis {
  justify-content: center;
}
.kb-inspector .section-coord {
  display: flex;
}
.kb-big-key {
  display: flex;
  width: fit-content;
}
.kb-inspector > div:last-child {
  flex-wrap: wrap;
  gap: 8px 14px;
}
.code-terminal {
  overflow: auto;
}

/* Custom sleek cyber-telemetry scrollbars */
.deck-cmd,
.tui-body-container,
.tech-table-wrap,
.code-terminal,
.kb-chassis,
.ast-ribbon,
.ratatui-topbar,
#tui-modal-content pre {
  scrollbar-width: thin;
  scrollbar-color: #23324d #04070d;
}

.deck-cmd::-webkit-scrollbar,
.tui-body-container::-webkit-scrollbar,
.tech-table-wrap::-webkit-scrollbar,
.code-terminal::-webkit-scrollbar,
.kb-chassis::-webkit-scrollbar,
.ast-ribbon::-webkit-scrollbar,
.ratatui-topbar::-webkit-scrollbar,
#tui-modal-content pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.deck-cmd::-webkit-scrollbar-track,
.tui-body-container::-webkit-scrollbar-track,
.tech-table-wrap::-webkit-scrollbar-track,
.code-terminal::-webkit-scrollbar-track,
.kb-chassis::-webkit-scrollbar-track,
.ast-ribbon::-webkit-scrollbar-track,
.ratatui-topbar::-webkit-scrollbar-track,
#tui-modal-content pre::-webkit-scrollbar-track {
  background: #04070d;
}

.deck-cmd::-webkit-scrollbar-thumb,
.tui-body-container::-webkit-scrollbar-thumb,
.tech-table-wrap::-webkit-scrollbar-thumb,
.code-terminal::-webkit-scrollbar-thumb,
.kb-chassis::-webkit-scrollbar-thumb,
.ast-ribbon::-webkit-scrollbar-thumb,
.ratatui-topbar::-webkit-scrollbar-thumb,
#tui-modal-content pre::-webkit-scrollbar-thumb {
  background: #23324d;
  border-radius: 3px;
}

.deck-cmd::-webkit-scrollbar-thumb:hover,
.tui-body-container::-webkit-scrollbar-thumb:hover,
.tech-table-wrap::-webkit-scrollbar-thumb:hover,
.code-terminal::-webkit-scrollbar-thumb:hover,
.kb-chassis::-webkit-scrollbar-thumb:hover,
.ast-ribbon::-webkit-scrollbar-thumb:hover,
#tui-modal-content pre::-webkit-scrollbar-thumb:hover {
  background: var(--cyan);
}

/* --------------------------------------------------------------------------
   Breakpoint: <= 1024px (Tablets & Small Desktops)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .nav-links {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 32px;
    font-size: 1.1rem;
    padding: 0;
  }
  .mobile-nav-drawer.open {
    display: flex;
  }
  .hide-md {
    display: none !important;
  }

  .shell-wrap {
    border-left: none;
    border-right: none;
  }
  .hero-grid,
  .kb-layout,
  .split-section {
    grid-template-columns: 1fr;
  }
  .hero-left,
  .split-pane {
    border-right: none;
    border-bottom: 1px solid var(--line-dim);
  }
  .col-7, .col-5, .col-4, .col-6 {
    grid-column: span 12;
    border-right: none;
  }
  .hero-left,
  .hero-right,
  .section-banner,
  .filter-workstation,
  .keyboard-section,
  .split-pane {
    padding: 30px 24px;
  }
  .workstation-section {
    padding: 24px 22px 30px;
  }
  .bento-cell {
    padding: 26px 24px;
  }
  .wt-chrome-hint {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Breakpoint: <= 768px (Tablets portrait & Large Mobiles)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hide-sm {
    display: none !important;
  }
  .telemetry-bar {
    padding: 5px 16px;
    scrollbar-width: none;
  }
  .telemetry-bar::-webkit-scrollbar {
    display: none;
  }
  .navbar-inner {
    padding: 0 16px;
  }
  .hero-left,
  .hero-right,
  .section-banner,
  .filter-workstation,
  .keyboard-section,
  .split-pane {
    padding: 24px 18px;
  }
  .workstation-section {
    padding: 20px 14px 26px;
  }
  .workstation-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .workstation-controls-right {
    justify-content: flex-start;
  }
  .tui-quickbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
  }
  .tui-inline-filter {
    min-width: 0;
    width: 100%;
  }
  .tui-modal-overlay {
    inset: 8px;
    padding: 12px 14px;
  }
  .tui-body-container {
    min-height: 320px;
    max-height: 380px;
  }
  .bento-cell {
    padding: 22px 18px;
  }
  .arch-nodes {
    grid-template-columns: repeat(2, 1fr);
  }
  .kb-chassis {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 12px;
  }
  .kb-row {
    width: max-content;
    margin: 0 auto 6px;
    justify-content: flex-start;
  }
  .kb-row:last-child {
    margin-bottom: 0;
  }
}

/* --------------------------------------------------------------------------
   Breakpoint: <= 640px (Mobile Phones)
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero-left,
  .hero-right,
  .section-banner,
  .filter-workstation,
  .keyboard-section,
  .split-pane {
    padding: 20px 14px;
  }
  .workstation-section {
    padding: 16px 10px 22px;
  }
  .bento-cell {
    padding: 18px 14px;
  }
  .hero-headline {
    font-size: clamp(1.72rem, 7.5vw, 2.3rem);
    margin-bottom: 12px;
  }
  .hero-lead {
    font-size: 0.88rem;
    margin-bottom: 18px;
  }
  .hero-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-cell:nth-child(2n) {
    border-right: none;
  }
  .metric-cell:nth-child(1),
  .metric-cell:nth-child(2) {
    border-bottom: 1px solid var(--line-dim);
  }
  .binary-split {
    grid-template-columns: 1fr;
  }
  .mode-btn {
    padding: 5px 8px;
    font-size: 0.69rem;
    gap: 5px;
  }
  .mode-btn kbd {
    font-size: 0.61rem;
    padding: 1px 4px;
  }
  .tui-viewport {
    font-size: 0.72rem;
  }
  .tui-grid-table {
    font-size: 0.72rem;
  }
  .tui-grid-table th,
  .tui-grid-table td {
    padding: 5px 8px;
  }
  .tui-modal-header {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.72rem;
  }
  .diff-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 0.7rem;
  }
  .query-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .query-input {
    flex: 1 1 200px;
    min-width: 0;
    font-size: 0.82rem;
  }
  .query-presets {
    padding: 8px 12px;
  }
  .ast-ribbon {
    padding: 8px 12px;
  }
  .kb-key {
    min-width: 32px;
    height: 38px;
    padding: 2px 5px;
    font-size: 0.68rem;
  }
  .kb-key.w-wide {
    min-width: 52px;
  }
  .kb-key.w-space {
    min-width: 120px;
  }
  .kb-inspector {
    padding: 18px 14px;
  }
  .cfg-grid {
    grid-template-columns: 1fr;
  }
  .cfg-item input[type="number"],
  .cfg-item select {
    width: 120px;
  }
  .code-terminal {
    padding: 12px;
    font-size: 0.72rem;
  }
  .site-footer {
    padding: 24px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 12px 18px;
  }
  .keystroke-hud {
    bottom: 12px;
    right: 12px;
    left: 12px;
    text-align: center;
    font-size: 0.7rem;
    padding: 6px 10px;
    max-width: calc(100vw - 24px);
  }
}

/* --------------------------------------------------------------------------
   Breakpoint: <= 480px (Extra Small Mobile Phones e.g. 360px - 414px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .hide-xs {
    display: none !important;
  }
  .telemetry-bar {
    padding: 4px 10px;
    font-size: 0.64rem;
  }
  .navbar-inner {
    height: 52px;
    padding: 0 10px;
    gap: 6px;
  }
  .brand {
    font-size: 0.94rem;
    gap: 7px;
  }
  .brand-mark {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
  .brand-tag {
    font-size: 0.6rem;
    padding: 1px 5px;
  }
  .hud-btn {
    height: 30px;
    padding: 0 9px;
    font-size: 0.68rem;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .cta-btn {
    justify-content: center;
    width: 100%;
    padding: 10px 14px;
  }
  .arch-nodes {
    grid-template-columns: 1fr;
  }
}
