/* ============================================================================
   scienceWiki (affeLab Bilim Ekosistemi Merkez Üssü) — Karanlık Akademik Tema
   Tasarım dili: affeLab ekosistemi (affePhysics / affeSpace / affeStats) ile aynı
   bileşen mimarisi; palet: Olay Ufku Turuncusu, Cherenkov Mavisi, Kuasar Moru.
   ============================================================================ */

:root {
  --bg-0: #06080d;
  --bg-1: #0b0f18;
  --bg-2: #111827;
  --panel: rgba(9, 12, 22, 0.72);
  --panel-hi: rgba(12, 17, 30, 0.9);
  --panel-solid: #0a0e19;
  --border: rgba(255, 255, 255, 0.11);
  --border-hi: rgba(56, 189, 248, 0.5);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --violet: #a855f7;
  --amber: #f97316;
  --crimson: #ef4444;
  --slate: #64748b;
  --emerald: #34d399;
  --gold: #fbbf24;
  --radius: 14px;
  --radius-sm: 9px;
  --display: 'Space Grotesk', 'Inter', sans-serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

html[data-theme="light"] {
  --bg-0: #eef2f8;
  --bg-1: #e2e8f0;
  --bg-2: #cbd5e1;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-hi: rgba(248, 250, 252, 0.95);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.14);
  --border-hi: rgba(2, 132, 199, 0.55);
  --text: #0f172a;
  --muted: #475569;
  --cyan: #0284c7;
  --violet: #7c3aed;
  --amber: #ea580c;
  --crimson: #dc2626;
  --slate: #475569;
  --emerald: #059669;
  --gold: #b45309;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  background: radial-gradient(circle at 50% 25%, var(--bg-2) 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

/* ---------- Özel Kaydırma Çubuğu ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(4, 6, 12, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.55);
}

/*__PRELOADER__*/
/* ============================================================================
   2. ÜST GEZİNME ÇUBUĞU (TOPBAR & 4 ANA MODÜL SEKMESİ)
   ============================================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 60;
  flex-wrap: wrap;
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.88);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8 0%, #a855f7 100%);
  color: #030407;
  font-weight: 900;
  font-size: 15px;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 15px rgba(56, 189, 248, 0.35);
}

.brand-title {
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.02em;
}

.brand-ver {
  font-size: 10.5px;
  color: var(--muted);
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: rgba(9, 12, 22, 0.72);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

html[data-theme="light"] .main-nav {
  background: rgba(226, 232, 240, 0.75);
}

.nav-tab {
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(168, 85, 247, 0.28));
  border: 1px solid var(--border-hi);
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.2);
}

html[data-theme="light"] .nav-tab.active {
  color: #0f172a;
  background: linear-gradient(135deg, rgba(4, 120, 87, 0.2), rgba(124, 58, 237, 0.18));
}

.nav-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.18);
  color: var(--cyan);
  font-weight: 700;
  font-family: var(--mono);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.icon-btn:hover, .icon-btn.active {
  border-color: var(--border-hi);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.18);
}

.theory-trigger-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(168, 85, 247, 0.24));
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--cyan);
  font-weight: 700;
}

html[data-theme="light"] .theory-trigger-btn {
  color: #047857;
}

/* ============================================================================
   3. MODÜL GÖRÜNÜMLERİ, ALT SEKME ÇUBUĞU VE 3 SÜTUNLU CAM HUD DÜZENİ
   ============================================================================ */
.module-section {
  display: none;
  padding: 10px 14px 20px;
  min-height: calc(100vh - 58px);
}

.module-section.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subtab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-wrap: wrap;
}

.subtab-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.subtab-btn {
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.subtab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.subtab-btn.active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--border-hi);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.subtab-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

/* 3 Sütunlu Laboratuvar İskeleti: Sol Kontrol | Merkez Sahne | Sağ Telemetri */
.lab-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  gap: 12px;
  align-items: stretch;
  flex: 1;
  min-height: calc(100vh - 130px);
}

.lab-grid.two-col {
  grid-template-columns: 330px minmax(0, 1fr);
}

/* Cam Paneller (Glassmorphism HUD) */
.hud-panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--shadow);
  overflow-y: auto;
  max-height: calc(100vh - 126px);
}

