:root {
  --bg: #06030f;
  --panel: #0b0618;
  --border: #2a1a4a;
  --hex: #7b5ea7;
  --hex-bright: #b89ee8;
  --accent: #c084fc;
  --glow: #9333ea;
  --text: #e8dff5;
  --dim: #5a4a7a;
  --red: #e879a0;
  --blue-ghost: #60a5fa;
  --toxic: #4ade80;
  --font-serif: "IM Fell English", Georgia, serif;
  --font-mono: "Share Tech Mono", "IBM Plex Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: clamp(16px, 1.5vw, 22px);
  --lonely: 0.5;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  background-image:
    radial-gradient(ellipse 55% 45% at 50% 0%, #1a0530 0%, transparent 72%),
    radial-gradient(ellipse 42% 55% at 85% 100%, #0d0228 0%, transparent 58%);
}

a {
  color: var(--hex-bright);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-wrap {
  position: relative;
  z-index: 1;
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.site-header {
  margin-bottom: 1.75rem;
}

.site-header h1,
.glitch-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.25rem, 3.5vw, 1.85rem);
  color: var(--accent);
  text-shadow: 0 0 28px var(--glow), 0 0 56px #6d28d940;
  letter-spacing: 0.06em;
  position: relative;
  display: inline-block;
  margin: 0 0 0.35rem;
}

.glitch-title[data-text]::before,
.glitch-title[data-text]::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-style: italic;
  letter-spacing: 0.06em;
  opacity: 0;
  mix-blend-mode: screen;
}

.glitch-title[data-text]::before {
  color: var(--red);
  text-shadow: 0 0 10px var(--red);
  animation: title-ghost-r 5.5s steps(1, end) infinite;
}

.glitch-title[data-text]::after {
  color: var(--blue-ghost);
  text-shadow: 0 0 10px var(--blue-ghost);
  animation: title-ghost-b 5.5s steps(1, end) infinite;
}

@keyframes title-ghost-r {
  0%,
  94% {
    opacity: 0;
    transform: translate(0, 0);
  }
  95% {
    opacity: 0.55;
    transform: translate(-2px, 1px);
  }
  97% {
    opacity: 0.35;
    transform: translate(1px, -1px);
  }
  100% {
    opacity: 0;
  }
}

@keyframes title-ghost-b {
  0%,
  91% {
    opacity: 0;
    transform: translate(0, 0);
  }
  92% {
    opacity: 0.5;
    transform: translate(2px, -1px);
  }
  94% {
    opacity: 0.3;
    transform: translate(-1px, 1px);
  }
  100% {
    opacity: 0;
  }
}

.kicker {
  font-size: 0.65rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  margin-bottom: 0.5rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 0 48px #6d28d918, inset 0 0 36px #06030f70;
  padding: 1.25rem 1.35rem;
}

.panel + .panel {
  margin-top: 1rem;
}

.nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.nav-bar a {
  color: var(--dim);
}

.nav-bar a:hover {
  color: var(--hex-bright);
}

.nav-bar a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.serif-pull {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text);
}

body.garden-warm {
  background-image:
    radial-gradient(ellipse 50% 40% at 50% 100%, #2a1538 0%, transparent 65%),
    radial-gradient(ellipse 45% 50% at 15% 20%, #1a1030 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 50% 0%, #1a0530 0%, transparent 72%);
}

body.human-tint-a .site-wrap::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse 80% 50% at 50% 0%,
    rgba(232, 121, 160, calc(0.04 + var(--lonely) * 0.08)),
    transparent 70%
  );
}

body.human-symbol-wire {
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.25);
}

body.human-symbol-garden .site-wrap::after {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  height: 22%;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(0deg, rgba(74, 222, 128, 0.04), transparent);
}

@media (prefers-reduced-motion: reduce) {
  .glitch-title[data-text]::before,
  .glitch-title[data-text]::after {
    animation: none !important;
  }
}

.term-screen {
  background: #040208;
  min-height: 14rem;
  max-height: 22rem;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  line-height: 1.45;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 24px #00000080;
  cursor: text;
}

