.decay-lab {
  --decay-serif: "Playfair Display", "Bodoni 72", "Didot", georgia, serif;
  --decay-sans: "Inter", "Avenir Next", "Segoe UI", arial, sans-serif;
  --decay-ink: #161a16;
  --decay-muted: #687166;
  --decay-paper: #fbfaf6;
  --decay-panel: rgba(247, 244, 234, 0.72);
  --decay-line: rgba(22, 26, 22, 0.16);
  --decay-live: #219f73;
  --decay-spent: #262b31;
  --decay-hot: #e34d3d;
  --decay-gold: #d5a21b;
  --decay-field-bg: rgba(255, 255, 255, 0.34);
  --decay-control-bg: rgba(255, 255, 255, 0.66);
  --decay-grid-line: rgba(22, 26, 22, 0.045);
  --decay-curve-ghost: rgba(22, 26, 22, 0.12);
  --decay-shadow: rgba(28, 24, 16, 0.12);

  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  width: min(100%, 1120px);
  padding: clamp(1.25rem, 3vw, 2.75rem);
  color: var(--decay-ink);
  background:
    linear-gradient(90deg, var(--decay-grid-line) 1px, transparent 1px),
    linear-gradient(0deg, var(--decay-grid-line) 1px, transparent 1px),
    radial-gradient(circle at 18% 16%, rgba(227, 77, 61, 0.08), transparent 32%),
    var(--decay-paper);
  background-size: 22px 22px, 22px 22px, auto, auto;
  box-shadow: 0 28px 90px var(--decay-shadow);
}

.theme-dark .decay-lab {
  --decay-ink: #f5f1e3;
  --decay-muted: #aeb8ad;
  --decay-paper: #111611;
  --decay-panel: rgba(27, 35, 29, 0.7);
  --decay-line: rgba(245, 241, 227, 0.17);
  --decay-live: #59dda0;
  --decay-spent: #727883;
  --decay-hot: #ff705c;
  --decay-gold: #f0be45;
  --decay-field-bg: rgba(6, 10, 8, 0.38);
  --decay-control-bg: rgba(21, 28, 24, 0.82);
  --decay-grid-line: rgba(245, 241, 227, 0.055);
  --decay-curve-ghost: rgba(245, 241, 227, 0.15);
  --decay-shadow: rgba(0, 0, 0, 0.36);
}

.decay-stage,
.decay-console {
  min-width: 0;
}

.decay-stage {
  display: grid;
  align-content: start;
  min-height: 520px;
}

.decay-stage-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1rem, 3vw, 2rem);
}

.decay-kicker,
.decay-field span,
.decay-results span {
  margin: 0;
  color: var(--decay-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

.decay-kicker {
  color: var(--decay-hot);
}

.decay-stage h2 {
  max-width: 8ch;
  margin: 0.25rem 0 0;
  font-size: 3.6rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.82;
}

.decay-seed-button,
.decay-jumps button {
  min-height: 42px;
  border: 0;
  color: var(--decay-ink);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}

.decay-seed-button {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--decay-hot);
}

.decay-curve {
  width: 100%;
  height: auto;
  margin-bottom: clamp(0.8rem, 3vw, 1.6rem);
  overflow: visible;
}

.decay-curve-ghost,
.decay-curve-line {
  fill: none;
  stroke-linecap: round;
}

.decay-curve-ghost {
  stroke: var(--decay-curve-ghost);
  stroke-width: 2;
}

.decay-curve-line {
  stroke: var(--decay-live);
  stroke-width: 4;
  transition: stroke-dashoffset 400ms cubic-bezier(0.25, 1, 0.5, 1);
}

.decay-curve-marker {
  fill: var(--decay-hot);
  stroke: var(--decay-paper);
  stroke-width: 4;
  filter: drop-shadow(0 0 14px rgba(227, 77, 61, 0.45));
  transition:
    cx 400ms cubic-bezier(0.25, 1, 0.5, 1),
    cy 400ms cubic-bezier(0.25, 1, 0.5, 1),
    opacity 400ms ease;
}

.decay-field-art {
  width: 100%;
  min-height: 280px;
  overflow: visible;
  background:
    radial-gradient(circle at 50% 50%, var(--decay-field-bg), transparent 64%);
}

.decay-atom {
  fill: var(--decay-live);
  filter: drop-shadow(0 0 10px rgba(33, 159, 115, 0.32));
  opacity: 0.94;
  transform-origin: center;
  transform-box: fill-box;
  animation: atom-materialize 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--delay);
  transition:
    fill 600ms ease,
    opacity 600ms ease,
    filter 600ms ease,
    transform 600ms cubic-bezier(0.25, 1, 0.5, 1);
}

.decay-atom-spent {
  fill: var(--decay-spent);
  filter: blur(4px) drop-shadow(0 0 4px rgba(38, 43, 49, 0.12));
  opacity: 0.3;
  transform: scale(0.82);
}

