:root {
  --bg: #060a1f;
  --bg-alt: #0b1130;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef1ff;
  --text-dim: #9aa3c7;
  --text-dimmer: #6b7398;
  --cyan: #22d3ee;
  --green: #34e0a1;
  --purple: #a78bfa;
  --amber: #fbbf24;
  --gradient-main: linear-gradient(135deg, var(--cyan), var(--purple));
  --shadow-glow: 0 0 60px rgba(34, 211, 238, 0.15);
  --radius: 18px;
  --header-h: 76px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

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

a { color: inherit; text-decoration: none; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.01em; }
p { color: var(--text-dim); margin: 0 0 16px; }

.text-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.badge-next { background: rgba(34, 211, 238, 0.12); color: var(--cyan); border: 1px solid rgba(34, 211, 238, 0.3); }
.badge-done { background: rgba(52, 224, 161, 0.12); color: var(--green); border: 1px solid rgba(52, 224, 161, 0.3); }
.badge-soon { background: rgba(167, 139, 250, 0.12); color: var(--purple); border: 1px solid rgba(167, 139, 250, 0.3); }

/* ---------- Background ambient elements ---------- */
.bg-elements {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
}
.bg-element {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dimmer);
  animation: float-drift linear infinite;
}
.bg-molecule {
  width: 56px;
  height: 46px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.16);
}
.bg-molecule svg { width: 100%; height: 100%; }

@keyframes float-drift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(18px, -26px) rotate(8deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--surface);
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: rgba(6, 10, 31, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-tile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gradient-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #060a1f;
  position: relative;
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.35);
}
.brand-tile-sm { width: 32px; height: 32px; }
.brand-symbol { font-weight: 800; font-size: 15px; line-height: 1; }
.brand-number { font-size: 8px; position: absolute; top: 3px; left: 5px; font-weight: 700; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }

.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a { font-size: 15px; color: var(--text-dim); transition: color 0.2s ease; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text) !important;
}
.nav-cta:hover { background: var(--surface-hover); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.25s ease, opacity 0.25s ease; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--gradient-main);
  color: #060a1f;
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(34, 211, 238, 0.4); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface); border-color: rgba(255,255,255,0.2); }
.btn:disabled { cursor: not-allowed; opacity: 0.75; transform: none !important; box-shadow: none !important; }
.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Full-page "processing" overlay — dims the whole page and shows a spinner + elapsed-seconds
   counter while a form submit (or any code that calls PageLoading.show()) is in flight, so a
   slow request (file import, exam submit) reads as "working", not "did my click even register".
   Injected into the DOM by page-loading.js — see that file for when it shows/hides. */
.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 31, 0.78);
  backdrop-filter: blur(2px);
}
.page-loading-overlay.is-visible { display: flex; }
.page-loading-box { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.page-loading-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-right-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.page-loading-text { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 0.02em; text-align: center; }
.page-loading-counter { color: rgba(255, 255, 255, 0.6); font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--header-h);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 40px;
}
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  margin-bottom: 20px;
}
.hero h1 { font-size: clamp(34px, 4.6vw, 56px); }
.hero-sub { font-size: 17px; max-width: 520px; }
.hero-actions { display: flex; gap: 16px; margin-top: 28px; flex-wrap: wrap; }

.hero-visual {
  position: relative;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.atom {
  position: relative;
  width: 230px;
  height: 230px;
  z-index: 2;
}
.nucleus {
  position: absolute;
  top: 50%; left: 50%;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--green) 45%, #0d8f5f 100%);
  box-shadow: 0 0 30px rgba(52, 224, 161, 0.75);
}
.orbit {
  position: absolute;
  top: 50%; left: 50%;
  width: 230px; height: 92px;
  margin: -46px 0 0 -115px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  animation: spin 8s linear infinite;
}
.orbit-1 { animation-duration: 6s; }
.orbit-2 { animation-duration: 9s; animation-direction: reverse; }
.orbit-3 { animation-duration: 12s; }
.electron {
  position: absolute;
  top: -5px; left: 50%;
  width: 10px; height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px 3px rgba(34, 211, 238, 0.85);
}
.orbit-2 .electron { background: var(--purple); box-shadow: 0 0 12px 3px rgba(167, 139, 250, 0.85); }
.orbit-3 .electron { background: var(--amber); box-shadow: 0 0 12px 3px rgba(251, 191, 36, 0.85); }

