:root {
  --green: #22c670;
  --green-dark: #119655;
  --night: #061914;
  --night-soft: #0b2821;
  --ink: #122033;
  --cream: #f4fbf7;
  --mint: #e3f7ec;
  --line: #d4e9dd;
  --muted: #587065;
  --cyan: #48d8d3;
  --cyan-dark: #1a8591;
  --violet: #9b8cff;
  --violet-dark: #6553c7;
  --gold: #f5c542;
  --gold-dark: #b77b00;
  --coral: #dc4c55;
  --coral-soft: #fff0f1;
  --paper: #fdfffe;
  --shadow: 0 22px 60px rgba(5, 50, 27, .12);
  --shadow-soft: 0 10px 28px rgba(5, 50, 27, .09);
  --radius: 19px;
  --course-accent: #22c670;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background:
    radial-gradient(900px 430px at 15% -5%, rgba(34, 198, 112, .13), transparent 64%),
    radial-gradient(720px 360px at 92% 4%, rgba(72, 216, 211, .10), transparent 68%),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, select, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  padding: 0;
  white-space: nowrap;
  border-radius: 9px;
  color: #fff;
  background: var(--night);
  font-weight: 800;
}
.skip-link:focus { width: auto; height: auto; overflow: visible; clip-path: none; padding: 10px 14px; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar {
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 14px clamp(15px, 3vw, 34px) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(5, 50, 27, .07);
}
.brand img { display: block; width: auto; height: 29px; object-fit: contain; }

.topbar-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, .78);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.topbar-label > span { color: var(--green); font-size: 15px; }

.shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 4px clamp(13px, 2.4vw, 30px) 42px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 9px 2px 18px;
}
.hero-copy { max-width: 750px; }
.kicker, .panel-kicker {
  margin: 0 0 5px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-size: clamp(34px, 4.5vw, 56px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.035em;
}
.hero-copy > p:last-child {
  max-width: 66ch;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 18px);
}

.hero-event {
  min-width: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid rgba(34, 198, 112, .24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(34, 198, 112, .13), transparent 52%),
    var(--night);
  box-shadow: 0 16px 34px rgba(6, 25, 20, .15);
}
.hero-particle {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, .08), 0 0 18px currentColor;
}
.hero-particle.hadron { color: var(--green); background: rgba(34, 198, 112, .12); }
.hero-particle.lepton { color: var(--cyan); background: rgba(72, 216, 211, .12); }
.hero-particle.mystery { color: var(--gold); border-style: dashed; background: rgba(245, 197, 66, .08); }
.hero-arrow { color: #fff; font-size: 24px; font-weight: 800; }
.hero-plus { color: #74958b; font-size: 17px; font-weight: 800; }

.course-panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(480px, 1fr) minmax(300px, .85fr);
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 760px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .8);
  box-shadow: var(--shadow-soft);
}
.app-tabs button {
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}
.app-tabs button > span { grid-row: 1 / 3; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--mint); color: var(--green-dark); font-size: 22px; }
.app-tabs button strong, .app-tabs button small { display: block; }
.app-tabs button strong { align-self: end; color: var(--ink); font-size: 13px; }
.app-tabs button small { align-self: start; font-size: 10px; font-weight: 700; }
.app-tabs button[aria-selected="true"] { border-color: var(--green); background: #fff; box-shadow: 0 6px 14px rgba(5, 50, 27, .1); }
.app-tabs button[aria-selected="true"] > span { color: var(--night); background: var(--green); }
.course-copy h2 { margin: 0; font-size: 17px; line-height: 1.15; }

.course-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--mint);
}
.course-switch button {
  min-height: 52px;
  padding: 7px 8px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: transform .16s ease, color .16s ease, background .16s ease, box-shadow .16s ease;
}
.course-switch button:hover { color: var(--ink); transform: translateY(-1px); }
.course-switch button[aria-pressed="true"] {
  color: var(--ink);
  background: #fff;
  border-color: var(--course-accent);
  box-shadow: 0 5px 13px rgba(5, 50, 27, .10);
}
.course-switch strong, .course-switch span { display: block; }
.course-switch strong { font-size: 12px; font-weight: 900; }
.course-switch span { font-size: 10px; font-weight: 750; white-space: nowrap; }

.course-boundary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding-left: 15px;
  border-left: 1px solid var(--line);
}
.boundary-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  flex: 0 0 auto;
  border: 3px solid color-mix(in srgb, var(--course-accent), white 70%);
  border-radius: 50%;
  background: var(--course-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--course-accent), transparent 80%);
}
.course-boundary p { min-width: 0; margin: 0; }
.course-boundary strong, .course-boundary span { display: block; }
.course-boundary strong { overflow: hidden; font-size: 11px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.course-boundary span { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.mission-nav {
  display: flex;
  gap: 8px;
  padding: 14px 1px 13px;
  overflow-x: auto;
  scrollbar-color: var(--green) transparent;
  scrollbar-width: thin;
}
.mission-nav button {
  min-width: 150px;
  min-height: 54px;
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, .78);
  text-align: left;
  box-shadow: 0 5px 13px rgba(5, 50, 27, .05);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.mission-nav button:hover { transform: translateY(-2px); border-color: var(--course-accent); }
.mission-nav button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--course-accent);
  background: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--course-accent), transparent 82%);
}
.mission-nav .nav-number {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--mint);
  font-size: 10px;
  font-weight: 900;
}
.mission-nav button[aria-pressed="true"] .nav-number { color: var(--night); background: var(--course-accent); }
.mission-nav strong, .mission-nav small { display: block; }
.mission-nav strong { overflow: hidden; font-size: 11px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.mission-nav small { margin-top: 1px; font-size: 9px; font-weight: 750; text-transform: uppercase; }

.lab-grid {
  display: grid;
  grid-template-columns: 292px minmax(520px, 1fr) 340px;
  grid-template-areas:
    "controls stage evidence"
    "controls candidates candidates"
    "controls analysis analysis";
  gap: 15px;
  align-items: start;
}

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}
.control-panel { grid-area: controls; position: sticky; top: 12px; padding: 17px; }
.stage-panel { grid-area: stage; padding: 14px; }
.evidence-panel { grid-area: evidence; padding: 16px; }
.candidate-panel { grid-area: candidates; padding: 16px; }
.analysis-panel { grid-area: analysis; padding: 16px; }