.hud-section {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

html[data-theme="light"] .hud-section {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.09);
}

.hud-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* Merkez 2B/3B Simülasyon Sahnesi */
.stage-panel {
  position: relative;
  background: radial-gradient(circle at 50% 45%, #0a1b15 0%, #030407 85%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 540px;
  box-shadow: var(--shadow);
}

html[data-theme="light"] .stage-panel {
  background: radial-gradient(circle at 50% 45%, #1e293b 0%, #090d16 90%);
}

/* Araç çubuğunun altında kalan tüm alan: kaydırıcı satır sayısı değişse bile
   (flex-wrap ile 1 veya 2 satıra çıkabilir), üstündeki HUD rozetleri ve
   banner her zaman BU kutuya göre (top/bottom) hizalanır, stage-panel'in
   tamamına göre değil — böylece araç çubuğuyla asla çakışmaz. */
.stage-viewport {
  position: relative;
  flex: 1;
  min-height: 480px;
  overflow: hidden;
}

.stage-canvas-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.stage-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Gerçek BodyParts3D veri seti indirilirken / çözülürken Modül 1 üstünde gösterilen katman. */
.anat-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 8, 0.86);
  backdrop-filter: blur(2px);
}
.anat-load-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 26px;
  text-align: center;
}
.anat-load-box small {
  color: var(--muted);
  font-size: 11.5px;
  max-width: 320px;
  line-height: 1.5;
}
.anat-load-box.is-error small {
  color: #ff3366;
}
.anat-search-results {
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.anat-load-overlay[hidden] {
  display: none;
}
.lab-tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Sahne Üstü Yüzen Telemetri / Durum Rozetleri (Floating HUD Overlay) */
.stage-overlay-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
  flex-wrap: wrap;
}

.stage-overlay-top > * {
  pointer-events: auto;
}

.stage-overlay-bottom {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
  flex-wrap: wrap;
}

.stage-overlay-bottom > * {
  pointer-events: auto;
}