@keyframes spin {
  from { transform: rotate(var(--start, 0deg)); }
  to   { transform: rotate(calc(var(--start, 0deg) + 360deg)); }
}
.orbit-1 { --start: 0deg; }
.orbit-2 { --start: 60deg; }
.orbit-3 { --start: 120deg; }

.flask {
  position: absolute;
  right: 4%;
  bottom: 0;
  width: 90px;
  z-index: 1;
  opacity: 0.9;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}
.flask-svg { display: block; width: 100%; height: auto; overflow: visible; }
.flask-glass {
  fill: rgba(255, 255, 255, 0.05);
  stroke: var(--border);
  stroke-width: 1.5;
}
.flask-wave path { fill: rgba(255, 255, 255, 0.3); }
.flask-wave {
  animation: flask-wave-scroll 3.4s linear infinite;
  transform-box: fill-box;
}
@keyframes flask-wave-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(45px); }
}
.flask-shine { fill: rgba(255, 255, 255, 0.14); }
.flask-bubble {
  fill: rgba(255, 255, 255, 0.85);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: flask-bubble-rise 3.2s ease-in infinite;
}
.flask-bubble:nth-child(1) { animation-delay: 0s; }
.flask-bubble:nth-child(2) { animation-delay: .6s; }
.flask-bubble:nth-child(3) { animation-delay: 1.3s; }
.flask-bubble:nth-child(4) { animation-delay: 2s; }
.flask-bubble:nth-child(5) { animation-delay: .9s; }
@keyframes flask-bubble-rise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(-44px) scale(1.1); opacity: 0; }
}
.bubble {
  position: absolute;
  bottom: -10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  animation: rise 3.2s ease-in infinite;
}
.bubble:nth-child(1) { left: 15%; animation-delay: 0s; }
.bubble:nth-child(2) { left: 35%; width: 4px; height: 4px; animation-delay: .7s; }
.bubble:nth-child(3) { left: 55%; animation-delay: 1.4s; }
.bubble:nth-child(4) { left: 70%; width: 5px; height: 5px; animation-delay: .3s; }
.bubble:nth-child(5) { left: 85%; width: 4px; height: 4px; animation-delay: 1.9s; }

@keyframes rise {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(-70px) scale(1.3); opacity: 0; }
}

.burner {
  position: absolute;
  left: 6%;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.burner-base {
  width: 52px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4b5480, #262b47);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.35);
}
.burner-stem {
  width: 14px;
  height: 30px;
  background: linear-gradient(180deg, #565f8c, #2a3050);
  border-radius: 2px 2px 0 0;
}
.flame {
  width: 20px;
  height: 46px;
  margin-bottom: -2px;
  transform-origin: bottom center;
  background: linear-gradient(0deg, #2dd4ff 0%, #34e0a1 30%, #fbbf24 68%, #ff8a3d 100%);
  clip-path: polygon(50% 0%, 78% 28%, 64% 34%, 84% 58%, 50% 100%, 16% 58%, 36% 34%, 22% 28%);
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.55));
  animation: flame-flicker 1.1s ease-in-out infinite alternate;
}
.flame-core {
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 6px;
  height: 16px;
  margin-left: -3px;
  border-radius: 50%;
  background: #eafffb;
  filter: blur(1.5px);
  opacity: 0.8;
}
@keyframes flame-flicker {
  0%   { transform: scaleY(1) scaleX(1) rotate(-2deg); }
  50%  { transform: scaleY(1.1) scaleX(0.92) rotate(1deg); }
  100% { transform: scaleY(0.94) scaleX(1.05) rotate(-1deg); }
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}
.scroll-cue span {
  width: 4px; height: 8px;
  border-radius: 2px;
  background: var(--cyan);
  animation: cue 1.6s ease-in-out infinite;
}
@keyframes cue {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(14px); opacity: 0; }
}

/* ---------- About ---------- */
.about { position: relative; z-index: 1; padding: 120px 0; }
.about-inner {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 60px;
  align-items: center;
}
.about-visual { display: flex; justify-content: center; }
.molecule {
  position: relative;
  width: 260px;
  height: 260px;
  animation: molecule-spin 22s linear infinite;
}
@keyframes molecule-spin { to { transform: rotate(360deg); } }
.ring {
  position: absolute;
  inset: 30px;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}
