/* ==========================================================================
   SahiSpace ChemLab (chem.sahispace.com) — 5 Premium 3D Studio Themes
   ========================================================================== */

:root {
  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Default: Sapphire Glass 3D */
  --bg-base: #060d1f;
  --bg-grad-1: rgba(56, 189, 248, 0.16);
  --bg-grad-2: rgba(99, 102, 241, 0.18);
  --surface-1: rgba(13, 24, 48, 0.84);
  --surface-2: rgba(20, 35, 68, 0.78);
  --surface-solid: #0d1933;
  --border-subtle: rgba(148, 197, 255, 0.16);
  --border-strong: rgba(56, 189, 248, 0.38);
  --text-main: #f0f6ff;
  --text-muted: #9db4d8;
  --accent-1: #38bdf8;
  --accent-2: #6366f1;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --lcd-bg: linear-gradient(145deg, #050b18, #0c1b36);
  --lcd-text: #7dd3fc;
  --danger: #fb7185;
  --success: #34d399;
  --warn: #fbbf24;
  --shadow-card: 0 18px 42px rgba(2, 6, 18, 0.55);
  --key-text: #ffffff;
  --key-sub: rgba(255, 255, 255, 0.82);
}

/* Theme 2: Emerald Gold Lab */
html[data-theme="emerald"] {
  --bg-base: #041511;
  --bg-grad-1: rgba(16, 185, 129, 0.18);
  --bg-grad-2: rgba(245, 158, 11, 0.14);
  --surface-1: rgba(8, 32, 26, 0.86);
  --surface-2: rgba(13, 46, 37, 0.8);
  --surface-solid: #08211b;
  --border-subtle: rgba(110, 231, 183, 0.18);
  --border-strong: rgba(251, 191, 36, 0.42);
  --text-main: #ecfdf5;
  --text-muted: #98c7b7;
  --accent-1: #10b981;
  --accent-2: #f59e0b;
  --accent-glow: rgba(16, 185, 129, 0.36);
  --lcd-bg: linear-gradient(145deg, #03100d, #09241c);
  --lcd-text: #fcd34d;
  --shadow-card: 0 18px 42px rgba(1, 12, 9, 0.6);
}

/* Theme 3: Crystal White 3D (Glossy Ceramic Daylight) */
html[data-theme="crystal"] {
  --bg-base: #eef4fb;
  --bg-grad-1: rgba(59, 130, 246, 0.12);
  --bg-grad-2: rgba(168, 85, 247, 0.1);
  --surface-1: rgba(255, 255, 255, 0.88);
  --surface-2: rgba(241, 246, 253, 0.92);
  --surface-solid: #ffffff;
  --border-subtle: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(37, 99, 235, 0.35);
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-1: #2563eb;
  --accent-2: #7c3aed;
  --accent-glow: rgba(37, 99, 235, 0.24);
  --lcd-bg: linear-gradient(145deg, #0f172a, #1e293b);
  --lcd-text: #7dd3fc;
  --shadow-card: 0 14px 34px rgba(15, 23, 42, 0.1);
}

/* Theme 4: Obsidian Studio (Matte Titanium & Rose Violet) */
html[data-theme="obsidian"] {
  --bg-base: #0a0a0f;
  --bg-grad-1: rgba(236, 72, 153, 0.14);
  --bg-grad-2: rgba(139, 92, 246, 0.16);
  --surface-1: rgba(20, 20, 28, 0.88);
  --surface-2: rgba(30, 30, 42, 0.84);
  --surface-solid: #14141d;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(192, 132, 252, 0.42);
  --text-main: #f8fafc;
  --text-muted: #a1a1b5;
  --accent-1: #c084fc;
  --accent-2: #f43f5e;
  --accent-glow: rgba(192, 132, 252, 0.32);
  --lcd-bg: linear-gradient(145deg, #07070b, #171422);
  --lcd-text: #f0abfc;
  --shadow-card: 0 20px 46px rgba(0, 0, 0, 0.72);
}

/* Theme 5: Smartboard Classroom (High-Contrast Projector Mode) */
html[data-theme="smartboard"] {
  --bg-base: #000814;
  --bg-grad-1: rgba(250, 204, 21, 0.12);
  --bg-grad-2: rgba(34, 211, 238, 0.14);
  --surface-1: #071324;
  --surface-2: #0d1e38;
  --surface-solid: #071324;
  --border-subtle: rgba(255, 255, 255, 0.24);
  --border-strong: rgba(250, 204, 21, 0.65);
  --text-main: #ffffff;
  --text-muted: #cbd5e1;
  --accent-1: #facc15;
  --accent-2: #22d3ee;
  --accent-glow: rgba(250, 204, 21, 0.35);
  --lcd-bg: #02060d;
  --lcd-text: #fde047;
  --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.7);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button { cursor: pointer; }
code {
  font-family: var(--font-mono);
  background: rgba(125, 211, 252, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
.full-w { width: 100%; }

/* Ambient Background */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 12% 14%, var(--bg-grad-1), transparent 42%),
    radial-gradient(circle at 86% 22%, var(--bg-grad-2), transparent 44%),
    radial-gradient(circle at 50% 92%, var(--bg-grad-1), transparent 48%);
}

/* ================= TOP NAVIGATION BAR ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 2px 4px;
  text-align: left;
}

.brand-logo {
  display: inline-flex;
  filter: drop-shadow(0 4px 10px var(--accent-glow));
  transition: transform 0.3s var(--ease);
}
.brand-btn:hover .brand-logo { transform: rotate(12deg) scale(1.06); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-title strong {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.22s var(--ease);
}
.nav-tab:hover { color: var(--text-main); }
.nav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 6px 18px var(--accent-glow);
}
html[data-theme="smartboard"] .nav-tab.active { color: #000814; }

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

.control-select {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.control-select:focus { border-color: var(--accent-1); }
.control-select option {
  background: var(--surface-solid);
  color: var(--text-main);
}

.control-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s var(--ease);
}
.control-btn:hover, .control-btn.active {
  border-color: var(--accent-1);
  box-shadow: 0 0 12px var(--accent-glow);
}

.pro-pill {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #111827;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
  transition: transform 0.2s var(--ease);
}
.pro-pill:hover { transform: translateY(-1px); }

/* ================= MAIN VIEWS ================= */
.app-main {
  position: relative;
  z-index: 1;
}

.view-section {
  display: none;
  animation: fadeSlide 0.3s var(--ease);
}
.view-section.active { display: block; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= BUTTONS & CHIPS ================= */
.btn-primary, .btn-secondary, .btn-ghost {
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.92rem;
  transition: all 0.22s var(--ease);
  border: 1px solid transparent;
}
.btn-lg { padding: 13px 22px; font-size: 0.96rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 8px 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.35);
}
html[data-theme="smartboard"] .btn-primary { color: #000814; }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.08); }

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-main);
}
.btn-secondary:hover { transform: translateY(-2px); border-color: var(--accent-1); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text-main); border-color: var(--border-strong); }

.mini-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s var(--ease);
}
.mini-chip:hover, .mini-chip.active {
  border-color: var(--accent-1);
  background: rgba(56, 189, 248, 0.16);
}
.mini-chip.accent {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border-color: transparent;
}
html[data-theme="smartboard"] .mini-chip.accent { color: #000814; }

/* ================= VIEW 1: HOME PAGE ================= */
.home-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 56px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  margin-bottom: 16px;
}

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.gradient-text {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-desc {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 560px;
}

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

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}
.stat-item strong {
  display: block;
  font-size: 1.35rem;
  color: var(--accent-1);
}
.stat-item span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Movable 3D Periodic Showcase Card */
.hero-3d-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.hero-3d-header, .hero-3d-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}
.hero-3d-footer {
  border-bottom: none;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
}
.hero-3d-btns { display: flex; gap: 6px; }