.term-line {
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.term-input-echo {
  color: var(--hex-bright);
}

.term-ok {
  color: var(--toxic);
}

.term-whisper {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--red);
  margin-top: 0.5rem;
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.term-input-row label {
  color: var(--accent);
  flex-shrink: 0;
}

.term-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0;
  outline: none;
}

.term-input-row input:focus {
  border-bottom-color: var(--accent);
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1.5rem 3rem;
  max-width: 36rem;
  margin: 0 auto;
}

.boot-line {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 2vw, 1rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0.35rem 0;
  color: var(--hex-bright);
}

#boot-hint {
  margin-top: 2rem;
  opacity: 0;
  transition: opacity 0.8s ease;
  font-size: 0.65rem;
  color: var(--dim);
  letter-spacing: 0.25em;
}

.memory-fragment {
  position: relative;
  padding: 1rem;
  margin-top: 0.75rem;
  cursor: crosshair;
  border: 1px dashed var(--border);
  min-height: 6rem;
}

.memory-fragment .hex-layer {
  font-size: 0.78rem;
  color: var(--hex);
  letter-spacing: 0.12em;
  transition: opacity 0.35s ease;
}

.memory-fragment .plain-layer {
  position: absolute;
  left: 1rem;
  top: 1rem;
  right: 1rem;
  opacity: 0;
  transition: opacity 0.45s ease;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--accent);
}

.memory-fragment:hover .hex-layer,
.memory-fragment:focus-within .hex-layer {
  opacity: 0.15;
}

.memory-fragment:hover .plain-layer,
.memory-fragment:focus-within .plain-layer {
  opacity: 1;
}

.memory-hotspot {
  position: absolute;
  width: 12px;
  height: 12px;
  bottom: 0.5rem;
  right: 0.5rem;
  opacity: 0.12;
  cursor: help;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  padding: 0;
}

.memory-hotspot:focus {
  outline: 1px solid var(--accent);
  opacity: 0.4;
}

.garden-stage {
  min-height: 10rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  margin-top: 0.75rem;
}

.garden-ground {
  position: absolute;
  z-index: 5;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(180deg, transparent, #0f0618);
}

.garden-plant {
  position: absolute;
  bottom: 28%;
  left: 50%;
  width: 4px;
  height: 2.5rem;
  margin-left: -2px;
  background: linear-gradient(180deg, var(--dim), var(--hex));
  border-radius: 2px;
  transform-origin: bottom center;
  transform: scaleY(0.35);
  opacity: 0.45;
  transition: transform 1.2s ease, opacity 1.2s ease, filter 1.2s ease;
}

.garden-stage[data-stage="1"] .garden-plant {
  transform: scaleY(1);
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(192, 132, 252, 0.45));
}

.garden-bloom {
  position: absolute;
  bottom: 52%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--red), transparent 70%);
  opacity: 0;
  transition: opacity 1s ease 0.2s;
}

.garden-stage[data-stage="1"] .garden-bloom {
  opacity: 0.85;
}

.human-form label.block {
  display: block;
  margin-bottom: 0.75rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
}

.human-form textarea {
  width: 100%;
  min-height: 6rem;
  background: #080412;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.65rem;
  resize: vertical;
}

.human-form button {
  margin-top: 0.85rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.65rem;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
}

.human-form button:hover {
  background: rgba(192, 132, 252, 0.12);
}

.echo-box {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--red);
  color: var(--dim);
  font-size: 0.72rem;
}

.hub-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

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

.hub-card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  background: rgba(11, 6, 24, 0.65);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hub-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px #9333ea30;
}

.hub-card h2 {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 400;
}

.hub-card p {
  margin: 0;
  font-size: 0.7rem;
  color: var(--dim);
  line-height: 1.4;
}

/* —— boot + typography corruption —— */
.boot-log {
  margin-top: 1.25rem;
  max-width: 32rem;
  font-size: 0.62rem;
  color: var(--dim);
  letter-spacing: 0.08em;
  line-height: 1.55;
}

.boot-log-line {
  margin: 0.2rem 0;
  opacity: 0.85;
}

.type-jitter {
  animation: jitter-kern 4.5s ease-in-out infinite;
}

