/* ============================================================
   Run01  -  Premium Monochrome Glassmorphic Theme  (v2)
   Full design system: Black / White / Gray palette.
   New in v2: language tabs, init overlay, plot/chart output.
   ============================================================ */

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

:root {
  /* -- Palette ----------------------- */
  --bg:                  #050505;
  --glass-bg:            rgba(255,255,255,0.02);
  --glass-bg-hover:      rgba(255,255,255,0.05);
  --glass-bg-active:     rgba(255,255,255,0.08);
  --glass-border:        rgba(255,255,255,0.07);
  --glass-border-hover:  rgba(255,255,255,0.15);
  --glass-border-focus:  rgba(255,255,255,0.25);

  --text:                #F5F5F7;
  --text-muted:          #8E8E93;
  --text-dim:            #48484A;

  --white:               #FFFFFF;
  --black:               #000000;

  /* -- Typography ------------------- */
  --font-ui:   'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-logo: 'Pixelify Sans', sans-serif;
  --font-landing-display: 'Bitcount Prop Single', monospace, sans-serif;
  --font-landing-body:    'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* -- Layout ----------------------- */
  --nav-h:    56px;
  --radius:   12px;
  --radius-sm: 6px;
}

/* -- LIGHT THEME ------------------------------------------ */
[data-theme="light"] {
  --bg:                  #F2F2F7;
  --glass-bg:            rgba(255,255,255,0.75);
  --glass-bg-hover:      rgba(255,255,255,0.88);
  --glass-bg-active:     rgba(255,255,255,1);
  --glass-border:        rgba(0,0,0,0.08);
  --glass-border-hover:  rgba(0,0,0,0.16);
  --glass-border-focus:  rgba(0,0,0,0.30);

  --text:                #1D1D1F;
  --text-muted:          #6E6E73;
  --text-dim:            #A1A1A6;

  --white:               #000000;
  --black:               #FFFFFF;
}

[data-theme="light"] body::before {
  background: radial-gradient(circle, rgba(0,0,0,0.02) 0%, transparent 70%);
}
[data-theme="light"] body::after {
  background: radial-gradient(circle, rgba(0,0,0,0.015) 0%, transparent 70%);
}
[data-theme="light"] .nav {
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}
[data-theme="light"] .workspace {
  box-shadow: 0 8px 40px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}
[data-theme="light"] .nav-brand,
[data-theme="light"] .nav-brand-text,
[data-theme="light"] #navBrand span {
  color: #000000 !important;
}
[data-theme="light"] .btn-run {
  background: #000000;
  color: #FFFFFF;
}
[data-theme="light"] .status-dot.ready,
[data-theme="light"] .status-dot.running {
  background: #1D1D1F;
  box-shadow: 0 0 6px rgba(0,0,0,0.35);
}
[data-theme="light"] .out-line {
  color: #1D1D1F;
}
[data-theme="light"] .init-overlay {
  background: #F2F2F7;
}
[data-theme="light"] .init-logo {
  color: #1D1D1F;
}
[data-theme="light"] .init-card {
  background: rgba(0,0,0,0.015);
  border: 4px solid var(--text);
  box-shadow: 6px 6px 0px 0px rgba(0,0,0,0.1);
}
[data-theme="light"] .init-progress-track {
  background: rgba(0,0,0,0.02);
  border-color: var(--text);
}
[data-theme="light"] .init-progress-fill {
  background: var(--text);
}
[data-theme="light"] .init-pill {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.05);
}
[data-theme="light"] .init-pill.loaded {
  background: rgba(0,0,0,0.07);
  border-color: var(--text);
  box-shadow: 2px 2px 0px 0px rgba(0,0,0,0.05);
}
[data-theme="light"] .out-plot-wrap {
  background: #f5f5f7;
}
[data-theme="light"] .out-plotly-wrap {
  background: #ffffff;
}
[data-theme="light"] .btn-run kbd {
  background: rgba(255,255,255,0.2);
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.3);
}
[data-theme="light"] .welcome-kbd {
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.15);
}

/* -- BASE ------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

html, body {
  min-height: 100%;
  background: #000000;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.in-ide {
  height: 100vh;
  overflow: hidden;
}

/* Ambient glow  -  top-left */
body::before {
  content: '';
  position: fixed;
  top: -20%;  left: -15%;
  width: 55%;  height: 55%;
  background: radial-gradient(circle, rgba(255,255,255,0.025) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
/* Ambient glow  -  bottom-right */
body::after {
  content: '';
  position: fixed;
  bottom: -20%;  right: -15%;
  width: 55%;  height: 55%;
  background: radial-gradient(circle, rgba(255,255,255,0.018) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* -- NAV -------------------------------------------------- */
.nav {
  height: var(--nav-h);
  margin: 14px 14px 7px;
  padding: 0 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  position: relative;
  z-index: 20;
  box-shadow: 0 4px 32px rgba(0,0,0,0.45);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

/* -- LOGO  -  Pixelify Sans only, always -------------------- */
.nav-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  user-select: none;
  font-family: 'Pixelify Sans', sans-serif !important;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--white);
}

/* -- NAV STATUS ------------------------------------------- */
.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  padding: 4px 10px;
  border-radius: 20px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.status-dot.loading {
  background: transparent;
  border: 1.5px solid var(--text-muted);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
.status-dot.ready {
  background: var(--white);
  box-shadow: 0 0 8px rgba(255,255,255,0.7);
}
.status-dot.running {
  background: var(--white);
  box-shadow: 0 0 8px rgba(255,255,255,0.7);
  animation: pulse 1.2s ease-in-out infinite;
}
.status-dot.error {
  background: #555;
  border: 1px solid #777;
}
.status-dot.compiling {
  background: transparent;
  border: 1.5px dashed var(--text-muted);
  animation: spin 1.2s linear infinite;
}

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1);    }
  50%      { opacity:.4; transform:scale(1.2); }
}

.status-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -- NAV ACTIONS / BUTTONS --------------------------------- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn svg { transition: transform 0.2s ease; }
.btn:hover svg { transform: translateY(-0.5px); }

.btn-ghost {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.btn-ghost:active:not(:disabled) { background: var(--glass-bg-active); }

.btn-run {
  background: var(--white);
  color: var(--black);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(255,255,255,0.15);
}
.btn-run:hover:not(:disabled) {
  background: rgba(255,255,255,0.9);
  box-shadow: 0 4px 22px rgba(255,255,255,0.3);
  transform: translateY(-0.5px);
}
.btn-run:active:not(:disabled) { background: rgba(255,255,255,0.75); transform: none; }

.run-icon { font-size: 8px; margin-right: 1px; }
.btn-run kbd {
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(0,0,0,0.08);
  color: var(--black);
  padding: 1px 5px;
  border: 1px solid rgba(0,0,0,0.1);
  margin-left: 2px;
}

/* -- DATA DROPDOWN ----------------------------------------- */
.data-dropdown-wrap {
  position: relative;
}

.data-chevron {
  transition: transform 0.22s ease;
  margin-left: 2px;
}
#btnData[aria-expanded="true"] .data-chevron {
  transform: rotate(180deg);
}

.data-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  background: rgba(18,18,20,0.97);
  border: 1px solid var(--glass-border-hover);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 2px 12px rgba(0,0,0,0.4);
  backdrop-filter: blur(32px) saturate(140%);
  -webkit-backdrop-filter: blur(32px) saturate(140%);
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.18s cubic-bezier(0.4,0,0.2,1);
}
.data-dropdown.open { display: block; }
@keyframes dropdownIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

.data-dropdown-header {
  padding: 12px 16px 8px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 4px;
}

.data-source-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  border-radius: 0;
}
.data-source-item:hover {
  background: rgba(255,255,255,0.05);
}
.data-source-item:last-child { margin-bottom: 4px; }

.ds-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.ds-icon-yf   { background: rgba(80,200,120,0.15); color: #50c878; border: 1px solid rgba(80,200,120,0.25); }
.ds-icon-fred { background: rgba(100,150,255,0.15); color: #7aa4ff; border: 1px solid rgba(100,150,255,0.25); }

.ds-info { flex: 1; min-width: 0; }
.ds-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-ui);
  margin-bottom: 2px;
}
.ds-desc {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.ds-badge-live {
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.3);
}

/* Light mode overrides for dropdown */
[data-theme="light"] .data-dropdown {
  background: rgba(255,255,255,0.97);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 2px 12px rgba(0,0,0,0.08);
}
[data-theme="light"] .data-source-item:hover {
  background: rgba(0,0,0,0.04);
}
[data-theme="light"] .ds-name { color: #1D1D1F; }
[data-theme="light"] .ds-desc { color: #8E8E93; }

/* -- WORKSPACE OUTER (column: editor row on top, dex panel below) - */
.workspace-outer {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h) - 42px);
  margin: 7px 14px 14px;
  position: relative;
  z-index: 10;
}

/* -- WORKSPACE (horizontal editor | output row) --------------- */
.workspace {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.55);
  position: relative;
  z-index: 10;
}

/* -- PANES ------------------------------------------------- */
.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.pane-editor { flex: 1 1 55%; }
.pane-output { flex: 1 1 45%; }

.pane-header {
  height: 44px;
  background: rgba(255,255,255,0.01);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 0 0 0;
  gap: 0;
  flex-shrink: 0;
  overflow: hidden;
}

.pane-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 16px;
}

/* -- LANGUAGE TABS ----------------------------------------- */
.lang-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
  flex-shrink: 0;
}

.lang-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--glass-border);
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
  position: relative;
  top: 1px;
}

.lang-tab:hover {
  color: var(--text-muted);
  background: rgba(255,255,255,0.025);
}

.lang-tab.active {
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border-bottom-color: var(--white);
}

.lang-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.18s;
}
.lang-tab.active .lang-icon,
.lang-tab:hover   .lang-icon { opacity: 1; }

/* Right meta inside editor pane header */
.pane-right-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 0 14px;
  flex-shrink: 0;
}

.file-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* -- PILLS ------------------------------------------------- */
.pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}
.pill-py  { background: rgba(255,255,255,0.08); color: var(--text);       border: 1px solid var(--glass-border); }
.pill-cpp { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--glass-border); }
.pill-cs  { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--glass-border); }
.pill-rs  { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--glass-border); }
.pill-out { background: rgba(255,255,255,0.03); color: var(--text-muted); border: 1px solid var(--glass-border); }

