  @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&display=swap');
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { width: 100%; height: 100%; overflow: hidden; }
  body {
    background: #04060d;
    color: #e2e8f0;
    font-family: 'Outfit', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    user-select: none;
  }

  /* ── 3D Stage ── */
  #stage { position: fixed; inset: 0; cursor: grab; z-index: 0; }
  #stage:active { cursor: grabbing; }
  #stage canvas { display: block; }
  #stage::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 52%, rgba(2,4,10,.6) 100%);
  }

  /* ── Header ── */
  header {
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
    text-align: center; z-index: 10; pointer-events: none; width: 94vw;
  }
  h1 {
    font-size: 1.3rem; font-weight: 700;
    background: linear-gradient(135deg, #ff6b4a, #fbbf24);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
  .subtitle { font-size: .72rem; color: #64748b; margin-top: 2px; }

  /* ── Info Panel (top-right) ── */
  #infoPanel {
    position: fixed; top: 14px; right: 14px; z-index: 10;
    background: rgba(10,14,27,.82); backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,.08); border-radius: 14px;
    padding: 14px 18px; min-width: 220px;
    box-shadow: 0 8px 30px rgba(0,0,0,.45);
  }
  #infoPanel h3 {
    font-size: .82rem; font-weight: 600; color: #94a3b8;
    margin-bottom: 8px; letter-spacing: .03em;
  }
  .info-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .78rem; padding: 3px 0; color: #cbd5e1;
  }
  .info-row .label { color: #64748b; }
  .info-row .value { font-weight: 600; }
  .info-row .value.positive { color: #f87171; }
  .info-row .value.negative { color: #60a5fa; }
  .info-row .value.neutral  { color: #34d399; }
  .info-row .value.excited  { color: #fbbf24; }
  #equation {
    margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06);
    font-size: .82rem; font-weight: 600; text-align: center; color: #fbbf24;
    min-height: 24px;
  }

  /* ── Step-by-step Narration ── */
  #narration {
    position: fixed; top: 55px; left: 50%; transform: translateX(-50%);
    z-index: 20; text-align: center; pointer-events: none;
    width: 90vw; max-width: 600px;
  }
  .narr-step {
    background: rgba(10,14,27,.9); backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
    padding: 12px 20px; margin-bottom: 6px;
    font-size: .9rem; font-weight: 500; color: #e2e8f0;
    line-height: 1.5;
    opacity: 0; transform: translateY(-10px);
    transition: opacity .4s ease, transform .4s ease;
  }
  .narr-step.show {
    opacity: 1; transform: translateY(0);
  }
  .narr-step .step-num {
    display: inline-block; width: 22px; height: 22px; line-height: 22px;
    border-radius: 50%; background: rgba(251,191,36,.2); color: #fbbf24;
    font-size: .72rem; font-weight: 700; text-align: center;
    margin-right: 8px; vertical-align: middle;
  }
  .narr-step.emission .step-num { background: rgba(56,189,248,.2); color: #38bdf8; }
  .narr-step.ionize .step-num { background: rgba(248,113,113,.2); color: #f87171; }
  .narr-step.gain .step-num { background: rgba(96,165,250,.2); color: #60a5fa; }
  .narr-sub { font-size: .75rem; color: #94a3b8; margin-top: 3px; }
  .narr-formula {
    font-size: .95rem; font-weight: 700; margin-top: 5px;
    font-family: 'Outfit', serif;
  }
  .narr-formula.gold { color: #fbbf24; }
  .narr-formula.blue { color: #38bdf8; }
  .narr-formula.red  { color: #f87171; }

  /* ── Photon Info Badge ── */
  #photonBadge {
    position: fixed; top: 50%; left: 14px; transform: translateY(-50%);
    z-index: 10; background: rgba(10,14,27,.82); backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.08); border-radius: 14px;
    padding: 14px 16px; width: 175px;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
    opacity: 0; transition: opacity .4s ease;
    pointer-events: none;
  }
  #photonBadge.show { opacity: 1; pointer-events: auto; }
  #photonBadge h4 {
    font-size: .75rem; color: #94a3b8; margin-bottom: 8px;
  }
  .photon-row {
    font-size: .72rem; color: #cbd5e1; padding: 2px 0;
    display: flex; justify-content: space-between;
  }
  .photon-row .plabel { color: #64748b; }
  .photon-row .pval { font-weight: 600; }
  #photonBadge .photon-color-swatch {
    width: 100%; height: 6px; border-radius: 3px; margin-top: 8px;
  }

  /* ── Energy Level Diagram (right) ── */
  #energyDiagram {
    position: fixed; right: 14px; top: 50%; transform: translateY(-50%);
    z-index: 10; background: rgba(10,14,27,.78); backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.07); border-radius: 14px;
    padding: 16px 14px; width: 155px;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
  }
  #energyDiagram h4 {
    font-size: .72rem; color: #94a3b8; text-align: center; margin-bottom: 10px;
  }
  .energy-canvas { width: 100%; height: 250px; }

  /* ── Shell Distribution Diagram (left) ── */
  #shellDiagram {
    position: fixed; left: 14px; top: 50%; transform: translateY(-50%);
    z-index: 10; background: rgba(10,14,27,.78); backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.07); border-radius: 14px;
    padding: 16px 14px; width: 170px;
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
  }
  #shellDiagram h4 {
    font-size: .72rem; color: #94a3b8; text-align: center; margin-bottom: 10px;
  }
  .shell-canvas { width: 100%; height: 280px; }

  /* ── Bottom Bar ── */
  #bottomBar {
    position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
    z-index: 10; display: flex; flex-direction: column; gap: 7px;
    align-items: center; max-width: 96vw;
  }
  .row {
    display: flex; gap: 10px; align-items: center;
    background: rgba(13,18,30,.78); backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,.07); border-radius: 14px;
    padding: 7px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.45);
    flex-wrap: wrap; justify-content: center;
  }
  .ctrl-btn {
    background: #1e293b; color: #e2e8f0; border: 1px solid #334155;
    padding: 6px 14px; border-radius: 9px; cursor: pointer;
    font-family: inherit; font-size: .76rem; transition: all .15s;
    white-space: nowrap; position: relative;
  }
  .ctrl-btn:hover { background: #334155; }
  .ctrl-btn.active { background: rgba(251,113,74,.16); border-color: rgba(251,113,74,.55); color: #ff6b4a; }

  .ctrl-btn.absorb { border-color: rgba(251,191,36,.4); }
  .ctrl-btn.absorb:hover { background: rgba(251,191,36,.15); color: #fbbf24; }
  .ctrl-btn.absorb .dir-hint { color: #fbbf24; font-size: .65rem; }

  .ctrl-btn.release { border-color: rgba(56,189,248,.4); }
  .ctrl-btn.release:hover { background: rgba(56,189,248,.15); color: #38bdf8; }
  .ctrl-btn.release .dir-hint { color: #38bdf8; font-size: .65rem; }

  .ctrl-btn.ionize-pos { border-color: rgba(248,113,113,.4); }
  .ctrl-btn.ionize-pos:hover { background: rgba(248,113,113,.15); color: #f87171; }
  .ctrl-btn.ionize-neg { border-color: rgba(96,165,250,.4); }
  .ctrl-btn.ionize-neg:hover { background: rgba(96,165,250,.15); color: #60a5fa; }
  .ctrl-btn.reset-btn { border-color: rgba(52,211,153,.4); }
  .ctrl-btn.reset-btn:hover { background: rgba(52,211,153,.15); color: #34d399; }
  .ctrl-btn:disabled { opacity: .35; cursor: not-allowed; }

  .separator { width: 1px; height: 26px; background: rgba(255,255,255,.08); }

  .elem-btn {
    background: rgba(255,255,255,.05); color: #94a3b8; border: 1px solid rgba(255,255,255,.08);
    padding: 4px 10px; border-radius: 7px; cursor: pointer;
    font-family: inherit; font-size: .72rem; transition: all .15s;
  }
  .elem-btn:hover { background: rgba(255,255,255,.1); color: #e2e8f0; }
  .elem-btn.active {
    background: rgba(251,113,74,.15); border-color: rgba(251,113,74,.5); color: #ff6b4a;
    box-shadow: 0 0 10px rgba(251,113,74,.15);
  }

  /* ── Comparison Panel ── */
  #compPanel {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
    background: rgba(8,12,24,.92); backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,.08);
    transform: translateY(100%); transition: transform .4s ease;
    max-height: 50vh; overflow-y: auto;
  }
  #compPanel.show { transform: translateY(0); }
  #compPanel .panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px 8px; position: sticky; top: 0;
    background: rgba(8,12,24,.95);
  }
  #compPanel .panel-header h3 { font-size: .9rem; font-weight: 600; }
  #compPanel .close-btn {
    background: none; border: none; color: #64748b; font-size: 1.1rem; cursor: pointer;
  }
  #compPanel .close-btn:hover { color: #e2e8f0; }
  .comp-table {
    width: 100%; border-collapse: collapse; font-size: .78rem;
    padding: 0 20px 16px;
  }
  .comp-table th {
    text-align: left; padding: 8px 12px; color: #64748b; font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,.06); font-size: .72rem;
  }
  .comp-table td {
    padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04);
    color: #cbd5e1; line-height: 1.4;
  }
  .comp-table tr:last-child td { border-bottom: none; }
  .comp-table .highlight { background: rgba(251,191,36,.04); }

  /* ── Photon Explainer Panel ── */
  #photonExplainer {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
    background: rgba(8,12,24,.94); backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,.08);
    transform: translateY(100%); transition: transform .4s ease;
    max-height: 55vh; overflow-y: auto;
  }
  #photonExplainer.show { transform: translateY(0); }
  #photonExplainer .panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px 8px; position: sticky; top: 0;
    background: rgba(8,12,24,.95);
  }
  #photonExplainer .panel-header h3 { font-size: .9rem; font-weight: 600; }
  #photonExplainer .close-btn {
    background: none; border: none; color: #64748b; font-size: 1.1rem; cursor: pointer;
  }
  .explainer-content {
    padding: 10px 24px 24px; max-width: 700px; margin: 0 auto;
    font-size: .85rem; line-height: 1.7; color: #cbd5e1;
  }
  .explainer-content h4 {
    font-size: .95rem; font-weight: 700; color: #fbbf24;
    margin: 16px 0 8px; display: flex; align-items: center; gap: 8px;
  }
  .explainer-content .formula-box {
    background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.15);
    border-radius: 10px; padding: 12px 18px; margin: 10px 0;
    text-align: center;
  }
  .explainer-content .formula-box .big {
    font-size: 1.2rem; font-weight: 800; color: #fbbf24;
  }
  .explainer-content .formula-box .desc {
    font-size: .72rem; color: #94a3b8; margin-top: 4px;
  }
  .explainer-content .vs-box {
    display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px;
    margin: 14px 0; align-items: stretch;
  }
  .vs-card {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px; padding: 14px;
  }
  .vs-card h5 { font-size: .82rem; font-weight: 700; margin-bottom: 6px; }
  .vs-card.absorb-card { border-color: rgba(251,191,36,.2); }
  .vs-card.absorb-card h5 { color: #fbbf24; }
  .vs-card.emit-card { border-color: rgba(56,189,248,.2); }
  .vs-card.emit-card h5 { color: #38bdf8; }
  .vs-divider {
    display: flex; align-items: center; font-size: 1.5rem; color: #334155;
    font-weight: 300;
  }
  .step-flow {
    display: flex; flex-direction: column; gap: 4px;
    font-size: .75rem; color: #94a3b8;
  }
  .step-flow .arrow { color: #475569; text-align: center; font-size: .65rem; }

  /* ── Responsive ── */
  @media (max-width: 860px) {
    #energyDiagram { display: none; }
    #shellDiagram { display: none; }
    #photonBadge { display: none; }
    #infoPanel { right: 8px; top: 48px; padding: 10px 14px; min-width: 180px; font-size: .72rem; }
    .ctrl-btn { padding: 5px 10px; font-size: .7rem; }
    .elem-btn { padding: 3px 7px; font-size: .66rem; }
    .narr-step { font-size: .78rem; padding: 9px 14px; }
  }

/* ── Back-to-home button (shared across all pages) ── */
#homeBtn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 18px 0 14px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 19px;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
#homeBtn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
}
#homeBtn:active { transform: translateY(0); }

/* ── language switcher pill ── */
.lang-switch {
  position: fixed;
  top: 14px;
  left: 124px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 19px;
  padding: 3px;
  height: 38px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.lang-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0 10px;
  height: 30px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-btn:hover {
  color: #f1f5f9;
}

.lang-btn.active {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
}

.i18n-loading [data-i18n] {
  visibility: hidden;
}