@keyframes jitter-kern {
  0%,
  100% {
    letter-spacing: 0.22em;
  }
  50% {
    letter-spacing: 0.26em;
  }
}

body.boot-distort .boot-screen {
  animation: boot-skew 0.9s ease both;
}

@keyframes boot-skew {
  0% {
    transform: translate(0, 0) skewX(0deg);
    filter: saturate(1);
  }
  40% {
    transform: translate(-3px, 2px) skewX(-0.6deg);
    filter: saturate(1.25) hue-rotate(-6deg);
  }
  100% {
    transform: translate(0, 0) skewX(0deg);
    filter: saturate(1.05);
  }
}

/* —— terminal atmosphere —— */
.term-warn {
  color: #fb923c;
  animation: term-blink 1.1s steps(2, end) infinite;
}

.term-dim {
  color: var(--dim);
  opacity: 0.82;
}

.term-flicker {
  animation: term-blink 2.4s steps(2, end) infinite;
}

@keyframes term-blink {
  0%,
  70% {
    opacity: 1;
  }
  71%,
  100% {
    opacity: 0.45;
  }
}

.hub-thread {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.84rem;
  color: var(--red);
  opacity: 0.9;
  max-width: 32rem;
  line-height: 1.45;
}

.terminal-zone {
  position: relative;
  padding: 0.5rem 0 0;
}

.terminal-zone::before {
  content: "⚠ uplink integrity: nominal fiction / emotional payload detected";
  display: block;
  font-size: 0.58rem;
  color: #fb923c;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0.75;
  animation: term-blink 3s steps(2, end) infinite;
}

.memory-lead {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--red);
  opacity: 0.92;
  line-height: 1.45;
  margin-top: 0.35rem;
}

.uplink-trace {
  opacity: 0.78;
}

.memory-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.memory-card {
  position: relative;
  border: 1px solid var(--border);
  padding: 1rem 1.1rem 1.2rem;
  min-height: 7rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(147, 51, 234, 0.12), transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(232, 121, 160, 0.08), transparent 40%),
    linear-gradient(165deg, #0a0516, #06030f);
  opacity: 0.35;
  transform: translateY(12px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.memory-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.memory-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: repeating-linear-gradient(
    -8deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 3px
  );
  mix-blend-mode: overlay;
}

.memory-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.corrupt-block {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--hex);
  letter-spacing: 0.15em;
  filter: blur(0.45px);
  transition: filter 0.5s ease, color 0.5s ease, letter-spacing 0.5s ease;
}

.memory-card:hover .corrupt-block,
.memory-card:focus-within .corrupt-block {
  filter: none;
  color: var(--text);
  letter-spacing: 0.06em;
}

.hex-echo {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1.55;
  color: var(--hex);
  letter-spacing: 0.06em;
  opacity: 0.88;
  word-break: break-all;
  margin-top: 0.35rem;
}

pre.hex-echo {
  white-space: pre-wrap;
  margin: 0;
}

.source-wall-panel {
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px dashed var(--border);
  background: rgba(8, 4, 18, 0.35);
}

.source-wall-pre {
  margin: 0;
  max-height: none;
}

.source-wall-pre--compact {
  font-size: 0.52rem;
  line-height: 1.5;
  max-height: 5.5rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.source-wall-ribbon {
  margin-top: 0.25rem;
}

.binary-ribbon {
  font-size: 0.58rem;
  word-break: break-all;
  color: var(--blue-ghost);
  margin-top: 0.5rem;
  opacity: 0.85;
}

.b64-slab {
  font-size: 0.62rem;
  color: var(--hex-bright);
  margin-top: 0.45rem;
  word-break: break-all;
}

.vig-slab {
  font-size: 0.68rem;
  margin-top: 0.5rem;
  color: var(--red);
}

.morse-slab {
  font-size: 0.62rem;
  margin-top: 0.45rem;
  color: var(--toxic);
  letter-spacing: 0.12em;
}

.rgb-lab {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.rgb-lab button {
  background: #12081f;
  border: 1px solid var(--border);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.rgb-lab button.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.rgb-hint {
  margin-top: 0.45rem;
  font-size: 0.6rem;
  min-height: 1.15rem;
  color: var(--hex-bright);
  opacity: 0.75;
}

.rgb-secret {
  margin-top: 0.35rem;
  font-size: 0.62rem;
  color: var(--dim);
  min-height: 1.2rem;
}

.rgb-secret.rgb-secret--lit {
  color: var(--toxic);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.25);
}

.stego-note {
  margin-top: 0.75rem;
  font-size: 0.6rem;
  color: var(--dim);
  border-left: 2px solid var(--border);
  padding-left: 0.65rem;
}

/* —— human extended —— */
.human-form textarea.compact {
  min-height: 4rem;
}

.human-row {
  margin-top: 1.25rem;
}

.human-form input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.symbol-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.symbol-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--dim);
  cursor: pointer;
}