.hero-3d-stage {
  height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: radial-gradient(circle at center, var(--bg-grad-1), transparent 70%);
  overflow: hidden;
}
.hero-3d-stage:active { cursor: grabbing; }

.hero-3d-board {
  display: grid;
  grid-template-columns: repeat(18, 22px);
  grid-template-rows: repeat(7, 22px);
  gap: 4px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  transform-style: preserve-3d;
  transform: rotateX(16deg) rotateY(-14deg);
  transition: transform 0.08s linear;
}

.hero-mini-tile {
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.6),
    0 3px 0 rgba(0,0,0,0.45),
    0 4px 8px rgba(0,0,0,0.3);
  transform: translateZ(8px);
}

/* Feature Cards */
.section-block { margin-bottom: 52px; }
.section-head { text-align: center; margin-bottom: 26px; }
.section-head h2 { margin: 0 0 8px; font-size: 1.8rem; }
.section-head p { margin: 0; color: var(--text-muted); }

.feature-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.feature-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}
.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-1);
  box-shadow: 0 18px 40px var(--accent-glow);
}
.f-icon { font-size: 1.8rem; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.feature-card p { margin: 0 0 16px; font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.f-link { font-size: 0.85rem; font-weight: 700; color: var(--accent-1); }

/* Roadmap Strip */
.roadmap-strip {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 52px;
}
.roadmap-label { font-weight: 800; font-size: 0.9rem; color: var(--accent-1); }
.roadmap-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.road-pill {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.price-card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}
.price-card.featured {
  border: 2px solid var(--accent-1);
  box-shadow: 0 20px 44px var(--accent-glow);
}
.popular-tag {
  position: absolute;
  top: -12px; right: 20px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
}
html[data-theme="smartboard"] .popular-tag { color: #000814; }
.price-tier { font-size: 1rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.price-val { font-size: 2rem; font-weight: 800; margin-bottom: 16px; }
.price-val span { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.price-list {
  list-style: none; padding: 0; margin: 0 0 22px; flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 0.9rem; color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 32px;
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
}
.footer-brand-name { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.footer-brand p { margin: 0 0 10px; color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; max-width: 380px; }
.footer-email { color: var(--accent-1); font-family: var(--font-mono); font-size: 0.88rem; text-decoration: none; }
.footer-col h4 { margin: 0 0 12px; font-size: 0.92rem; }
.footer-link {
  display: block; background: none; border: none; padding: 4px 0;
  color: var(--text-muted); font-size: 0.88rem; text-align: left;
}
.footer-link:hover { color: var(--accent-1); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding-top: 18px; border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem; color: var(--text-muted);
}

/* ================= VIEW 2: FULL-SCREEN GLOSSY 3D PERIODIC TABLE ================= */
#view-periodic {
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 16px 26px;
}

.periodic-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.search-wrap {
  position: relative;
  flex: 1 1 230px;
  max-width: 310px;
}
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 0.85rem; opacity: 0.7;
}
.search-wrap input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  font-size: 0.86rem;
  outline: none;
}
.search-wrap input:focus { border-color: var(--accent-1); }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s var(--ease);
}
.chip:hover { color: var(--text-main); border-color: var(--border-strong); }
.chip.active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px var(--accent-glow);
}
html[data-theme="smartboard"] .chip.active { color: #000814; }

.exc-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff3b5c;
  box-shadow: 0 0 8px #ff3b5c;
}

/* Full-Width 3D Periodic Grid */
.periodic-board-wrap {
  overflow-x: auto;
  padding: 12px 6px 18px;
  perspective: 1400px;
}

.periodic-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(56px, 1fr));
  gap: 7px;
  min-width: 1120px;
  transition: transform 0.5s var(--ease);
  transform-style: preserve-3d;
}
.periodic-grid.tilted {
  transform: rotateX(12deg) scale(0.97);
}

