:root {
  --core-alkali: #ffb86b;
  --core-alkaline: #f7d95e;
  --core-transition: #66dff4;
  --core-post: #88b8ff;
  --core-metalloid: #77e0bd;
  --core-nonmetal: #a8e6ff;
  --core-halogen: #dc9cff;
  --core-noble: #ff8fd3;
  --core-lanthanide: #ff9f95;
  --core-actinide: #c7a5ff;
  --core-unknown: #b9c3d6;
  --core-theory: #d89cff;
}

/* Home portal — CSS-built so the eventual art pack can replace it cleanly. */

.space-sq-card--natural-core {
  isolation: isolate;
  background:
    radial-gradient(circle at 76% 24%, rgba(216, 156, 255, 0.3), transparent 25%),
    radial-gradient(circle at 20% 80%, rgba(102, 223, 244, 0.22), transparent 30%),
    linear-gradient(145deg, #090824, #020713 70%);
}

.natural-core-home-art {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(150px, 1.1fr);
  gap: 16px;
  align-items: center;
  padding: clamp(18px, 3vw, 30px);
  overflow: hidden;
}

.natural-core-home-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: 0.72;
  background:
    linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(90deg, transparent, #000 38%, #000);
}

.natural-core-home-copy {
  position: relative;
  z-index: 2;
  text-align: left;
}

.natural-core-home-copy small {
  display: block;
  color: var(--accent-cool);
  font-size: clamp(0.62rem, 1vw, 0.78rem);
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.natural-core-home-copy strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: clamp(1.4rem, 3.2vw, 2.5rem);
  font-weight: 950;
  line-height: 0.96;
}

.natural-core-home-copy span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(0.7rem, 1.15vw, 0.88rem);
}

.natural-core-home-lattice {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  transform: perspective(440px) rotateY(-10deg) rotateX(4deg);
}

.natural-core-home-lattice span {
  display: grid;
  min-height: clamp(28px, 4.5vw, 48px);
  border: 1px solid color-mix(in srgb, var(--cell, var(--accent-cool)) 66%, transparent);
  border-radius: 5px;
  place-items: center;
  background: color-mix(in srgb, var(--cell, var(--accent-cool)) 13%, rgba(2, 7, 18, 0.86));
  color: var(--cell, var(--accent-cool));
  font-size: clamp(0.62rem, 1.5vw, 1rem);
  font-weight: 950;
  box-shadow: 0 0 18px color-mix(in srgb, var(--cell, var(--accent-cool)) 18%, transparent);
}

.natural-core-home-lattice span:nth-child(4n + 1) { --cell: var(--core-alkali); }
.natural-core-home-lattice span:nth-child(4n + 2) { --cell: var(--core-transition); }
.natural-core-home-lattice span:nth-child(4n + 3) { --cell: var(--core-metalloid); }
.natural-core-home-lattice span:nth-child(4n) { --cell: var(--core-noble); }

/* Natural Core table surface */

.wing-shell--natural-core {
  min-height: 100vh;
  padding: clamp(8px, 1.4vw, 18px);
  background:
    linear-gradient(rgba(2, 6, 12, 0.26), rgba(2, 6, 12, 0.5)),
    url("public/assets/magg-space/background.png") center / cover fixed no-repeat;
}

.natural-core-shell,
.element-shell {
  width: min(1500px, 100%);
  margin-inline: auto;
  color: var(--text);
}

.natural-core-shell {
  display: grid;
  gap: 12px;
}

.natural-core-header,
.natural-core-status-band,
.natural-core-controls,
.natural-core-preview,
.natural-core-collection,
.element-topbar,
.element-hero,
.element-story,
.element-sidebar section,
.element-sequence-nav,
.element-boundary-notice,
.element-not-found {
  border: 1px solid rgba(255, 244, 188, 0.2);
  background:
    radial-gradient(circle at 18% 12%, rgba(102, 223, 244, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(9, 14, 28, 0.84), rgba(5, 9, 20, 0.91));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}

.natural-core-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border-radius: 18px;
  padding: 18px 20px;
}

.natural-core-heading {
  min-width: 0;
  text-align: center;
}