/* —— garden stages 0–4 —— */
.garden-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(185deg, #05020c 0%, #12081f 55%, #0a0612 100%);
  transition: background 1.4s ease, filter 1.4s ease;
}

.garden-stage[data-stage="1"] .garden-sky {
  background: linear-gradient(185deg, #12081f 0%, #1c0f2e 50%, #0f0618 100%);
}

.garden-stage[data-stage="2"] .garden-sky {
  background: linear-gradient(185deg, #1a0f30 0%, #2a1538 45%, #12081f 100%);
}

.garden-stage[data-stage="3"] .garden-sky {
  background: linear-gradient(185deg, #25143a 0%, #3d1f4a 40%, #1a0f28 100%);
  filter: saturate(1.15);
}

.garden-stage[data-stage="4"] .garden-sky {
  background: linear-gradient(185deg, #2e1a42 0%, #4a2860 35%, #1e1230 100%);
  filter: saturate(1.25);
}

.garden-static {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  transition: opacity 1.2s ease;
}

.garden-stage[data-stage="3"] .garden-static,
.garden-stage[data-stage="4"] .garden-static {
  opacity: 0.08;
}

.garden-particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  background:
    radial-gradient(circle at 20% 30%, rgba(192, 132, 252, 0.15) 0, transparent 25%),
    radial-gradient(circle at 70% 20%, rgba(96, 165, 250, 0.12) 0, transparent 22%),
    radial-gradient(circle at 55% 60%, rgba(232, 121, 160, 0.1) 0, transparent 20%);
}

.garden-stage[data-stage="3"] .garden-particles,
.garden-stage[data-stage="4"] .garden-particles {
  opacity: 0.7;
  animation: drift-part 14s ease-in-out infinite;
}

.garden-stage[data-stage="4"] .garden-particles {
  opacity: 1;
}

@keyframes drift-part {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(2%, -1%);
  }
}

.stem {
  position: absolute;
  z-index: 3;
  bottom: 26%;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--dim), var(--hex));
  transform-origin: bottom center;
  transform: scaleY(0.2);
  opacity: 0.35;
  transition: transform 1s ease, opacity 1s ease, filter 1s ease;
}

.stem:nth-child(1) {
  left: 32%;
  height: 2rem;
}
.stem:nth-child(2) {
  left: 50%;
  height: 2.8rem;
  margin-left: -1.5px;
}
.stem:nth-child(3) {
  left: 66%;
  height: 2.2rem;
}

.floral {
  position: absolute;
  z-index: 4;
  bottom: 44%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--red), transparent 70%);
  opacity: 0;
  transition: opacity 1s ease 0.15s;
}

.floral.f1 {
  left: 32%;
}
.floral.f2 {
  left: 50%;
}
.floral.f3 {
  left: 66%;
}

.garden-stage[data-stage="1"] .stem,
.garden-stage[data-stage="2"] .stem,
.garden-stage[data-stage="3"] .stem,
.garden-stage[data-stage="4"] .stem {
  transform: scaleY(1);
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(192, 132, 252, 0.35));
}

.garden-stage[data-stage="2"] .stem {
  filter: drop-shadow(0 0 10px rgba(147, 51, 234, 0.45));
}

.garden-stage[data-stage="2"] .floral,
.garden-stage[data-stage="3"] .floral,
.garden-stage[data-stage="4"] .floral {
  opacity: 0.75;
}

