.decay-shell {
  min-height: calc(100svh - 72px);
  padding: clamp(24px, 4vw, 58px);
  overflow: hidden;
  background:
    radial-gradient(circle at 79% 19%, rgba(255,42,168,.2), transparent 28rem),
    radial-gradient(circle at 5% 86%, rgba(85,222,244,.14), transparent 30rem),
    linear-gradient(rgba(131,243,157,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(131,243,157,.04) 1px, transparent 1px),
    #050507;
  background-size: auto, auto, 31px 31px, 31px 31px, auto;
}

.decay-heading {
  margin-bottom: clamp(30px, 5vw, 66px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 36px;
}
.decay-heading .lab-return { margin-bottom: 24px; }
.decay-heading .mono {
  margin: 0 0 15px;
  color: var(--cyan);
  font-size: .68rem;
  font-weight: 800;
}
.decay-heading h1 {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 2vw, 34px);
  color: var(--cream);
  font-size: clamp(4.5rem, 10vw, 10.5rem);
  font-weight: 950;
  letter-spacing: -.1em;
  line-height: .64;
  text-shadow: 8px 4px 0 var(--pink), -4px -2px 0 var(--cyan);
}
.decay-heading h1 span:last-child {
  color: transparent;
  -webkit-text-stroke: 2px var(--cream);
  text-shadow: 7px 4px 0 rgba(131,243,157,.48), -4px -2px 0 rgba(255,42,168,.85);
  transform: translateY(22%);
}
.decay-instruction {
  margin: 0 0 -8px;
  max-width: 11ch;
  color: var(--toxic);
  font-family: "Instrument Serif Weird", Georgia, serif;
  font-size: clamp(2.1rem, 4vw, 4.2rem);
  font-style: italic;
  line-height: .86;
  transform: rotate(-4deg);
  text-shadow: 3px 2px 0 rgba(255,42,168,.48);
}

.decay-machine {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 355px) minmax(0, 1fr);
  border: 2px solid rgba(255,251,220,.76);
  background: #08080c;
  box-shadow: 13px 13px 0 rgba(255,42,168,.34), 0 34px 90px rgba(0,0,0,.68);
}
.decay-machine::before {
  content: "";
  position: absolute;
  z-index: 5;
  top: -7px;
  left: 18%;
  width: 22%;
  height: 4px;
  background: var(--toxic);
  box-shadow: 28vw 0 0 var(--cyan), 49vw 0 0 var(--pink);
}

.source-terminal {
  min-width: 0;
  padding: 23px;
  display: flex;
  flex-direction: column;
  gap: 17px;
  border-right: 1px solid rgba(255,251,220,.4);
  background:
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(255,255,255,.018) 5px),
    linear-gradient(155deg, #16131c, #08080c 54%, #07130d);
}
.terminal-label,
.field-header {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--cyan);
  font: 800 .61rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}
.terminal-label b { color: var(--toxic); font-weight: 800; }
.message-label {
  color: var(--muted);
  font: 800 .61rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}
#messageInput {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  padding: 18px;
  border: 1px solid rgba(85,222,244,.46);
  border-radius: 0;
  outline: none;
  background:
    linear-gradient(rgba(85,222,244,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85,222,244,.035) 1px, transparent 1px),
    #040407;
  background-size: 18px 18px, 18px 18px, auto;
  color: var(--cream);
  caret-color: var(--pink);
  font: 850 1.05rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .045em;
  text-transform: uppercase;
  box-shadow: inset 4px 0 0 rgba(255,42,168,.62);
}
#messageInput:focus { border-color: var(--toxic); box-shadow: inset 4px 0 0 var(--pink), 0 0 0 2px rgba(131,243,157,.12); }
.input-note {
  margin: -7px 0 0;
  color: #686672;
  font: 700 .56rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .1em;
}
.decay-actions { display: grid; gap: 9px; }
.decay-actions .hot { min-height: 54px; }
.decay-actions .lab-button:not(.hot) { width: calc(50% - 5px); }
.decay-actions #restoreSource { margin-top: -53px; margin-left: calc(50% + 5px); }

.signal-readout {
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 18px;
  border: 1px solid rgba(255,42,168,.36);
  background: rgba(0,0,0,.38);
}
.signal-readout > div { display: grid; gap: 7px; }
.signal-readout span {
  color: var(--muted);
  font: 750 .55rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}
.signal-readout b {
  color: var(--cream);
  font: 950 1.5rem/.9 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.signal-readout > div:nth-child(2) { text-align: right; }
.retention-meter {
  grid-column: 1 / -1;
  height: 7px;
  border: 1px solid #3a3842;
  background: #030305;
}
.retention-meter i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--toxic));
  box-shadow: 0 0 15px rgba(131,243,157,.64);
  transition: width .25s steps(4), filter .25s;
}
#decayStatus {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.3em;
  color: var(--cyan);
  font: 800 .59rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .11em;
}