.editor-meta,
.output-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.65;
}

/* -- EDITOR MOUNT ------------------------------------------ */
.editor-mount {
  flex: 1;
  overflow: hidden;
  background: #0a0a0a;
}

[data-theme="light"] .editor-mount,
[data-theme="light"] .output-mount {
  background: #ffffff;
}

/* -- RESIZE HANDLE ----------------------------------------- */
.resize-handle {
  width: 1px;
  background: var(--glass-border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: all 0.18s ease;
  position: relative;
  z-index: 15;
}
.resize-handle:hover,
.resize-handle.dragging {
  background: rgba(255,255,255,0.6);
  box-shadow: 0 0 12px rgba(255,255,255,0.15);
  width: 3px;
}

/* -- OUTPUT MOUNT ------------------------------------------ */
.output-mount {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.72;
  background: #0a0a0a;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}
.output-mount::-webkit-scrollbar       { width: 5px; height: 5px; }
.output-mount::-webkit-scrollbar-track { background: transparent; }
.output-mount::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}
.output-mount::-webkit-scrollbar-thumb:hover { background: var(--glass-border-hover); }

/* Welcome state */
.output-welcome {
  color: var(--text-muted);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 4px 0;
}

/* ── GLOBAL SCROLLBARS ────────────────────────────────────────── */
* {
  scrollbar-width: auto;
  scrollbar-color: rgba(255, 255, 255, 0.4) #080808;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #080808;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid #000000;
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
.welcome-prompt { display: flex; align-items: center; gap: 10px; }
.prompt-caret   { color: var(--white); font-weight: 700; animation: blink 1.2s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.welcome-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255,255,255,0.1);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
}

/* -- OUTPUT LINES ------------------------------------------ */
.out-line {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  display: block;
}
.out-line.err {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.06);
  border-left: 2px solid #ef4444;
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: var(--radius-sm);
}
.out-line.sys  { color: var(--text-dim); font-style: italic; }
.out-empty     { color: var(--text-dim); font-style: italic; }

/* Run block */
.out-block { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--glass-border); }
.out-block:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.out-run-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.out-run-num  { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.out-run-time { font-size: 10px; color: var(--text-dim); margin-left: auto; }

.out-success-badge {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  padding: 2px 7px; border-radius: 4px;
}
.out-error-badge {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  padding: 2px 7px; border-radius: 4px;
}
.out-lang-badge {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim);
  border: 1px solid var(--glass-border);
  padding: 2px 7px; border-radius: 4px;
  font-family: var(--font-mono);
}

/* -- INLINE PLOT OUTPUT ------------------------------------ */
.out-plot-wrap {
  margin: 12px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  display: inline-block;
  max-width: 100%;
  background: #0a0a0a;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.out-plot-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* -- INLINE PLOTLY OUTPUT ---------------------------------- */
.out-plotly-wrap {
  margin: 12px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  min-height: 360px;
  position: relative;
  background: #0a0a0a;
}

/* -- GLOBAL SCROLLBARS ------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--glass-border) transparent; }
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--glass-border-hover); }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   INIT OVERLAY  -  full-screen loading splash
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
.init-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,5,5,0.97);
  backdrop-filter: blur(28px) saturate(120%);
  -webkit-backdrop-filter: blur(28px) saturate(120%);
  transition: opacity 0.7s ease, visibility 0.7s;
}
.init-overlay.hiding {
  opacity: 0;
  visibility: hidden;
}

.init-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 360px;
  padding: 40px 36px;
  background: rgba(255,255,255,0.02);
  border: 4px solid var(--text);
  border-radius: 0;
  box-shadow: 8px 8px 0px 0px rgba(0, 0, 0, 0.4);
}

/* -- INIT LOGO  -  Pixelify Sans only, always --------------- */
.init-logo {
  display: flex;
  align-items: center;
  user-select: none;
  font-family: 'Pixelify Sans', sans-serif !important;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--white);
  margin-bottom: 6px;
}

.init-subtitle {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: -16px;
}

/* Progress bar */
.init-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.init-progress-track {
  height: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 3px solid var(--text);
  border-radius: 0;
  padding: 2px;
  overflow: hidden;
}
.init-progress-fill {
  height: 100%;
  border-radius: 0;
  background: var(--text);
  transition: width 0.15s steps(15);
}
.init-progress-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  min-height: 14px;
  letter-spacing: 0.02em;
}

/* Package pills */
.init-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.init-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  color: var(--text-dim);
  transition: all 0.3s ease;
  letter-spacing: 0.02em;
}
.init-pill.loaded {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--text);
  color: var(--text);
  box-shadow: 2px 2px 0px 0px rgba(0,0,0,0.15);
}

/* -- FULLSCREEN CONTROLS ----------------------------------- */
.pane-fs-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.pane-fs-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.08);
}
[data-theme="light"] .pane-fs-btn:hover {
  background: rgba(0,0,0,0.06);
}

/* Fullscreen state */
.workspace.has-fullscreen .pane:not(.pane-fullscreen) {
  display: none !important;
}
.workspace.has-fullscreen .resize-handle {
  display: none !important;
}
.workspace.has-fullscreen .pane-fullscreen {
  flex: 1 1 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  width: 100% !important;
  border-left: none !important;
  border-right: none !important;
}

.pane-ai.pane-fullscreen .ai-chat-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   DATA EXPLORER  -  BOTTOM PANEL
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Horizontal drag handle (sits between workspace and dex-panel) */
.resize-handle-h {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.04);
  border-top: 1px solid rgba(255,255,255,0.07);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  cursor: row-resize;
  flex-shrink: 0;
  transition: background 0.15s ease;
  position: relative;
  z-index: 12;
}
.resize-handle-h:hover,
.resize-handle-h.dragging {
  background: rgba(99,102,241,0.35);
}

/* Bottom panel  -  inline inside workspace-outer */
.dex-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(10,10,12,0.98);
  border: 1px solid rgba(255,255,255,0.10);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,0.55);
  overflow: hidden;
  transition: height 0.22s cubic-bezier(0.4,0,0.2,1);
  min-height: 0;
}

/* Fullscreen bottom panel  -  expand to cover the entire workspace-outer */
.workspace-outer.bottom-fullscreen .workspace {
  display: none;
}
.workspace-outer.bottom-fullscreen .resize-handle-h {
  display: none !important;
}
.workspace-outer.bottom-fullscreen .dex-panel {
  flex: 1 1 100%;
  border-radius: var(--radius);
  border-top: 1px solid rgba(255,255,255,0.10);
}

/* Panel header */
.dex-header {
  height: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.015);
}

.dex-header-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.dex-header-title svg { opacity: 0.6; }
.dex-header-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Header actions group (fullscreen + close buttons) */
.dex-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dex-close-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.dex-close-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: rgba(255,255,255,0.18);
}

/* Toolbar row */
.dex-toolbar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  background: rgba(255,255,255,0.01);
}

/* Search bar */
.dex-search-wrap {
  flex: 1;
  position: relative;
}
.dex-search-wrap svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  opacity: 0.35;
  pointer-events: none;
}
.dex-search {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 7px 10px 7px 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  outline: none;
  transition: all 0.18s ease;
}
.dex-search::placeholder { color: var(--text-dim); }
.dex-search:focus {
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}

/* Source tabs */
.dex-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.dex-tab {
  padding: 6px 13px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  background: transparent;
  color: var(--text-dim);
}
.dex-tab:hover:not(.active) {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
}
.dex-tab.active.yf {
  background: rgba(80,200,120,0.12);
  border-color: rgba(80,200,120,0.30);
  color: #50c878;
}
.dex-tab.active.fred {
  background: rgba(122,164,255,0.12);
  border-color: rgba(122,164,255,0.30);
  color: #7aa4ff;
}
.dex-tab.active.vfs {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

/* Body  -  split into tree + preview */
.dex-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Tree pane */
.dex-tree-pane {
  width: 280px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,0.05);
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.dex-tree-pane::-webkit-scrollbar { width: 4px; }
.dex-tree-pane::-webkit-scrollbar-track { background: transparent; }
.dex-tree-pane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }

/* Preview pane */
.dex-preview-pane {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.dex-preview-pane::-webkit-scrollbar { width: 4px; }
.dex-preview-pane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }

/* Empty state */
.dex-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  opacity: 0.7;
  padding: 40px;
}
.dex-empty-state svg { opacity: 0.3; margin-bottom: 8px; }

/* Preview card */
.dex-preview-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 16px 18px;
}
.dex-preview-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dex-preview-name .dex-preview-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.dex-preview-icon.yf { background: rgba(80,200,120,0.15); color: #50c878; border: 1px solid rgba(80,200,120,0.25); }
.dex-preview-icon.fred { background: rgba(122,164,255,0.15); color: #7aa4ff; border: 1px solid rgba(122,164,255,0.25); }

.dex-preview-desc {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}
.dex-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.dex-meta-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-dim);
  letter-spacing: 0.03em;
}
.dex-meta-tag.live {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.25);
  color: #22c55e;
}
.dex-meta-tag.api {
  background: rgba(122,164,255,0.08);
  border-color: rgba(122,164,255,0.25);
  color: #7aa4ff;
}