.garden-wall-caption {
  position: absolute;
  z-index: 6;
  left: 0.4rem;
  right: 0.4rem;
  top: 0.35rem;
  text-align: center;
  pointer-events: none;
}

.garden-wall-plain {
  margin: 0 auto;
  max-width: 100%;
  font-size: clamp(0.62rem, 2.1vw, 0.84rem);
  line-height: 1.38;
  color: rgba(248, 244, 255, 0.94);
  text-shadow:
    0 0 20px rgba(91, 33, 182, 0.5),
    0 0 42px rgba(17, 6, 32, 0.9);
}

.garden-wall-hex {
  display: block;
  margin: 0.35rem auto 0;
  max-width: 100%;
  font-size: clamp(0.36rem, 1vw, 0.48rem);
  line-height: 1.45;
  opacity: 0.52;
  max-height: 2.85rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent);
  mask-image: linear-gradient(to bottom, black 50%, transparent);
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
}

.garden-stage[data-stage="4"] .floral {
  opacity: 1;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  bottom: 45%;
  background:
    radial-gradient(circle at 32% 28%, #fff7ed 0, transparent 42%),
    radial-gradient(circle at 70% 32%, #fbcfe8 0, transparent 38%),
    radial-gradient(circle, #fb923c 0%, #7c3aed 58%, transparent 80%);
  box-shadow:
    0 0 26px rgba(251, 146, 60, 0.55),
    0 0 52px rgba(192, 132, 252, 0.38),
    inset 0 0 10px rgba(255, 255, 255, 0.22);
  animation: garden-floral-orbit 4.2s ease-in-out infinite;
}

@keyframes garden-floral-orbit {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.09);
    filter: brightness(1.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .garden-stage[data-stage="4"] .floral {
    animation: none;
  }
}

.hub-narrative {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--border);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.45;
}

.hub-stats {
  font-size: 0.62rem;
  color: var(--dim);
  margin-top: 0.5rem;
  letter-spacing: 0.08em;
}

.ending-storm-layer {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.4) 0px, rgba(0, 0, 0, 0.4) 1px, transparent 1px, transparent 4px),
    radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: overlay;
  transition: opacity 0.2s ease;
}

.ending-root {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.25rem 3rem;
  text-align: center;
}

.ending-lines-block {
  max-width: 32rem;
}

.ending-kicker {
  transition: color 1.2s ease, letter-spacing 1.2s ease;
}

.ending-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
  color: var(--text);
  margin: 0.55rem 0;
  max-width: 28rem;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity 1s ease, transform 1s ease, filter 0.3s ease, color 0.8s ease;
}

.ending-line.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ending-line.is-faded {
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  filter: blur(3px);
  transition: opacity 1.1s ease, transform 1.1s ease, filter 1.1s ease;
  pointer-events: none;
}

body.ending--build .ending-line.is-on {
  animation: ending-line-breathe 2.2s ease-in-out infinite;
  text-shadow:
    0 0 24px rgba(192, 132, 252, 0.45),
    0 0 48px rgba(91, 33, 182, 0.25);
}

body.ending--build-deep .ending-line.is-on {
  animation: ending-line-chroma 0.12s steps(2) infinite, ending-line-breathe 2.2s ease-in-out infinite;
}

@keyframes ending-line-breathe {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

@keyframes ending-line-chroma {
  0% {
    text-shadow:
      2px 0 0 rgba(255, 80, 120, 0.35),
      -2px 0 0 rgba(80, 200, 255, 0.35),
      0 0 20px rgba(192, 132, 252, 0.5);
  }
  100% {
    text-shadow:
      -2px 0 0 rgba(255, 120, 180, 0.35),
      2px 0 0 rgba(120, 220, 255, 0.35),
      0 0 28px rgba(192, 132, 252, 0.55);
  }
}

body.ending--surge {
  animation: ending-surge-body 1.65s cubic-bezier(0.45, 0, 0.2, 1) forwards;
}

body.ending--surge .ending-storm-layer {
  opacity: 1;
  animation: ending-storm-scan 0.08s linear infinite;
}

body.ending--surge .ending-line.is-on {
  animation: ending-line-shred 1.65s ease-in forwards !important;
}

body.ending--surge .ending-kicker {
  animation: ending-kicker-fry 1.65s ease-in forwards;
}

@keyframes ending-storm-scan {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(6px);
  }
}

