/* ==================== RESET & BASE ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a12;
  --bg2: #0f0f1a;
  --surface: #161625;
  --surface2: #1e1e35;
  --border: #2a2a48;
  --text: #eeeef5;
  --text2: #9494b8;
  --accent: #7c6aff;
  --accent2: #00d4aa;
  --accent3: #ff6b8a;
  --accent4: #ffb84d;
  --accent5: #38bdf8;
  --green: #00d4aa;
  --yellow: #ffb84d;
  --radius: 12px;
  --gradient-hero: linear-gradient(135deg, #7c6aff 0%, #00d4aa 50%, #38bdf8 100%);
  --gradient-accent: linear-gradient(135deg, #7c6aff, #ff6b8a);
  --gradient-card: linear-gradient(145deg, var(--surface), var(--surface2));
  --nav-bg: rgba(10, 10, 18, 0.85);
  --shadow-glow: 0 0 30px rgba(124, 106, 255, 0.15);
}

[data-theme="light"] {
  --bg: #f5f5fa;
  --bg2: #eeeef5;
  --surface: #ffffff;
  --surface2: #f0f0f8;
  --border: #d8d8e8;
  --text: #1a1a2e;
  --text2: #5a5a7a;
  --accent: #6c5ce7;
  --accent2: #00b894;
  --accent3: #e84393;
  --accent4: #f39c12;
  --accent5: #0984e3;
  --nav-bg: rgba(245, 245, 250, 0.85);
  --shadow-glow: 0 4px 20px rgba(108, 92, 231, 0.1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 { line-height: 1.2; }
h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.5rem; }
h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
h4 { font-size: 1rem; font-weight: 600; }
p { color: var(--text2); }
a { color: var(--accent); text-decoration: none; }
code { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; background: var(--surface2); padding: 2px 6px; border-radius: 4px; color: var(--accent2); }
ul { list-style: none; padding: 0; }
ul li { padding: 4px 0; padding-left: 1.2em; position: relative; color: var(--text2); font-size: 0.95rem; }
ul li::before { content: ""; position: absolute; left: 0; top: 12px; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

.mt-1 { margin-top: 0.5rem; }
.mt-3 { margin-top: 3rem; }

/* ==================== NAV ==================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}

.nav.scrolled {
  border-bottom-color: var(--border);
}

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

.nav-logo {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--accent2);
  background: rgba(78, 205, 196, 0.1);
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s, border-color 0.2s;
  margin-left: 8px;
  flex-shrink: 0;
}

.theme-toggle:hover { border-color: var(--accent); }
.theme-icon-light { display: none; color: var(--accent4); }
.theme-icon-dark { color: var(--accent5); }
[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="light"] .theme-icon-dark { display: none; }

@media (max-width: 768px) {
  .nav-links { gap: 0; }
  .nav-link { font-size: 0.7rem; padding: 6px 8px; }
  .nav-logo { display: none; }
}

/* ==================== SECTIONS ==================== */
.section { padding: 80px 0; scroll-margin-top: 56px; }
.section-dark { background: var(--bg2); }
.section-sub { color: var(--text2); font-size: 1.1rem; margin-bottom: 2.5rem; max-width: 700px; }

/* ==================== HERO ==================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 80px 0 60px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,106,255,0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,212,170,0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 80%, rgba(255,107,138,0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 40% 10%, rgba(56,189,248,0.1) 0%, transparent 40%);
  z-index: 0;
}

[data-theme="light"] .hero-bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108,92,231,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,184,148,0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 80%, rgba(232,67,147,0.08) 0%, transparent 40%);
}

.hero .container { position: relative; z-index: 1; }

.hero-label {
  display: inline-block;
  background: linear-gradient(135deg, rgba(124,106,255,0.15), rgba(0,212,170,0.15));
  color: var(--accent2);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
  border: 1px solid rgba(124,106,255,0.3);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, #7c6aff 40%, #00d4aa 70%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .hero h1 {
  background: linear-gradient(135deg, #1a1a2e 0%, #6c5ce7 40%, #00b894 70%, #0984e3 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  max-width: 680px;
  margin-bottom: 40px;
  color: var(--text2);
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent2);
  font-family: 'JetBrains Mono', monospace;
}

.stat:nth-child(1) .stat-value { color: var(--accent); }
.stat:nth-child(2) .stat-value { color: var(--accent2); }
.stat:nth-child(3) .stat-value { color: var(--accent3); }
.stat:nth-child(4) .stat-value { color: var(--accent5); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cta {
  display: inline-block;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124,106,255,0.35);
}

/* ==================== PIPELINE ==================== */
.pipeline-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 20px;
}