.dex-code-preview {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #ccc;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
  max-height: 280px;
  overflow-y: auto;
  position: relative;
}
.dex-code-comment { color: #555; }
.dex-code-kw      { color: #cc99cd; }
.dex-code-str     { color: #7ec699; }
.dex-code-fn      { color: #6fb3d2; }
.dex-code-num     { color: #f08d49; }

/* Load button */
.dex-load-btn {
  width: 100%;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(255,255,255,0.1);
}
.dex-load-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255,255,255,0.18);
}
.dex-load-btn:active { transform: none; opacity: 0.75; }

.dex-static-info {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 4px 0 14px;
  line-height: 1.5;
}
[data-theme="light"] .dex-static-info {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}

.dex-btn-secondary {
  width: 100%;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-top: 8px;
}
.dex-btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.dex-btn-delete {
  padding: 7px 14px;
  border-radius: 7px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(239, 68, 68, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.dex-btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}
.dex-meta-tag.vfs {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.dex-preview-icon.vfs {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* -- TREE NODES -------------------------------------------- */
.dex-node {
  user-select: none;
}

/* Category (root) */
.dex-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px 5px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.dex-cat-header:hover { background: rgba(255,255,255,0.03); }

.dex-cat-chevron {
  width: 10px; height: 10px;
  transition: transform 0.18s ease;
  flex-shrink: 0;
  opacity: 0.4;
}
.dex-node[aria-expanded="true"] > .dex-cat-header .dex-cat-chevron { transform: rotate(90deg); }

.dex-cat-label { flex: 1; }
.dex-cat-count {
  font-size: 9px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  padding: 1px 5px;
  border-radius: 3px;
  opacity: 0.6;
}

.dex-cat-children {
  display: none;
  overflow: hidden;
}
.dex-node[aria-expanded="true"] > .dex-cat-children { display: block; }

/* Sub-folder */
.dex-folder {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 20px 4px 0;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  border-radius: 0;
}
.dex-folder:hover { background: rgba(255,255,255,0.03); }
.dex-folder svg { flex-shrink: 0; opacity: 0.5; }
.dex-folder-node {
  overflow: hidden;
}
.dex-folder-children {
  display: none;
}
.dex-folder-node[aria-expanded="true"] > .dex-folder { color: var(--text); }
.dex-folder-node[aria-expanded="true"] > .dex-folder svg { opacity: 0.8; }
.dex-folder-node[aria-expanded="true"] > .dex-folder .dex-folder-chevron { transform: rotate(90deg); }
.dex-folder-node[aria-expanded="true"] > .dex-folder-children { display: block; }

.dex-folder-chevron {
  width: 8px; height: 8px;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

/* File / leaf node */
.dex-file {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 20px 3px 0;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  border-radius: 0;
  border-left: 2px solid transparent;
}
.dex-file:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
}
.dex-file.selected {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-left-color: var(--white);
}
.dex-file svg { flex-shrink: 0; opacity: 0.4; }
.dex-file.selected svg { opacity: 0.8; }
.dex-file-name { flex: 1; }
.dex-file-ext {
  font-size: 8px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

/* Indentation levels */
.dex-l0 { padding-left: 16px; }
.dex-l1 { padding-left: 28px; }
.dex-l2 { padding-left: 40px; }
.dex-l3 { padding-left: 52px; }
.dex-l4 { padding-left: 64px; }

/* Search highlight */
.dex-hl {
  background: rgba(255,220,0,0.25);
  color: #ffd700;
  border-radius: 2px;
}

/* No-results */
.dex-no-results {
  padding: 20px 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
}

/* Stats bar at bottom */
.dex-stats {
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.01);
}
.dex-stats-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
  flex-shrink: 0;
}

/* -- LIGHT MODE overrides ----------------------------------- */
[data-theme="light"] .dex-panel {
  background: rgba(248,248,252,0.99);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 4px 0 60px rgba(0,0,0,0.18);
}
[data-theme="light"] .dex-header { background: rgba(0,0,0,0.015); border-bottom-color: rgba(0,0,0,0.07); }
[data-theme="light"] .dex-close-btn { border-color: rgba(0,0,0,0.10); }
[data-theme="light"] .dex-close-btn:hover { background: rgba(0,0,0,0.05); }
[data-theme="light"] .dex-search { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.10); }
[data-theme="light"] .dex-search:focus { border-color: rgba(0,0,0,0.25); background: rgba(0,0,0,0.07); }
[data-theme="light"] .dex-tab:hover:not(.active) { background: rgba(0,0,0,0.04); }
[data-theme="light"] .dex-tree-pane { border-right-color: rgba(0,0,0,0.07); }
[data-theme="light"] .dex-cat-header:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .dex-folder:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .dex-file:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .dex-file.selected { background: rgba(0,0,0,0.06); border-left-color: #1D1D1F; }
[data-theme="light"] .dex-preview-card { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .dex-code-preview { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.08); color: #1D1D1F; }
[data-theme="light"] .dex-load-btn { background: #1D1D1F; color: #FFFFFF; }
[data-theme="light"] .dex-backdrop { background: rgba(0,0,0,0.35); }
[data-theme="light"] .dex-stats { border-top-color: rgba(0,0,0,0.07); }

/* -- AI Assistant styling ----------------------------------- */
.pane-ai {
  flex: 1 1 350px;
  max-width: 500px;
  min-width: 300px;
  background: rgba(13, 13, 15, 0.95);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .pane-ai {
  background: rgba(248, 248, 252, 0.98);
  border-left-color: rgba(0, 0, 0, 0.08);
}

.btn-ai {
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-ai:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
[data-theme="light"] .btn-ai:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* -- Model Select (dark mode fix) ---------------------------- */
.ai-model-select {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e5e5;
  border-radius: 5px;
  padding: 3px 24px 3px 8px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  max-width: 175px;
  margin-right: 8px;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: auto;
  transition: border-color 0.2s, background 0.2s;
}
.ai-model-select:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: #222;
}
.ai-model-select:focus {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.ai-model-select option {
  background: #1e1e1e;
  color: #e5e5e5;
  padding: 4px 8px;
}
[data-theme="light"] .ai-model-select {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #1d1d1f;
}
[data-theme="light"] .ai-model-select option {
  background: #fff;
  color: #1d1d1f;
}

/* -- Quick Actions Toolbar - REMOVED ---------------------------- */
/* .ai-quick-actions and .btn-ai-action styles retained for reference only     */

/* -- AI Input Wrap ------------------------------------------- */
.ai-input-wrap {
  padding: 10px 12px 12px;
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
[data-theme="light"] .ai-input-wrap {
  background: rgba(0, 0, 0, 0.03);
}

/* -- Code Action Bar (shows inside input area after code generated) -- */
.ai-code-action-bar {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: linear-gradient(135deg, rgba(15, 15, 15, 0.9), rgba(25, 25, 25, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  animation: ai-slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.ai-code-action-bar.visible {
  display: flex;
}
[data-theme="light"] .ai-code-action-bar {
  background: linear-gradient(135deg, rgba(240, 240, 248, 0.95), rgba(248, 248, 255, 0.98));
  border-color: rgba(0, 0, 0, 0.1);
}
.ai-code-action-label {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.ai-code-action-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  margin-left: auto;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.ai-code-action-dismiss:hover { opacity: 1; }

/* -- Textarea Row -------------------------------------------- */
.ai-textarea-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ai-textarea {
  flex: 1;
  height: 38px;
  max-height: 120px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  scrollbar-width: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.2s;
}
.ai-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity 0.5s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-textarea:focus {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 0 16px rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .ai-textarea {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
}
[data-theme="light"] .ai-textarea::placeholder {
  color: #555;
  opacity: 0.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .ai-textarea:focus {
  border-color: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.01);
}
.ai-send-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 7px;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-color);
  transition: all 0.18s;
}
.ai-send-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}
[data-theme="light"] .ai-send-btn {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .ai-send-btn:hover {
  background: rgba(239, 108, 0, 0.08);
}

/* Chat bubble styling */
.ai-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
  animation: ai-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ai-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-msg-user {
  align-items: flex-end;
}
.ai-msg-assistant {
  align-items: flex-start;
}

.ai-msg-bubble {
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
}
[data-theme="light"] .ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.01));
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d1d1f;
}

.ai-msg-assistant .ai-msg-bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  color: var(--text-color);
}
[data-theme="light"] .ai-msg-assistant .ai-msg-bubble {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}

/* Assistant markdown styling */
.ai-msg-bubble p {
  margin: 0 0 8px 0;
}
.ai-msg-bubble p:last-child {
  margin-bottom: 0;
}
.ai-msg-bubble ul, .ai-msg-bubble ol {
  margin: 0 0 8px 0;
  padding-left: 20px;
}
.ai-msg-bubble li {
  margin-bottom: 4px;
}

/* Chat code blocks */
.ai-code-block-container {
  margin: 8px 0;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  width: 100%;
}
[data-theme="light"] .ai-code-block-container {
  background: rgba(0, 0, 0, 0.04);
}

.ai-code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--glass-border);
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ai-code-block-actions {
  display: flex;
  gap: 8px;
}

.ai-code-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.15s;
}
.ai-code-btn:hover {
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.05);
}

.ai-code-block-container pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
}

.ai-code-block-container code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: #e0e0e0;
}
[data-theme="light"] .ai-code-block-container code {
  color: #24292e;
}

/* Quick Actions buttons */
.btn-ai-action:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-color) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
[data-theme="light"] .btn-ai-action:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: #1d1d1f !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

/* Textarea focus glow */
.ai-textarea:focus {
  border-color: rgba(255, 202, 40, 0.3) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}
[data-theme="light"] .ai-textarea:focus {
  border-color: rgba(239, 108, 0, 0.3) !important;
  background: rgba(0, 0, 0, 0.01) !important;
}

.ai-send-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}
[data-theme="light"] .ai-send-btn:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* Chat bubble loader animation */
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  align-items: center;
}
.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  opacity: 0.4;
  animation: ai-dot-pulse 1.4s infinite ease-in-out;
}
.ai-typing-dot:nth-child(1) { animation-delay: 0s; }
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0.95; }
}

/* Error message style */
.ai-msg-error .ai-msg-bubble {
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.25);
  color: #ef5350;
}

/* -- Liquid Metal Shimmer & Ripple Click Effects ------------------ */
@keyframes liquid-metal-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes ripple-animation {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(4); opacity: 0; }
}

/* Common interactive button base */
.btn-liquid-metal,
.btn-ai-run-primary,
.btn-ai-apply-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-liquid-metal:active,
.btn-ai-run-primary:active,
.btn-ai-apply-primary:active {
  transform: scale(0.96) translateY(1px) !important;
}