@keyframes ending-surge-body {
  0% {
    background-color: #0a0612;
    filter: brightness(1);
  }
  12% {
    background-color: #1e1038;
    filter: brightness(1.4) contrast(1.15);
  }
  28% {
    background-color: #f8f4ff;
    filter: brightness(1.85) contrast(1.4) saturate(0.35);
  }
  42% {
    background-color: #120008;
    filter: brightness(0.35) contrast(1.8) hue-rotate(-25deg);
  }
  58% {
    background-color: #2a0a32;
    filter: brightness(2.1) contrast(1.2);
  }
  78% {
    background-color: #0a0612;
    filter: brightness(0.6) blur(0.5px);
  }
  100% {
    background-color: #0a0612;
    filter: brightness(1) blur(0);
  }
}

@keyframes ending-line-shred {
  0% {
    transform: scale(1) skewX(0deg);
    letter-spacing: 0.02em;
    opacity: 1;
  }
  35% {
    transform: scale(1.03) skewX(-2deg);
    letter-spacing: 0.12em;
    opacity: 0.95;
  }
  70% {
    transform: scale(0.92) skewX(3deg);
    opacity: 0.5;
    filter: blur(2px);
  }
  100% {
    transform: scale(1.08) skewX(0deg);
    opacity: 0;
    filter: blur(6px);
  }
}

@keyframes ending-kicker-fry {
  40% {
    opacity: 0.2;
    transform: scaleY(1.4);
  }
  100% {
    opacity: 0;
    transform: scaleY(0.6);
  }
}

body.ending--resolved {
  background: radial-gradient(ellipse 100% 90% at 50% 0%, #4a2d6e 0%, #2a1842 38%, #12081f 72%, #06030d 100%) fixed !important;
  color: #faf6ff;
  animation: ending-resolve-settle 1.4s ease forwards;
}

body.ending--resolved::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  box-shadow:
    inset 0 0 140px rgba(0, 0, 0, 0.55),
    inset 0 -80px 120px rgba(20, 5, 35, 0.4);
}

@keyframes ending-resolve-settle {
  from {
    filter: brightness(0.7);
  }
  to {
    filter: brightness(1);
  }
}

body.ending--resolved .ending-kicker {
  color: #e9d5ff;
  letter-spacing: 0.28em;
  opacity: 0.95;
}

body.ending--resolved .ending-footer,
body.ending--resolved .ending-footer a {
  color: rgba(230, 216, 255, 0.85);
}

body.ending--resolved .ending-footer a:hover {
  color: #ffd89c;
}

.ending-root--resolved {
  justify-content: center;
}