/* Glossy 3D Gem Keycap Buttons */
.el-key {
  position: relative;
  border: none;
  border-radius: 11px;
  padding: 6px 4px 7px;
  min-height: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: var(--key-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 0.14s var(--ease), box-shadow 0.18s var(--ease), opacity 0.2s;
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.55),
    inset 0 -3px 6px rgba(0, 0, 0, 0.28),
    0 5px 0 var(--key-edge, #1e293b),
    0 8px 14px rgba(0, 0, 0, 0.36);
}

/* Top Glossy Glass Highlight */
.el-key::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 46%;
  background: linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.04));
  border-radius: 11px 11px 45% 45%;
  pointer-events: none;
}

.el-key:hover {
  transform: translateY(-4px) scale(1.06);
  z-index: 6;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.72),
    inset 0 -3px 6px rgba(0, 0, 0, 0.25),
    0 8px 0 var(--key-edge, #1e293b),
    0 14px 24px var(--key-glow, rgba(56, 189, 248, 0.55));
}

.el-key:active, .el-key.pressed {
  transform: translateY(3px) scale(0.98);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.35),
    0 2px 0 var(--key-edge, #1e293b),
    0 4px 8px rgba(0, 0, 0, 0.3);
}

.el-key.selected {
  outline: 2.5px solid #ffffff;
  outline-offset: 2px;
  z-index: 8;
}