.pipe-step {
  flex: 1;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.pipe-step h3 { color: var(--text); font-size: 1.1rem; margin-bottom: 8px; }
.pipe-step p { font-size: 0.85rem; }

.pipe-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.pipe-step:nth-child(1) .pipe-icon { background: var(--accent); }
.pipe-step:nth-child(3) .pipe-icon { background: var(--accent2); }
.pipe-step:nth-child(5) .pipe-icon { background: var(--accent5); }
.pipe-step:nth-child(7) .pipe-icon { background: var(--accent4); }
.pipe-step:nth-child(9) .pipe-icon { background: var(--accent3); }

.pipe-arrow {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  color: var(--accent);
  padding: 0 8px;
  flex-shrink: 0;
  margin-top: 40px;
}

/* ==================== ARCHITECTURE ==================== */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.arch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  border-top: 3px solid var(--accent);
}

.arch-card:nth-child(1) { border-top-color: var(--accent); }
.arch-card:nth-child(2) { border-top-color: var(--accent2); }
.arch-card:nth-child(3) { border-top-color: var(--accent3); }

.arch-card h3 { color: var(--accent2); }

.arch-card:nth-child(1) h3 { color: var(--accent); }
.arch-card:nth-child(2) h3 { color: var(--accent2); }
.arch-card:nth-child(3) h3 { color: var(--accent3); }

.arch-layers { font-size: 0.8rem; color: var(--text2); margin-bottom: 12px; font-family: 'JetBrains Mono', monospace; }
.arch-detail p { margin-bottom: 12px; }

/* Architecture Flow Diagram */
.arch-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 24px 0;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 32px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  min-width: 320px;
  max-width: 480px;
  text-align: center;
}

.flow-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.flow-detail {
  font-size: 0.85rem;
  color: var(--text2);
  font-family: 'JetBrains Mono', monospace;
}

.flow-sub {
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 4px;
}

.flow-input { border-color: var(--accent5); }
.flow-input .flow-label { color: var(--accent5); }
.flow-backbone { border-color: var(--accent); }
.flow-backbone .flow-label { color: var(--accent); }
.flow-neck { border-color: var(--accent2); }
.flow-neck .flow-label { color: var(--accent2); }
.flow-head { border-color: var(--accent3); }
.flow-head .flow-label { color: var(--accent3); }
.flow-output { border-color: var(--accent4); background: rgba(255,184,77,0.08); }
.flow-output .flow-label { color: var(--accent4); }

.flow-arrow {
  font-size: 1.2rem;
  color: var(--text2);
  padding: 6px 0;
}

.flow-branches {
  display: flex;
  gap: 16px;
}

.flow-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.flow-branch-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.flow-branch-detail {
  font-size: 0.8rem;
  color: var(--text2);
  font-family: 'JetBrains Mono', monospace;
}

/* ==================== TRAINING ==================== */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.data-card h4 { color: var(--text); margin-bottom: 4px; }
.data-format {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(108,99,255,0.15);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.data-num { font-size: 1.4rem; font-weight: 700; color: var(--accent2); margin-bottom: 4px; }
.data-desc { font-size: 0.85rem; }

/* Class merge */
.merge-section { margin-bottom: 2rem; }
.merge-section h3 { margin-bottom: 12px; }
.merge-section > p { margin-bottom: 16px; }

.merge-examples { display: flex; flex-direction: column; gap: 8px; }
.merge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.merge-from { font-size: 0.9rem; color: var(--text2); flex: 1; min-width: 200px; }
.merge-arrow { color: var(--accent); font-weight: 700; font-size: 1.2rem; }
.merge-to { font-weight: 700; color: var(--accent2); font-size: 0.95rem; }

/* Classes grid */
.classes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.class-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
}