.decay-atom-decaying {
  animation: atom-quantum-decay 600ms cubic-bezier(0.25, 1, 0.5, 1) both;
}

.decay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--decay-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.decay-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.decay-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
}

.decay-dot-live {
  background: var(--decay-live);
}

.decay-dot-spent {
  background: var(--decay-spent);
  opacity: 0.48;
}

.decay-console {
  display: grid;
  align-content: start;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.decay-select-block,
.decay-field {
  display: grid;
  gap: 0.72rem;
}

.decay-field output,
.decay-results strong {
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.9;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.decay-field output {
  font-size: 2.15rem;
}

.decay-select-shell {
  position: relative;
  display: block;
}

.decay-select-shell::after {
  position: absolute;
  top: 50%;
  right: 0.05rem;
  width: 0.52rem;
  height: 0.52rem;
  border-right: 1px solid var(--decay-ink);
  border-bottom: 1px solid var(--decay-ink);
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.decay-field select {
  width: 100%;
  min-height: 56px;
  padding: 0.15rem 2rem 0.15rem 0;
  border: 0;
  border-bottom: 1px solid var(--decay-line);
  border-radius: 0;
  outline: none;
  appearance: none;
  color: var(--decay-ink);
  background: transparent;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
}

.decay-field select option {
  color: var(--decay-ink);
  background: var(--decay-paper);
}

.theme-dark .decay-field select option {
  color: #f5f1e3;
  background: #111611;
}

.decay-field select::-ms-expand {
  display: none;
}

.decay-field input[type='range'] {
  width: 100%;
  height: 30px;
  margin: 0;
  appearance: none;
  background: transparent;
}

.decay-field input[type='range']::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--decay-line);
}

.decay-field input[type='range']::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -8.5px;
  border: 3px solid var(--decay-paper);
  border-radius: 50%;
  appearance: none;
  background: var(--decay-hot);
  box-shadow: 0 0 0 1px var(--decay-hot), 0 10px 24px rgba(227, 77, 61, 0.24);
  transition: transform 360ms ease, box-shadow 360ms ease;
}

.decay-field input[type='range']::-moz-range-track {
  height: 1px;
  background: var(--decay-line);
}

.decay-field input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--decay-paper);
  border-radius: 50%;
  background: var(--decay-hot);
  box-shadow: 0 0 0 1px var(--decay-hot), 0 10px 24px rgba(227, 77, 61, 0.24);
  transition: transform 360ms ease, box-shadow 360ms ease;
}

.decay-field input[type='range']:is(:hover, :focus-visible)::-webkit-slider-thumb {
  transform: scale(1.18);
  box-shadow: 0 0 0 1px var(--decay-hot), 0 14px 30px rgba(227, 77, 61, 0.32);
}

.decay-field input[type='range']:is(:hover, :focus-visible)::-moz-range-thumb {
  transform: scale(1.18);
  box-shadow: 0 0 0 1px var(--decay-hot), 0 14px 30px rgba(227, 77, 61, 0.32);
}

.decay-use {
  display: grid;
  min-height: 58px;
  place-items: center;
  padding: 0.9rem 1.15rem;
  color: var(--decay-muted);
  background: var(--decay-panel);
  font-size: 0.86rem;
  font-weight: 450;
  line-height: 1.35;
  text-align: center;
}

.decay-jumps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.decay-jumps button {
  padding: 0;
  color: var(--decay-muted);
}

.decay-jumps button:hover {
  color: var(--decay-hot);
}

.decay-results {
  display: grid;
  gap: 1.1rem;
}

.decay-metric {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
  padding: 0;
}

.decay-results strong {
  display: block;
  font-size: 1.95rem;
}

@keyframes atom-materialize {
  from {
    opacity: 0;
    transform: scale(0.62);
  }
}

@keyframes atom-quantum-decay {
  0% {
    fill: var(--decay-live);
    opacity: 0.94;
    filter: blur(0) drop-shadow(0 0 12px rgba(33, 159, 115, 0.34));
    transform: scale(1);
  }

  38% {
    fill: var(--decay-hot);
    opacity: 1;
    filter: blur(0.6px) drop-shadow(0 0 20px rgba(227, 77, 61, 0.36));
    transform: scale(1.15);
  }

  100% {
    fill: var(--decay-spent);
    opacity: 0.3;
    filter: blur(4px) drop-shadow(0 0 2px rgba(38, 43, 49, 0.1));
    transform: scale(0.82);
  }
}

@media (min-width: 860px) {
  .decay-lab {
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.72fr);
    align-items: start;
  }

  .decay-results {
    margin-top: 0.2rem;
  }

  .decay-stage h2 {
    font-size: 8rem;
  }

  .decay-field output {
    font-size: 3.05rem;
  }

  .decay-field select {
    font-size: 2.2rem;
  }

  .decay-results strong {
    font-size: 2.55rem;
  }
}
