:root {
  --bg: #06111b;
  --panel: rgba(10, 21, 36, 0.84);
  --panel-strong: rgba(12, 27, 46, 0.96);
  --line: rgba(151, 202, 255, 0.14);
  --text: #edf7ff;
  --muted: #adc3d8;
  --accent: #7ce8ff;
  --accent-strong: #22beff;
  --energy: #ffd16f;
  --proton: #ff8a7b;
  --neutron: #d5ecff;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(34, 190, 255, 0.16), transparent 26%),
    radial-gradient(circle at 84% 14%, rgba(255, 209, 111, 0.14), transparent 24%),
    linear-gradient(165deg, #020910 0%, #081523 42%, #10253d 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
}

.page {
  width: min(1200px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.site-nav {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.7rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(9, 20, 34, 0.68);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-right: auto;
  padding: 0.3rem 0.35rem 0.3rem 0.1rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-block;
}

.brand-core,
.brand-orbit {
  position: absolute;
  inset: 0;
}

.brand-core {
  width: 8px;
  height: 8px;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--energy), var(--accent));
  box-shadow: 0 0 18px rgba(124, 232, 255, 0.45);
  animation: core-pulse 2.8s ease-in-out infinite;
}

.brand-orbit {
  border: 2px solid rgba(134, 231, 255, 0.72);
  border-radius: 50%;
}

.orbit-a {
  transform: rotate(28deg) scaleX(1.18) scaleY(0.58);
  animation: orbit-spin-a 7s linear infinite;
}

.orbit-b {
  transform: rotate(-28deg) scaleX(1.18) scaleY(0.58);
  animation: orbit-spin-b 9s linear infinite;
}

.brand-text {
  font-size: 0.95rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(150, 201, 255, 0.1);
  transition: transform 180ms ease, color 180ms ease, background-color 180ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.nav-link.is-active {
  color: #04111c;
  background: linear-gradient(135deg, var(--accent), #b4f8ff);
  border-color: transparent;
}

.hero,
.compare-grid,
.core-grid,
.map-grid {
  display: grid;
  gap: 1.2rem;
}

.hero {
  grid-template-columns: 1.05fr 0.95fr;
  align-items: stretch;
  margin-bottom: 1.2rem;
}

.hero-copy,
.hero-visual,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-copy {
  padding: 1.8rem;
}

.hero-visual {
  padding: 1.2rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(124, 232, 255, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(8, 19, 34, 0.92), rgba(8, 18, 32, 0.82));
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--energy);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.77rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.85rem;
  font-size: clamp(2.3rem, 4.7vw, 4rem);
  line-height: 1.03;
}

h2 {
  margin-bottom: 0.7rem;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1rem;
}

.lead,
.panel p,
.notation-copy p,
.facts-list p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.45rem 0 1.25rem;
}

.primary,
.secondary,
.iso-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.88rem 1.2rem;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.primary {
  color: #04111c;
  font-weight: 800;
  background: linear-gradient(135deg, var(--energy), #fff0a6);
  box-shadow: 0 12px 24px rgba(255, 209, 111, 0.24);
}

.secondary,
.iso-btn {
  color: var(--text);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(151, 202, 255, 0.12);
}

.primary:hover,
.secondary:hover,
.iso-btn:hover {
  transform: translateY(-1px);
}

.hero-facts,
.compare-grid,
.core-grid,
.map-grid,
.facts-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-facts {
  display: grid;
  gap: 0.8rem;
}

.hero-facts article,
.facts-list article {
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(151, 202, 255, 0.08);
}

.label {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.atom-scene {
  position: relative;
  min-height: 540px;
  border-radius: 24px;
  overflow: hidden;
  transition: transform 260ms ease, filter 260ms ease;
  background:
    radial-gradient(circle at 50% 50%, rgba(34, 190, 255, 0.08), transparent 28%),
    radial-gradient(circle at 50% 50%, rgba(255, 209, 111, 0.08), transparent 8%);
}

.atom-scene.is-restarting {
  transform: scale(0.985);
  filter: saturate(1.15) brightness(1.05);
}

.scale-glow {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 390px;
  height: 390px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 232, 255, 0.18), rgba(124, 232, 255, 0));
}

.shell {
  position: absolute;
  inset: 50% auto auto 50%;
  border-radius: 50%;
  border: 1px solid rgba(151, 202, 255, 0.24);
  transform: translate(-50%, -50%);
}

.shell-a {
  width: 380px;
  height: 380px;
}

.shell-b {
  width: 276px;
  height: 276px;
  border-style: dashed;
}

.shell-c {
  width: 170px;
  height: 170px;
  border-color: rgba(255, 209, 111, 0.2);
}

.electron {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9af0ff, #24bfff);
  box-shadow: 0 0 20px rgba(34, 190, 255, 0.6);
}

.electron-a {
  animation: orbit-outer 7s linear infinite;
}

.electron-b {
  animation: orbit-middle 5.2s linear infinite reverse;
}

.electron-c {
  animation: orbit-inner 3.8s linear infinite;
}

.nucleus-core {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 88px;
  height: 88px;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), transparent 40%),
    rgba(11, 27, 45, 0.96);
  box-shadow: 0 0 35px rgba(255, 209, 111, 0.18);
  animation: nucleus-pulse 2.9s ease-in-out infinite;
}