/*  Agree & Run */
.btn-ai-run-primary {
  background: linear-gradient(135deg, rgba(34,197,94,0.28), rgba(16,185,129,0.18), rgba(5,150,105,0.28));
  background-size: 200% 200%;
  animation: liquid-metal-shimmer 3.5s ease infinite;
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #4ade80;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 7px;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  white-space: nowrap;
}
.btn-ai-run-primary:hover {
  border-color: rgba(34, 197, 94, 0.75);
  color: #86efac;
  box-shadow: 0 4px 16px rgba(34,197,94,0.4), inset 0 1px 0 rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
[data-theme="light"] .btn-ai-run-primary {
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

/*  Apply Code */
.btn-ai-apply-primary {
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05), rgba(255,255,255,0.15));
  background-size: 200% 200%;
  animation: liquid-metal-shimmer 3.5s ease infinite;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 7px;
  box-shadow: 0 2px 10px rgba(255,255,255,0.12), inset 0 1px 0 rgba(255,255,255,0.1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  white-space: nowrap;
}
.btn-ai-apply-primary:hover {
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(255,255,255,0.25), inset 0 1px 0 rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
[data-theme="light"] .btn-ai-apply-primary {
  color: #1d1d1f;
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Ripple span */
.btn-ripple-span {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
  animation: ripple-animation 0.55s ease-out forwards;
  transform: translate(-50%, -50%) scale(0);
}

/* -- Surgical Diff Edit Card ---------------------------------------- */
.ai-diff-card {
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
  font-size: 11.5px;
  animation: ai-slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transition: border-color 0.2s, opacity 0.2s;
}
[data-theme="light"] .ai-diff-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.ai-diff-card.ai-diff-accepted {
  border-color: rgba(34, 197, 94, 0.4);
  opacity: 0.7;
}
.ai-diff-card.ai-diff-rejected {
  border-color: rgba(239, 68, 68, 0.25);
  opacity: 0.45;
}

.ai-diff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
[data-theme="light"] .ai-diff-header {
  background: rgba(0, 0, 0, 0.03);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.ai-diff-title {
  font-size: 10.5px;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
[data-theme="light"] .ai-diff-title {
  color: #1d1d1f;
}

.ai-diff-actions {
  display: flex;
  gap: 6px;
}

.ai-diff-btn {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.ai-diff-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ai-diff-accept {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}
.ai-diff-accept:not(:disabled):hover {
  background: rgba(34, 197, 94, 0.28);
  border-color: rgba(34, 197, 94, 0.7);
  color: #86efac;
}
[data-theme="light"] .ai-diff-accept {
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.08);
}

.ai-diff-reject {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}
.ai-diff-reject:not(:disabled):hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
}
[data-theme="light"] .ai-diff-reject {
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
}

.ai-diff-body {
  padding: 6px 0;
  overflow-x: auto;
}

.ai-diff-line {
  padding: 1.5px 12px;
  white-space: pre;
  line-height: 1.55;
  font-size: 11px;
}

.ai-diff-remove {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-left: 3px solid rgba(239, 68, 68, 0.55);
}
[data-theme="light"] .ai-diff-remove {
  background: rgba(254, 226, 226, 0.6);
  color: #dc2626;
}

.ai-diff-add {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border-left: 3px solid rgba(34, 197, 94, 0.5);
}
[data-theme="light"] .ai-diff-add {
  background: rgba(220, 252, 231, 0.6);
  color: #15803d;
}

/* Monaco Editor Pending-Edit Decoration */
.monaco-pending-edit-line {
  background: rgba(255, 255, 255, 0.08) !important;
  border-left: 3px solid rgba(255, 255, 255, 0.6) !important;
}
.monaco-pending-edit-glyph {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 8px !important;
  height: 8px !important;
  margin-top: 6px;
  margin-left: 3px;
}
[data-theme="light"] .monaco-pending-edit-line {
  background: rgba(0, 0, 0, 0.05) !important;
  border-left: 3px solid rgba(0, 0, 0, 0.3) !important;
}
[data-theme="light"] .monaco-pending-edit-glyph {
  background: rgba(0, 0, 0, 0.25);
}
/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   AI CHAT  -  RICH MARKDOWN BODY  (.ai-md-body)
   Renders marked.js output like ChatGPT / Claude  -  clean & structured
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.ai-md-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-color, #e5e5e5);
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Paragraphs */
.ai-md-body p {
  margin: 0 0 10px;
}
.ai-md-body p:last-child { margin-bottom: 0; }

/* Headings */
.ai-md-body h1,
.ai-md-body h2,
.ai-md-body h3,
.ai-md-body h4,
.ai-md-body h5,
.ai-md-body h6 {
  font-family: var(--font-ui, inherit);
  font-weight: 600;
  line-height: 1.3;
  margin: 14px 0 6px;
  color: var(--white, #fff);
}
.ai-md-body h1 { font-size: 1.25em; border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.1)); padding-bottom: 4px; }
.ai-md-body h2 { font-size: 1.1em;  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.07)); padding-bottom: 3px; }
.ai-md-body h3 { font-size: 1.0em; }
.ai-md-body h4, .ai-md-body h5, .ai-md-body h6 { font-size: 0.9em; opacity: 0.85; }

/* Bold & Italic */
.ai-md-body strong { font-weight: 700; color: var(--white, #fff); }
.ai-md-body em     { font-style: italic; color: rgba(255,255,255,0.8); }

/* Inline code */
.ai-md-body code {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  color: #d4d4d4;
  white-space: nowrap;
}
[data-theme="light"] .ai-md-body code {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1d1d1f;
}

/* Horizontal rule */
.ai-md-body hr {
  border: none;
  border-top: 1px solid var(--glass-border, rgba(255,255,255,0.1));
  margin: 12px 0;
}

/* Lists */
.ai-md-body ul,
.ai-md-body ol {
  padding-left: 20px;
  margin: 6px 0 10px;
}
.ai-md-body li {
  margin: 3px 0;
  line-height: 1.55;
}
.ai-md-body ul { list-style: disc; }
.ai-md-body ol { list-style: decimal; }
.ai-md-body li > ul,
.ai-md-body li > ol { margin: 2px 0; }

/* Blockquote */
.ai-md-body blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0 6px 6px 0;
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
}
[data-theme="light"] .ai-md-body blockquote {
  border-left-color: rgba(0,0,0,0.25);
  background: rgba(0,0,0,0.03);
  color: #555;
}

/* -- Tables ------------------------------------------------------ */
.ai-md-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.1);
}
.ai-md-body thead {
  background: rgba(255, 255, 255, 0.07);
}
.ai-md-body thead th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}
.ai-md-body tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.12s;
}
.ai-md-body tbody tr:last-child { border-bottom: none; }
.ai-md-body tbody tr:hover { background: rgba(255,255,255,0.04); }
.ai-md-body td {
  padding: 7px 12px;
  color: rgba(255,255,255,0.85);
  vertical-align: top;
  line-height: 1.45;
}

/* Light theme tables */
[data-theme="light"] .ai-md-body table {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .ai-md-body thead {
  background: rgba(0,0,0,0.04);
}
[data-theme="light"] .ai-md-body thead th {
  color: #555;
  border-bottom-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .ai-md-body tbody tr { border-bottom-color: rgba(0,0,0,0.05); }
[data-theme="light"] .ai-md-body tbody tr:hover { background: rgba(0,0,0,0.02); }
[data-theme="light"] .ai-md-body td { color: #333; }

/* Strikethrough */
.ai-md-body del { opacity: 0.5; text-decoration: line-through; }

/* Links */
.ai-md-body a {
  color: rgba(255,255,255,0.75);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ai-md-body a:hover { color: #fff; }
[data-theme="light"] .ai-md-body a { color: #1d6fa4; }

/* Light theme heading & text colours */
[data-theme="light"] .ai-md-body { color: #1d1d1f; }
[data-theme="light"] .ai-md-body h1,
[data-theme="light"] .ai-md-body h2,
[data-theme="light"] .ai-md-body h3,
[data-theme="light"] .ai-md-body h4,
[data-theme="light"] .ai-md-body h5,
[data-theme="light"] .ai-md-body h6 { color: #0d0d0f; }
[data-theme="light"] .ai-md-body strong { color: #0d0d0f; }
[data-theme="light"] .ai-md-body em { color: #444; }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   AUTHENTICATION & USER PROFILE STYLING
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Top Nav Auth Controls */
.auth-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-auth {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-color);
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.btn-auth:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
[data-theme="light"] .btn-auth:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}

/* User Menu & Avatar */
.user-menu-wrap {
  position: relative;
}

.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px 3px 4px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  cursor: pointer;
}
.user-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.user-name {
  font-size: 12px;
  font-weight: 500;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown menu */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #141416;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: ai-slide-in 0.18s ease-out;
}
.user-dropdown.visible {
  display: block;
}
[data-theme="light"] .user-dropdown {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.user-dropdown-header {
  padding: 8px 16px;
}
.user-dropdown-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--white, #fff);
}
[data-theme="light"] .user-dropdown-name { color: #1d1d1f; }
.user-dropdown-email {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 6px 0;
}
[data-theme="light"] .user-dropdown-divider { background: rgba(0, 0, 0, 0.08); }

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.user-dropdown-item:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Auth Modal Overlay & Box */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.auth-modal-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #131316;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: ai-slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="light"] .auth-modal {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.auth-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
[data-theme="light"] .auth-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 20px;
}
.auth-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--white, #fff);
  margin: 0 0 6px;
}
[data-theme="light"] .auth-modal-title { color: #1d1d1f; }
.auth-modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
}
[data-theme="light"] .auth-tabs {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}
.auth-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .auth-tab.active {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Auth Alert */
.auth-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  margin-bottom: 16px;
}
.auth-alert.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.auth-alert.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form.hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-color);
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
}
[data-theme="light"] .form-group input {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
  color: #1d1d1f;
}
.form-group input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-submit-btn {
  width: 100%;
  padding: 11px;
  margin-top: 4px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-submit-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Divider OR */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="light"] .auth-divider::before,
[data-theme="light"] .auth-divider::after {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}
.auth-divider span {
  padding: 0 10px;
}

/* Google Auth Button Container */
.google-auth-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}
#googleBtnContainer {
  min-height: 44px;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ============================================================
   PIXEL-RUN-ZERO LANDING PAGE STYLING & VIEW MANAGEMENT
   ============================================================ */

/* ── View switcher containers ───────────────────────────── */
#landingView {
  width: 100%;
  min-height: 100vh;
  background: #000000;
  color: #ffffff;
  font-family: 'Roboto', sans-serif;
  position: relative;
  overflow-x: hidden;
  transition: opacity 0.25s ease;
}

#ideView {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  transition: opacity 0.25s ease;
}

.hidden {
  display: none !important;
}

#landingView.hidden,
#ideView.hidden {
  display: none !important;
}

/* ── Landing Header ─────────────────────────────────────── */
.site-header {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  border-bottom: 2px solid rgba(255,255,255,0.18);
  background: #000000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.landing-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.landing-nav a {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  transition: color 0.15s ease;
}

.landing-nav a:hover {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.landing-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-crop {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: #ffffff;
  color: #000000;
  border: 2px solid #ffffff;
  box-shadow: none;
  text-decoration: none;
}

.logo-pixel-text {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  color: #000000;
}

/* ── Pixel Buttons ──────────────────────────────────────── */
.pixel-button {
  min-height: 40px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 2px solid #ffffff;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
  user-select: none;
}

.pixel-button:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.88;
}

.pixel-button:active {
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.75;
}

.pixel-button-dark {
  background: #0a0a0a;
  color: #ffffff;
  border-color: #ffffff;
}

.pixel-button-dark:hover {
  background: #222222;
}

.pixel-button-accent {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: none;
}

.pixel-button-accent:hover {
  background: #e2e2e2;
}

.pixel-button-ghost {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255,255,255,0.4);
  box-shadow: none;
}