.natural-core-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.5rem);
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.natural-core-heading > p:last-child {
  width: min(760px, 100%);
  margin: 10px auto 0;
  color: var(--muted);
  font-size: clamp(0.82rem, 1.1vw, 1rem);
}

.natural-core-status-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-radius: 14px;
  overflow: hidden;
}

.natural-core-status-band > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 12px;
  align-items: center;
  padding: 12px 16px;
}

.natural-core-status-band > div + div {
  border-left: 1px dashed rgba(216, 156, 255, 0.46);
  background:
    repeating-linear-gradient(135deg, rgba(216, 156, 255, 0.05) 0 8px, transparent 8px 16px),
    rgba(31, 10, 48, 0.22);
}

.natural-core-status-symbol {
  grid-row: 1 / 3;
  color: var(--accent-cool);
  font-size: 1.4rem;
}

.natural-core-status-symbol--theory {
  color: var(--core-theory);
}

.natural-core-status-band strong {
  font-size: 0.88rem;
}

.natural-core-status-band small {
  color: var(--soft);
}

.natural-core-controls {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) minmax(190px, 0.45fr) auto;
  gap: 12px;
  align-items: end;
  border-radius: 14px;
  padding: 12px;
}

.natural-core-view-switcher {
  display: flex;
  gap: 6px;
  align-self: stretch;
}

.natural-core-view-switcher button,
.natural-core-legend-item {
  border: 1px solid rgba(102, 223, 244, 0.28);
  border-radius: 9px;
  background: rgba(3, 12, 24, 0.72);
  color: var(--muted);
  font-weight: 900;
}

.natural-core-view-switcher button {
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.78rem;
}

.natural-core-view-switcher button:hover,
.natural-core-view-switcher button:focus-visible,
.natural-core-view-switcher button.is-active {
  border-color: rgba(247, 217, 94, 0.62);
  color: var(--accent);
  outline: none;
}

.natural-core-view-switcher button.is-active {
  background: linear-gradient(180deg, rgba(75, 53, 9, 0.55), rgba(19, 14, 4, 0.7));
  box-shadow: inset 0 0 0 1px rgba(247, 217, 94, 0.12);
}

.natural-core-search,
.natural-core-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.natural-core-filter[hidden] {
  display: none;
}

.natural-core-search span,
.natural-core-filter span {
  color: var(--soft);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.natural-core-search input,
.natural-core-filter select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(102, 223, 244, 0.26);
  border-radius: 9px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--text);
  outline: none;
}

.natural-core-search input:focus,
.natural-core-filter select:focus {
  border-color: rgba(102, 223, 244, 0.7);
  box-shadow: 0 0 0 3px rgba(102, 223, 244, 0.12);
}

.natural-core-filter option {
  background: #080e1d;
}

.natural-core-result-count {
  min-width: 168px;
  margin: 0 2px 12px;
  color: var(--accent-cool);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: right;
}

.natural-core-preview {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 106px;
  border-radius: 14px;
  padding: 12px 18px;
}

.natural-core-preview-symbol {
  display: grid;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid rgba(102, 223, 244, 0.58);
  border-radius: 16px;
  place-items: center;
  background:
    radial-gradient(circle, rgba(102, 223, 244, 0.24), transparent 70%),
    rgba(2, 10, 22, 0.82);
  color: var(--accent-cool);
  font-size: 2rem;
  font-weight: 950;
  box-shadow: inset 0 0 22px rgba(102, 223, 244, 0.1), 0 0 22px rgba(102, 223, 244, 0.08);
}

.natural-core-preview-symbol img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.natural-core-preview-symbol img[hidden],
.element-hero-asset[hidden],
.element-visual-library[hidden] {
  display: none !important;
}

.natural-core-preview .space-section-label {
  margin: 0 0 2px;
  text-align: left;
}

.natural-core-preview h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.natural-core-preview p:last-child {
  display: -webkit-box;
  max-width: 900px;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.natural-core-preview-status {
  border: 1px solid rgba(102, 223, 244, 0.34);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--accent-cool);
  font-size: 0.7rem;
  font-weight: 950;
}