.experiment-switcher { margin-top: auto; padding-top: 3px; }
.experiment-switcher > p { margin: 0 0 8px; color: var(--muted); font-size: .58rem; }
.experiment-switcher > a,
.experiment-switcher > div {
  padding: 10px 0;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 9px;
  border-top: 1px solid #302e37;
  color: inherit;
  text-decoration: none;
}
.experiment-switcher b { color: var(--pink); font: 900 .9rem/1 ui-monospace, monospace; }
.experiment-switcher span { font-size: .72rem; font-weight: 850; letter-spacing: .075em; }
.experiment-switcher small { display: block; margin-top: 5px; color: var(--cyan); font: 700 .53rem/1 ui-monospace, monospace; letter-spacing: .1em; }
.experiment-switcher a:hover,
.experiment-switcher a:focus-visible { background: linear-gradient(90deg, rgba(85,222,244,.12), transparent); }
.experiment-switcher .current { background: linear-gradient(90deg, rgba(255,42,168,.15), transparent); }
.experiment-switcher .current b { color: var(--yellow); text-shadow: 0 0 11px var(--pink); }
.experiment-switcher .current small { color: var(--toxic); }

.decay-field {
  min-width: 0;
  min-height: 760px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(rgba(85,222,244,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85,222,244,.045) 1px, transparent 1px),
    radial-gradient(circle at 72% 48%, rgba(255,42,168,.13), transparent 40%),
    #030306;
  background-size: 26px 26px, 26px 26px, auto, auto;
}
.field-header {
  position: relative;
  z-index: 3;
  min-height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(85,222,244,.38);
  background: rgba(3,3,6,.78);
}
.field-header b { color: var(--pink); font-weight: 800; }
.echo-stack {
  position: relative;
  z-index: 2;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
}
.echo-row {
  --damage: 0;
  min-height: 48px;
  width: 100%;
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 14px;
  padding: 10px 13px;
  overflow: hidden;
  border: 1px solid rgba(255,251,220, calc(.34 - var(--damage) * .002));
  border-radius: 0;
  background: linear-gradient(90deg, rgba(255,42,168,calc(.13 - var(--damage) * .0008)), rgba(4,4,7,.78) 35%, rgba(85,222,244,.035));
  color: rgba(255,251,220, calc(1 - var(--damage) * .006));
  font: 800 clamp(.72rem, 1.25vw, 1rem)/1.28 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: calc(.04em + var(--damage) * .001em);
  text-align: left;
  cursor: pointer;
  transform: translateX(calc(var(--damage) * .13px));
  animation: echo-arrive .25s steps(3) both;
}
.echo-row::after {
  content: "";
  position: absolute;
  right: calc(var(--damage) * -.4%);
  bottom: 5px;
  width: calc(var(--damage) * 1%);
  height: 2px;
  background: var(--pink);
  box-shadow: 0 -12px 0 rgba(85,222,244,.7);
}
.echo-generation { color: var(--cyan); font-size: .58rem; letter-spacing: .1em; }
.echo-text { min-width: 0; overflow-wrap: anywhere; }
.echo-loss { color: var(--toxic); font-size: .56rem; text-align: right; letter-spacing: .08em; }
.echo-row.terminal-loss { border-color: rgba(255,42,168,.5); color: rgba(255,42,168,.68); }
.echo-row.terminal-loss .echo-loss { color: var(--pink); }
.empty-receiver {
  min-height: 100%;
  display: grid;
  place-items: center;
  color: #5a5863;
  font: 800 .68rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
  text-align: center;
}
.empty-receiver span::after { content: "_"; color: var(--toxic); animation: receiver-blink .75s steps(2) infinite; }
.field-noise {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.04) 4px);
  mix-blend-mode: screen;
}

body.decaying .decay-machine { animation: machine-kick .18s steps(2) 2; }
body.decaying .decay-heading h1 span:last-child { animation: title-decay .24s steps(2) 3; }
@keyframes echo-arrive { from { opacity: 0; transform: translateX(-22px) skewX(-8deg); filter: blur(4px); } }
@keyframes receiver-blink { 50% { opacity: 0; } }
@keyframes machine-kick { 50% { transform: translate(3px,-1px); filter: saturate(1.35); } }
@keyframes title-decay { 50% { transform: translate(8px, 22%); text-shadow: 15px 3px 0 var(--pink), -11px -2px 0 var(--cyan); } }

@media (max-width: 980px) {
  .decay-heading { grid-template-columns: 1fr; align-items: start; }
  .decay-instruction { justify-self: end; margin-top: -20px; }
  .decay-machine { grid-template-columns: 1fr; }
  .source-terminal { border-right: 0; border-bottom: 1px solid rgba(255,251,220,.4); }
  .decay-field { min-height: 650px; }
  .experiment-switcher { margin-top: 12px; }
}

@media (max-width: 620px) {
  .decay-shell { padding: 28px 12px 40px; }
  .decay-heading { gap: 20px; margin-bottom: 36px; }
  .decay-heading h1 { display: grid; gap: 12px; font-size: clamp(4.4rem, 23vw, 6.4rem); line-height: .58; }
  .decay-heading h1 span:last-child { transform: translate(8%,0); }
  .decay-instruction { margin: 0 12px 0 0; font-size: 2.3rem; }
  .decay-machine { box-shadow: 7px 7px 0 rgba(255,42,168,.34); }
  .source-terminal { padding: 17px 14px; }
  #messageInput { min-height: 150px; font-size: .94rem; }
  .decay-actions .lab-button:not(.hot) { width: 100%; }
  .decay-actions #restoreSource { margin: 0; }
  .decay-field { min-height: 610px; }
  .field-header { padding: 0 13px; font-size: .54rem; }
  .echo-stack { padding: 13px 10px; gap: 7px; }
  .echo-row { grid-template-columns: 40px minmax(0,1fr); gap: 9px; padding: 9px; font-size: .68rem; }
  .echo-loss { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .empty-receiver span::after { animation: none; }
}