.ending-source-wall {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.15s ease, transform 1.15s ease;
  max-width: 36rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.ending-source-wall.is-on {
  opacity: 1;
  transform: translateY(0);
}

.ending-source-wall.is-out {
  opacity: 0;
  transform: translateY(-6px) scale(0.99);
  pointer-events: none;
  transition: opacity 0.95s ease, transform 0.95s ease;
}

.ending-source-hex {
  font-size: clamp(0.44rem, 1.15vw, 0.56rem);
  text-align: left;
  max-height: min(30vh, 10rem);
  overflow: auto;
  margin: 0 auto;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  background: rgba(5, 2, 12, 0.6);
  white-space: pre-wrap;
}

.ending-source-plain {
  margin: 0.9rem 0 0;
  font-size: clamp(0.92rem, 2.4vw, 1.12rem);
  line-height: 1.45;
  color: var(--text);
}

body.ending--resolved .ending-source-plain {
  color: #faf6ff;
}

.ending-coda {
  margin-top: 0.5rem;
  max-width: min(28rem, 92vw);
  opacity: 0;
  transform: translateY(22px) scale(0.97);
  transition:
    opacity 1.35s ease 0.15s,
    transform 1.35s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

.ending-coda.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ending-coda-card {
  position: relative;
  padding: 2rem 1.75rem 2.25rem;
  border-radius: 2px;
  background: linear-gradient(165deg, rgba(35, 18, 52, 0.92) 0%, rgba(18, 8, 32, 0.96) 100%);
  border: 1px solid rgba(255, 200, 140, 0.35);
  box-shadow:
    0 0 0 1px rgba(147, 51, 234, 0.2),
    0 0 60px rgba(91, 33, 182, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ending-coda-orbit {
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 180deg,
    transparent 0deg,
    rgba(192, 132, 252, 0.12) 120deg,
    transparent 240deg,
    rgba(251, 191, 36, 0.08) 300deg,
    transparent 360deg
  );
  animation: ending-coda-orbit-spin 14s linear infinite;
  pointer-events: none;
}

@keyframes ending-coda-orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

.ending-coda-tag {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 200, 160, 0.75);
  margin: 0 0 1rem;
}

.ending-coda-title {
  position: relative;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.65rem, 5vw, 2.35rem);
  line-height: 1.2;
  color: #fff9fc;
  margin: 0;
  text-shadow:
    0 0 40px rgba(192, 132, 252, 0.45),
    0 2px 0 rgba(30, 10, 45, 0.8);
}

.ending-coda-sub {
  position: relative;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  line-height: 1.5;
  color: rgba(230, 215, 250, 0.88);
  margin: 1.15rem 0 0;
}

.ending-footer {
  margin-top: 2.25rem;
  font-size: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
  body.ending--surge {
    animation: none;
    filter: brightness(1.1);
    transition: filter 0.35s ease;
  }

  body.ending--surge .ending-storm-layer {
    animation: none;
    opacity: 0.85;
  }

  body.ending--build .ending-line.is-on,
  body.ending--build-deep .ending-line.is-on {
    animation: none;
    text-shadow: 0 0 18px rgba(192, 132, 252, 0.35);
  }

  body.ending--surge .ending-line.is-on {
    animation: none !important;
    opacity: 0;
  }

  .ending-coda-orbit {
    animation: none;
  }
}

/* —— global audio hint (from page-shell) —— */
.audio-unlock-hint {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  max-width: min(36rem, calc(100vw - 1.5rem));
  z-index: 200;
  pointer-events: none;
  padding: 0.55rem 0.85rem;
  background: rgba(6, 3, 15, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 0 24px #6d28d940;
  font-size: 0.62rem;
  line-height: 1.45;
  color: var(--text);
  letter-spacing: 0.04em;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.audio-unlock-hint.is-dismissed {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}

.audio-unlock-hint--pending {
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .audio-unlock-hint {
    transition: none;
  }
}

/* —— completion certificate (garden) —— */
.garden-proof-panel {
  margin-top: 1.35rem;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--border);
  background: rgba(8, 4, 18, 0.45);
}

.garden-proof-lede,
.garden-proof-foot {
  font-size: 0.62rem;
  line-height: 1.45;
  max-width: 42rem;
}

.garden-proof-lede a,
.garden-proof-foot a {
  color: var(--accent);
}

.garden-proof-token {
  width: 100%;
  max-width: 100%;
  margin-top: 0.55rem;
  padding: 0.45rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  line-height: 1.35;
  color: var(--hex-bright);
  background: rgba(5, 2, 12, 0.75);
  border: 1px solid var(--border);
  resize: vertical;
  min-height: 3.2rem;
}

.garden-proof-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.garden-proof-btn {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  background: rgba(18, 8, 31, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
}

.garden-proof-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.garden-proof-status {
  margin-top: 0.45rem;
  font-size: 0.58rem;
  min-height: 1rem;
}

/* —— proof verifier page —— */
.proof-root .proof-in {
  width: 100%;
  min-height: 5rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  padding: 0.5rem;
  background: rgba(5, 2, 12, 0.75);
  border: 1px solid var(--border);
  color: var(--hex-bright);
  margin-top: 0.75rem;
}

.proof-root .proof-out {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px dashed var(--border);
  background: rgba(8, 4, 18, 0.35);
  min-height: 2rem;
}