.natural-core-preview.is-theoretical .natural-core-preview-symbol,
.natural-core-preview.is-theoretical .natural-core-preview-status {
  border-color: rgba(216, 156, 255, 0.54);
  color: var(--core-theory);
}

.natural-core-preview.is-source-missing .natural-core-preview-status {
  border-style: dashed;
  border-color: rgba(247, 217, 94, 0.6);
  color: var(--accent);
}

.natural-core-collection {
  min-width: 0;
  border-radius: 18px;
  padding: 16px;
}

.natural-core-section-heading {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.natural-core-section-heading .space-section-label {
  margin: 0 0 3px;
  text-align: left;
}

.natural-core-section-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2.6rem);
}

.natural-core-section-heading > p {
  max-width: 520px;
  margin: 0;
  color: var(--soft);
  font-size: 0.78rem;
  text-align: right;
}

.periodic-table-viewport {
  min-width: 0;
  border: 1px solid rgba(102, 223, 244, 0.18);
  border-radius: 14px;
  padding: 12px;
  overflow-x: auto;
  background:
    linear-gradient(rgba(102, 223, 244, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 223, 244, 0.035) 1px, transparent 1px),
    rgba(1, 6, 16, 0.78);
  background-size: 28px 28px;
  scrollbar-color: rgba(102, 223, 244, 0.4) rgba(0, 0, 0, 0.24);
}

.periodic-table-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(56px, 1fr));
  grid-template-rows: 20px repeat(9, 78px);
  gap: 5px;
  min-width: 1160px;
}

.periodic-group-label {
  align-self: center;
  color: rgba(255, 248, 231, 0.44);
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}

.periodic-element {
  --element-color: var(--core-unknown);
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--element-color) 55%, transparent);
  border-radius: 7px;
  padding: 6px;
  overflow: hidden;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--element-color) 16%, transparent), transparent 60%),
    rgba(3, 12, 25, 0.9);
  color: var(--text);
  text-decoration: none;
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--element-color) 6%, transparent);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.periodic-element::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -24px;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--element-color) 24%, transparent);
  border-radius: 50%;
}

.periodic-element:hover,
.periodic-element:focus-visible {
  z-index: 4;
  border-color: var(--element-color);
  outline: none;
  box-shadow:
    inset 0 0 18px color-mix(in srgb, var(--element-color) 12%, transparent),
    0 0 0 2px color-mix(in srgb, var(--element-color) 28%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.48);
  transform: translateY(-2px) scale(1.04);
}

.periodic-element-number {
  color: var(--soft);
  font-size: 0.58rem;
  font-weight: 900;
}

.periodic-element-symbol {
  grid-column: 1 / -1;
  align-self: end;
  color: var(--element-color);
  font-size: clamp(1rem, 1.25vw, 1.3rem);
  font-weight: 950;
  line-height: 1;
}