.tag-highlight {
  border-color: var(--accent2);
  color: var(--accent2);
  background: rgba(78,205,196,0.08);
}

/* Chart */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 800px;
  height: 350px;
}

/* Loss */
.loss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.loss-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.loss-card h4 { color: var(--text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.loss-weight {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(108,99,255,0.2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.loss-card p { font-size: 0.88rem; }

/* Params table */
.params-table-wrap { overflow-x: auto; }

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.params-table th, .params-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.params-table th { color: var(--text2); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.params-table td:first-child { font-weight: 600; color: var(--text); white-space: nowrap; }
.params-table td:nth-child(2) { font-family: 'JetBrains Mono', monospace; color: var(--accent2); }
.params-table td:nth-child(3) { color: var(--text2); }

.results-table td:nth-child(n+4), .results-table th:nth-child(n+4) { text-align: right; }
.results-table td:nth-child(n+2) { font-family: 'JetBrains Mono', monospace; }
.row-best { background: rgba(78,205,196,0.08); }
.row-best td { color: var(--accent2) !important; font-weight: 600; }

/* ==================== TRANSFORM ==================== */
.transform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

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

.transform-explain h3 { margin-top: 20px; color: var(--accent2); }
.transform-explain h3:first-child { margin-top: 0; }
.transform-explain p { margin-bottom: 12px; }

.math-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}

.math-block p { font-size: 0.85rem; margin-bottom: 6px; }
.math { display: block; font-size: 0.9rem; padding: 8px 12px; background: var(--bg); border-radius: 6px; line-height: 1.8; }

.calib-steps { display: flex; flex-direction: column; gap: 12px; }

.calib-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.calib-num {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.calib-step p { font-size: 0.9rem; color: var(--text); margin: 0; }

.drift-box {
  margin-top: 24px;
  padding: 20px;
  background: rgba(78,205,196,0.06);
  border: 1px solid rgba(78,205,196,0.2);
  border-radius: var(--radius);
}

.drift-box h4 { color: var(--accent2); margin-bottom: 8px; }
.drift-box p { font-size: 0.88rem; margin-bottom: 10px; }

/* ==================== HARDWARE ==================== */
.hw-explainer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent2);
}

@media (max-width: 800px) { .hw-explainer { grid-template-columns: 1fr; } }

.hw-explainer-text h3 { color: var(--accent2); margin-bottom: 12px; }
.hw-explainer-text p { margin-bottom: 12px; font-size: 0.92rem; }
.hw-explainer-text ul { margin-top: 8px; }

.toolhead-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.toolhead-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
}

.toolhead-rail {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  justify-content: center;
}

.toolhead-pos {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--surface2);
  border: 2px solid var(--border);
  flex: 1;
  text-align: center;
}

.toolhead-pos-name {
  font-weight: 700;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
}

.toolhead-pos-desc {
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 2px;
}

.toolhead-pos-left { border-color: var(--accent5); }
.toolhead-pos-left .toolhead-pos-name { color: var(--accent5); }
.toolhead-pos-mid { border-color: var(--accent4); }
.toolhead-pos-mid .toolhead-pos-name { color: var(--accent4); }
.toolhead-pos-right { border-color: var(--accent2); }
.toolhead-pos-right .toolhead-pos-name { color: var(--accent2); }

.toolhead-bed {
  padding: 12px 24px;
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: 8px;
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text2);
}

.hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.hw-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.hw-card h3 { color: var(--text); margin-bottom: 2px; }
.hw-protocol { font-size: 0.75rem; color: var(--accent); font-family: 'JetBrains Mono', monospace; margin-bottom: 12px; }