.pixel-button-ghost:hover {
  background: rgba(255,255,255,0.12);
  border-color: #ffffff;
}

/* ── Binary Rail ────────────────────────────────────────── */
.binary-rail {
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 0;
  border-bottom: 2px solid rgba(255,255,255,0.15);
  background: #080808;
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  font-family: 'Pixelify Sans', monospace;
  font-weight: 400;
  letter-spacing: 0.05em;
  word-spacing: 12px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Hero Section (Full-Width Clean Horizontal Flow) ─────── */
.hero-section {
  width: 100%;
  padding: clamp(60px, 7vw, 100px) clamp(20px, 5vw, 60px) clamp(60px, 8vw, 110px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #000000;
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.hero-content {
  max-width: 880px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 52px;
}

.hero-content .eyebrow {
  margin-bottom: 20px;
}

.hero-content h1 {
  margin: 0;
  font-family: 'Pixelify Sans', sans-serif;
  font-weight: 700;
  font-size: clamp(48px, 6.5vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.hero-content h1 span {
  color: #ffffff;
}

.hero-content .hero-lede {
  max-width: 640px;
  margin: 24px auto 32px;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
}

.hero-content .flex-actions {
  justify-content: center;
}

.hero-content .boot-line {
  margin-top: 32px;
  justify-content: center;
}

.eyebrow {
  font-family: 'Pixelify Sans', monospace;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  letter-spacing: 0.08em;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: none;
  animation: pixel-blink 1.4s steps(2) infinite;
}

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

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 2px solid #ffffff;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  font-family: 'Pixelify Sans', monospace;
  letter-spacing: 0.05em;
  transition: opacity 0.15s ease;
}

.text-link:hover {
  opacity: 0.8;
}

.boot-line {
  margin-top: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
}

.boot-line span::before {
  content: "■ ";
  color: #ffffff;
}

.boot-line span::before {
  content: "■ ";
  color: #ffffff;
}

.floating-pixels {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.floating-pixels i {
  position: absolute;
  display: block;
  width: 8px;
  height: 8px;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(255,255,255,0.4);
  animation: pixel-drift 7s ease-in-out infinite;
}

.floating-pixels i:nth-child(1) { left: 8%; top: 18%; }
.floating-pixels i:nth-child(2) { right: 14%; top: 24%; width: 5px; height: 5px; animation-delay: -2s; }
.floating-pixels i:nth-child(3) { left: 13%; bottom: 18%; width: 6px; height: 6px; animation-delay: -4s; }
.floating-pixels i:nth-child(4) { right: 9%; bottom: 12%; animation-delay: -1s; }
.floating-pixels i:nth-child(5) { right: 22%; top: 8%; width: 4px; height: 4px; animation-delay: -5s; }

/* ── Hero Visual & Code Mockup ──────────────────────────── */
.hero-visual {
  position: relative;
  min-height: 580px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #111111 0%, #000000 75%);
  overflow: hidden;
  padding: 40px;
}

.corner-code {
  position: absolute;
  z-index: 5;
  top: 20px;
  right: 20px;
  padding: 8px 12px;
  background: #ffffff;
  color: #000000;
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  box-shadow: none;
}

.hero-code-mockup {
  width: 90%;
  max-width: 520px;
  background: #080808;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: none;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.mockup-header {
  height: 36px;
  background: #141414;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}

.mockup-dots {
  display: flex;
  gap: 5px;
}

.mockup-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
}

.mockup-tab {
  font-family: 'Roboto', sans-serif;
  font-size: 11.5px;
  color: #ffffff;
  padding: 4px 10px;
  background: #080808;
  border: 1px solid rgba(255,255,255,0.15);
  border-bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-py {
  font-size: 8px;
  padding: 1px 4px;
  background: #ffffff;
  color: #000000;
  font-weight: 700;
}

.mockup-badge {
  margin-left: auto;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  font-family: 'Bitcount Prop Single', monospace;
  font-weight: 400;
}

.mockup-editor-lines {
  padding: 16px 14px;
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
}

.m-line { display: flex; gap: 12px; }
.m-ln { color: rgba(255,255,255,0.25); width: 14px; user-select: none; }
.m-kw { color: #ffffff; font-weight: 700; }
.m-cm { color: rgba(255,255,255,0.4); font-style: italic; }
.m-str { color: #d0d0d0; }

.mockup-sparkline {
  height: 60px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 6px 12px;
}

.mockup-sparkline svg {
  width: 100%;
  height: 100%;
  stroke: #ffffff;
}

.glass-stat {
  position: absolute;
  z-index: 6;
  min-width: 110px;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.75);
  color: #ffffff;
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.glass-stat span {
  display: block;
  margin-bottom: 3px;
  font-size: 8.5px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.06em;
}

.glass-stat strong {
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 17px;
  font-weight: 400;
  color: #ffffff;
}

.glass-stat-a {
  left: 8%;
  bottom: 12%;
  animation: glass-float 5s ease-in-out infinite;
}

.glass-stat-b {
  right: 8%;
  bottom: 22%;
  animation: glass-float 5s 1.2s ease-in-out infinite;
}

/* ── Manifesto Band ─────────────────────────────────────── */
.manifesto-band {
  padding: clamp(70px, 8vw, 130px) clamp(24px, 6vw, 90px);
  display: grid;
  grid-template-columns: 100px 1.2fr 1fr;
  gap: 40px;
  background: #000000;
  color: #ffffff;
  border-bottom: 2px solid rgba(255,255,255,0.18);
}

.section-index {
  color: #ffffff;
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 19px;
  font-weight: 400;
}

.kicker {
  font-family: 'Bitcount Prop Single', monospace;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7);
  margin-bottom: 10px;
}

.manifesto-band h2,
.section-heading h2,
.proof-copy h2 {
  font-family: 'Bitcount Prop Single', monospace;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 1.05;
  margin-top: 12px;
  color: #ffffff;
}

.manifesto-copy {
  align-self: end;
  max-width: 540px;
}

.manifesto-copy > p {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255,255,255,0.75);
  font-family: 'Roboto', sans-serif;
}

.terminal-note {
  margin-top: 26px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.3);
  background: #080808;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.8;
  font-family: 'Roboto', sans-serif;
}

.terminal-note span {
  color: rgba(255,255,255,0.45);
}

/* ── Capabilities Section ───────────────────────────────── */
.capabilities-section {
  position: relative;
  padding: clamp(60px, 7vw, 110px) clamp(24px, 6vw, 90px);
  border-bottom: 2px solid rgba(255,255,255,0.18);
  background: #000000;
}

.section-heading {
  max-width: 850px;
  margin-bottom: 48px;
}

.section-heading h2,
.proof-copy h2 {
  font-family: 'Bitcount Prop Single', monospace;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 1.05;
  margin-top: 10px;
  color: #ffffff;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  border: 1px solid rgba(255,255,255,0.18);
  gap: 1px;
  background: rgba(255,255,255,0.15);
}

.capability-card {
  padding: 32px 28px;
  position: relative;
  background: #060606;
  transition: background 0.2s ease;
}

.capability-card:hover {
  background: #0e0e0e;
}

.capability-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  background: #ffffff;
  color: #000000;
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 16px;
  font-weight: 400;
}

.capability-card h3 {
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.25;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.capability-card p {
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  line-height: 1.65;
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
}

/* ── Proof Section ──────────────────────────────────────── */
.proof-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #000000;
  border-bottom: 2px solid rgba(255,255,255,0.18);
}

.proof-terminal {
  margin: clamp(30px, 5vw, 70px);
  border: 2px solid rgba(255,255,255,0.35);
  background: #080808;
  color: #ffffff;
  box-shadow: none;
}

.terminal-bar {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Roboto', sans-serif;
}

.terminal-row {
  padding: 16px;
  display: grid;
  grid-template-columns: 22px 180px 1fr;
  gap: 8px;
  align-items: start;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  line-height: 1.5;
  font-family: 'Roboto', sans-serif;
}

.terminal-row:last-child {
  border: 0;
}

.terminal-row svg {
  color: #ffffff;
}

.terminal-row strong {
  font-family: 'Bitcount Prop Single', monospace;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.terminal-row span {
  color: rgba(255,255,255,0.65);
}

.proof-copy {
  padding: clamp(50px, 6vw, 90px) clamp(24px, 5vw, 70px) clamp(50px, 6vw, 90px) 0;
  align-self: center;
}

.proof-copy > p:not(.kicker) {
  max-width: 500px;
  margin: 20px 0 28px;
  line-height: 1.7;
  color: rgba(255,255,255,0.75);
  font-size: 15px;
  font-family: 'Roboto', sans-serif;
}

/* ── Founder Note Section ───────────────────────────────── */
.founder-section {
  width: 100%;
  padding: clamp(70px, 8vw, 130px) clamp(24px, 6vw, 90px);
  background: #020202;
  border-bottom: 2px solid rgba(255, 255, 255, 0.18);
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: 800px;
}

.founder-container {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}

.founder-visual-col {
  position: sticky;
  top: 96px;
}

.founder-card-frame {
  background: #070707;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: none;
  transition: border-color 0.2s ease;
}

.founder-card-frame:hover {
  transform: none;
  border-color: #ffffff;
  box-shadow: none;
}

.founder-tag {
  padding: 10px 14px;
  background: #0e0e0e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.status-dot-sm {
  width: 6px;
  height: 6px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
  display: inline-block;
  animation: pixel-blink 1.4s steps(2) infinite;
}

.founder-portrait-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000000;
  overflow: hidden;
}

.founder-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) brightness(1.02);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.founder-card-frame:hover .founder-portrait-img {
  transform: scale(1.02);
}

.founder-portrait-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 65%, rgba(7, 7, 7, 0.6) 100%);
}

.founder-caption {
  padding: 14px 16px;
  background: #090909;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.founder-caption-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.founder-caption-name {
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: #ffffff;
  line-height: 1;
}

.founder-status-badge {
  font-family: 'Roboto', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 2px;
}

.founder-caption-role {
  display: block;
  font-family: 'Roboto', sans-serif;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.65);
}

