:root {
  --bg: #05070b;
  --panel: #0d1118;
  --panel2: #111722;
  --line: rgba(77,166,255,0.22);
  --line-strong: rgba(77,166,255,0.42);
  --blue: #4da6ff;
  --fire: #ff6a1a;
  --gold: #ffd166;
  --green: #2ecc71;
  --red: #e63946;
  --text: #d8dde6;
  --muted: #798394;
  --muted2: #5f6877;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(77,166,255,0.14), transparent 32%),
    radial-gradient(circle at 84% 8%, rgba(255,106,26,0.13), transparent 30%),
    radial-gradient(circle at 50% 100%, rgba(46,204,113,0.05), transparent 35%),
    linear-gradient(180deg, #05070b 0%, #080a0f 100%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

.ee-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(8,10,15,0.90);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 42px; width: auto; opacity: 0.92; }

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.ee-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ee-site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; font: 700 11px/1.1 Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.ee-site-nav a { color: var(--text); text-decoration: none; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.035); border-radius: 999px; padding: 7px 10px; }
.ee-site-nav a:hover { color: var(--fire); border-color: rgba(255,106,26,0.55); }
.version { color: var(--blue); font-family: Consolas, monospace; font-size: 12px; letter-spacing: 0.04em; white-space: nowrap; }

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 18px 12px;
  background: linear-gradient(90deg, rgba(13,17,24,0.96), rgba(8,11,16,0.92));
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.kicker { color: var(--fire); font: 700 10px/1.1 Consolas, monospace; letter-spacing: .18em; text-transform: uppercase; }
.hero-strip h2 { margin: 5px 0 0; font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.data-status { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; text-align: right; min-width: 330px; }

.control-panel {
  display: grid;
  grid-template-columns: 1.5fr 1.4fr repeat(4, minmax(120px, .75fr));
  gap: 10px;
  align-items: end;
  padding: 12px 18px;
  background: rgba(13,17,24,0.94);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.control-wide { min-width: 220px; }
.control label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

input, select, button {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: #090d14;
  color: var(--text);
  padding: 0 9px;
  font: 13px "Segoe UI", system-ui, sans-serif;
}

input:focus, select:focus { outline: 1px solid rgba(77,166,255,0.45); border-color: rgba(77,166,255,0.55); }
button {
  cursor: pointer;
  border-color: rgba(77,166,255,0.35);
  color: var(--blue);
  background: linear-gradient(180deg, #101722, #090d14);
  font-weight: 650;
}
button:hover { border-color: rgba(255,106,26,0.62); color: var(--fire); }

@media (max-width: 980px) {
  .ee-header { align-items: flex-start; flex-direction: column; padding: 14px 16px; }
  .ee-header-right { align-items: flex-start; width: 100%; }
  .ee-site-nav { justify-content: flex-start; }
  .version { white-space: normal; }
}

.numeric-pair > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.axis-grid { grid-column: span 3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.button-row { grid-column: span 3; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.viewer-wrap {
  position: relative;
  height: calc(100vh - 74px - 78px - 146px - 36px);
  min-height: 590px;
}

#nuclideChart { width: 100%; height: 100%; }

.info-dock {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 306px;
  max-height: calc(100% - 32px);
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.info-card {
  padding: 13px 14px;
  background: rgba(8,12,18,0.88);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 0 32px rgba(0,0,0,0.45);
  overflow: hidden;
}

.info-card h3 {
  margin: 0 0 9px;
  color: var(--blue);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.info-card p { margin: 5px 0; color: #c6ccd6; font-family: Consolas, monospace; font-size: 12px; }
.info-card .small { margin-top: 9px; color: var(--muted); font-family: "Segoe UI", system-ui, sans-serif; font-size: 11px; line-height: 1.35; }

.selection-card { pointer-events: auto; }
.selected-empty { color: var(--muted); font-size: 12px; }
.nuclide-title { font: 700 18px/1.1 Consolas, monospace; color: #eef4ff; margin-bottom: 4px; }
.nuclide-subtitle { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.nuclide-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0; }
.nuclide-stat { background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.07); padding: 6px; border-radius: 4px; }
.nuclide-stat span { display:block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.nuclide-stat b { display:block; margin-top:2px; color: var(--text); font-family: Consolas, monospace; }
.detail-line { margin: 6px 0; color: #c9d0db; font-size: 12px; line-height: 1.35; }
.detail-line b { color: var(--blue); }

.legend-card { max-height: 300px; overflow: auto; }
.legend-row { display: flex; gap: 8px; align-items: center; margin: 5px 0; color: #c9d0db; font-size: 11px; }
.swatch { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(255,255,255,.25); flex: 0 0 auto; }
.legend-muted { color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 8px; }

footer {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  color: var(--muted2);
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(5,7,11,0.94);
}

@media (max-width: 1320px) {
  .control-panel { grid-template-columns: repeat(3, 1fr); }
  .axis-grid, .button-row { grid-column: span 3; }
  .viewer-wrap { height: calc(100vh - 74px - 82px - 245px - 36px); min-height: 520px; }
}

@media (max-width: 860px) {
  .ee-header, .hero-strip { flex-direction: column; align-items: flex-start; height: auto; padding: 12px 16px; }
  .data-status { text-align: left; min-width: 0; }
  .control-panel, .axis-grid, .button-row { grid-template-columns: 1fr; }
  .axis-grid, .button-row { grid-column: span 1; }
  .viewer-wrap { height: 640px; }
  .info-dock { position: static; width: auto; padding: 10px 14px; max-height: none; }
  footer { height: auto; min-height: 42px; flex-direction: column; align-items: flex-start; padding: 10px 16px; }
}

/* v0.5.5.7 · SCIENCE DETAIL PANEL */
.science-section {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.science-section h4 {
  margin: 0 0 7px;
  color: var(--fire);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.science-note {
  margin: 6px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.42;
}

.decay-branch {
  display: grid;
  grid-template-columns: minmax(58px, .8fr) 22px 1.6fr;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
  padding: 6px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 4px;
}

.branch-mode {
  color: #eef4ff;
  font-family: Consolas, monospace;
  font-size: 11px;
}

.branch-arrow {
  color: var(--fire);
  text-align: center;
}

.branch-daughter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.branch-coords {
  color: var(--muted);
  font-size: 10px;
  font-family: Consolas, monospace;
}

.daughter-jump {
  width: auto;
  height: 24px;
  padding: 0 8px;
  align-self: flex-start;
  font-size: 11px;
  border-color: rgba(255,106,26,.35);
  color: #ffd2bd;
}

.daughter-jump:disabled {
  opacity: .45;
  cursor: default;
}

.energy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.energy-cell {
  padding: 6px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 4px;
}

.energy-cell span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
}

.energy-cell b {
  display: block;
  margin-top: 2px;
  color: #dce7f5;
  font-family: Consolas, monospace;
  font-size: 11px;
}

.inline-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 6px -1px 0;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 2px;
}

.muted {
  color: var(--muted);
}

.data-source-section {
  opacity: .92;
}
/* v0.5.5.8 · RESPONSIVE LAYOUT PASS */
@media (orientation: portrait) and (min-width: 900px) {
  .viewer-wrap {
    min-height: calc(100vh - 150px);
  }

  .side-stack {
    width: min(420px, 42vw);
  }

  .selection-card {
    max-height: 52vh;
    overflow: auto;
  }

  #nuclideChart {
    min-height: 68vh;
  }
}

@media (orientation: landscape) and (min-width: 1101px) {
  .viewer-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 14px;
    padding: 14px;
    height: calc(100vh - 74px - 36px);
    min-height: 640px;
  }

  #nuclideChart {
    height: 100%;
    min-height: 620px;
    border: 1px solid rgba(77,166,255,0.14);
    border-radius: 8px;
    background: rgba(5,7,11,0.35);
  }

  .side-stack {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    max-height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .info-card {
    flex: 0 0 auto;
  }

  .selection-card {
    flex: 1 1 auto;
    min-height: 260px;
    overflow: auto;
  }

  .legend-card {
    max-height: 220px;
  }
}

@media (max-width: 900px) {
  .ee-header {
    height: auto;
    min-height: 68px;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    flex-direction: column;
  }

  .brand img {
    height: 34px;
  }

  h1 {
    font-size: 18px;
  }

  .version {
    font-size: 11px;
  }

  .intro-strip {
    padding: 12px 14px;
  }

  .intro-strip h2 {
    font-size: 15px;
  }

  .control-panel {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }

  .viewer-wrap {
    height: auto;
    min-height: 0;
    display: block;
    padding: 10px;
  }

  #nuclideChart {
    height: 72vh;
    min-height: 460px;
    border: 1px solid rgba(77,166,255,0.14);
    border-radius: 8px;
  }

  .side-stack {
    position: static;
    width: 100%;
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .orientation-card,
  .selection-card,
  .legend-card {
    display: block;
  }

  .selection-card {
    max-height: none;
  }

  .energy-grid {
    grid-template-columns: 1fr;
  }

  footer {
    height: auto;
    min-height: 36px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 14px;
  }
}

@media (max-width: 520px) {
  .nuclide-grid {
    grid-template-columns: 1fr;
  }

  .decay-branch {
    grid-template-columns: 1fr;
  }

  .branch-arrow {
    text-align: left;
  }

  #nuclideChart {
    height: 68vh;
    min-height: 390px;
  }
}
/* v0.5.5.8a · PORTRAIT FRAMING FIX */
@media (orientation: portrait) and (min-width: 900px) {
  .viewer-wrap {
    height: calc(100vh - 74px - 78px - 245px - 36px);
    min-height: 760px;
    padding-bottom: 22px;
  }

  #nuclideChart {
    height: 100%;
    min-height: 740px;
  }

  .info-dock,
  .side-stack {
    right: 18px;
    top: 14px;
    width: min(410px, 40vw);
  }

  .selection-card {
    max-height: 56vh;
  }
}

@media (orientation: portrait) and (min-width: 900px) and (max-height: 1400px) {
  .viewer-wrap {
    min-height: 700px;
  }

  #nuclideChart {
    min-height: 680px;
  }

  .selection-card {
    max-height: 48vh;
  }
}
/* v0.5.5.9 · DATA SOURCES AND PROVENANCE */
.sources-card {
  max-height: 260px;
  overflow: auto;
}

.sources-content {
  color: #c9d0db;
  font-size: 11px;
  line-height: 1.4;
}

.source-block {
  padding: 7px 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.source-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.source-title {
  color: var(--fire);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 10px;
  margin-bottom: 3px;
}

.source-line {
  color: #c9d0db;
  margin: 3px 0;
}

.source-line b {
  color: var(--blue);
}

.warning-note {
  color: #ffd2bd;
}