.workflow-steps { display: flex; flex-direction: column; gap: 10px; }

.wf-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--text2);
}

.wf-n {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ==================== RESULTS ==================== */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.result-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent2);
  margin-bottom: 4px;
}

.result-card:nth-child(1) .result-value { color: var(--accent); }
.result-card:nth-child(2) .result-value { color: var(--accent2); }
.result-card:nth-child(3) .result-value { color: var(--accent5); }
.result-card:nth-child(4) .result-value { color: var(--accent3); }

.result-card:nth-child(1) { border-top: 3px solid var(--accent); }
.result-card:nth-child(2) { border-top: 3px solid var(--accent2); }
.result-card:nth-child(3) { border-top: 3px solid var(--accent5); }
.result-card:nth-child(4) { border-top: 3px solid var(--accent3); }

.result-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-card p { font-size: 0.82rem; }

/* ==================== DEMO ==================== */

/* Before/After slider */
.ba-container {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: pan-y;
  margin-bottom: 24px;
}

.ba-container img {
  pointer-events: none;
  -webkit-user-drag: none;
}

.ba-img { width: 100%; display: block; }

.ba-reveal {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 50%;
  overflow: hidden;
}

.ba-reveal .ba-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  min-width: 0;
}

.ba-slider {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 3px;
  background: var(--accent2);
  cursor: col-resize;
  z-index: 10;
}

.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: var(--accent2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.ba-handle::before {
  content: "\2194";
  color: var(--bg);
  font-size: 18px;
  font-weight: 700;
}

.ba-label {
  position: absolute;
  top: 12px;
  z-index: 5;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(0,0,0,0.7);
  color: var(--text);
}
.ba-label-left { left: 12px; }
.ba-label-right { right: 12px; }

/* Detection summary chips */
.det-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.det-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
}

.det-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.det-chip-count {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent2);
  font-weight: 600;
}

/* Detection list */
.demo-container {
  max-height: 350px;
  overflow-y: auto;
}

.det-list-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}

.det-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  transition: background 0.2s;
}

.det-item:hover { background: var(--surface2); }
.det-item .det-name { font-weight: 600; color: var(--text); }
.det-item .det-conf { font-family: 'JetBrains Mono', monospace; color: var(--accent2); font-size: 0.75rem; }
.det-item .det-pos { color: var(--text2); font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; }

/* ==================== UPLOAD ==================== */
.upload-section {
  border-top: 1px solid var(--border);
  padding-top: 3rem;
}

.upload-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent4);
  flex-shrink: 0;
}

.status-dot.online { background: var(--accent2); }
.status-dot.offline { background: var(--accent3); }

.upload-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-drop:hover,
.upload-drop.dragover {
  border-color: var(--accent);
  background: rgba(124,106,255,0.04);
}

.upload-drop.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.upload-icon {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.upload-title {
  font-size: 1.1rem;
  color: var(--text) !important;
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 0.85rem;
}

.upload-loading {
  text-align: center;
  padding: 48px 24px;
}

.upload-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.upload-loading p {
  font-size: 0.95rem;
  color: var(--text2);
}

.upload-results {
  margin-top: 24px;
}

.upload-reset {
  margin-top: 20px;
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-reset:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

/* ==================== TECH ==================== */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.tech-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 0.9rem;
  color: var(--text2);
}

.tech-item strong { display: block; color: var(--accent2); margin-bottom: 4px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ==================== FOOTER ==================== */
footer {
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--border);
}

footer p { font-size: 0.85rem; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  h2 { font-size: 1.8rem; }
  .hero-stats { gap: 24px; }
  .stat-value { font-size: 1.5rem; }
  .pipeline-flow { flex-direction: column; align-items: stretch; }
  .pipe-arrow { transform: rotate(90deg); text-align: center; margin: 0; padding: 4px 0; }
  .arch-grid { grid-template-columns: 1fr; }
}
