:root {
  color-scheme: dark;
  --bg: #080d15;
  --panel: #0e1621;
  --line: #243142;
  --muted: #9aaac0;
  --text: #e8eef6;
  --cyan: #88dbe9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.6 system-ui,
    sans-serif;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.13em;
}
header a {
  text-decoration: none;
  color: var(--text);
}
header a span {
  color: var(--muted);
  margin-left: 14px;
}
.badge {
  color: var(--cyan);
}
main {
  max-width: 1350px;
  padding: 28px;
  margin: auto;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 24px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--cyan);
  margin: 0 0 12px;
}
h1 {
  font:
    400 clamp(28px, 4vw, 48px) / 1.1 Georgia,
    serif;
  letter-spacing: -0.03em;
  margin: 0;
}
h2 {
  font-weight: 400;
  font-size: 23px;
  line-height: 1.25;
  margin: 8px 0 12px;
}
.intro > p,
.caption,
.hint,
.bottom p,
footer {
  color: var(--muted);
}
.intro > p {
  font-size: 12px;
  margin: 0;
}
.lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.view {
  min-width: 0;
  padding: 24px;
  background: #070c14;
}
.view-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.view-heading h2 {
  font:
    32px Georgia,
    serif;
  margin: 5px 0 0;
}
#slice-label {
  font-size: 11px;
  color: var(--muted);
}
.canvas-wrap {
  position: relative;
  max-width: 620px;
  margin: 8px auto 0;
  aspect-ratio: 1;
}
#field {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.axis {
  position: absolute;
  color: #899aae;
  font: 10px monospace;
  pointer-events: none;
}
.vertical {
  top: 9px;
  left: 52%;
}
.horizontal {
  right: 7px;
  top: 52%;
}
#empty {
  position: absolute;
  top: 42%;
  left: 10%;
  right: 10%;
  text-align: center;
  color: var(--muted);
  background: #070c14cc;
  padding: 14px;
}
.legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  color: #c1cddc;
  flex-wrap: wrap;
}
.legend > span:first-child {
  width: 86px;
  height: 5px;
  border-radius: 5px;
}
.phase-gradient {
  background: linear-gradient(
    90deg,
    #f66f68,
    #a380d3,
    #50dbe8,
    #a3c97d,
    #f66f68
  );
}
.density-gradient {
  background: linear-gradient(90deg, #070c14, #77dcf4);
}
.readout {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font: 10px/1.5 monospace;
  color: var(--muted);
  margin: 14px 0;
}
.caption {
  font-size: 11px;
  max-width: 600px;
  margin: 14px auto 0;
}
#render-status {
  font-size: 10px;
  color: var(--muted);
  margin: 8px 0 0;
}
.controls {
  padding: 24px;
  border-left: 1px solid var(--line);
}
button,
select,
input {
  font: inherit;
  color: inherit;
}
button,
select {
  background: #101c2a;
  border: 1px solid #33435a;
  border-radius: 4px;
}
button {
  cursor: pointer;
  min-height: 40px;
}
button:hover {
  border-color: var(--cyan);
}
button[aria-pressed="true"] {
  border-color: var(--cyan);
  background: #15303b;
  color: #bdf2f4;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid #efbd80;
  outline-offset: 4px;
}
.presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.presets button {
  text-align: left;
  padding: 9px 12px;
  font-size: 17px;
}
.presets small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.quantum-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.quantum-numbers label {
  font-size: 10px;
  color: var(--muted);
}
select {
  display: block;
  min-height: 40px;
  padding: 6px;
  width: 100%;
  margin-top: 6px;
}
.hint {
  font-size: 10px;
  margin: 10px 0 0;
}
.divider {
  border-top: 1px solid var(--line);
  margin: 22px 0;
}
.segments {
  display: flex;
  gap: 6px;
}
.segments button {
  font-size: 11px;
  padding: 8px;
  flex: 1;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  margin-top: 15px;
}
.row select {
  width: 135px;
  margin: 0;
}
.slider-label {
  display: flex;
  justify-content: space-between;
  margin: 18px 0 6px;
  font-size: 11px;
}
output {
  color: var(--cyan);
  font-family: monospace;
}
input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}
.reset {
  font-size: 11px;
  width: 100%;
  margin-top: 14px;
  background: transparent;
}
dl {
  font-size: 12px;
  margin: 0;
}
dl div {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  font-family: monospace;
}
.bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}
.bottom p {
  font-size: 12px;
  max-width: 410px;
}
.bottom .eyebrow {
  font-size: 10px;
  color: var(--cyan);
}
.radial {
  min-width: 0;
}
#radial {
  width: 100%;
  height: 150px;
  display: block;
}
.radial .readout {
  margin: 0;
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 10px;
  padding-top: 14px;
}
footer a {
  color: var(--cyan);
  white-space: nowrap;
}
@media (max-width: 760px) {
  header {
    padding: 16px;
  }
  header a span {
    display: none;
  }
  main {
    padding: 18px 12px;
  }
  .intro {
    display: block;
  }
  .intro > p {
    margin-top: 12px;
  }
  .lab {
    grid-template-columns: 1fr;
  }
  .view {
    padding: 18px 12px;
  }
  .controls {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px;
  }
  .bottom {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 26px 8px;
  }
  .bottom h2 {
    font-size: 22px;
  }
  .view-heading h2 {
    font-size: 26px;
  }
  #slice-label {
    font-size: 10px;
  }
  .quantum-numbers {
    margin-top: 14px;
  }
  .controls .divider {
    margin: 18px 0;
  }
  .readout {
    flex-wrap: wrap;
  }
  footer {
    align-items: flex-start;
    padding: 14px 8px;
  }
  .canvas-wrap {
    max-width: 460px;
  }
}
.stage {
  position: relative;
  min-height: 740px;
  background: #080d16;
  overflow: hidden;
  isolation: isolate;
}
#volume {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#volume:active {
  cursor: grabbing;
}
#volume:focus-visible {
  outline: 2px solid #efbd80;
  outline-offset: -4px;
}
.stage-top,
.stage-bottom {
  position: absolute;
  left: 28px;
  right: 28px;
  pointer-events: none;
}
.stage-top {
  top: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.stage-top h2 {
  font:
    46px Georgia,
    serif;
  margin: 4px 0;
}
.stage-top h2 span {
  font: 12px monospace;
  color: var(--muted);
  margin-left: 14px;
}
#energy {
  font: 12px monospace;
  color: var(--cyan);
}
.stage-bottom {
  bottom: 20px;
  text-align: center;
}
#interaction-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 14px;
}
.stage-bottom .legend {
  font-size: 9px;
  letter-spacing: 0.1em;
}
#extent {
  font: 10px monospace;
  color: var(--muted);
  margin: 10px 0 0;
}
.numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.numbers label {
  font-size: 10px;
  color: var(--muted);
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  font-size: 12px;
  cursor: pointer;
}
.check input {
  accent-color: var(--cyan);
  width: 17px;
  height: 17px;
}
.view-buttons {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.view-buttons button {
  flex: 1;
  font-size: 10px;
  padding: 4px;
}
#export {
  background: transparent;
  width: 100%;
  margin-top: 16px;
  font-size: 12px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-top: 0;
}
.facts > div {
  padding: 20px;
  border-right: 1px solid var(--line);
}
.facts > div:last-child {
  border: 0;
}
.facts span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.facts strong {
  font-size: 16px;
  display: block;
  margin-top: 6px;
  font-weight: 400;
}
.notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 55px;
  padding: 36px 0 20px;
}
.notes p:not(.eyebrow) {
  font-size: 12px;
  color: var(--muted);
  max-width: 480px;
}
#loading,
#error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #080d16e8;
  z-index: 3;
  padding: 30px;
  text-align: center;
}
#loading[hidden],
#error[hidden] {
  display: none;
}
#error a {
  color: var(--cyan);
  margin-top: 18px;
}
#retry {
  padding: 8px 22px;
}
.loader {
  width: 32px;
  height: 32px;
  border: 1px solid #3b596c;
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#loading p {
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 760px) {
  .stage {
    min-height: 480px;
    height: 65svh;
    max-height: 650px;
  }
  .stage-top {
    left: 18px;
    right: 18px;
    top: 18px;
  }
  .stage-top h2 {
    font-size: 34px;
  }
  .stage-top .eyebrow {
    font-size: 8px;
  }
  .stage-bottom {
    left: 12px;
    right: 12px;
    bottom: 14px;
  }
  .facts {
    grid-template-columns: 1fr 1fr;
  }
  .facts > div {
    padding: 15px;
  }
  .facts strong {
    font-size: 13px;
  }
  .notes {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 28px 8px;
  }
  .notes h2 {
    font-size: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .loader {
    animation: none;
  }
}

.compass {
  position: absolute;
  left: 18px;
  bottom: 95px;
  width: 84px;
  height: 84px;
  pointer-events: none;
  opacity: 0.8;
}
@media (max-width: 760px) {
  .compass {
    left: 8px;
    bottom: 86px;
    width: 65px;
    height: 65px;
  }
}
/* Keep interface overlays above the GPU canvas in browser compositing. */
#volume {
  z-index: 0;
}
.stage-top,
.stage-bottom,
.compass {
  z-index: 1;
  transform: translateZ(0);
}

.density-swatch {
  background: #59ccf5;
}