.periodic-element-name {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.periodic-element-state {
  position: absolute;
  top: 4px;
  right: 4px;
  max-width: 38px;
  overflow: hidden;
  color: color-mix(in srgb, var(--element-color) 75%, white);
  font-size: 0.42rem;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.periodic-element.is-source-missing {
  border-style: dashed;
  background:
    repeating-linear-gradient(135deg, rgba(247, 217, 94, 0.08) 0 6px, transparent 6px 12px),
    rgba(3, 12, 25, 0.9);
}

.periodic-element.is-source-missing .periodic-element-state {
  max-width: 44px;
  color: var(--accent);
}

.periodic-element--alkali-metal { --element-color: var(--core-alkali); }
.periodic-element--alkaline-earth { --element-color: var(--core-alkaline); }
.periodic-element--transition-metal { --element-color: var(--core-transition); }
.periodic-element--post-transition { --element-color: var(--core-post); }
.periodic-element--metalloid { --element-color: var(--core-metalloid); }
.periodic-element--reactive-nonmetal { --element-color: var(--core-nonmetal); }
.periodic-element--halogen { --element-color: var(--core-halogen); }
.periodic-element--noble-gas { --element-color: var(--core-noble); }
.periodic-element--lanthanide { --element-color: var(--core-lanthanide); }
.periodic-element--actinide { --element-color: var(--core-actinide); }
.periodic-element--unclassified { --element-color: var(--core-unknown); }

.periodic-series-bridge {
  display: grid;
  border: 1px dashed rgba(255, 248, 231, 0.28);
  border-radius: 7px;
  place-content: center;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 5px, transparent 5px 10px);
  color: var(--soft);
  text-align: center;
}

.periodic-series-bridge strong {
  font-size: 0.54rem;
}

.periodic-series-bridge small {
  font-size: 0.42rem;
}

.natural-core-family-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.natural-core-legend-item {
  --element-color: var(--core-unknown);
  min-height: 30px;
  border-color: color-mix(in srgb, var(--element-color) 42%, transparent);
  padding: 0 10px;
  color: color-mix(in srgb, var(--element-color) 82%, white);
  font-size: 0.66rem;
}

.natural-core-legend-item::before {
  content: "◆";
  margin-right: 5px;
  color: var(--element-color);
}

.natural-core-legend-item:hover,
.natural-core-legend-item:focus-visible,
.natural-core-legend-item[aria-pressed="true"] {
  border-color: var(--element-color);
  outline: none;
  background: color-mix(in srgb, var(--element-color) 14%, rgba(3, 12, 24, 0.8));
}

.natural-core-legend-item--alkali-metal { --element-color: var(--core-alkali); }
.natural-core-legend-item--alkaline-earth { --element-color: var(--core-alkaline); }
.natural-core-legend-item--transition-metal { --element-color: var(--core-transition); }
.natural-core-legend-item--post-transition { --element-color: var(--core-post); }
.natural-core-legend-item--metalloid { --element-color: var(--core-metalloid); }
.natural-core-legend-item--reactive-nonmetal { --element-color: var(--core-nonmetal); }
.natural-core-legend-item--halogen { --element-color: var(--core-halogen); }
.natural-core-legend-item--noble-gas { --element-color: var(--core-noble); }
.natural-core-legend-item--lanthanide { --element-color: var(--core-lanthanide); }
.natural-core-legend-item--actinide { --element-color: var(--core-actinide); }
.natural-core-legend-item--unclassified { --element-color: var(--core-unknown); }

.natural-core-collection--theory {
  border-style: dashed;
  border-color: rgba(216, 156, 255, 0.45);
  background:
    repeating-linear-gradient(135deg, rgba(216, 156, 255, 0.025) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, rgba(24, 8, 42, 0.88), rgba(5, 9, 20, 0.94));
}

.natural-core-theory-notice,
.element-boundary-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.natural-core-theory-notice {
  margin-bottom: 14px;
  border: 1px dashed rgba(216, 156, 255, 0.5);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(53, 17, 78, 0.26);
}

.natural-core-theory-notice > span {
  color: var(--core-theory);
  font-size: 1.35rem;
}

.natural-core-theory-notice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.theoretical-element-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.theoretical-element {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  min-height: 92px;
  border: 1px dashed rgba(216, 156, 255, 0.42);
  border-radius: 10px;
  padding: 12px;
  background:
    repeating-linear-gradient(135deg, rgba(216, 156, 255, 0.045) 0 7px, transparent 7px 14px),
    rgba(4, 8, 20, 0.78);
  color: var(--text);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease;
}

.theoretical-element:hover,
.theoretical-element:focus-visible {
  border-color: var(--core-theory);
  outline: none;
  box-shadow: 0 0 0 3px rgba(216, 156, 255, 0.12);
  transform: translateY(-2px);
}

.theoretical-element-identity {
  display: grid;
  grid-row: 1 / 3;
  width: 60px;
  height: 60px;
  border: 1px solid rgba(216, 156, 255, 0.34);
  border-radius: 10px;
  place-content: center;
  background: rgba(33, 11, 54, 0.5);
  text-align: center;
}

.theoretical-element-identity .periodic-element-number {
  color: var(--soft);
}

.theoretical-element-identity .periodic-element-symbol {
  color: var(--core-theory);
  font-size: 1.25rem;
}

.theoretical-element-name {
  align-self: end;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theoretical-element-status {
  align-self: start;
  color: var(--core-theory);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.natural-core-error {
  border: 1px solid rgba(255, 120, 120, 0.55);
  border-radius: 12px;
  padding: 16px;
  background: rgba(72, 10, 22, 0.72);
}

/* Element explainer */

.wing-shell--element {
  padding: clamp(8px, 2vw, 28px);
}

.element-shell {
  --element-color: var(--core-transition);
  display: grid;
  gap: 14px;
  width: min(1280px, 100%);
}

.element-shell > [hidden] {
  display: none !important;
}

.element-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-radius: 16px;
  padding: 14px 16px;
  text-align: center;
}

.element-topbar .space-topline {
  margin: 0;
}

.element-boundary-notice {
  border-radius: 14px;
  padding: 13px 16px;
}

.element-boundary-notice[hidden] {
  display: none;
}

.element-boundary-notice > span {
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 950;
}

.element-boundary-notice p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.element-boundary-notice.is-theoretical {
  border-style: dashed;
  border-color: rgba(216, 156, 255, 0.56);
  background:
    repeating-linear-gradient(135deg, rgba(216, 156, 255, 0.04) 0 8px, transparent 8px 16px),
    linear-gradient(180deg, rgba(42, 13, 67, 0.84), rgba(11, 7, 27, 0.92));
}

.element-boundary-notice.is-theoretical > span {
  color: var(--core-theory);
}

.element-hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  min-height: 520px;
  border-radius: 20px;
  overflow: hidden;
}

.element-shell--alkali-metal { --element-color: var(--core-alkali); }
.element-shell--alkaline-earth { --element-color: var(--core-alkaline); }
.element-shell--transition-metal { --element-color: var(--core-transition); }
.element-shell--post-transition { --element-color: var(--core-post); }
.element-shell--metalloid { --element-color: var(--core-metalloid); }
.element-shell--reactive-nonmetal { --element-color: var(--core-nonmetal); }
.element-shell--halogen { --element-color: var(--core-halogen); }
.element-shell--noble-gas { --element-color: var(--core-noble); }
.element-shell--lanthanide { --element-color: var(--core-lanthanide); }
.element-shell--actinide { --element-color: var(--core-actinide); }
.element-shell--unclassified { --element-color: var(--core-unknown); }
.element-shell--theoretical-frontier { --element-color: var(--core-theory); }

.element-visual {
  position: relative;
  display: grid;
  min-height: 520px;
  overflow: hidden;
  place-items: center;
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--element-color) 30%, transparent), transparent 25%),
    radial-gradient(circle at 50% 50%, rgba(2, 12, 28, 0.12), rgba(1, 5, 15, 0.92) 70%),
    linear-gradient(rgba(102, 223, 244, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 223, 244, 0.06) 1px, transparent 1px);
  background-size: auto, auto, 34px 34px, 34px 34px;
}