.atom-dot {
  --angle: calc(var(--i) * 60deg);
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  transform: rotate(var(--angle)) translate(110px) rotate(calc(-1 * var(--angle)));
}
.atom-dot::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--gradient-main);
  opacity: 0.85;
}
.atom-dot:nth-child(odd)::after { background: linear-gradient(135deg, var(--green), var(--amber)); }

.about-text p { max-width: 560px; }
.about-stats { display: flex; gap: 40px; margin-top: 32px; flex-wrap: wrap; }
.stat-num { display: block; font-size: 30px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-dimmer); }

/* ---------- Features ---------- */
.features { position: relative; z-index: 1; padding: 100px 0; background: var(--bg-alt); }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.section-head p { margin: 0; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.feature-card {
  background: transparent;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.feature-card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 211, 238, 0.35);
  background: var(--surface-hover);
}
.feature-icon {
  font-size: 30px;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 16px;
}
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { font-size: 14.5px; margin: 0; }

/* ---------- Atom structure ---------- */
.atom-structure { position: relative; z-index: 1; padding: 100px 0; background: var(--bg-alt); }
/* ---------- Periodic table ---------- */
.cat-kim-loai-kiem { --cat: #d95926; }
.cat-kim-loai-kiem-tho { --cat: #a8a300; }
.cat-kim-loai-chuyen-tiep { --cat: #3987e5; }
.cat-kim-loai-yeu { --cat: #e66767; }
.cat-a-kim { --cat: #9085e9; }
.cat-phi-kim { --cat: #0f8f6a; }
.cat-halogen { --cat: #c23b7a; }
.cat-khi-hiem { --cat: #0aa5a0; }
.cat-lantan, .cat-actini { --cat: #d1638c; }
.cat-chua-xac-dinh { --cat: var(--text-dimmer); }

.ptable-wrap { overflow-x: auto; padding-bottom: 6px; }
.ptable-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  margin: 0 0 20px;
}
.ptable-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.ptable-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--cat);
  flex: none;
}
.cat-chua-xac-dinh .ptable-swatch,
.ptable-swatch.cat-chua-xac-dinh { background: transparent; border: 1.5px dashed var(--cat); }

.ptable {
  display: grid;
  grid-template-columns: repeat(18, minmax(40px, 1fr));
  grid-auto-rows: minmax(40px, auto);
  gap: 3px;
  min-width: 820px;
}
.ptable-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 2px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cat, var(--border));
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.cat-chua-xac-dinh.ptable-cell { border-top-style: dashed; }
.ptable-cell:hover, .ptable-cell:focus-visible {
  background: var(--surface-hover);
  transform: translateY(-2px);
  z-index: 2;
  outline: none;
}
.ptable-cell-f { border-top-width: 3px; }
.ptable-z { font-size: 8.5px; color: var(--text-dimmer); align-self: flex-start; margin-left: 2px; line-height: 1; }
.ptable-symbol { font-size: 13px; font-weight: 700; line-height: 1.3; }
.ptable-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-dimmer);
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.ptable-cell[style*="grid-row: 9"], .ptable-cell[style*="grid-row: 10"] { margin-top: 8px; }

.ptable-tooltip {
  position: fixed;
  z-index: 60;
  min-width: 220px;
  max-width: 260px;
  padding: 14px 16px;
  background: #0d1333;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}
.ptable-tooltip.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.ptable-tooltip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ptable-tooltip-symbol {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border-top: 3px solid var(--cat, var(--border));
  background: rgba(255,255,255,0.04);
  font-weight: 700;
  font-size: 14px;
}
.ptable-tooltip-name { display: flex; flex-direction: column; font-weight: 700; font-size: 14.5px; }
.ptable-tooltip-name small { font-weight: 500; font-size: 11.5px; color: var(--text-dimmer); }
.ptable-tooltip dl { display: grid; grid-template-columns: auto auto; gap: 4px 12px; margin: 0; }
.ptable-tooltip dt { font-size: 11.5px; color: var(--text-dimmer); }
.ptable-tooltip dd { margin: 0; font-size: 12.5px; color: var(--text); text-align: right; }

/* ---------- Atom popup modal ---------- */
.atom-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.atom-modal.is-open { opacity: 1; visibility: visible; }
.atom-modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 20, 0.78); backdrop-filter: blur(4px); }
.atom-modal-panel {
  position: relative;
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}
.atom-modal.is-open .atom-modal-panel { transform: translateY(0) scale(1); }
.atom-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.atom-modal-close:hover { background: var(--surface-hover); }
.atom-modal-head { text-align: center; margin-bottom: 18px; padding-right: 30px; }
.atom-modal-head h3 { font-size: 22px; margin: 0 0 6px; }
.atom-modal-head p { margin: 0; font-size: 13.5px; color: var(--text-dim); }
body.modal-open { overflow: hidden; }

/* A genuine Word data table (frequency table, etc.) swapped in for a "[[table:N]]" marker by
   inline-table-render.js — see components/question-tables.blade.php. Loaded globally since the
   marker can appear in a question shown on either the student quiz pages or teacher review pages. */
.imported-table { border-collapse: collapse; margin: 10px 0; font-size: 14.5px; max-width: 100%; display: block; overflow-x: auto; }
.imported-table td { border: 1px solid var(--border); padding: 6px 12px; text-align: center; }
.imported-table img { height: 1.3em; width: auto; vertical-align: middle; }

.atom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.atom-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.atom-panel-title {
  text-align: center;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
  margin: 0 0 16px;
  font-weight: 700;
}
.atom-2d-stage { display: flex; align-items: center; justify-content: center; min-height: 320px; }
.atom-2d-stage svg { max-width: 100%; height: auto; }
.atom-3d-stage {
  position: relative;
  height: 320px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, rgba(167, 139, 250, 0.12), transparent 65%), var(--bg-alt);
}
.atom-3d-stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }

/* ---------- Molecule gallery ---------- */
.molecules { position: relative; z-index: 1; padding: 100px 0; }
.molecule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.molecule-card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 26px;
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.molecule-card:hover {
  transform: translateY(-6px) rotate(-0.5deg);
  border-color: rgba(52, 224, 161, 0.35);
  background: var(--surface-hover);
}
.viewer3d { margin-bottom: 60px; }
.viewer3d-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}
.viewer3d-tab {
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.viewer3d-tab:hover { background: var(--surface-hover); color: var(--text); }
.viewer3d-tab.is-active {
  background: var(--gradient-main);
  color: #060a1f;
  border-color: transparent;
  transform: translateY(-1px);
}
.viewer3d-stage {
  position: relative;
  width: 100%;
  height: 440px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 38%, rgba(34, 211, 238, 0.1), transparent 65%),
    var(--bg-alt);
  overflow: hidden;
}
.viewer3d-stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.viewer3d-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  margin: 0;
  color: var(--text-dimmer);
  font-size: 14px;
  line-height: 1.7;
}
.viewer3d-hint { text-align: center; font-size: 13px; color: var(--text-dimmer); margin: 14px 0 0; }
.viewer3d-search {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 22px auto 0;
  flex-wrap: wrap;
  justify-content: center;
}
.viewer3d-search input {
  flex: 1 1 320px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s ease;
}
.viewer3d-search input:focus { border-color: var(--cyan); }
.viewer3d-search-btn { padding: 11px 22px; font-size: 14.5px; white-space: nowrap; }
.viewer3d-search-status {
  text-align: center;
  min-height: 20px;
  font-size: 13.5px;
  color: var(--text-dimmer);
  margin: 12px 0 0;
}
.viewer3d-search-status.is-error { color: #fb7185; }
.viewer3d-search-status.is-ok { color: var(--green); }
.viewer3d-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 31, 0.35);
}
.viewer3d-spinner span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}
.molecule-grid-heading {
  text-align: center;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
  margin: 0 0 24px;
  font-weight: 700;
}

