:root {
  --bg-dark: #070d14;
  --bg-card: #0d1726;
  --bg-card-hover: #111e33;
  --bg-card-subtle: #09121f;
  --border: #1a293f;
  --border-light: #243b59;
  --border-focus: #38bdf8;
  --cyan: #22d3ee;
  --cyan-hover: #06b6d4;
  --cyan-glow: rgba(34, 211, 238, 0.25);
  --blue: #38bdf8;
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.25);
  --pink: #f43f5e;
  --pink-glow: rgba(244, 63, 94, 0.25);
  --emerald: #10b981;
  --amber: #f59e0b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
}

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

html, body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background grid pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(26, 41, 63, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 41, 63, 0.15) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(7, 13, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-name span.lab-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(34, 211, 238, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
  letter-spacing: 0.05em;
}

/* Nav Links */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(13, 23, 38, 0.6);
  padding: 4px;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 14px;
  border-radius: 9999px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab svg {
  opacity: 0.75;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.nav-tab.active svg {
  opacity: 1;
  color: var(--cyan);
}

/* Header Action */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-launch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 18px;
  border-radius: 9999px;
  background: var(--cyan);
  color: #070d14;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px var(--cyan-glow);
}

.btn-launch:hover {
  background: var(--cyan-hover);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
}

/* Main Container */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

/* Section visibility & Continuous Scrolling */
.page-section {
  display: block;
  padding: 4.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  scroll-margin-top: 75px;
  transition: opacity 0.3s ease;
}

.page-section:last-of-type {
  border-bottom: none;
}

/* Typography & Eyebrows */
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.75rem;
}

h1.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 1.25rem;
}

h1.hero-title span.cyan-text {
  color: var(--cyan);
  text-shadow: 0 0 25px var(--cyan-glow);
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 11px 22px;
  border-radius: 8px;
  background: var(--cyan);
  color: #070d14;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px var(--cyan-glow);
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--cyan-hover);
  box-shadow: 0 0 25px rgba(34, 211, 238, 0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-light);
}

.link-cyan {
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  transition: opacity 0.2s;
}

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

/* Hero 2-Col Layout */
.hero-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 3.5rem;
}

/* Projection Card */
.projection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.projection-card::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-header-title {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.badge-tag {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.25);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-tag.pulse::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.badge-tag.gold {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-tag.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
}

.canvas-container {
  width: 100%;
  height: 320px;
  position: relative;
  border-radius: 10px;
  background: var(--bg-card-subtle);
  border: 1px solid rgba(26, 41, 63, 0.5);
  overflow: hidden;
}

.canvas-container canvas,
canvas#wsMoleculeCanvas,
canvas#modalCanvas,
canvas#heroCanvas,
canvas#datasetCanvas,
canvas#explainCanvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Metric Strip */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.metric-card .metric-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.metric-card .metric-val {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  margin-bottom: 0.4rem;
}

.metric-card .metric-val.cyan {
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-glow);
}

.metric-card .metric-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.feature-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.feature-box-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.feature-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.feature-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Page Section Common Header */
.section-header {
  margin-bottom: 2rem;
}

.section-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-header p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 650px;
}

/* Split Layouts */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* Dataset Page Styles */
.molecule-library-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  max-height: 600px;
}

.library-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.library-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

/* Category Filter Pills */
.category-pills-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem 0;
  flex-wrap: wrap;
}

.cat-pill {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cat-pill:hover {
  color: #fff;
  border-color: rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
}

.cat-pill.active {
  background: rgba(34, 211, 238, 0.15);
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.25);
}

.search-box {
  position: relative;
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px 9px 36px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--cyan);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.molecule-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 4px;
}

.molecule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.molecule-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.molecule-item.selected {
  background: rgba(34, 211, 238, 0.08);
  border-color: var(--cyan);
}

.mol-name {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.mol-sub {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.mol-gap-badge {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Selected Record Panel */
.record-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.record-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.record-title h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

.record-title span.smiles {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Canvas Settings Bar */
.canvas-settings-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-toggle-btn {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-toggle-btn:hover {
  border-color: rgba(34, 211, 238, 0.4);
  color: #fff;
}

.setting-toggle-btn.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.stat-grid-4, .stat-grid-6 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

@media (min-width: 680px) {
  .stat-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.stat-box-val.cyan {
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan-glow);
}

.stat-box-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stat-box-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

/* Workspace Styles */
.workspace-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.smiles-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.smiles-input-wrap input {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 42px 12px 14px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.smiles-input-wrap input:focus {
  border-color: var(--cyan);
}

.input-action-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.input-action-btn:hover {
  color: var(--cyan);
}

.quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.3);
}

select.model-select {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

select.model-select:focus {
  border-color: var(--cyan);
}

.heuristic-notice {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 0.85rem;
  font-size: 0.8rem;
  color: #fcd34d;
  line-height: 1.5;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.notice-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #fcd34d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Workspace Output Card */
.workspace-output-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.workspace-output-card:hover {
  border-color: rgba(34, 211, 238, 0.25);
}

.ws-empty-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  width: 100%;
  padding: 0.5rem 0.5rem 2rem 0.5rem;
}

.output-ready-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin: 0.75rem 0 2.5rem 0;
  align-self: flex-start;
}

.speed-gauge-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem auto 2.25rem auto;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(17, 28, 45, 0.8) 0%, rgba(8, 14, 24, 0.95) 100%);
  border: 1px solid rgba(34, 211, 238, 0.25);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.12), inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.gauge-svg {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2.8;
  stroke-linecap: round;
}

.gauge-val {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2.8;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px var(--cyan));
}

.gauge-center-needle {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.3);
}

.empty-headline {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.6rem;
}

.empty-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 320px;
  line-height: 1.6;
  margin: 0 auto;
}