.element-hero-asset {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.element-visual.has-asset::before,
.element-visual.has-asset::after,
.element-visual.has-asset .element-orbit,
.element-visual.has-asset .element-atomic-number,
.element-visual.has-asset .element-symbol {
  opacity: 0;
}

.element-visual::before,
.element-visual::after {
  content: "";
  position: absolute;
  width: 62%;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--element-color) 42%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--element-color) 13%, transparent);
  filter: blur(0.2px);
}

.element-visual::before { top: 16%; }
.element-visual::after { bottom: 16%; }

.element-orbit {
  position: absolute;
  width: 250px;
  height: 250px;
  border: 1px solid color-mix(in srgb, var(--element-color) 48%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 28px color-mix(in srgb, var(--element-color) 12%, transparent);
}

.element-orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--element-color);
  box-shadow: 0 0 14px var(--element-color);
}

.element-orbit--one { transform: rotate(20deg) scaleY(0.34); }
.element-orbit--two { transform: rotate(140deg) scaleY(0.34); }
.element-orbit--three { transform: rotate(260deg) scaleY(0.34); }

.element-atomic-number {
  position: absolute;
  top: 24px;
  left: 26px;
  color: color-mix(in srgb, var(--element-color) 76%, white);
  font-size: clamp(2rem, 5vw, 4.5rem);
  font-weight: 950;
  line-height: 1;
}