/* ── Founder Story / Letter ─────────────────────────────── */
.founder-story-col {
  min-width: 0;
}

#founder-title {
  font-family: 'Bitcount Prop Single', monospace;
  font-size: clamp(34px, 4.5vw, 64px);
  font-weight: 400;
  line-height: 0.95;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin: 10px 0 28px 0;
}

.founder-statement {
  font-family: 'Roboto', sans-serif;
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 500;
  line-height: 1.45;
  color: #ffffff;
  margin-bottom: 22px;
  border-left: 3px solid #ffffff;
  padding-left: 18px;
  letter-spacing: -0.01em;
}

.founder-letter p {
  font-family: 'Roboto', sans-serif;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 20px;
  font-weight: 400;
}

.founder-highlight {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: 4px solid #ffffff;
  color: #ffffff !important;
  font-weight: 500;
  box-shadow: none;
}

.founder-quote {
  margin: 32px 0;
  padding: 24px 28px;
  background: #070707;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: none;
  font-family: 'Pixelify Sans', sans-serif;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  letter-spacing: 0.02em;
  position: relative;
}

.founder-quote-mark {
  color: rgba(255, 255, 255, 0.4);
}

.founder-signoff {
  margin-top: 28px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.founder-signoff-line {
  width: 36px;
  height: 2px;
  background: #ffffff;
  flex-shrink: 0;
}

.founder-signoff-text {
  display: flex;
  flex-direction: column;
}

.founder-sig-name {
  font-family: 'Pixelify Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.founder-sig-title {
  font-family: 'Roboto', sans-serif;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.founder-action {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ── Landing Footer ─────────────────────────────────────── */
.landing-footer {
  min-height: 100px;
  padding: 30px clamp(24px, 6vw, 90px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #000000;
  color: #ffffff;
  font-size: 11px;
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Lightweight Keyframes ──────────────────────────────── */
@keyframes pixel-blink {
  50% { opacity: 0.2; }
}

@keyframes glass-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ── Responsive rules ───────────────────────────────────── */
@media (max-width: 900px) {
  .hero-grid, .proof-section { grid-template-columns: 1fr; }
  .founder-container { grid-template-columns: 1fr; gap: 40px; }
  .founder-visual-col { position: static; max-width: 380px; margin: 0 auto; }
  .hero-copy { border-right: 0; border-bottom: 2px solid rgba(255,255,255,0.18); min-height: auto; }
  .hero-visual { min-height: 420px; }
  .manifesto-band { grid-template-columns: 1fr; }
  .capability-grid { grid-template-columns: 1fr; }
  .capability-card { border-right: 0; border-bottom: 2px solid rgba(255,255,255,0.22); }
  .capability-card:last-child { border-bottom: 0; }
  .pipeline-section { grid-template-columns: 1fr; min-height: auto; }
  .pipeline-visual { border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.15); }
  .proof-copy { padding: 50px 24px; }
  .hidden-mobile { display: none !important; }
}

@media (max-width: 600px) {
  .site-header { height: 64px; padding: 0 16px; }
  .hero-copy h1 { font-size: 44px; }
  .terminal-row { grid-template-columns: 22px 1fr; }
  .terminal-row span { grid-column: 2; }
  .landing-footer { flex-direction: column; gap: 16px; align-items: flex-start; }
}

/* ── Branding Logos (Clean, Normal, Crisp Solid White) ── */
.brand-text-logo {
  font-family: 'Pixelify Sans', sans-serif !important;
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 1;
  display: inline-block;
  text-shadow: none !important;
  transition: opacity 0.15s ease;
}

.landing-logo {
  text-decoration: none;
}

.landing-logo:hover .brand-text-logo {
  opacity: 0.85;
  text-shadow: none !important;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  text-decoration: none;
  padding-right: 4px;
}

.nav-brand-text {
  font-family: 'Pixelify Sans', monospace !important;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
  line-height: 1;
  text-shadow: none !important;
  transition: opacity 0.15s ease, color 0.2s ease;
}

[data-theme="light"] .nav-brand-text,
[data-theme="light"] .nav-brand,
[data-theme="light"] #navBrand,
[data-theme="light"] #navBrand .nav-brand-text {
  color: #000000 !important;
}

.nav-brand:hover .nav-brand-text {
  opacity: 0.85;
}

.footer-logo-wrap {
  display: flex;
  align-items: center;
}

.footer-brand-text {
  font-family: 'Pixelify Sans', sans-serif !important;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  line-height: 1;
  text-shadow: none !important;
}

.auth-logo-text {
  font-family: 'Pixelify Sans', sans-serif !important;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  margin: 0 auto 12px auto;
  text-align: center;
  text-shadow: none !important;
}

/* ── Full-Width Large Product Image Showcase ────────────── */
.hero-product-showcase {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.hero-product-frame {
  width: 100%;
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #050505;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.95), 0 0 1px rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

.hero-product-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  aspect-ratio: 1024 / 472;
}

/* ── Detailed App Specs Grid ─────────────────────────────── */
.features-detail-section {
  padding: clamp(60px, 7vw, 110px) clamp(24px, 6vw, 90px);
  background: #040404;
  border-bottom: 2px solid rgba(255,255,255,0.18);
  content-visibility: auto;
}

.features-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

.feature-detail-card {
  padding: 28px 24px;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px;
  box-shadow: none;
  transition: border-color 0.2s ease;
}

.feature-detail-card:hover {
  border-color: rgba(255,255,255,0.4);
}

.feature-tag {
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #000000;
  background: #ffffff;
  display: inline-block;
  padding: 3px 8px;
  margin-bottom: 16px;
  border-radius: 2px;
}

.feature-detail-card h4 {
  font-family: 'Bitcount Prop Single', monospace;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 12px;
  color: #ffffff;
  line-height: 1.25;
}

.feature-detail-card p {
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.75);
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
}

.feature-detail-card code {
  color: #ffffff;
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

/* ── Hardware Acceleration & Smoothness Optimizations ────── */
#landingView, #landingView * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.floating-pixels i, .status-dot, .status-dot-sm, .glass-stat, .pixel-cube, .compute-core, .data-orbit, .founder-card-frame {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  will-change: transform;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

#landingStack, #landingFeatures, #landingWhy, #founder {
  content-visibility: auto;
  contain-intrinsic-size: 650px;
}

/* Instant tactile response for links & interactive cards */
.landing-nav a, .text-link, .pixel-button, .capability-card, .feature-detail-card {
  -webkit-tap-highlight-color: transparent;
}


/* ── Physics Modal Header Layout ────────────────────────────────── */
.physics-modal-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* ── IDE-only modals: never show on landing page ─────────────────
   When ideView is hidden the modals are already .hidden via JS.
   This CSS provides a hard safety net so they can never paint
   over the landing page under any circumstance.                   */
body:has(#ideView.hidden) .vision-modal-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

   VIDEO COMPUTER VISION STUDIO (RUN01 Vision & YOLOV8)
   ══════════════════════════════════════════════════════════════ */

/* nav button */
.btn-vision {
  color: #a855f7;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
  gap: 5px;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}
.btn-vision:hover {
  background: rgba(168, 85, 247, 0.12) !important;
  color: #c084fc !important;
}
.btn-vision svg {
  color: #a855f7;
  transition: transform 0.2s ease;
}
.btn-vision:hover svg {
  transform: scale(1.1);
  color: #c084fc;
}

/* modal overlay */
.vision-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 8px;
}
.vision-modal-overlay.hidden {
  display: none !important;
}

/* modal card */
.vision-modal-card {
  background: #0d0d0d;
  border: 1px solid #1e1e1e;
  border-radius: 12px;
  width: 100%;
  max-width: none;
  height: calc(100vh - 16px);
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.85);
}

/* header */
.vision-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid #1a1a1a;
  background: #0a0a0a;
  flex-shrink: 0;
  min-width: 0;
}
.vision-modal-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}
.vision-badge {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.vision-modal-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.vision-status-badge {
  font-size: 9px;
  color: var(--text-muted);
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.vision-status-badge--ready {
  color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.3);
}
.vision-status-badge--loading {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
}
.vision-status-badge--processing {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}
.vision-status-badge--done {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.3);
}
.vision-status-badge--error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
}

.vision-modal-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vision-send-btn {
  background: #a855f7;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.35);
}
.vision-send-btn:hover {
  background: #9333ea;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.55);
  transform: translateY(-1px);
}
.vision-modal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.vision-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.vision-modal-close:hover {
  color: var(--text-primary);
  background: #1e1e1e;
}

/* body: 3-column layout */
.vision-modal-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 260px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #080808;
}