.mol-svg { width: 100%; height: 140px; overflow: visible; }
.mol-bond {
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mol-branch { stroke-width: 2.5; }
.mol-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 3;
}
.mol-atom { stroke: rgba(6, 10, 31, 0.6); stroke-width: 2; transform-box: fill-box; transform-origin: 50% 50%; }
.atom-o { fill: var(--amber); }
.atom-c { fill: var(--cyan); }
.atom-h { fill: #eef1ff; }
.mol-branch-atom { opacity: 0.9; }
.molecule-card h3 { font-size: 16px; margin: 4px 0 2px; }
.mol-formula { margin: 0; font-size: 13.5px; color: var(--text-dimmer); font-family: "Cambria Math", Georgia, serif; }

/* ---------- Test tube strip ---------- */
.tube-strip {
  position: relative;
  z-index: 1;
  padding: 30px 0 50px;
  overflow-x: auto;
}
.tube-row {
  display: flex;
  justify-content: center;
  gap: 26px;
  min-width: max-content;
  padding: 0 24px;
}
.tube {
  width: 30px;
  height: 96px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
  animation: tube-sway 4s ease-in-out infinite;
}
.tube:nth-child(even) { animation-duration: 5s; animation-delay: -1.2s; }
.tube:nth-child(3n) { animation-delay: -2.4s; }
@keyframes tube-sway {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.5deg); }
}
.tube-liquid {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 55%;
  overflow: hidden;
}
.tube-liquid-1 { background: linear-gradient(180deg, rgba(34, 211, 238, 0.55), rgba(34, 211, 238, 0.85)); }
.tube-liquid-2 { background: linear-gradient(180deg, rgba(167, 139, 250, 0.55), rgba(167, 139, 250, 0.85)); }
.tube-liquid-3 { background: linear-gradient(180deg, rgba(52, 224, 161, 0.55), rgba(52, 224, 161, 0.85)); }
.tube-liquid-4 { background: linear-gradient(180deg, rgba(251, 191, 36, 0.55), rgba(251, 191, 36, 0.85)); }
.tube-liquid-5 { background: linear-gradient(180deg, rgba(251, 113, 133, 0.55), rgba(251, 113, 133, 0.85)); }
.tube-liquid .bubble { width: 4px; height: 4px; background: rgba(255, 255, 255, 0.8); }