.nucleon {
  border-radius: 50%;
  box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.35);
}

.proton {
  background: radial-gradient(circle at 30% 28%, #ffd5cf, var(--proton));
}

.neutron {
  background: radial-gradient(circle at 30% 28%, #ffffff, var(--neutron));
}

.scene-label {
  position: absolute;
  padding: 0.8rem 0.95rem;
  border-radius: 18px;
  background: rgba(8, 18, 32, 0.76);
  border: 1px solid rgba(151, 202, 255, 0.12);
  max-width: 220px;
}

.scene-label strong,
.legend-title,
.isotope-name {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1rem;
}

.scene-label span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.section-gap {
  margin-top: 1.35rem;
}

.atom-label {
  top: 1rem;
  right: 1rem;
}

.nucleus-label {
  left: 1rem;
  bottom: 1rem;
}

.compare-grid,
.core-grid,
.map-grid {
  display: grid;
  margin-bottom: 1.2rem;
}

.compare-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.core-grid,
.map-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 1.4rem;
}

.size-bar-card,
.mass-card,
.notation-card,
.isotope-display,
.nuclide-map {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(151, 202, 255, 0.08);
}

.size-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 0.75rem;
}

.size-row + .size-row {
  margin-top: 0.8rem;
}

.size-label,
.size-value {
  font-weight: 700;
  color: var(--text);
}

.size-bar {
  height: 14px;
  border-radius: 999px;
}