.hud-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-pill {
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(8, 18, 15, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
}

.hud-pill b {
  color: #38bdf8;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-a { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.dot-b { background: #a855f7; box-shadow: 0 0 8px #a855f7; }
.dot-c { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.dot-d { background: #ff3366; box-shadow: 0 0 8px #ff3366; }
.dot-n { background: #64748b; }

/* ============================================================================
   4. KONTROL ELEMANLARI (SLIDERS, SEGMENTED BUTTONS, STEPPERS, CHIPS)
   ============================================================================ */
.ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ctrl-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.ctrl-label b {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.22);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.65);
  transition: transform 0.12s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.bio-select, .bio-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(4, 6, 12, 0.65);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

html[data-theme="light"] .bio-select,
html[data-theme="light"] .bio-input {
  background: #ffffff;
}

.bio-select:focus, .bio-input:focus {
  border-color: var(--cyan);
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.btn-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.btn-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.mode-btn {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--border-hi);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.16);
}

.mode-btn.alert-btn.active {
  background: rgba(255, 51, 102, 0.22);
  border-color: #ff3366;
  color: #fda4af;
  box-shadow: 0 0 14px rgba(255, 51, 102, 0.35);
}

.action-btn {
  padding: 8px 12px;
  border-radius: 9px;
  background: linear-gradient(135deg, #38bdf8 0%, #047857 100%);
  color: #04140e;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
  transition: transform 0.14s ease, filter 0.14s ease;
}

.action-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.action-btn.amber {
  background: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
  color: #1c0a00;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.32);
}

.action-btn.purple {
  background: linear-gradient(135deg, #c084fc 0%, #7c3aed 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.32);
}

.action-btn.crimson {
  background: linear-gradient(135deg, #ff3366 0%, #be123c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 51, 102, 0.32);
}

/* ============================================================================
   5. TELEMETRİ KARTLARI VE KANVAS GRAFİKLERİ
   ============================================================================ */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.tel-card {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(4, 6, 12, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

html[data-theme="light"] .tel-card {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(15, 23, 42, 0.1);
}

.tel-card small {
  font-size: 10.5px;
  color: var(--muted);
}

.tel-card b {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--cyan);
}

.plot-canvas {
  width: 100%;
  height: 155px;
  display: block;
  background: rgba(4, 6, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* Gen / Kodon Rozeti (nuclide-box ekosistem desenine karşılık gelir) */
.gene-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gene-box {
  min-width: 68px;
  height: 68px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(168, 85, 247, 0.18));
  border: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--mono);
}

.gene-nums {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.1;
  text-align: right;
  color: var(--muted);
}

.gene-sym {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

/* ============================================================================
   6. GENEL LABORATUVAR BİLEŞEN KİTİ (Üst Araç Çubuğu, Mod Anahtarı, Kartlar,
      Çipler, Modal, Toast) — her 4 modülde ortak kullanılan "lab-*" desenleri
   ============================================================================ */
html[data-matter="alert"] {
  --cyan: #ff2ec4;
  --border-hi: rgba(255, 46, 196, 0.55);
}

.lab-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: rgba(4, 6, 12, 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.lab-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  transition: all 0.16s ease;
  white-space: nowrap;
}

.lab-tool-btn:hover,
.lab-tool-btn.active {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.16);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.lab-tool-btn.danger:hover,
.lab-tool-btn.danger.active {
  border-color: #ff3366;
  background: rgba(255, 51, 102, 0.2);
  color: #fda4af;
  box-shadow: 0 0 14px rgba(255, 51, 102, 0.35);
}

.lab-tool-btn.emerald:hover,
.lab-tool-btn.emerald.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

/* N-sekmeli (2/3/4) genel segmented mod anahtarı */
.lab-mode-switch {
  display: grid;
  gap: 4px;
  background: rgba(4, 6, 12, 0.65);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
}
.lab-mode-switch.cols-2 { grid-template-columns: repeat(2, 1fr); }
.lab-mode-switch.cols-3 { grid-template-columns: repeat(3, 1fr); }
.lab-mode-switch.cols-4 { grid-template-columns: repeat(4, 1fr); }

.lab-mode-tab {
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
}

.lab-mode-tab.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(168, 85, 247, 0.22));
  color: var(--cyan);
  border: 1px solid var(--border-hi);
}

/* Renkli Etkileşimli Lejant (katman/organel/alt kabuk gibi listeler için) */
.lab-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.lab-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(12, 17, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.lab-legend-chip .sw {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.lab-legend-chip.off {
  opacity: 0.32;
  filter: grayscale(0.7);
}

.lab-legend-chip:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
}

/* Genel 2 Sütunlu Kart Izgarası (organ listesi, organel listesi, senaryo listesi) */
.lab-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.lab-card-grid.single-col {
  grid-template-columns: 1fr;
}

.lab-card {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(4, 6, 12, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.14s ease;
}

.lab-card:hover,
.lab-card.active {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.14);
}

.lab-card b {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
}

.lab-card span {
  font-size: 10.5px;
  color: var(--text);
  font-weight: 600;
}

.lab-card small {
  font-size: 9.5px;
  color: var(--muted);
}

/* Giriş çubuğu ve hızlı çipler (DNA sekansı, SMILES vb. serbest metin girişleri) */
.lab-build-bar {
  display: flex;
  gap: 6px;
}

.lab-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lab-chip {
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--cyan);
  transition: all 0.14s ease;
}

.lab-chip:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--cyan);
}

/* Rehberli Görev / Durum Sahne Altı Bandı */
.lab-scene-banner {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 48px;
  z-index: 12;
  background: rgba(8, 16, 14, 0.92);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

/* Genel Modaller (Karşılaştırma / Ders / Analiz / Geçmiş) */
.lab-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(4, 6, 12, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.lab-modal {
  width: min(860px, 95vw);
  max-height: 88vh;
  background: var(--panel-hi);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
}

.lab-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lab-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.lab-compare-table th,
.lab-compare-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.lab-compare-table th {
  color: var(--muted);
  font-weight: 600;
  width: 32%;
}

.lab-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 8px 18px;
  border-radius: 99px;
  background: rgba(8, 16, 14, 0.94);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(56, 189, 248, 0.35);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* Yapım Aşamasında Kartı (iskelet evresinde henüz derinleştirilmemiş alt-sekmeler için) */
.lab-soon-card {
  margin: auto;
  max-width: 460px;
  padding: 22px 24px;
  border-radius: 16px;
  background: rgba(9, 12, 22, 0.55);
  border: 1px dashed var(--border-hi);
  text-align: center;
  color: var(--muted);
}
.lab-soon-card .icon {
  font-size: 30px;
  margin-bottom: 8px;
}
.lab-soon-card h4 {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 6px;
}
.lab-soon-card p {
  font-size: 12.5px;
  line-height: 1.55;
}

/* ============================================================================
   7. SCIENCEWIKI "AKADEMİK BİLGİ & TEORİ" ÇEKMECESİ (4 SEKMELİ DRAWER)
   ============================================================================ */
.theory-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(4, 6, 12, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: flex-end;
}

.theory-drawer {
  width: min(620px, 95vw);
  height: 100%;
  background: var(--panel-hi);
  border-left: 1px solid var(--border-hi);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.7);
  overflow-y: auto;
}

.theory-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.theory-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.theory-tab-btn {
  padding: 8px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.theory-tab-btn.active {
  color: var(--cyan);
  border-color: var(--border-hi);
  background: rgba(56, 189, 248, 0.14);
}

.theory-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.65;
}

.theory-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(4, 6, 12, 0.45);
  border: 1px solid var(--border);
}

html[data-theme="light"] .theory-card {
  background: rgba(241, 245, 249, 0.8);
}

.theory-card h4 {
  color: var(--cyan);
  margin-bottom: 6px;
  font-size: 14px;
}

.formula-box {
  padding: 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.24);
  margin: 8px 0;
  overflow-x: auto;
}

.task-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.28);
  margin-bottom: 8px;
}

.task-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--violet);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* ============================================================================
   8. RESPONSIVE (MOBİL VE TABLET BOTTOM-SHEET / AKORDEON UYUMU)
   ============================================================================ */