.nucleus-app { display: block; }
.nucleus-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding: 19px 22px;
  background: linear-gradient(125deg, #fff, #eefbf4);
}
.nucleus-hero h2 { margin: 0; color: var(--green-dark); font-size: 25px; }
.nucleus-hero p:last-child { max-width: 72ch; margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.nucleus-course-label { min-width: 220px; }
.nucleus-course-label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.nucleus-course-label select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font: inherit; font-size: 11px; font-weight: 750; }

.nucleus-grid {
  display: grid;
  grid-template-columns: 282px minmax(520px, 1fr) 320px;
  grid-template-areas:
    "nucleons nucleus-stage nucleus-readout"
    "nuclide-chart nuclide-chart nuclide-chart";
  gap: 15px;
  align-items: start;
}
.nucleon-controls { grid-area: nucleons; padding: 16px; }
.nucleus-stage { grid-area: nucleus-stage; min-width: 0; padding: 14px; }
.nucleus-readout { grid-area: nucleus-readout; padding: 16px; }
.nuclide-chart-card { grid-area: nuclide-chart; padding: 18px; }
.nucleon-controls .panel-heading, .nucleus-readout .panel-heading { margin-bottom: 13px; }
.nucleon-store {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f9fdfb;
}
.nucleon-store strong, .nucleon-store span { display: block; }
.nucleon-store strong { font-size: 11px; }
.nucleon-store span { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.nucleon-token { width: 44px; height: 44px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; color: var(--night); font-size: 16px; font-weight: 900; box-shadow: 0 5px 12px rgba(6,25,20,.13); }
.proton-token { background: #ff8f70; }
.neutron-token { background: #5fc9df; }
.nucleon-actions { display: grid; grid-template-columns: repeat(2, 34px); gap: 4px; }
.nucleon-actions button { width: 34px; height: 34px; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; color: var(--green-dark); background: #fff; font-size: 18px; font-weight: 900; }
.nucleon-actions button:disabled { cursor: not-allowed; opacity: .38; }
.nucleus-presets { margin: 16px 0; padding-top: 13px; border-top: 1px solid var(--line); }
.nucleus-presets h3 { margin: 0 0 8px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.nucleus-presets > div { display: flex; flex-wrap: wrap; gap: 5px; }
.nucleus-presets button { min-width: 42px; min-height: 36px; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; color: var(--green-dark); background: var(--mint); font-family: Cambria, serif; font-size: 15px; font-weight: 850; }

.nucleus-canvas-shell { position: relative; min-height: 460px; overflow: hidden; border-radius: 13px; background: var(--night); }
#nucleus-canvas { display: block; width: 100%; height: 460px; }
.nucleus-key { position: absolute; right: 12px; bottom: 11px; display: flex; gap: 9px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 999px; color: #cce4da; background: rgba(6,25,20,.82); font-size: 9px; font-weight: 750; }
.nucleus-key span { display: inline-flex; align-items: center; gap: 5px; }
.nucleus-key i { width: 9px; height: 9px; border-radius: 50%; }
.key-proton { background: #ff8f70; }
.key-neutron { background: #5fc9df; }
.nucleus-status { align-self: center; padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 850; text-transform: uppercase; white-space: nowrap; }
.nucleus-status.is-stable { color: #087744; background: #dcf7e8; }
.nucleus-status.is-neutron-rich, .nucleus-status.is-proton-rich { color: #9b5d00; background: #fff1c9; }
.nucleus-status.is-empty, .nucleus-status.is-outside-model { color: var(--muted); background: #edf4f0; }

.nuclide-identity { display: grid; place-items: center; min-height: 150px; margin-bottom: 11px; border: 1px solid rgba(34,198,112,.24); border-radius: 15px; background: radial-gradient(circle at 50% 40%, rgba(34,198,112,.15), transparent 58%), var(--night); }
.nuclide-identity strong { color: #fff; font-family: Cambria, serif; font-size: 52px; line-height: 1; }
.nuclide-identity span { margin-top: -25px; color: #a9ccbd; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.nucleus-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; }
.nucleus-counts div { padding: 9px; border-radius: 9px; background: var(--mint); }
.nucleus-counts dt { color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.nucleus-counts dd { margin: 3px 0 0; color: var(--green-dark); font-size: 16px; font-weight: 900; }
.stability-copy { min-height: 44px; margin: 12px 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.decay-button { width: 100%; }
.decay-result { min-height: 94px; margin-top: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #f9fdfb; }
.decay-result strong { display: block; color: var(--green-dark); font-family: Cambria, serif; font-size: 15px; }
.decay-result p { margin: 6px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }

.nuclide-chart-card > p { margin: -4px 0 12px; color: var(--muted); font-size: 10px; }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 750; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; background: #73d9a2; }
.nuclide-chart-scroll { overflow-x: auto; padding-bottom: 5px; }
.nuclide-chart { display: grid; grid-template-columns: 42px repeat(13, minmax(38px, 1fr)); gap: 4px; min-width: 670px; }
.nuclide-axis-corner, .nuclide-axis { display: grid; min-height: 33px; place-items: center; color: var(--muted); font-size: 9px; font-weight: 850; }
.nuclide-cell { min-height: 34px; cursor: pointer; border: 1px solid #d5e8dc; border-radius: 7px; color: #668074; background: #f4f8f5; font-size: 9px; font-weight: 850; }
.nuclide-cell.is-stable { color: #075f3a; border-color: #66ce95; background: #dff8e9; }
.nuclide-cell.is-neutron-rich { background: #e8f5fb; }
.nuclide-cell.is-proton-rich { background: #fff2e5; }
.nuclide-cell.is-current { outline: 3px solid var(--green-dark); outline-offset: 1px; transform: scale(1.06); }

.mission-marker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.mission-marker > span:first-child {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--night);
  background: var(--course-accent);
  font-size: 12px;
  font-weight: 900;
}
.mission-marker > span:last-child {
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.control-panel > h2 { margin: 0; font-size: 23px; line-height: 1.12; letter-spacing: -.02em; }
.mission-prompt { margin: 9px 0 15px; color: var(--muted); font-size: 13px; }

.transport { display: flex; align-items: stretch; gap: 7px; flex-wrap: wrap; }
.primary-button, .secondary-button, .icon-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 850;
  transition: transform .15s ease, color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.primary-button { color: var(--night); background: var(--green); box-shadow: 0 7px 17px rgba(34, 198, 112, .24); }
.primary-button:hover { color: #fff; background: var(--green-dark); transform: translateY(-1px); }
.secondary-button, .icon-button { color: var(--ink); border-color: var(--line); background: #fff; }
.secondary-button:hover, .icon-button:hover { border-color: var(--green); transform: translateY(-1px); }
.icon-button { width: 44px; padding: 0; font-size: 20px; }
button:disabled { cursor: not-allowed; opacity: .46; box-shadow: none; transform: none !important; }

.view-section, .mission-guide { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-heading-row h3, .mission-guide h3 { margin: 0; font-size: 12px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.section-heading-row span { color: var(--muted); font-size: 10px; font-weight: 800; }
.view-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.view-switch button {
  min-height: 46px;
  padding: 7px 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--paper);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.view-switch button[aria-pressed="true"] { color: var(--green-dark); border-color: var(--green); background: var(--mint); }
.view-switch button span { display: block; margin-bottom: 1px; font-size: 16px; }

.mission-guide ol { margin: 9px 0 0; padding: 0; list-style: none; counter-reset: guide; }
.mission-guide li {
  counter-increment: guide;
  position: relative;
  min-height: 28px;
  padding: 4px 0 5px 30px;
  color: var(--muted);
  font-size: 11px;
}
.mission-guide li::before {
  content: counter(guide);
  position: absolute;
  top: 2px;
  left: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--green-dark);
  background: var(--mint);
  font-size: 9px;
  font-weight: 900;
}

.spec-detail, .model-note {
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}
.spec-detail summary, .model-note summary {
  min-height: 43px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  cursor: pointer;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.spec-detail p, .model-note p { margin: 0; padding: 0 11px 11px; color: var(--muted); font-size: 11px; }

.stage-heading, .panel-heading, .candidate-heading, .analysis-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.stage-heading h2, .panel-heading h2, .candidate-heading h2, .analysis-heading h2 { margin: 0; font-size: 17px; }
.stage-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d9eee5;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.stage-status > span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
.stage-heading { margin: -14px -14px 0; padding: 13px 15px; border-radius: 18px 18px 0 0; color: #fff; background: var(--night); }
.stage-heading .panel-kicker { color: #84cbaa; }

.canvas-shell {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  border-radius: 0 0 14px 14px;
  background: var(--night);
}
#event-canvas { display: block; width: 100%; height: clamp(500px, 51vh, 620px); }

.equation-plate {
  position: absolute;
  top: 13px;
  left: 50%;
  max-width: calc(100% - 28px);
  transform: translateX(-50%);
  padding: 7px 15px 8px;
  border: 1px solid rgba(141, 225, 181, .22);
  border-radius: 11px;
  color: #fff;
  background: rgba(3, 17, 13, .76);
  box-shadow: 0 9px 28px rgba(0, 0, 0, .18);
  backdrop-filter: blur(8px);
  text-align: center;
}
.equation-plate span, .equation-plate strong { display: block; }
.equation-plate span { color: #7eac9a; font-size: 8px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.equation-plate strong { overflow: hidden; font-family: Cambria, "Times New Roman", serif; font-size: clamp(17px, 2vw, 24px); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.canvas-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 11px;
  max-width: calc(100% - 24px);
  padding: 7px 10px;
  border: 1px solid rgba(141, 225, 181, .17);
  border-radius: 10px;
  color: #acc9bd;
  background: rgba(3, 17, 13, .76);
  font-size: 8px;
  font-weight: 750;
  text-transform: uppercase;
  backdrop-filter: blur(7px);
}
.canvas-legend span { display: inline-flex; align-items: center; gap: 5px; }
.canvas-legend i { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.legend-hadron { color: var(--green); }
.legend-lepton { color: var(--cyan); }
.legend-antimatter { color: var(--violet); }
.legend-photon { color: var(--gold); }
.canvas-description { margin: 9px 2px 0; color: var(--muted); font-size: 11px; }

.ledger-state, .interaction-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ledger-state.is-open { color: #8a6814; background: #fff7d9; }
.ledger-state.is-pass { color: #087744; background: #dbf7e8; }
.ledger-state.is-fail { color: #a62e37; background: #ffe3e6; }

.ledger-table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ledger-table th {
  padding: 7px 4px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .07em;
  text-align: center;
  text-transform: uppercase;
}
.ledger-table th:first-child { width: 43%; text-align: left; }
.ledger-table td { padding: 9px 4px; border-bottom: 1px solid #ebf5ef; font-size: 12px; font-weight: 800; text-align: center; }
.ledger-table td:first-child { text-align: left; }
.ledger-label strong, .ledger-label span { display: block; }
.ledger-label strong { font-size: 10px; }
.ledger-label span { color: var(--muted); font-size: 8px; font-weight: 700; }
.ledger-result {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}
.ledger-result.unknown { color: #8b701e; background: #fff3c4; }
.ledger-result.pass { color: #087744; background: #d8f8e7; }
.ledger-result.allowed { color: #5b4eb3; background: #eeeaff; }
.ledger-result.fail { color: #a62e37; background: #ffe2e5; }

.energy-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #eed47c;
  border-radius: 11px;
  color: #725200;
  background: #fff9df;
}
.energy-card span { font-size: 9px; font-weight: 850; text-transform: uppercase; }
.energy-card strong { font-family: Cambria, "Times New Roman", serif; font-size: 16px; }

.check-feedback {
  display: grid;
  grid-template-columns: 35px 1fr;
  gap: 9px;
  align-items: center;
  min-height: 79px;
  margin-top: 13px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.feedback-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #80691b;
  background: #fff2bc;
  font-size: 16px;
  font-weight: 900;
}
.check-feedback strong { display: block; font-size: 11px; }
.check-feedback p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.check-feedback.is-correct { border-color: #7fd7a8; background: #eafaf1; }
.check-feedback.is-correct .feedback-icon { color: #fff; background: var(--green-dark); }
.check-feedback.is-wrong { border-color: #ef9ba2; background: var(--coral-soft); }
.check-feedback.is-wrong .feedback-icon { color: #fff; background: var(--coral); }

.candidate-heading { align-items: flex-end; }
.candidate-actions { display: flex; gap: 7px; }
.check-button { min-width: 116px; }
.particle-tray { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.particle-option {
  min-height: 88px;
  display: grid;
  grid-template-columns: 48px 1fr 23px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.particle-option:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--role-colour), white 30%); box-shadow: 0 10px 20px rgba(5, 50, 27, .09); }
.particle-option[aria-pressed="true"] { border-color: var(--role-colour); background: color-mix(in srgb, var(--role-colour), white 91%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--role-colour), transparent 83%); }
.particle-glyph {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid var(--role-colour);
  border-radius: 50%;
  color: var(--role-colour);
  background: color-mix(in srgb, var(--role-colour), var(--night) 87%);
  box-shadow: inset 0 0 13px color-mix(in srgb, var(--role-colour), transparent 76%);
  font-family: Cambria, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 800;
}
.particle-option[data-role="nuclide"] .particle-glyph, .particle-option[data-role="nucleus"] .particle-glyph { border-radius: 13px; }
.particle-option[data-role="antimatter"] .particle-glyph { border-style: double; border-width: 4px; }
.particle-option[data-role="photon"] .particle-glyph { border-radius: 45% 55% 45% 55%; }
.particle-copy strong, .particle-copy span { display: block; }
.particle-copy strong { font-size: 11px; line-height: 1.2; }
.particle-copy span { margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.particle-radio {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}
.particle-option[aria-pressed="true"] .particle-radio { border-color: var(--role-colour); background: var(--role-colour); }

.interaction-badge { color: #fff; background: var(--night-soft); }
.analysis-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.insight-card {
  min-height: 116px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}
.insight-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 900;
}
.observation-card .insight-icon { color: #116a74; background: #dff8f6; }
.explanation-card .insight-icon { color: #087744; background: #dcf7e8; }
.misconception-card .insight-icon { color: #a62e37; background: #ffe2e5; }
.insight-card h3 { margin: 0; font-size: 10px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.insight-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.model-note { margin-top: 10px; }

.footer {
  width: 100%;
  max-width: 1640px;
  margin: auto auto 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px clamp(15px, 3vw, 34px) 20px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--green-dark);
  outline-offset: 3px;
}

@media (max-width: 1380px) {
  .course-panel { grid-template-columns: auto minmax(440px, 1fr); }
  .course-boundary { grid-column: 1 / -1; padding: 9px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .course-boundary span { max-width: 110ch; }
  .lab-grid {
    grid-template-columns: 280px minmax(520px, 1fr);
    grid-template-areas:
      "controls stage"
      "controls evidence"
      "controls candidates"
      "controls analysis";
  }
  .evidence-panel { display: grid; grid-template-columns: 1.2fr .9fr; gap: 0 15px; align-items: start; }
  .evidence-panel .panel-heading { grid-column: 1 / -1; }
  .check-feedback { margin-top: 0; }
  .energy-card { grid-column: 2; }
  .nucleus-grid {
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-areas:
      "nucleons nucleus-stage"
      "nucleons nucleus-readout"
      "nuclide-chart nuclide-chart";
  }
  .nucleus-readout { display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px; }
  .nucleus-readout .panel-heading { grid-column: 1 / -1; }
  .nuclide-identity { grid-row: 2 / span 3; margin: 0; }
}

@media (max-width: 980px) {
  .hero { align-items: flex-start; }
  .hero-event { min-width: 330px; transform: scale(.9); transform-origin: right top; }
  .course-panel { grid-template-columns: 1fr; }
  .course-switch { grid-column: 1; }
  .course-boundary { grid-column: 1; }
  .lab-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "controls"
      "stage"
      "candidates"
      "evidence"
      "analysis";
  }
  .control-panel { position: static; display: grid; grid-template-columns: 1.25fr 1fr; gap: 0 20px; }
  .mission-marker, .control-panel > h2, .mission-prompt, .transport { grid-column: 1; }
  .view-section { grid-column: 2; grid-row: 1 / span 4; margin-top: 0; padding: 0 0 0 18px; border-top: 0; border-left: 1px solid var(--line); }
  .mission-guide, .spec-detail { display: none; }
  .particle-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nucleus-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "nucleons" "nucleus-stage" "nucleus-readout" "nuclide-chart";
  }
  .nucleon-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .nucleon-controls > .panel-heading, .nucleon-controls > .nucleus-presets, .nucleon-controls > .spec-detail { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar-label { display: none; }
  .hero { display: block; }
  .hero-event { width: 100%; min-width: 0; margin-top: 15px; transform: none; }
  .course-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-switch button { text-align: center; }
  .control-panel { display: block; }
  .view-section { margin-top: 16px; padding: 15px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .canvas-shell { min-height: 440px; }
  #event-canvas { height: 440px; }
  .evidence-panel { display: block; }
  .check-feedback { margin-top: 12px; }
  .candidate-heading { align-items: flex-start; }
  .candidate-actions { flex-direction: column-reverse; }
  .candidate-actions button { width: 122px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .insight-card { min-height: 0; }
  .footer { display: block; }
  .footer span { display: block; margin-top: 3px; }
  .app-tabs { max-width: none; }
  .app-tabs button { grid-template-columns: 32px 1fr; padding: 7px 8px; }
  .app-tabs button > span { width: 32px; height: 32px; font-size: 18px; }
  .nucleus-hero { display: grid; padding: 16px; }
  .nucleus-course-label { min-width: 0; }
  .nucleus-canvas-shell { min-height: 410px; }
  #nucleus-canvas { height: 410px; }
  .nucleus-readout { display: block; }
  .nuclide-identity { margin-bottom: 11px; }
}

@media (max-width: 460px) {
  .shell { padding-left: 10px; padding-right: 10px; }
  .hero h1 { font-size: 36px; }
  .hero-event { gap: 6px; padding: 13px 10px; }
  .hero-particle { width: 40px; height: 40px; font-size: 18px; }
  .course-panel { padding: 12px; }
  .mission-nav button { min-width: 136px; }
  .stage-panel { padding: 10px; }
  .stage-heading { margin: -10px -10px 0; }
  .canvas-shell { min-height: 390px; }
  #event-canvas { height: 390px; }
  .canvas-legend { left: 9px; right: 9px; justify-content: flex-start; }
  .equation-plate { top: 9px; }
  .candidate-heading { display: block; }
  .candidate-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px; }
  .candidate-actions button { width: auto; }
  .particle-tray { grid-template-columns: 1fr; }
  .particle-option { min-height: 76px; }
  .particle-glyph { width: 43px; height: 43px; }
  .analysis-heading { align-items: flex-start; }
  .interaction-badge { max-width: 130px; text-align: center; }
  .app-tabs button small { display: none; }
  .app-tabs button { min-height: 50px; grid-template-rows: 1fr; }
  .app-tabs button > span { grid-row: 1; }
  .nucleon-controls { display: block; }
  .nucleon-store { grid-template-columns: 42px 1fr; }
  .nucleon-actions { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); }
  .nucleon-actions button { width: 100%; }
  .nucleus-stage { padding: 10px; }
  .nucleus-canvas-shell { min-height: 370px; }
  #nucleus-canvas { height: 370px; }
}

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

/* Full Atom Builder ------------------------------------------------------- */
.hero-atom {
  position: relative;
  width: 390px;
  min-width: 390px;
  height: 111px;
  overflow: hidden;
  border: 1px solid rgba(34, 198, 112, .24);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 50%, rgba(34, 198, 112, .17), transparent 48%), var(--night);
  box-shadow: 0 16px 34px rgba(6, 25, 20, .15);
}
.hero-orbit { position: absolute; top: 50%; left: 50%; border: 1px solid rgba(72, 216, 211, .35); border-radius: 50%; transform: translate(-50%, -50%) rotate(-14deg); }
.hero-orbit.orbit-one { width: 150px; height: 64px; animation: hero-orbit-spin 9s linear infinite; }
.hero-orbit.orbit-two { width: 248px; height: 89px; transform: translate(-50%, -50%) rotate(17deg); animation: hero-orbit-spin-reverse 13s linear infinite; }
.hero-orbit i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 13px var(--violet); }
.hero-orbit i:nth-child(1) { top: -4px; left: 49%; }
.hero-orbit i:nth-child(2) { right: 8%; bottom: 5px; }
.hero-orbit i:nth-child(3) { bottom: -4px; left: 24%; }
.hero-nucleus { position: absolute; top: 50%; left: 50%; width: 58px; height: 58px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 5px; border-radius: 50%; transform: translate(-50%, -50%); background: rgba(5, 28, 21, .88); box-shadow: 0 0 34px rgba(34, 198, 112, .48); }
.hero-nucleus b { display: grid; place-items: center; border-radius: 50%; color: var(--night); font-size: 9px; }
.hero-nucleus b:nth-child(odd) { background: #ff8f70; }
.hero-nucleus b:nth-child(even) { background: #5fc9df; }
@keyframes hero-orbit-spin { to { transform: translate(-50%, -50%) rotate(346deg); } }
@keyframes hero-orbit-spin-reverse { to { transform: translate(-50%, -50%) rotate(-343deg); } }

.atom-builder-hero { position: relative; overflow: hidden; background: linear-gradient(125deg, #fff 0%, #eefbf4 70%, #e5f8f6 100%); }
.atom-builder-hero::after { content: ""; position: absolute; right: 260px; width: 160px; height: 160px; border: 1px solid rgba(34, 198, 112, .17); border-radius: 50%; box-shadow: 0 0 0 25px rgba(72, 216, 211, .05), 0 0 0 52px rgba(34, 198, 112, .035); pointer-events: none; }
.atom-builder-hero > * { position: relative; z-index: 1; }
.atom-builder-hero p { max-width: 74ch; margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.course-lens-copy { display: inline-flex; margin-top: 9px; padding: 5px 9px; border-radius: 999px; color: var(--green-dark); background: rgba(34, 198, 112, .11); font-size: 9px; font-weight: 850; letter-spacing: .035em; }

.builder-preset-nav { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; padding: 12px 14px; overflow: hidden; }
.builder-preset-nav > div:first-child { min-width: 140px; }
.builder-preset-nav h2 { margin: 0; font-size: 15px; }
.preset-track { display: flex; flex: 1; gap: 7px; min-width: 0; overflow-x: auto; padding: 2px 1px 5px; scrollbar-color: var(--green) transparent; scrollbar-width: thin; }
.preset-track button { min-width: 112px; min-height: 54px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 6px 10px; cursor: pointer; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--paper); text-align: left; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.preset-track button:hover { transform: translateY(-2px); border-color: var(--green); background: var(--mint); }
.preset-track strong { color: var(--green-dark); font-family: Cambria, "Times New Roman", serif; font-size: 18px; line-height: 1; white-space: nowrap; }
.preset-track span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }

.nucleus-grid.atom-builder-grid {
  grid-template-columns: 292px minmax(520px, 1fr) 350px;
  grid-template-areas:
    "nucleons nucleus-stage nucleus-readout"
    "nucleons decay-learning decay-learning"
    "nuclide-chart nuclide-chart nuclide-chart"
    "decay-history decay-history decay-history";
}
.atom-builder-grid .nucleon-controls { position: static; }
.decay-history-panel { grid-area: decay-history; padding: 17px; }
.drag-label { display: inline-flex; padding: 5px 8px; border-radius: 999px; color: var(--green-dark); background: var(--mint); font-size: 8px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.builder-intro { margin: -3px 0 13px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.atom-source-stack { display: grid; gap: 8px; }
.nucleon-store.atom-source { width: 100%; grid-template-columns: 47px minmax(0, 1fr) 24px; margin: 0; padding: 10px; cursor: grab; color: var(--ink); text-align: left; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.nucleon-store.atom-source:hover { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 9px 20px rgba(5, 50, 27, .09); }
.nucleon-store.atom-source.is-dragging { opacity: .58; transform: scale(.98); }
.atom-source > span { margin: 0; }
.atom-source > span:nth-child(2) strong, .atom-source > span:nth-child(2) small { display: block; }
.atom-source > span:nth-child(2) strong { color: var(--ink); font-size: 11px; }
.atom-source > span:nth-child(2) small { margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 750; }
.atom-source .source-add { display: grid; width: 23px; height: 23px; place-items: center; margin: 0; border-radius: 7px; color: var(--green-dark); background: var(--mint); font-size: 17px; font-weight: 900; }
.atom-source .nucleon-token { position: relative; display: grid; margin: 0; color: var(--night); font-size: 15px; }
.atom-source .nucleon-token small { position: absolute; right: -4px; bottom: -4px; min-width: 18px; padding: 1px 3px; border: 1px solid rgba(255, 255, 255, .75); border-radius: 999px; color: var(--night); background: #fff; font-size: 7px; line-height: 1.4; text-align: center; }
.electron-token { color: #fff !important; background: var(--violet); }

.particle-inventory { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.particle-inventory h3 { margin: 0 0 7px; font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.inventory-row { min-height: 37px; display: grid; grid-template-columns: 1fr 34px 31px; align-items: center; gap: 7px; border-bottom: 1px solid #edf5f0; }
.inventory-row > span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 780; }
.inventory-row > strong { text-align: right; font-size: 14px; }
.inventory-row button { width: 29px; height: 29px; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; color: var(--green-dark); background: #fff; font-size: 17px; font-weight: 900; }
.inventory-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.proton-dot, .key-proton { background: #ff8f70; }
.neutron-dot, .key-neutron { background: #5fc9df; }
.electron-dot, .key-electron { background: var(--violet); }
.photon-dot, .key-photon { background: var(--gold); }
.builder-parts-actions { display: flex; gap: 7px; margin-top: 13px; }
.builder-parts-actions .secondary-button { flex: 1; }

.atom-stage-heading { margin-bottom: 0; }
.nucleus-stage.is-dragover { border-color: var(--green); box-shadow: 0 0 0 4px rgba(34, 198, 112, .19), var(--shadow); }
.atom-canvas-shell { min-height: 430px; border-radius: 0; }
#nucleus-canvas { height: 430px; }
.atom-drop-hint { position: absolute; top: 58%; left: 50%; display: inline-flex; align-items: center; gap: 7px; transform: translate(-50%, -50%); padding: 8px 11px; border: 1px dashed rgba(140, 226, 183, .36); border-radius: 10px; color: #afd1c2; background: rgba(4, 23, 17, .72); font-size: 9px; font-weight: 800; text-transform: uppercase; pointer-events: none; }
.atom-drop-hint span { color: var(--green); font-size: 17px; }
.atom-stage-meta { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 12px; border-radius: 0 0 13px 13px; background: #09231c; }
.atom-equation-plate { min-width: 0; padding: 0; color: #fff; text-align: left; }
.atom-equation-plate span, .atom-equation-plate strong { display: block; }
.atom-equation-plate span { color: #7eac9a; font-size: 8px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.atom-equation-plate strong { overflow: hidden; font-family: Cambria, "Times New Roman", serif; font-size: clamp(15px, 1.55vw, 20px); text-overflow: ellipsis; white-space: nowrap; }
.nucleus-key.atom-key { position: static; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; padding: 0; border: 0; border-radius: 0; background: transparent; }
.stage-status #atom-stage-light { background: var(--muted); box-shadow: 0 0 10px var(--muted); }
.stage-status #atom-stage-light.is-stable { background: var(--green); box-shadow: 0 0 10px var(--green); }
.stage-status #atom-stage-light.is-radioactive, .stage-status #atom-stage-light.is-free-neutron { background: var(--coral); box-shadow: 0 0 10px var(--coral); }
.stage-status #atom-stage-light.is-metastable { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.nucleus-status.is-radioactive, .nucleus-status.is-free-neutron { color: #a62e37; background: #ffe3e6; }
.nucleus-status.is-metastable { color: #785900; background: #fff2bc; }
.nucleus-status.is-empty, .nucleus-status.is-no-element, .nucleus-status.is-beyond-table, .nucleus-status.is-unknown { color: var(--muted); background: #edf4f0; }
.atom-nuclide-identity { min-height: 118px; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 11px; place-items: center stretch; padding: 13px; }
.nuclide-mark { position: relative; width: 70px; height: 72px; color: #fff; font-family: Cambria, "Times New Roman", serif; }
.atom-nuclide-identity .nuclide-mark strong { position: absolute; top: 14px; left: 30px; color: #fff; font-size: 43px; line-height: 1; }
.nuclide-mass, .nuclide-atomic { position: absolute; left: 0; width: 27px; margin: 0 !important; color: #bce3d0 !important; font-family: Cambria, "Times New Roman", serif; font-size: 15px !important; font-weight: 850 !important; text-align: right; }
.nuclide-mass { top: 4px; }
.nuclide-atomic { bottom: 5px; }
.nuclide-mark em { position: absolute; top: 4px; right: 0; color: var(--gold); font-family: Cambria, serif; font-size: 18px; font-style: normal; font-weight: 850; }
.atom-nuclide-identity .nuclide-copy { min-width: 0; }
.atom-nuclide-identity .nuclide-copy strong { display: block; overflow: hidden; color: #fff; font-family: inherit; font-size: 14px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.atom-nuclide-identity .nuclide-copy span { display: block; margin: 4px 0 0; color: #a9ccbd; font-size: 9px; font-weight: 750; text-transform: none; }
.charge-chip { align-self: start; margin: 0 !important; padding: 5px 7px; border-radius: 999px; color: var(--night) !important; background: var(--green); font-size: 8px !important; font-weight: 900 !important; white-space: nowrap; }
.atom-facts dd { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.atom-facts div:last-child dd { font-size: 11px; }
.atom-inspector .stability-copy { min-height: 0; margin: 11px 2px 0; }

.decay-learning-panel { grid-area: decay-learning; min-width: 0; padding: 18px; }
.decay-learning-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.decay-learning-heading h2 { margin: 0; font-size: 20px; }
.clock-isotope { min-width: 150px; padding: 8px 11px; border-radius: 10px; color: #d7f1e5; background: var(--night); text-align: right; }
.clock-isotope span, .clock-isotope strong { display: block; }
.clock-isotope span { color: #82ae9d; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.clock-isotope strong { margin-top: 2px; overflow: hidden; font-family: Cambria, "Times New Roman", serif; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.decay-learning-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 1.08fr) minmax(0, 1fr); gap: 10px; }
.learning-step { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fbfefc; }
.learning-step-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.learning-step-heading > span { width: 30px; height: 30px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--night); background: var(--green); font-size: 11px; font-weight: 900; }
.learning-step-heading small, .learning-step-heading h3 { display: block; }
.learning-step-heading small { color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.learning-step-heading h3 { margin: 2px 0 0; font-size: 13px; }
.prediction-step > p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.prediction-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 11px; }
.prediction-option { min-height: 39px; padding: 6px 7px; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 9px; font-weight: 850; line-height: 1.2; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.prediction-option:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--green); }
.prediction-option.is-correct { color: #075f3a; border-color: #51c887; background: #dcf7e8; }
.prediction-option.is-incorrect { color: #9c3440; border-color: #ef9ba3; background: #fff0f1; }
.prediction-option:disabled { cursor: not-allowed; opacity: .52; }
.prediction-feedback { min-height: 26px; margin-top: 9px !important; padding-top: 8px; border-top: 1px solid #e6f0ea; font-weight: 760; }
.prediction-feedback.is-correct { color: #087744; }
.prediction-feedback.is-incorrect { color: #a62e37; }
.clock-step { border-color: #bcebd1; background: linear-gradient(145deg, #f3fcf7, #edfaf5); box-shadow: inset 0 3px 0 var(--green); }
.clock-mode-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: #fff; }
.clock-mode-row div > span, .clock-mode-row div > strong { display: block; }
.clock-mode-row div > span { color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.clock-mode-row div > strong { margin-top: 2px; color: var(--green-dark); font-family: Cambria, "Times New Roman", serif; font-size: 14px; }
.clock-mode-row > span { padding-top: 2px; color: var(--muted); font-size: 8px; font-weight: 800; white-space: nowrap; }
.clock-step label { display: block; margin-top: 8px; color: var(--muted); font-size: 8px; font-weight: 850; text-transform: uppercase; }
.clock-step select { width: 100%; min-height: 34px; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-size: 9px; font-weight: 750; }
.clock-readout { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 11px; }
.clock-readout strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.clock-readout span { color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.decay-progress { height: 8px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: #deece4; }
.decay-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .1s linear; }
.clock-note { margin: 7px 0 0; color: var(--muted); font-size: 8px; line-height: 1.35; }
.atom-transport { display: grid; grid-template-columns: 1.2fr 1fr; gap: 7px; margin-top: 10px; }
.atom-transport .primary-button, .atom-transport .secondary-button { min-width: 0; padding-inline: 8px; }
.atom-transport #excite-nucleus { grid-column: 1 / -1; }
.equation-reveal { min-height: 76px; padding: 11px; border-radius: 10px; color: #fff; background: var(--night); }
.equation-reveal span, .equation-reveal strong { display: block; }
.equation-reveal span { color: #82ae9d; font-size: 7px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.equation-reveal strong { margin-top: 6px; font-family: Cambria, "Times New Roman", serif; font-size: 14px; line-height: 1.35; }
.explain-step > p { margin: 9px 1px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.free-neutron-conservation { display: grid; gap: 5px; margin-top: 10px; }
.free-neutron-conservation[hidden] { display: none; }
.free-neutron-conservation span { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--mint); }
.free-neutron-conservation small { color: var(--muted); font-size: 7px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.free-neutron-conservation strong { color: var(--green-dark); font-family: Cambria, "Times New Roman", serif; font-size: 10px; white-space: nowrap; }
.extension-note { min-height: 0; color: #8a6814 !important; font-size: 8px !important; }

.periodic-panel { padding: 16px; }
.periodic-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 11px; }
.periodic-heading h2 { margin: 0; font-size: 17px; }
.periodic-heading > p { margin: 0; color: var(--muted); font-size: 9px; font-weight: 750; text-align: right; }
.periodic-scroll { overflow-x: auto; padding: 3px 2px 7px; scrollbar-color: var(--green) transparent; scrollbar-width: thin; }
.periodic-table { min-width: 760px; display: grid; grid-template-columns: repeat(18, minmax(34px, 1fr)); grid-template-rows: repeat(9, 34px); gap: 3px; }
.periodic-cell { display: grid; place-items: center; border: 1px solid #d7e9df; border-radius: 7px; color: #44675a; background: #f5faf7; font-size: 9px; font-weight: 850; transition: transform .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease; }
.periodic-cell.series-lanthanide { background: #eef6ff; }
.periodic-cell.series-actinide { background: #f4f0ff; }
.periodic-cell.is-current { z-index: 1; color: var(--night); border-color: var(--green-dark); background: var(--green); box-shadow: 0 0 0 3px rgba(34, 198, 112, .2), 0 7px 13px rgba(5, 50, 27, .18); transform: scale(1.12); }

.decay-history-panel .panel-heading { margin-bottom: 10px; }
.history-clear { min-height: 36px; }
.decay-history { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.decay-history li { min-height: 50px; display: grid; grid-template-columns: 33px 1fr; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.decay-history .history-number { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--night); background: var(--green); font-size: 9px; font-weight: 900; }
.decay-history strong, .decay-history small { display: block; }
.decay-history strong { color: var(--green-dark); font-family: Cambria, "Times New Roman", serif; font-size: 14px; }
.decay-history small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.decay-history .empty-history { display: block; min-height: 0; color: var(--muted); font-size: 9px; }
.data-provenance { margin: 9px 1px 0; color: var(--muted); font-size: 8px; }
.data-provenance a { color: var(--green-dark); font-weight: 800; }

@media (max-width: 1380px) {
  .nucleus-grid.atom-builder-grid {
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-areas: "nucleons nucleus-stage" "nucleus-readout decay-learning" "nuclide-chart nuclide-chart" "decay-history decay-history";
  }
  .atom-builder-grid .atom-inspector { display: block; }
  .atom-builder-grid .atom-nuclide-identity { grid-row: auto; margin-bottom: 11px; }
  .atom-builder-grid .atom-nuclide-identity { grid-template-columns: 70px minmax(0, 1fr); }
  .atom-builder-grid .atom-nuclide-identity .charge-chip { grid-column: 2; justify-self: start; }
}

@media (max-width: 980px) {
  .hero-atom { min-width: 330px; transform: scale(.9); transform-origin: right top; }
  .nucleus-grid.atom-builder-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "nucleons" "nucleus-stage" "decay-learning" "nucleus-readout" "nuclide-chart" "decay-history"; }
  .atom-builder-grid .nucleon-controls { position: static; display: block; }
  .atom-source-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nucleon-store.atom-source { min-height: 118px; display: flex; flex-direction: column; align-items: flex-start; }
  .atom-source .source-add { position: absolute; align-self: flex-end; }
  .particle-inventory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .particle-inventory h3 { grid-column: 1 / -1; }
  .inventory-row { grid-template-columns: 1fr 28px 29px; }
  .decay-learning-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explain-step { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .hero-atom { width: 100%; min-width: 0; margin-top: 15px; transform: none; }
  .builder-preset-nav { align-items: flex-start; flex-direction: column; gap: 8px; }
  .builder-preset-nav > div:first-child { min-width: 0; }
  .preset-track { width: 100%; }
  .atom-source-stack { grid-template-columns: 1fr; }
  .nucleon-store.atom-source { min-height: 0; display: grid; grid-template-columns: 47px 1fr 24px; }
  .atom-source .source-add { position: static; align-self: auto; }
  .particle-inventory { display: block; }
  .atom-canvas-shell { min-height: 390px; }
  #nucleus-canvas { height: 390px; }
  .atom-stage-meta { align-items: flex-start; flex-direction: column; gap: 8px; }
  .nucleus-key.atom-key { justify-content: flex-start; }
  .decay-learning-grid { grid-template-columns: 1fr; }
  .explain-step { grid-column: auto; }
  .periodic-heading { display: block; }
  .periodic-heading > p { margin-top: 4px; text-align: left; }
}

@media (max-width: 460px) {
  .atom-builder-hero::after { display: none; }
  .course-lens-copy { border-radius: 8px; }
  .preset-track button { min-width: 104px; }
  .atom-canvas-shell { min-height: 360px; }
  #nucleus-canvas { height: 360px; }
  .decay-learning-panel { padding: 14px; }
  .decay-learning-heading { align-items: flex-start; }
  .clock-isotope { min-width: 112px; max-width: 52%; }
  .clock-isotope strong { font-size: 13px; }
  .prediction-options { grid-template-columns: 1fr; }
  .atom-nuclide-identity { grid-template-columns: 70px minmax(0, 1fr); }
  .atom-builder-grid .atom-nuclide-identity .charge-chip { grid-column: 1 / -1; justify-self: start; }
  .atom-transport { grid-template-columns: 1fr; }
  .atom-transport #excite-nucleus { grid-column: auto; }
  .periodic-table { min-width: 650px; grid-template-columns: repeat(18, minmax(28px, 1fr)); grid-template-rows: repeat(9, 30px); }
}