.atom-bar {
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.nucleus-bar {
  width: 2%;
  min-width: 12px;
  background: linear-gradient(90deg, var(--energy), #fff1b5);
}

.mass-bar {
  display: flex;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.mass-nucleus {
  width: 99.9%;
  background: linear-gradient(90deg, #ffc65f, #ff8f76);
}

.mass-electrons {
  width: 0.1%;
  min-width: 8px;
  background: linear-gradient(90deg, #9cf1ff, #25bfff);
}

.mass-legend {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.45rem;
  border-radius: 50%;
}

.nucleus-dot {
  background: #ffb466;
}

.electron-dot {
  background: #53d7ff;
}

.notation-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.notation-example {
  display: grid;
  place-items: center;
  min-height: 170px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.nuclide {
  position: relative;
  display: inline-block;
  padding-left: 1.3rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  font-weight: 700;
}

.nuclide .mass,
.nuclide .atomic {
  position: absolute;
  left: 0;
  font-size: 0.43em;
  line-height: 1;
}

.nuclide .mass {
  top: -0.15em;
}

.nuclide .atomic {
  bottom: 0.05em;
}

.isotope-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.iso-btn.is-active {
  color: #04111c;
  background: linear-gradient(135deg, var(--accent), #b8f9ff);
  border-color: transparent;
}

.isotope-display {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.isotope-nucleus {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  gap: 6px;
  justify-content: center;
  align-content: center;
  min-height: 170px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-nucleon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.35);
  animation: nucleon-pop 320ms ease;
}

.mini-nucleon.proton {
  background: radial-gradient(circle at 30% 28%, #ffd5cf, var(--proton));
}

.mini-nucleon.neutron {
  background: radial-gradient(circle at 30% 28%, #ffffff, var(--neutron));
}

.isotope-equation {
  margin: 0.6rem 0 0.8rem;
}

.nuclide-map {
  position: relative;
}

.map-axis {
  color: var(--muted);
  font-size: 0.9rem;
}

.map-axis-y {
  margin-bottom: 0.75rem;
}

.map-chart {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: stretch;
}

.map-y-scale {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 0.45rem;
  min-height: 260px;
  padding: 0.45rem 0;
}

.map-y-scale span,
.map-x-scale span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.map-grid-area {
  position: relative;
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 0.45rem;
  min-height: 260px;
  padding: 0.45rem;
  border-radius: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: calc(100% / 16) calc(100% / 6);
}

.stability-line {
  position: absolute;
  left: 5.5%;
  bottom: 12%;
  width: 82%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(124, 232, 255, 0.05), rgba(255, 209, 111, 0.42), rgba(124, 232, 255, 0.08));
  box-shadow: 0 0 18px rgba(255, 209, 111, 0.16);
  transform: rotate(-28deg);
  transform-origin: left center;
  pointer-events: none;
  z-index: 0;
}

.map-cell {
  grid-column: var(--y);
  grid-row: calc(9 - var(--x));
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0.25rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #06111b;
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  position: relative;
  z-index: 1;
}

.map-cell.stable {
  background: linear-gradient(135deg, #ffe08a, #9cf1ff);
}

.map-cell.accent {
  background: linear-gradient(135deg, #ffad95, #ffd36f);
}

.map-cell.light {
  background: linear-gradient(135deg, #dff6ff, #b7f0ff);
}

.map-cell.radio {
  background: linear-gradient(135deg, #ff8a7b, #ffd16f);
}

.map-cell:hover {
  transform: translateY(-1px) scale(1.04);
}

.map-cell.is-active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.82), 0 0 22px rgba(124, 232, 255, 0.28);
  filter: saturate(1.08);
  z-index: 3;
}

.map-cell:hover::after,
.map-cell:focus-visible::after {
  content: attr(data-coords);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(8, 18, 32, 0.94);
  border: 1px solid rgba(151, 202, 255, 0.2);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  pointer-events: none;
  z-index: 4;
}

.map-axis-x {
  margin-top: 0.75rem;
  text-align: right;
}

.map-x-scale {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
  padding-left: calc(32px + 0.55rem);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 0.45rem;
  border-radius: 50%;
}

.stable-swatch {
  background: linear-gradient(135deg, #ffe08a, #9cf1ff);
}

.accent-swatch {
  background: linear-gradient(135deg, #ffad95, #ffd36f);
}

.radio-swatch {
  background: linear-gradient(135deg, #ff8a7b, #ffd16f);
}

.nuclide-detail-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(151, 202, 255, 0.08);
}

.nuclide-detail-top {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.detail-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.detail-badge {
  margin: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #04111c;
  background: linear-gradient(135deg, var(--accent), #b8f9ff);
}

.detail-equation {
  margin: 0 0 0.9rem;
}

.detail-copy {
  color: var(--muted);
  line-height: 1.6;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.detail-grid article {
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(151, 202, 255, 0.08);
}

.facts-list {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

@keyframes orbit-spin-a {
  from {
    transform: rotate(28deg) scaleX(1.18) scaleY(0.58);
  }
  to {
    transform: rotate(388deg) scaleX(1.18) scaleY(0.58);
  }
}

@keyframes orbit-spin-b {
  from {
    transform: rotate(-28deg) scaleX(1.18) scaleY(0.58);
  }
  to {
    transform: rotate(-388deg) scaleX(1.18) scaleY(0.58);
  }
}

@keyframes core-pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 18px rgba(124, 232, 255, 0.45);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow: 0 0 24px rgba(255, 209, 111, 0.55);
  }
}

@keyframes orbit-outer {
  from {
    transform: rotate(0deg) translateX(190px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(190px) rotate(-360deg);
  }
}

@keyframes orbit-middle {
  from {
    transform: rotate(0deg) translateX(138px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(138px) rotate(-360deg);
  }
}

@keyframes orbit-inner {
  from {
    transform: rotate(0deg) translateX(85px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(85px) rotate(-360deg);
  }
}

@keyframes nucleus-pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes nucleon-pop {
  from {
    transform: scale(0.7);
    opacity: 0.2;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .hero,
  .compare-grid,
  .core-grid,
  .map-grid,
  .notation-card,
  .isotope-display,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .atom-scene {
    min-height: 430px;
  }

  .shell-a {
    width: 300px;
    height: 300px;
  }

  .shell-b {
    width: 220px;
    height: 220px;
  }

  .shell-c {
    width: 130px;
    height: 130px;
  }

  .electron-a {
    animation-name: orbit-outer-mobile;
  }

  .electron-b {
    animation-name: orbit-middle-mobile;
  }

  .electron-c {
    animation-name: orbit-inner-mobile;
  }

  @keyframes orbit-outer-mobile {
    from {
      transform: rotate(0deg) translateX(150px) rotate(0deg);
    }
    to {
      transform: rotate(360deg) translateX(150px) rotate(-360deg);
    }
  }

  @keyframes orbit-middle-mobile {
    from {
      transform: rotate(0deg) translateX(110px) rotate(0deg);
    }
    to {
      transform: rotate(360deg) translateX(110px) rotate(-360deg);
    }
  }

  @keyframes orbit-inner-mobile {
    from {
      transform: rotate(0deg) translateX(65px) rotate(0deg);
    }
    to {
      transform: rotate(360deg) translateX(65px) rotate(-360deg);
    }
  }

  .map-cell.is-active::after {
    font-size: 0.62rem;
    padding: 0.26rem 0.48rem;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100vw - 1rem, 100%);
  }

  .hero-copy,
  .hero-visual,
  .panel {
    padding: 1rem;
    border-radius: 22px;
  }

  .atom-scene {
    min-height: 360px;
  }

  .shell-a {
    width: 250px;
    height: 250px;
  }

  .shell-b {
    width: 180px;
    height: 180px;
  }

  .shell-c {
    width: 104px;
    height: 104px;
  }

  .nucleus-core {
    width: 70px;
    height: 70px;
  }

  .hero-facts {
    grid-template-columns: 1fr;
  }

  .scene-label {
    max-width: 170px;
    font-size: 0.84rem;
  }
}