.cyan-code {
  font-family: var(--font-mono);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cyan-code:hover {
  background: rgba(34, 211, 238, 0.25);
  border-color: var(--cyan);
}

.gauge-center-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.output-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.output-title-bar h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.stats-3-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

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

.stat-item .stat-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stat-item .stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-item .stat-value.cyan {
  color: var(--cyan);
  text-shadow: 0 0 15px var(--cyan-glow);
}

.stat-item .stat-value.amber {
  color: #fbbf24;
}

.stat-item .stat-value.status-badge {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--emerald);
  text-transform: lowercase;
  margin-top: 0.25rem;
}

/* Uncertainty Track */
.uncertainty-track-container {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.uncertainty-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.track-bar {
  height: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  position: relative;
}

.track-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.3), rgba(34, 211, 238, 0.8));
  border-radius: 9999px;
}

.track-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  border: 2px solid #070d14;
}

.output-footnote {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.output-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Assistant Chat Styles */
.assistant-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.assistant-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.assistant-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-context {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.assistant-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon:hover {
  color: var(--cyan);
  border-color: var(--border-light);
}

.prompt-chips-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.prompt-chip {
  padding: 6px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-chip:hover {
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.3);
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-right: 6px;
}

.chat-msg {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-msg.assistant .chat-avatar {
  background: rgba(34, 211, 238, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.chat-msg.user .chat-avatar {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.chat-bubble {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  max-width: 90%;
  line-height: 1.6;
  font-size: 0.9rem;
}

.chat-msg.user .chat-bubble {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.2);
}

.chat-bubble p {
  margin-bottom: 0.5rem;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--cyan);
}

.chat-input-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.chat-input-bar input {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 50px 12px 16px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-bar input:focus {
  border-color: var(--cyan);
}

.btn-send {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.2);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-send:hover {
  background: var(--cyan);
  color: #070d14;
}

.assistant-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Explainability */
.explain-legend-bottom {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.explain-canvas-legend {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.legend-dot.high {
  background: var(--pink);
  box-shadow: 0 0 8px var(--pink);
}

.legend-dot.low {
  background: var(--purple);
  box-shadow: 0 0 8px var(--purple);
}

.atom-weights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}

.atom-weight-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.atom-weight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.atom-label-name {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.atom-weight-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--cyan);
}

.atom-role-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* Downside Working Analysis Section */
.downside-analysis-wrap {
  background: linear-gradient(180deg, rgba(13, 21, 35, 0.8) 0%, rgba(7, 12, 20, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.downside-analysis-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--purple), #10b981, transparent);
}

.working-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.working-card {
  background: rgba(14, 23, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.6rem 1.4rem;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
  backdrop-filter: blur(8px);
}

.working-card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 12px 28px rgba(34, 211, 238, 0.12);
}

.working-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.2);
}

.working-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.working-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.badge-tag.pulse {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.45);
  animation: pulse-border 2.5s infinite ease-in-out;
}

@keyframes pulse-border {
  0%, 100% {
    box-shadow: 0 0 4px rgba(34, 211, 238, 0.2);
  }
  50% {
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.55);
  }
}

/* Benchmarks */
.benchmark-table-wrap {
  overflow-x: auto;
}

table.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.benchmark-table th {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

table.benchmark-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(26, 41, 63, 0.4);
  font-size: 0.9rem;
}

table.benchmark-table tr.best-row td {
  background: rgba(34, 211, 238, 0.05);
}

.status-indicator-green {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 8px #10b981;
}

/* R2 & Benchmark Dynamic Bars with Animated Moving Lines */
.graph-metric-pills {
  display: flex;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.metric-pill {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.metric-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.metric-pill.active {
  background: rgba(34, 211, 238, 0.18);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.r2-bars-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.r2-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.r2-bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
}

.r2-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.r2-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #06b6d4, #22d3ee);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.5);
  position: relative;
  overflow: hidden;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

.r2-bar-fill.gold {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
}

.r2-bar-fill.emerald {
  background: linear-gradient(90deg, #059669, #10b981);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}

.r2-bar-fill.purple {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.5);
}

/* Continuously gliding laser light animation across benchmark lines */
.r2-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  animation: barLaserGlide 2.4s infinite ease-in-out;
}

@keyframes barLaserGlide {
  0% { left: -50%; }
  60%, 100% { left: 150%; }
}

/* Structure Preview Interactive Canvas Controls */
.structure-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.canvas-view-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ctrl-btn {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ctrl-btn:hover {
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.4);
  color: var(--cyan);
}

.ctrl-btn.active {
  background: rgba(34, 211, 238, 0.22);
  border-color: rgba(34, 211, 238, 0.55);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.canvas-hint-pill {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.5);
  background: rgba(7, 13, 20, 0.75);
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Full View Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.88);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 16px;
  width: 100%;
  max-width: 920px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(34, 211, 238, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-canvas-wrap {
  position: relative;
  height: 480px;
  background: radial-gradient(circle at center, rgba(14, 25, 42, 0.95) 0%, rgba(6, 10, 16, 0.98) 100%);
}

.modal-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.modal-canvas-wrap canvas:active {
  cursor: grabbing;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Gallery & Plots */
.plots-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.plot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.plot-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.plot-card-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plot-card-head h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.plot-card img {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

/* App Footer */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Responsive */
@media (max-width: 1024px) {
  .hero-layout, .split-layout {
    grid-template-columns: 1fr;
  }
  .metrics-strip, .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 1rem;
  }
  .nav-tabs {
    display: none;
  }
  .metrics-strip, .features-grid, .stats-3-col, .stat-grid-4 {
    grid-template-columns: 1fr;
  }
  h1.hero-title {
    font-size: 2.5rem;
  }
}