/* LEFT PANE */
.vision-left-pane {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-right: 1px solid #1a1a1a;
  background: #0a0a0a;
  overflow-y: auto;
  min-width: 0;
  gap: 10px;
}
.vision-section-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.vision-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 12px;
  border: 1.5px dashed rgba(168, 85, 247, 0.35);
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.04);
  cursor: pointer;
  text-align: center;
  color: rgba(168, 85, 247, 0.7);
  transition: all 0.2s ease;
}
.vision-upload-zone:hover,
.vision-upload-zone--active {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}
.vision-upload-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-primary);
}
.vision-upload-sub {
  font-size: 9.5px;
  color: var(--text-muted);
}
.vision-upload-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #141414;
  border: 1px solid #222;
  border-radius: 6px;
}
.vision-upload-info.hidden {
  display: none !important;
}
.vision-upload-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vision-upload-filename {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vision-upload-dims {
  font-size: 9.5px;
  color: var(--text-muted);
}
.vision-upload-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}
.vision-upload-clear:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
}
.vision-config-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.vision-config-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: .04em;
}
.vision-config-val {
  color: #c084fc;
  font-family: 'JetBrains Mono', monospace;
}
.vision-select {
  background: #141414;
  border: 1px solid #242424;
  border-radius: 5px;
  color: var(--text-primary);
  padding: 5px 8px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}
.vision-select:focus {
  border-color: rgba(168, 85, 247, 0.5);
}
.vision-size-pills {
  display: flex;
  gap: 4px;
}
.vision-pill {
  flex: 1;
  background: #141414;
  border: 1px solid #242424;
  border-radius: 4px;
  color: var(--text-muted);
  padding: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.vision-pill:hover {
  background: #1c1c1c;
  color: var(--text-secondary);
}
.vision-pill-active {
  background: rgba(168, 85, 247, 0.15) !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
  color: #c084fc !important;
}
.vision-slider {
  width: 100%;
  accent-color: #a855f7;
  cursor: pointer;
}
.vision-palette-row {
  display: flex;
  gap: 4px;
}
.vision-palette-btn {
  flex: 1;
  background: #141414;
  border: 1px solid #242424;
  border-radius: 4px;
  color: var(--text-muted);
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
}
.vision-palette-btn-active {
  background: rgba(168, 85, 247, 0.15) !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
  color: #c084fc !important;
}
.vision-config-toggles {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.vision-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
}
.vision-toggle input {
  accent-color: #a855f7;
}
.vision-status-panel {
  margin-top: 8px;
  padding: 8px 10px;
  background: #121212;
  border: 1px solid #222;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vision-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-secondary);
}
.vision-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(168, 85, 247, 0.2);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.vision-progress-bar {
  height: 3px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}
.vision-progress-fill {
  height: 100%;
  background: #a855f7;
  transition: width 0.2s;
}
.vision-progress-pct {
  font-size: 9px;
  color: var(--text-muted);
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
}

/* CENTER PANE */
.vision-center-pane {
  display: flex;
  flex-direction: column;
  background: #050505;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.vision-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}
.vision-empty-state.hidden {
  display: none !important;
}
.vision-player-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #000;
  overflow: hidden;
}
.vision-player-wrap.hidden {
  display: none !important;
}
.vision-video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.vision-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: contain;
}
.vision-player-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  z-index: 10;
}
.vision-play-btn {
  background: #a855f7;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.vision-play-btn:hover {
  background: #c084fc;
  transform: scale(1.08);
}
.vision-scrubber {
  flex-shrink: 0;
  padding: 10px 16px;
  background: #0a0a0a;
  border-top: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vision-scrubber.hidden {
  display: none !important;
}
.vision-scrubber-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vision-frame-badge {
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}
.vision-time-display {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.vision-scrubber-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vision-scrubber-btn {
  background: #141414;
  border: 1px solid #242424;
  color: var(--text-secondary);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.vision-scrubber-btn:hover {
  background: #202020;
  color: #fff;
}
.vision-scrubber-track {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.vision-scrubber-processed {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: rgba(168, 85, 247, 0.4);
  border-radius: 2px;
  pointer-events: none;
}
.vision-scrubber-range {
  width: 100%;
  accent-color: #a855f7;
  cursor: pointer;
}

/* RIGHT PANE */
.vision-right-pane {
  display: flex;
  flex-direction: column;
  border-left: 1px solid #1a1a1a;
  background: #0a0a0a;
  overflow: hidden;
  min-width: 0;
}
.vision-detections-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #1a1a1a;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.vision-det-count {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 600;
  color: #c084fc;
}
.vision-det-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}
.vision-det-empty {
  padding: 24px 14px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.vision-det-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s;
}
.vision-det-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.vision-det-color {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.vision-det-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.vision-det-class {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vision-det-bbox {
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.vision-det-conf {
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.vision-det-footer {
  padding: 8px 14px;
  border-top: 1px solid #1a1a1a;
  font-size: 9.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .vision-modal-overlay { padding: 0; }
  .vision-modal-card { border-radius: 0; height: 100vh; }
  .vision-modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .vision-left-pane { max-height: 220px; }
  .vision-right-pane { max-height: 180px; }
}

/* ══════════════════════════════════════════════════════════════════
   STRONG LOOP: AUTONOMOUS SELF-HEALING & ACTIVE EDITOR CONTROL
   ══════════════════════════════════════════════════════════════════ */

/* Send button working / stop state across all panels */
.ai-send-btn .ai-btn-icon-send,
.cad-send-btn .cad-btn-icon-send,
.desmos-send-btn .desmos-btn-icon-send {
  display: block;
  transition: transform 0.15s ease;
}
.ai-send-btn .ai-btn-icon-working,
.cad-send-btn .cad-btn-icon-working,
.desmos-send-btn .desmos-btn-icon-working {
  display: none;
  position: relative;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
}

/* When AI is working (streaming or running auto-heal loop) */
.ai-send-btn.is-working,
.cad-send-btn.is-working,
.desmos-send-btn.is-working {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #f87171 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
  cursor: pointer;
}
.ai-send-btn.is-working .ai-btn-icon-send,
.cad-send-btn.is-working .cad-btn-icon-send,
.desmos-send-btn.is-working .desmos-btn-icon-send {
  display: none !important;
}
.ai-send-btn.is-working .ai-btn-icon-working,
.cad-send-btn.is-working .cad-btn-icon-working,
.desmos-send-btn.is-working .desmos-btn-icon-working {
  display: flex !important;
}
.ai-working-spinner {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #ef4444;
  border-right-color: #ef4444;
  animation: aiSpinWorking 0.8s linear infinite;
}
.ai-working-stop-sq {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 2px;
  transition: transform 0.15s ease;
}
.ai-send-btn.is-working:hover .ai-working-stop-sq,
.cad-send-btn.is-working:hover .ai-working-stop-sq,
.desmos-send-btn.is-working:hover .ai-working-stop-sq {
  transform: scale(1.2);
}
.ai-send-btn.is-working:hover,
.cad-send-btn.is-working:hover,
.desmos-send-btn.is-working:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  border-color: rgba(239, 68, 68, 0.8) !important;
}

[data-theme="light"] .ai-send-btn.is-working,
[data-theme="light"] .cad-send-btn.is-working,
[data-theme="light"] .desmos-send-btn.is-working {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

@keyframes aiSpinWorking {
  100% { transform: rotate(360deg); }
}

/* Monaco / CAD / Desmos AI Active Control Badge */
.ai-editor-control-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #c084fc;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  animation: badgePulse 2s ease-in-out infinite;
  user-select: none;
}
.ai-editor-control-badge.hidden {
  display: none !important;
}
.ai-editor-control-badge .control-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
  animation: dotBlink 1.2s infinite ease-in-out;
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
  50% { box-shadow: 0 0 8px 1px rgba(168, 85, 247, 0.25); }
}

/* Active editor subtle glowing border */
.pane-editor.ai-active-editor,
.cad-source-pane.ai-active-editor {
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.5), 0 0 12px rgba(168, 85, 247, 0.15);
  transition: box-shadow 0.3s ease;
}

/* Monaco line decorations for surgical edit */
.monaco-pending-edit-line {
  background: rgba(234, 179, 8, 0.18) !important;
}
.monaco-applied-edit-line {
  background: rgba(52, 211, 153, 0.22) !important;
  transition: background 1.5s ease-out;
}

/* Auto-Heal Loop Chat Progress Card */
.ai-loop-card {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0d0d0f;
  font-family: inherit;
}
[data-theme="light"] .ai-loop-card {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.12);
}
.ai-loop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
}
[data-theme="light"] .ai-loop-header {
  background: rgba(0, 0, 0, 0.04);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
.ai-loop-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ai-loop-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #34d399;
  color: #000000;
}
.ai-loop-badge.healing {
  background: #fbbf24;
  color: #000000;
}
.ai-loop-badge.running {
  background: #60a5fa;
  color: #000000;
}
.ai-loop-badge.error {
  background: #f87171;
  color: #000000;
}
.ai-loop-stop-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ai-loop-stop-btn:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #ffffff;
}
.ai-loop-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11.5px;
}
.ai-loop-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.ai-loop-step.active {
  color: var(--text-primary);
  font-weight: 500;
}
.ai-loop-step.success {
  color: #34d399;
}
.ai-loop-step.warning {
  color: #fbbf24;
}
.ai-loop-step-icon {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.ai-loop-error-snippet {
  margin: 4px 0 2px 22px;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #fca5a5;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
}
[data-theme="light"] .ai-loop-error-snippet {
  background: #fef2f2;
  color: #b91c1c;
}
.ai-loop-summary {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #34d399;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="light"] .ai-loop-summary {
  background: #f0fdf4;
  border-color: rgba(5, 150, 105, 0.3);
  color: #059669;
}

/* ============================================================
   RUN01 Vision Studio — Computer Vision UI
   Full RUN01 Vision-style layout & controls
   ============================================================ */

/* ── Layout ─────────────────────────────────────────── */
.cv-studio {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #050505;
  color: #F5F5F7;
  font-family: var(--font-ui, 'DM Mono', monospace);
  overflow: hidden;
}

.cv-studio-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 10;
}

.cv-back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.06em;
  font-family: 'DM Mono', monospace;
  transition: color 0.2s;
}
.cv-back-link:hover { color: #F5F5F7; }

.cv-studio-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.12em;
  color: #F5F5F7;
  font-weight: 600;
}