.element-symbol {
  position: relative;
  z-index: 2;
  color: var(--element-color);
  font-size: clamp(6rem, 14vw, 11rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 1;
  text-shadow: 0 0 42px color-mix(in srgb, var(--element-color) 38%, transparent);
}

.element-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(24px, 4vw, 58px);
  background:
    radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--element-color) 12%, transparent), transparent 32%),
    rgba(4, 7, 18, 0.54);
}

.element-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.element-status-badge,
.element-family-badge {
  border: 1px solid color-mix(in srgb, var(--element-color) 45%, transparent);
  border-radius: 999px;
  padding: 7px 10px;
  color: color-mix(in srgb, var(--element-color) 82%, white);
  font-size: 0.7rem;
  font-weight: 950;
}

.element-intro h1 {
  margin: 18px 0 0;
  font-size: clamp(3rem, 7vw, 7rem);
  font-weight: 950;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.element-overview {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.4vw, 1.15rem);
  line-height: 1.55;
}

.element-fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.element-fact-grid > div {
  min-width: 0;
  border: 1px solid rgba(102, 223, 244, 0.18);
  border-radius: 9px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
}

.element-fact-grid dt {
  color: var(--soft);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.element-fact-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.element-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.72fr);
  gap: 14px;
  align-items: start;
}

.element-visual-library {
  border: 1px solid rgba(102, 223, 244, 0.18);
  border-radius: 18px;
  padding: clamp(18px, 3vw, 30px);
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--element-color) 12%, transparent), transparent 34%),
    rgba(4, 9, 18, 0.72);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

.element-visual-library-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.element-visual-library-heading .space-section-label {
  margin: 0 0 4px;
  text-align: left;
}

.element-visual-library-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
}

.element-visual-library-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
  text-align: right;
}

.element-visual-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.element-visual-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(102, 223, 244, 0.18);
  border-radius: 14px;
  background: rgba(2, 7, 18, 0.76);
}

.element-visual-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: rgba(1, 5, 14, 0.5);
}