@media (max-width: 1220px) {
  .lab-grid {
    grid-template-columns: 290px minmax(0, 1fr);
  }
  .lab-grid > .hud-panel:last-child {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 8px 10px;
  }
  .main-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    width: 100%;
    order: 3;
  }
  .lab-grid, .lab-grid.two-col {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .stage-panel {
    order: -1;
    min-height: 400px;
  }
  .stage-viewport {
    min-height: 380px;
  }
  .hud-panel {
    max-height: none;
  }
  .theory-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .lab-card-grid {
    grid-template-columns: 1fr;
  }
}



/* ============================================================================
   9. SÜRÜKLENEBİLİR "scienceWiki" PENCERESİ (Sezgisel / Kim Buldu / LaTeX / Dene)
   ============================================================================ */
.wiki-window {
  position: fixed;
  z-index: 900;
  top: 92px;
  right: 22px;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--panel-hi);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}
.wiki-window .theory-head { cursor: move; user-select: none; }
.wiki-window .theory-body { overflow-y: auto; flex: 1; }
.wiki-window.dragging { opacity: 0.92; }

/* Modül kök kapsayıcısı: her modül kendi alt sekmelerini ve lab-grid'ini burada üretir */
.mod-root { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

/* Uzay sahnesi üstü küçük HUD rozetleri */
.space-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  background: rgba(3, 4, 7, 0.7); border: 1px solid var(--border);
  color: var(--text); backdrop-filter: blur(8px);
}
.space-badge.warn { border-color: rgba(239, 68, 68, 0.6); color: #fca5a5; }
.space-badge.ok { border-color: rgba(52, 211, 153, 0.55); color: #6ee7b7; }
.space-badge.hot { border-color: rgba(249, 115, 22, 0.6); color: #fdba74; }

@media (max-width: 860px) {
  .wiki-window {
    top: auto; bottom: 0; left: 0 !important; right: 0; width: 100%;
    max-height: 70vh; border-radius: 16px 16px 0 0;
  }
  .wiki-window .theory-head { cursor: default; }
}

/* 9 modül sekmesinin üst çubuğa sığması için kompakt gezinme */
.main-nav .nav-tab { padding: 6px 9px; font-size: 11.5px; white-space: nowrap; }
@media (max-width: 1500px) { .main-nav .nav-tab { padding: 5px 7px; font-size: 11px; } .brand-ver { display: none; } }