/* ---------- Roadmap ---------- */
.roadmap { position: relative; z-index: 1; padding: 100px 0; }
.timeline { position: relative; max-width: 760px; margin: 0 auto; padding-left: 32px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--purple), var(--border));
}
.timeline-item { position: relative; padding-bottom: 44px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -32px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
}
.timeline-item.is-done .timeline-dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 12px rgba(52, 224, 161, 0.7); }
.timeline-content h3 { font-size: 18px; margin-bottom: 6px; }
.timeline-content p { margin: 0; font-size: 14.5px; }

/* ---------- CTA ---------- */
.cta { position: relative; z-index: 1; padding: 110px 0; background: var(--bg-alt); }
.cta-inner { max-width: 560px; margin: 0 auto; text-align: center; }
.cta h2 { font-size: clamp(26px, 3.4vw, 34px); }
.cta-form { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; justify-content: center; }
.cta-form input {
  flex: 1 1 260px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
}
.cta-form input:focus { border-color: var(--cyan); }
.cta-note { min-height: 20px; font-size: 14px; color: var(--green); margin-top: 14px; }
.cta-note.is-error { color: #fb7185; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 1; padding: 48px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.footer-tagline { margin: 4px 0 0; font-size: 14px; }
.footer-copy { font-size: 13px; color: var(--text-dimmer); margin: 0; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { height: 320px; order: -1; }
  .about-inner { grid-template-columns: 1fr; gap: 40px; }
  .about-visual { order: -1; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .molecule-grid { grid-template-columns: repeat(2, 1fr); }
  .atom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: rgba(6, 10, 31, 0.97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 24px;
    transform: translateY(-130%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; }
  .nav-links a { width: 100%; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav-links a:last-child { border-bottom: none; }
  .nav-cta { text-align: center; margin-top: 8px; }
  .nav-toggle { display: flex; }
  .feature-grid { grid-template-columns: 1fr; }
  .molecule-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .burner { display: none; }
  .viewer3d-stage { height: 320px; }
  .viewer3d-tab { padding: 8px 14px; font-size: 13px; }
  .atom-modal { padding: 12px; }
  .atom-modal-panel { padding: 20px 16px; }
  .ptable { min-width: 720px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* An inline formula image (a MathType equation captured as a picture, positioned mid-sentence
   by WordQuestionImporter's [[img:...]] marker) — sized to sit on the text baseline like a word,
   not as a separate block image. */
.inline-formula-image {
  height: 1.15em;
  width: auto;
  vertical-align: middle;
  display: inline-block;
  margin: 0 2px;
}