.element-visual-card figcaption {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.element-visual-card figcaption strong {
  font-size: 0.82rem;
}

.element-visual-accuracy {
  justify-self: start;
  border: 1px solid rgba(102, 223, 244, 0.24);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 850;
  line-height: 1.2;
}

.element-visual-accuracy--exact {
  border-color: rgba(117, 237, 205, 0.42);
  color: #75edcd;
}

.element-visual-accuracy--approximation,
.element-visual-accuracy--teaching,
.element-visual-accuracy--caution {
  border-style: dashed;
  border-color: rgba(247, 217, 94, 0.46);
  color: var(--accent);
}

.element-visual-accuracy--illustrative {
  border-style: dashed;
  border-color: rgba(216, 156, 255, 0.46);
  color: #d89cff;
}

.element-story,
.element-sidebar section {
  border-radius: 16px;
  padding: clamp(20px, 3vw, 34px);
}

.element-story {
  display: grid;
  gap: 12px;
}

.element-story section + section {
  border-top: 1px solid rgba(102, 223, 244, 0.14);
  padding-top: 20px;
}

.element-story h2,
.element-sidebar h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.element-story p,
.element-story li,
.element-sidebar p,
.element-source-list li {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.element-story p {
  margin: 8px 0 0;
}

.element-story ul {
  margin: 10px 0 0;
  padding-left: 22px;
}

.element-sidebar {
  display: grid;
  gap: 12px;
}

.element-sidebar .space-section-label {
  margin: 0 0 4px;
  text-align: left;
}

.element-sidebar p {
  margin: 9px 0 0;
}

.element-connection-rule {
  border-top: 1px dashed rgba(247, 217, 94, 0.3);
  padding-top: 9px;
  color: var(--accent) !important;
  font-size: 0.78rem !important;
}

.element-source-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.element-source-list a {
  color: var(--accent-cool);
}

.element-sequence-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-radius: 14px;
  padding: 10px;
}

.element-sequence-nav a {
  display: grid;
  min-height: 46px;
  border: 1px solid rgba(102, 223, 244, 0.26);
  border-radius: 9px;
  padding: 8px 12px;
  place-items: center;
  color: var(--accent-cool);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.element-sequence-nav a:hover,
.element-sequence-nav a:focus-visible {
  border-color: rgba(247, 217, 94, 0.56);
  color: var(--accent);
  outline: none;
}

.element-not-found {
  display: grid;
  min-height: 60vh;
  border-radius: 18px;
  padding: 36px;
  place-items: center;
  text-align: center;
}

.element-not-found[hidden] {
  display: none;
}

.element-not-found .space-section-label {
  margin: 0;
}

.element-not-found h1 {
  margin: 8px 0;
  font-size: clamp(2rem, 5vw, 4rem);
}

body[data-accessible-view] .periodic-table-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: none;
  min-width: 0;
}

body[data-accessible-view] .periodic-element {
  grid-column: auto !important;
  grid-row: auto !important;
  min-height: 100px;
}

body[data-accessible-view] .periodic-group-label,
body[data-accessible-view] .periodic-series-bridge {
  display: none;
}

body[data-accessible-view] .element-hero,
body[data-accessible-view] .element-content-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 1080px) {
  .natural-core-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .natural-core-view-switcher {
    grid-column: 1 / -1;
  }

  .natural-core-result-count {
    align-self: center;
    margin: 0;
  }

  .element-hero {
    grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  }

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

@media (max-width: 760px) {
  .wing-shell--natural-core,
  .wing-shell--element {
    padding: 8px;
  }

  .natural-core-header,
  .element-topbar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .natural-core-heading,
  .element-topbar .space-topline {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .natural-core-header > .direct-link:first-child,
  .element-topbar > .direct-link:first-child {
    justify-self: start;
  }

  .natural-core-header > .direct-link:last-child,
  .element-topbar > .direct-link:last-child {
    justify-self: end;
  }

  .natural-core-status-band,
  .natural-core-controls,
  .element-hero,
  .element-content-grid,
  .element-visual-library-heading {
    grid-template-columns: 1fr;
  }

  .element-visual-library-heading > p {
    text-align: left;
  }

  .natural-core-status-band > div + div {
    border-top: 1px dashed rgba(216, 156, 255, 0.46);
    border-left: 0;
  }

  .natural-core-view-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .natural-core-search,
  .natural-core-filter,
  .natural-core-result-count {
    grid-column: 1 / -1;
  }

  .natural-core-result-count {
    text-align: left;
  }

  .natural-core-preview {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 12px;
  }

  .natural-core-preview-symbol {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    font-size: 1.5rem;
  }

  .natural-core-preview-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .natural-core-section-heading {
    display: grid;
    gap: 6px;
  }

  .natural-core-section-heading > p {
    text-align: left;
  }

  .periodic-table-viewport {
    overflow-x: hidden;
  }

  .periodic-table-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    gap: 8px;
    min-width: 0;
  }

  .periodic-group-label,
  .periodic-series-bridge {
    display: none;
  }

  .periodic-element {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 112px;
    padding: 10px;
  }

  .periodic-element-symbol {
    font-size: 2rem;
  }

  .periodic-element-name {
    font-size: 0.72rem;
  }

  .periodic-element-state {
    top: 8px;
    right: 8px;
    max-width: 76px;
    font-size: 0.52rem;
  }

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

  .element-visual {
    min-height: 380px;
  }

  .element-intro {
    padding: 24px 20px 28px;
  }

  .element-fact-grid {
    grid-template-columns: 1fr;
  }

  .element-sequence-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .natural-core-heading h1 {
    font-size: 2rem;
  }

  .natural-core-header,
  .natural-core-controls,
  .natural-core-collection {
    border-radius: 12px;
  }

  .natural-core-view-switcher {
    grid-template-columns: 1fr;
  }

  .natural-core-family-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .natural-core-legend-item {
    justify-self: stretch;
    min-width: 0;
  }

  .theoretical-element-grid {
    grid-template-columns: 1fr;
  }

  .element-visual-grid {
    grid-template-columns: 1fr;
  }

  .element-visual {
    min-height: 330px;
  }

  .element-orbit {
    width: 210px;
    height: 210px;
  }

  .element-intro h1 {
    font-size: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .periodic-element,
  .theoretical-element {
    transition: none;
  }

  .periodic-element:hover,
  .theoretical-element:hover {
    transform: none;
  }
}