.cv-studio-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(155,92,246,0.2);
  color: #9B5CF6;
  border: 1px solid rgba(155,92,246,0.4);
  letter-spacing: 0.08em;
}

.cv-studio-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
}
.cv-header-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #F5F5F7;
}

.cv-studio-body {
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  flex: 1;
  overflow: hidden;
}

/* ── Left Sidebar ────────────────────────────────────── */
.cv-sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid rgba(255,255,255,0.07);
  overflow-y: auto;
  background: #080808;
}

.cv-sidebar-section {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cv-sidebar-run {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cv-section-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.35);
  font-family: 'DM Mono', monospace;
  margin-bottom: 10px;
}

/* ── Upload Zone ─────────────────────────────────────── */
.cv-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border: 1px dashed rgba(155,92,246,0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s;
  background: rgba(155,92,246,0.04);
  text-align: center;
}
.cv-upload-zone:hover,
.cv-upload-zone--active {
  border-color: rgba(155,92,246,0.7);
  background: rgba(155,92,246,0.1);
}

.cv-upload-icon { color: rgba(155,92,246,0.6); }

.cv-upload-label {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7);
}

.cv-upload-sublabel {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  font-family: 'DM Mono', monospace;
}

.cv-upload-done {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(155,92,246,0.08);
  border: 1px solid rgba(155,92,246,0.25);
  border-radius: 6px;
}

.cv-upload-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cv-upload-filename {
  font-size: 11px;
  color: #F5F5F7;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cv-upload-info {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-family: 'DM Mono', monospace;
}

.cv-upload-clear {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s;
}
.cv-upload-clear:hover { background: rgba(239,68,68,0.2); color: #EF4444; }

/* ── Config Panel ────────────────────────────────────── */
.cv-config-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cv-config-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.35);
  font-family: 'DM Mono', monospace;
}

.cv-config-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cv-config-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  font-family: 'DM Mono', monospace;
}

.cv-config-value {
  color: #9B5CF6;
}

.cv-select-wrap {
  position: relative;
}

.cv-select {
  width: 100%;
  padding: 6px 28px 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #F5F5F7;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  appearance: none;
  transition: border-color 0.2s;
}
.cv-select:hover { border-color: rgba(255,255,255,0.2); }
.cv-select:focus { outline: none; border-color: #9B5CF6; }
.cv-select option { background: #111; }

.cv-select-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: rgba(255,255,255,0.4);
}

.cv-size-pills {
  display: flex;
  gap: 4px;
}

.cv-size-pill {
  flex: 1;
  padding: 5px 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.cv-size-pill--active {
  background: rgba(155,92,246,0.2);
  border-color: rgba(155,92,246,0.5);
  color: #9B5CF6;
}
.cv-size-pill:hover:not(.cv-size-pill--active) {
  background: rgba(255,255,255,0.08);
  color: #F5F5F7;
}

.cv-slider {
  width: 100%;
  height: 2px;
  accent-color: #9B5CF6;
  cursor: pointer;
}

.cv-palette-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cv-palette-btn {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  transition: all 0.2s;
}
.cv-palette-btn--active {
  background: rgba(155,92,246,0.2);
  border-color: rgba(155,92,246,0.5);
  color: #9B5CF6;
}

.cv-config-toggles {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cv-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.cv-toggle-label {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  font-family: 'DM Mono', monospace;
}

/* ── Run Buttons ─────────────────────────────────────── */
.cv-run-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  background: #9B5CF6;
  color: #000;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.cv-run-btn:hover { background: #b07ef8; }
.cv-run-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cv-preload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
}
.cv-preload-btn:hover { border-color: rgba(255,255,255,0.25); color: #F5F5F7; }
.cv-preload-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.cv-stop-btn-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #EF4444;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}
.cv-stop-btn-main:hover { background: rgba(239,68,68,0.25); }

/* ── Processing Status ───────────────────────────────── */
.cv-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
}

.cv-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-status--loading {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  color: #3B82F6;
  flex-direction: row;
  align-items: center;
}

.cv-status--processing {
  background: rgba(234,179,8,0.08);
  border: 1px solid rgba(234,179,8,0.25);
  color: #EAB308;
}

.cv-status--done {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  color: #10B981;
  flex-direction: row;
  align-items: center;
}

.cv-status--error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #EF4444;
  flex-direction: row;
  align-items: center;
}

.cv-progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.cv-progress-fill {
  height: 100%;
  background: #EAB308;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.cv-progress-pct {
  align-self: flex-end;
  color: rgba(234,179,8,0.7);
}

.cv-stop-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #EF4444;
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  letter-spacing: 0.06em;
}

/* ── Main Player Area ────────────────────────────────── */
.cv-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
}

.cv-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  gap: 12px;
  color: rgba(255,255,255,0.2);
}

.cv-empty-icon { opacity: 0.2; }

.cv-empty-title {
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
}

.cv-empty-sub {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.2);
}

.cv-player-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  min-height: 0;
}

.cv-video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cv-annotation-canvas,
.cv-canvas-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cv-player-controls {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 14px;
}

.cv-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #9B5CF6;
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}
.cv-play-btn:hover { background: #b07ef8; transform: scale(1.05); }

/* ── Frame Scrubber ──────────────────────────────────── */
.cv-scrubber {
  flex-shrink: 0;
  padding: 10px 16px;
  background: rgba(0,0,0,0.85);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cv-scrubber-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cv-frame-badge {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
}

.cv-time-display {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,0.35);
}

.cv-scrubber-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-scrubber-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.cv-scrubber-btn:hover { background: rgba(255,255,255,0.12); color: #F5F5F7; }

.cv-scrubber-track {
  position: relative;
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
}

.cv-scrubber-processed {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: rgba(155,92,246,0.35);
  border-radius: 999px;
  pointer-events: none;
  transition: width 0.3s;
}

.cv-scrubber-range {
  width: 100%;
  height: 3px;
  accent-color: #9B5CF6;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

/* ── Right Detections Sidebar ────────────────────────── */
.cv-detections-sidebar {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255,255,255,0.07);
  background: #080808;
  overflow: hidden;
}

.cv-detections-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.35);
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}

.cv-detections-count {
  margin-left: auto;
  color: #9B5CF6;
  font-size: 9px;
}

.cv-detections-empty {
  padding: 20px 14px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,0.2);
  text-align: center;
}

.cv-detections-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 6px 0;
}

.cv-detection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.cv-detection-item:hover { background: rgba(255,255,255,0.03); }

.cv-detection-color {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.cv-detection-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.cv-detection-class {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: #F5F5F7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cv-detection-track {
  color: rgba(155,92,246,0.7);
  font-size: 10px;
}

.cv-detection-bbox {
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  font-family: 'DM Mono', monospace;
}

.cv-detection-conf {
  font-size: 14px;
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.cv-detections-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 9px;
  color: rgba(255,255,255,0.2);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 960px) {
  .cv-studio-body {
    grid-template-columns: 240px 1fr 220px;
  }
}

@media (max-width: 768px) {
  .cv-studio-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .cv-sidebar-left { max-height: 200px; overflow-y: auto; }
  .cv-detections-sidebar { display: none; }
}

/* ── New Vision Studio Additions ────────────────────── */
.cv-backend-badge {
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.cv-backend-gpu {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.cv-backend-wasm {
  background: rgba(234, 179, 8, 0.15);
  color: #EAB308;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.cv-source-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.cv-source-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all 0.2s;
}
.cv-source-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #F5F5F7;
}
.cv-source-tab.active {
  background: rgba(155, 92, 246, 0.15);
  border-color: rgba(155, 92, 246, 0.4);
  color: #9B5CF6;
  font-weight: 600;
}

.cv-source-active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(155, 92, 246, 0.08);
  border: 1px solid rgba(155, 92, 246, 0.25);
  border-radius: 5px;
}
.cv-source-active-label {
  font-size: 11px;
  color: #9B5CF6;
  font-family: 'DM Mono', monospace;
}
.cv-source-clear {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
}
.cv-source-clear:hover { color: #EF4444; }

.cv-live-dot {
  color: #10B981;
  animation: cvPulse 1.5s infinite;
  margin-right: 4px;
}
@keyframes cvPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.cv-camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border-radius: 5px;
  background: rgba(155, 92, 246, 0.12);
  border: 1px solid rgba(155, 92, 246, 0.35);
  color: #9B5CF6;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
}
.cv-camera-btn:hover {
  background: rgba(155, 92, 246, 0.25);
}

.cv-privacy-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.4;
}
.cv-privacy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
}

.cv-collapsible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.cv-collapsible:hover { color: rgba(255, 255, 255, 0.7); }

.cv-class-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cv-class-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cv-class-clear {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  padding: 0;
}
.cv-class-clear:disabled { color: rgba(255, 255, 255, 0.25); cursor: default; }
.cv-class-expand {
  background: none;
  border: none;
  color: #9B5CF6;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
}
.cv-class-list {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}
.cv-class-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cv-class-group-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  text-align: left;
  cursor: pointer;
  padding: 2px 0;
}
.cv-class-group-btn:hover { color: #9B5CF6; }
.cv-class-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.cv-class-pill {
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
}
.cv-class-pill.active {
  background: rgba(155, 92, 246, 0.25);
  border-color: rgba(155, 92, 246, 0.6);
  color: #F5F5F7;
}

.cv-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.cv-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
}
.cv-stat-label { color: rgba(255, 255, 255, 0.4); }
.cv-stat-value { color: #F5F5F7; font-weight: 600; }
.cv-stat-gpu { color: #10B981; }
.cv-stat-wasm { color: #EAB308; }

.cv-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.15);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  color: #EF4444;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
}
.cv-error-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: #EF4444;
  font-size: 16px;
  cursor: pointer;
}

.cv-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 20;
  color: #9B5CF6;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
}
.cv-loading-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.cv-loading-fill {
  height: 100%;
  background: #9B5CF6;
  transition: width 0.2s ease;
}

.cv-empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.cv-run-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #F5F5F7;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.cv-run-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}
.cv-empty-privacy {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 4px;
}

.cv-track-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(155, 92, 246, 0.4);
  border-radius: 4px;
  color: #9B5CF6;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  font-weight: 600;
  pointer-events: none;
}