.el-key.dimmed {
  opacity: 0.18;
  filter: grayscale(0.75);
  transform: scale(0.95);
}

.el-z {
  position: absolute; top: 4px; left: 6px;
  font-size: 0.64rem; font-weight: 800; opacity: 0.92;
}
.el-exc-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff2e55;
  border: 1px solid #fff;
  box-shadow: 0 0 8px #ff2e55;
}
.el-sym {
  margin-top: 9px;
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}
.el-name {
  font-size: 0.58rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--key-sub);
}
.el-mass {
  font-size: 0.54rem;
  font-family: var(--font-mono);
  opacity: 0.85;
}

/* Vibrant Category Gem Gradients */
.cat-alkali {
  background: linear-gradient(145deg, #fb7185, #e11d48);
  --key-edge: #9f1239; --key-glow: rgba(244, 63, 94, 0.55);
}
.cat-alkaline {
  background: linear-gradient(145deg, #fb923c, #ea580c);
  --key-edge: #9a3412; --key-glow: rgba(249, 115, 22, 0.55);
}
.cat-transition {
  background: linear-gradient(145deg, #38bdf8, #0284c7);
  --key-edge: #075985; --key-glow: rgba(56, 189, 248, 0.55);
}
.cat-post {
  background: linear-gradient(145deg, #2dd4bf, #0d9488);
  --key-edge: #115e59; --key-glow: rgba(45, 212, 191, 0.55);
}
.cat-metalloid {
  background: linear-gradient(145deg, #a3e635, #4d7c0f);
  --key-edge: #365314; --key-glow: rgba(132, 204, 22, 0.55);
}
.cat-nonmetal {
  background: linear-gradient(145deg, #34d399, #059669);
  --key-edge: #065f46; --key-glow: rgba(16, 185, 129, 0.55);
}
.cat-halogen {
  background: linear-gradient(145deg, #facc15, #d97706);
  --key-edge: #92400e; --key-glow: rgba(250, 204, 21, 0.55);
}
.cat-noble {
  background: linear-gradient(145deg, #c084fc, #7e22ce);
  --key-edge: #581c87; --key-glow: rgba(192, 132, 252, 0.55);
}
.cat-lanthanide {
  background: linear-gradient(145deg, #818cf8, #4338ca);
  --key-edge: #312e81; --key-glow: rgba(129, 140, 248, 0.55);
}
.cat-actinide {
  background: linear-gradient(145deg, #f472b6, #be185d);
  --key-edge: #831843; --key-glow: rgba(244, 114, 182, 0.55);
}

.lanth-label {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 800; color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--surface-2);
}

.legend-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  padding: 10px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  color: var(--text-muted);
}
.leg-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.leg-dot { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }

/* ================= VIEW 3: FORMULA + 2D/3D MOLECULE LAB ================= */
#view-formula, #view-bond {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 20px;
  align-items: start;
}

.panel-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-header h2 { margin: 0 0 4px; font-size: 1.25rem; }
.panel-sub { margin: 0; font-size: 0.83rem; color: var(--text-muted); }

.status-tag {
  background: rgba(52, 211, 153, 0.16);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.lcd-screen {
  background: var(--lcd-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: inset 0 4px 16px rgba(0, 0, 0, 0.5);
}
.lcd-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}
.lcd-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #94a3b8;
  margin-bottom: 4px;
}
.lcd-formula {
  font-size: 1.9rem;
  font-weight: 900;
  color: #ffffff;
  font-family: var(--font-mono);
  line-height: 1.1;
}
.lcd-subname { font-size: 0.84rem; color: var(--lcd-text); margin-top: 4px; font-weight: 600; }
.lcd-mass-group { text-align: right; }
.lcd-mass { font-size: 1.9rem; font-weight: 900; color: var(--lcd-text); font-family: var(--font-mono); line-height: 1.1; }
.lcd-unit { font-size: 0.78rem; color: #cbd5e1; margin-top: 4px; }

.formula-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.formula-input-row input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: var(--font-mono);
  font-weight: 700;
  outline: none;
}
.formula-input-row input:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-glow); }

.autofix-banner {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--success);
}
.autofix-banner.err {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.4);
  color: var(--danger);
}

.presets-wrap {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.mini-label { font-size: 0.76rem; font-weight: 700; color: var(--text-muted); }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.keypad-wrap {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 16px;
}
.keypad-elements, .keypad-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 6px;
}
.k-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 9px 4px;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.1s;
}
.k-btn:hover { border-color: var(--accent-1); }
.k-btn:active { transform: translateY(2px); }
.k-btn.k-op { color: var(--accent-1); }
.k-btn.k-danger { color: var(--danger); }

.composition-box {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}
.comp-head {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
  margin-bottom: 10px;
}
.comp-stacked-bar {
  display: flex; height: 14px; border-radius: 999px; overflow: hidden;
  background: rgba(0,0,0,0.2); margin-bottom: 12px;
}
.comp-seg { height: 100%; transition: width 0.35s var(--ease); }
.comp-list { display: flex; flex-direction: column; gap: 7px; }
.comp-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.84rem;
}

/* 2D & 3D Molecule Studio */
.mol-mode-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--surface-2);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}
.mol-tab {
  border: none; background: transparent;
  padding: 8px 10px; border-radius: 9px;
  font-size: 0.82rem; font-weight: 700; color: var(--text-muted);
}
.mol-tab.active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
}
html[data-theme="smartboard"] .mol-tab.active { color: #000814; }

.mol-stage {
  position: relative;
  height: 320px;
  border-radius: var(--radius-md);
  background: var(--lcd-bg);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  touch-action: none;
}
.mol-canvas { width: 100%; height: 100%; cursor: grab; display: block; }
.mol-canvas:active { cursor: grabbing; }
.mol-svg { width: 100%; height: 100%; }

.mol-fallback {
  text-align: center; padding: 24px; color: #cbd5e1; max-width: 340px;
}
.fallback-icon { font-size: 2.2rem; margin-bottom: 8px; }
.mol-fallback h4 { margin: 0 0 6px; color: #fff; }
.mol-fallback p { margin: 0; font-size: 0.84rem; line-height: 1.5; }

.mol-stage-controls {
  position: absolute; top: 10px; right: 10px; display: flex; gap: 6px;
}
.mol-drag-tag {
  position: absolute; bottom: 10px; left: 12px;
  font-size: 0.72rem; color: #94a3b8;
  background: rgba(0, 0, 0, 0.45); padding: 4px 10px; border-radius: 999px;
}

.mol-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.meta-tile {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
}
.meta-tile span { display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 3px; }
.meta-tile strong { font-size: 0.92rem; }

.exam-note-box {
  background: rgba(56, 189, 248, 0.1);
  border-left: 3.5px solid var(--accent-1);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ================= VIEW 4: BOND COMPARATOR ================= */
.bond-selectors {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}
.bond-slot label {
  display: block; font-size: 0.78rem; font-weight: 700;
  color: var(--text-muted); margin-bottom: 6px;
}
.bond-mini-card {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}
.swap-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 1.2rem; font-weight: 800;
  transition: transform 0.25s var(--ease);
}
.swap-btn:hover { transform: rotate(180deg); border-color: var(--accent-1); }

.bond-verdict-lcd {
  background: var(--lcd-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.verdict-delta { font-size: 2.2rem; font-weight: 900; color: var(--lcd-text); font-family: var(--font-mono); }
.verdict-type { font-size: 1.25rem; font-weight: 800; color: #fff; margin-bottom: 4px; }
.verdict-desc { margin: 0; font-size: 0.86rem; color: #cbd5e1; }

.exam-trap-alert {
  background: rgba(251, 113, 133, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.45);
  border-left: 4px solid var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  margin-bottom: 14px;
}

.bond-bars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.trend-comp-row {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
}

/* ================= SLIDE-OUT ELEMENT INSPECTOR DRAWER ================= */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(2, 6, 20, 0.55);
  backdrop-filter: blur(4px);
}

.inspector-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 95vw);
  z-index: 70;
  background: var(--surface-solid);
  border-left: 1px solid var(--border-strong);
  box-shadow: -16px 0 44px rgba(0, 0, 0, 0.55);
  transform: translateX(105%);
  transition: transform 0.3s var(--ease);
  display: flex;
  flex-direction: column;
}
.inspector-drawer.open { transform: translateX(0); }

.insp-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.insp-hero { display: flex; gap: 14px; align-items: center; }
.insp-big-tile {
  width: 68px; height: 74px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; position: relative;
  box-shadow: inset 0 2px 2px rgba(255,255,255,0.5), 0 6px 16px rgba(0,0,0,0.35);
}
.insp-z { position: absolute; top: 5px; left: 7px; font-size: 0.7rem; }
.insp-sym { font-size: 1.6rem; line-height: 1; margin-top: 6px; }
.insp-m { font-size: 0.65rem; font-family: var(--font-mono); opacity: 0.9; }

.insp-titles h3 { margin: 0 0 3px; font-size: 1.25rem; }
.insp-hindi { font-size: 0.92rem; color: var(--accent-1); font-weight: 700; margin-bottom: 5px; }
.insp-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge-pill {
  font-size: 0.7rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-subtle);
}
.badge-alert { background: rgba(251, 113, 133, 0.2); color: var(--danger); border-color: var(--danger); }

.close-btn {
  background: var(--surface-2); border: 1px solid var(--border-subtle);
  width: 34px; height: 34px; border-radius: 10px; font-weight: 800;
}

.insp-quick-actions {
  padding: 10px 18px; display: flex; gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.insp-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px; padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.insp-tab {
  border: none; background: transparent; padding: 8px 4px;
  border-radius: 8px; font-size: 0.76rem; font-weight: 700; color: var(--text-muted);
}
.insp-tab.active {
  background: var(--surface-2); color: var(--accent-1);
  border: 1px solid var(--border-strong);
}

.insp-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.insp-panel { display: none; }
.insp-panel.active { display: block; }

.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kv-item {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 10px 12px;
}
.kv-item span { display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 3px; }
.kv-item strong { font-size: 0.9rem; word-break: break-word; }

.bohr-stage {
  text-align: center; background: var(--lcd-bg);
  border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 12px; margin-bottom: 14px;
}
.bohr-shells { font-family: var(--font-mono); font-size: 0.82rem; color: var(--lcd-text); margin-top: 6px; }

.trends-list { display: flex; flex-direction: column; gap: 10px; }
.trend-bar-card {
  background: var(--surface-2); border: 1px solid var(--border-subtle);
  border-radius: 11px; padding: 10px 12px;
}
.trend-track {
  height: 8px; border-radius: 999px; background: rgba(148, 163, 184, 0.2);
  overflow: hidden; margin-top: 6px;
}
.trend-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
}

.mnemonic-card, .uses-card {
  background: var(--surface-2); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  font-size: 0.88rem; line-height: 1.55;
}

/* ================= MODAL ================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(2, 6, 20, 0.68);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-card {
  width: min(560px, 100%);
  max-height: 85vh;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-body {
  padding: 18px 20px; overflow-y: auto;
  font-size: 0.9rem; line-height: 1.65; color: var(--text-muted);
}
.modal-body strong { color: var(--text-main); }

/* ================= RESPONSIVE ================= */
@media (max-width: 1100px) {
  .hero-grid, .lab-grid { grid-template-columns: 1fr; }
  .feature-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 10px 12px; }
  .nav-tabs { order: 3; width: 100%; justify-content: space-between; overflow-x: auto; }
  .nav-tab { padding: 7px 11px; font-size: 0.8rem; white-space: nowrap; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .feature-cards-grid, .footer-grid, .bond-bars-grid { grid-template-columns: 1fr; }
  .bond-selectors { grid-template-columns: 1fr; }
  .swap-btn { margin: 0 auto; }
}