:root {
  /* Interface text and compact annotations: **IBM Plex Sans Condensed** Condensed* for tiny dashboard readouts */
  --plum: #241528;
  --ember: #E85D4F;
  --apricot: #FFB36B;
  --gold: #FFD36A;
  --moss: #6F8F5F;
  --cream: #FFE8C8;
  --violet: #8C5CFF;
  --serif: "Libre Baskerville", Baskerville, Georgia, serif;
  --ornate: "Cormorant Garamond", Garamond, Georgia, serif;
  --ui: "IBM Plex Sans Condensed", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--cream);
  background: var(--plum);
  font-family: var(--ui);
}

button { font: inherit; }

.altar {
  position: relative;
  min-height: 100vh;
  padding: clamp(18px, 3vw, 42px);
  display: grid;
  grid-template-columns: 1fr 1.25fr 1.05fr 0.95fr;
  grid-template-rows: 0.68fr 1.25fr 1fr 0.52fr;
  gap: clamp(12px, 1.45vw, 22px);
  background:
    radial-gradient(circle at 20% 82%, rgba(255, 211, 106, 0.18), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(140, 92, 255, 0.2), transparent 25%),
    radial-gradient(circle at 48% 50%, rgba(232, 93, 79, 0.12), transparent 38%),
    linear-gradient(145deg, #241528 0%, #311a2e 48%, #241528 100%);
  isolation: isolate;
}

.ambient-noise,
.scanlines,
.horizon-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ambient-noise {
  z-index: 1;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 10% 20%, var(--cream) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 70%, var(--gold) 0 1px, transparent 1.4px),
    radial-gradient(circle at 45% 55%, var(--violet) 0 1px, transparent 1.5px);
  background-size: 54px 54px, 88px 88px, 132px 132px;
  animation: pollenDrift 18s linear infinite;
}

.scanlines {
  z-index: 3;
  opacity: 0.16;
  mix-blend-mode: screen;
  background: repeating-linear-gradient(180deg, transparent 0 7px, rgba(255, 232, 200, 0.08) 8px, transparent 10px);
}

.horizon-glow {
  z-index: 0;
  top: auto;
  height: 28vh;
  background: radial-gradient(ellipse at 52% 100%, rgba(255, 179, 107, 0.55), rgba(232, 93, 79, 0.24) 38%, transparent 70%);
  filter: blur(10px);
}

.pane {
  position: relative;
  z-index: 2;
  overflow: hidden;
  padding: clamp(16px, 2vw, 28px);
  border: 1px solid rgba(255, 179, 107, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 232, 200, 0.10), rgba(36, 21, 40, 0.34)),
    radial-gradient(circle at 12% 12%, rgba(255, 211, 106, 0.14), transparent 34%);
  box-shadow: inset 0 0 28px rgba(255, 179, 107, 0.09), 0 18px 60px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
  transform: translateY(16px) scale(0.975);
  opacity: 0.82;
  transition: transform 720ms cubic-bezier(.19, 1.35, .33, 1), opacity 520ms ease, border-color 520ms ease, box-shadow 520ms ease, clip-path 720ms cubic-bezier(.19, 1.35, .33, 1);
}

.pane::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background:
    linear-gradient(90deg, transparent 0 20%, rgba(140, 92, 255, 0.42) 21% 22%, transparent 23% 61%, rgba(232, 93, 79, 0.4) 62% 63%, transparent 64%),
    repeating-linear-gradient(112deg, transparent 0 24px, rgba(111, 143, 95, 0.22) 25px, transparent 27px);
  mix-blend-mode: screen;
}

.pane::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -32px;
  top: -32px;
  border: 1px solid rgba(255, 211, 106, 0.26);
  border-radius: 50%;
  box-shadow: 0 0 38px rgba(255, 211, 106, 0.16);
}

.pane:hover,
.pane.is-awake,
.altar[data-mode="bloom"] .pane {
  transform: translateY(0) scale(1.015);
  opacity: 1;
  border-color: rgba(255, 211, 106, 0.76);
  box-shadow: inset 0 0 36px rgba(255, 179, 107, 0.18), 0 22px 76px rgba(232, 93, 79, 0.16), 0 0 0 1px rgba(140, 92, 255, 0.11);
}

.pane-caption,
.eyebrow,
.readout,
.whisper-panel span {
  position: relative;
  z-index: 2;
  color: var(--gold);
  font-family: var(--ui);
  font-size: clamp(0.72rem, 1.1vw, 0.9rem);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.title-field {
  grid-column: 1 / 3;
  grid-row: 1 / 2;
  border-radius: 38px 92px 38px 76px;
  clip-path: polygon(0 0, 95% 0, 100% 54%, 88% 100%, 0 100%);
}

h1 {
  position: relative;
  z-index: 2;
  margin: 10px 0 8px;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 7vw, 7.6rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
  color: var(--cream);
  text-shadow: 0 0 22px rgba(255, 179, 107, 0.32), 2px 0 rgba(140, 92, 255, 0.18), -2px 0 rgba(232, 93, 79, 0.16);
}

.title-koan,
.pane-poem,
.poetic,
.whisper-panel p {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 56ch;
  font-family: var(--ornate);
  font-size: clamp(1.05rem, 1.55vw, 1.55rem);
  color: rgba(255, 232, 200, 0.86);
  line-height: 1.2;
}

.etched-runes {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.etched-runes span {
  padding: 5px 10px;
  border: 1px solid rgba(111, 143, 95, 0.46);
  border-radius: 999px;
  color: rgba(255, 232, 200, 0.75);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.mode-orbit {
  position: relative;
  z-index: 5;
  grid-column: 3 / 5;
  grid-row: 1 / 2;
  align-self: start;
  justify-self: end;
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 179, 107, 0.28);
  border-radius: 999px;
  background: rgba(36, 21, 40, 0.44);
  box-shadow: inset 0 0 24px rgba(255, 211, 106, 0.08);
}

.mode-button {
  border: 0;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--cream);
  background: transparent;
  font-family: var(--serif);
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 420ms cubic-bezier(.2, 1.4, .35, 1), background 280ms ease, color 280ms ease;
}

.mode-button:hover,
.mode-button.is-active {
  transform: translateY(-2px) scale(1.04);
  color: var(--plum);
  background: linear-gradient(135deg, var(--gold), var(--apricot));
}

.central-window {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  border-radius: 62px 34px 84px 42px;
  clip-path: polygon(7% 0, 100% 0, 94% 86%, 76% 100%, 0 94%, 0 12%);
}

.network-diagram {
  position: relative;
  z-index: 2;
  height: min(45vh, 430px);
  margin: 10px 0 14px;
}

.network-diagram svg { width: 100%; height: 100%; }
.root-path { fill: none; stroke: rgba(111, 143, 95, 0.78); stroke-width: 2; stroke-dasharray: 8 10; }
.path-b { stroke: rgba(255, 179, 107, 0.72); }
.path-c { stroke: rgba(140, 92, 255, 0.58); }
.node { fill: var(--gold); stroke: rgba(255, 232, 200, 0.9); stroke-width: 1; animation: nodePulse 3.5s ease-in-out infinite; }
.node-b, .node-f { fill: var(--ember); }
.node-g, .node-d { fill: var(--moss); }
.pollen-svg circle { fill: var(--gold); filter: drop-shadow(0 0 8px var(--gold)); }

.crescent { border-radius: 110px 34px 110px 34px; }
.petal { border-radius: 34px 110px 42px 96px; }
.pond { border-radius: 48% 52% 42% 58% / 58% 38% 62% 42%; }
.kernel { border-radius: 42px 42px 120px 120px; }

.spore-clock { grid-column: 1 / 2; grid-row: 2 / 3; }
.moth-relay { grid-column: 4 / 5; grid-row: 2 / 3; }
.root-memory { grid-column: 1 / 2; grid-row: 3 / 4; }
.signal-pond { grid-column: 4 / 5; grid-row: 3 / 4; }
.dream-kernel { grid-column: 2 / 4; grid-row: 4 / 5; }

.dial {
  position: relative;
  z-index: 2;
  width: min(22vw, 150px);
  aspect-ratio: 1;
  margin: 18px auto;
  border: 1px solid rgba(255, 211, 106, 0.48);
  border-radius: 50%;
  background: conic-gradient(from 180deg, rgba(255, 211, 106, 0.72), rgba(232, 93, 79, 0.18), transparent 58%, rgba(111, 143, 95, 0.38));
  box-shadow: 0 0 32px rgba(255, 211, 106, 0.16);
}
.dial span, .dial i { position: absolute; inset: 17%; border-radius: 50%; border: 1px solid rgba(255, 232, 200, 0.24); }
.dial i { inset: 48% 10% auto 48%; height: 2px; background: var(--cream); transform-origin: left center; animation: dialTurn 12s linear infinite; }

.moth-glyph { position: relative; z-index: 2; height: 125px; margin: 10px 0; }
.moth-glyph span { position: absolute; top: 24px; width: 46%; height: 82px; border: 1px solid rgba(255, 232, 200, 0.34); background: radial-gradient(circle at 50% 50%, rgba(140, 92, 255, 0.2), transparent 58%); }
.moth-glyph span:first-child { left: 5%; border-radius: 82% 18% 68% 32%; transform: rotate(-14deg); }
.moth-glyph span:nth-child(2) { right: 5%; border-radius: 18% 82% 32% 68%; transform: rotate(14deg); }
.moth-glyph i { position: absolute; left: 50%; top: 10px; width: 2px; height: 105px; background: var(--gold); box-shadow: 0 0 18px var(--gold); animation: relayBlink 2.8s ease-in-out infinite; }

.memory-bars { position: relative; z-index: 2; display: flex; align-items: end; gap: 10px; height: 116px; margin: 16px 0; }
.memory-bars span { flex: 1; min-width: 12px; border-radius: 999px 999px 8px 8px; background: linear-gradient(180deg, var(--moss), rgba(111, 143, 95, 0.12)); box-shadow: 0 0 18px rgba(111, 143, 95, 0.22); animation: barBreathe 4s ease-in-out infinite; }
.memory-bars span:nth-child(1) { height: 46%; } .memory-bars span:nth-child(2) { height: 78%; animation-delay: .4s; } .memory-bars span:nth-child(3) { height: 58%; animation-delay: .8s; } .memory-bars span:nth-child(4) { height: 90%; animation-delay: 1.2s; } .memory-bars span:nth-child(5) { height: 64%; animation-delay: 1.6s; }

.pond-lens { position: relative; z-index: 2; height: 132px; margin: 8px 0; border-radius: 50%; border: 1px solid rgba(140, 92, 255, 0.36); background: radial-gradient(circle, rgba(255, 232, 200, 0.15), rgba(140, 92, 255, 0.16) 38%, rgba(36, 21, 40, 0.1) 70%); overflow: hidden; }
.pond-lens span { position: absolute; left: 12%; right: 12%; height: 2px; background: rgba(255, 211, 106, 0.58); animation: ripple 3.6s ease-in-out infinite; }
.pond-lens span:nth-child(1) { top: 34%; } .pond-lens span:nth-child(2) { top: 52%; animation-delay: .5s; } .pond-lens span:nth-child(3) { top: 68%; animation-delay: 1s; }

.seed-stack { position: relative; z-index: 2; display: flex; justify-content: center; gap: 18px; margin: 14px 0; }
.seed-stack span { width: 70px; height: 34px; border: 1px solid rgba(255, 211, 106, 0.55); border-radius: 999px 999px 999px 14px; background: linear-gradient(135deg, rgba(255, 211, 106, 0.3), rgba(232, 93, 79, 0.12)); transform: rotate(-12deg); animation: seedFloat 5s ease-in-out infinite; }
.seed-stack span:nth-child(2) { animation-delay: .7s; transform: rotate(8deg); } .seed-stack span:nth-child(3) { animation-delay: 1.4s; }

.whisper-panel {
  position: relative;
  z-index: 4;
  grid-column: 4 / 5;
  grid-row: 4 / 5;
  align-self: stretch;
  padding: 18px;
  border: 1px solid rgba(111, 143, 95, 0.44);
  border-radius: 28px 28px 28px 68px;
  background: rgba(36, 21, 40, 0.54);
}

.floating-runes span {
  position: absolute;
  z-index: 3;
  color: var(--gold);
  opacity: 0.5;
  animation: runeFloat 8s ease-in-out infinite;
}
.floating-runes span:nth-child(1) { left: 8%; top: 22%; } .floating-runes span:nth-child(2) { left: 84%; top: 18%; animation-delay: 1s; } .floating-runes span:nth-child(3) { left: 52%; top: 9%; animation-delay: 2s; } .floating-runes span:nth-child(4) { left: 72%; top: 78%; animation-delay: 3s; } .floating-runes span:nth-child(5) { left: 18%; top: 83%; animation-delay: 4s; } .floating-runes span:nth-child(6) { left: 93%; top: 52%; animation-delay: 5s; }

.altar[data-mode="tune"] .central-window { transform: translateY(-4px) scale(0.98) rotate(-0.4deg); }
.altar[data-mode="tune"] .spore-clock { transform: translate(12px, 12px) scale(1.04); }
.altar[data-mode="tune"] .moth-relay { transform: translate(-12px, 16px) scale(1.04); }
.altar[data-mode="tune"] .root-memory { transform: translate(18px, -16px) scale(1.02); }
.altar[data-mode="tune"] .signal-pond { transform: translate(-18px, -16px) scale(1.02); }
.altar[data-mode="tune"] .root-path { stroke-dashoffset: 120; animation: rootTrace 3.4s linear infinite; }
.altar[data-mode="bloom"] .central-window { background: radial-gradient(circle at 50% 52%, rgba(255, 211, 106, 0.16), rgba(140, 92, 255, 0.1), rgba(255, 232, 200, 0.07)); }
.altar[data-mode="bloom"] .poetic { color: var(--cream); }

@keyframes pollenDrift { to { background-position: 140px 80px, -120px 90px, 70px -110px; } }
@keyframes nodePulse { 0%,100% { opacity: .65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.28); } }
@keyframes dialTurn { to { transform: rotate(360deg); } }
@keyframes relayBlink { 0%,100% { opacity: .38; } 45%,55% { opacity: 1; box-shadow: 0 0 28px var(--violet); } }
@keyframes barBreathe { 0%,100% { filter: brightness(.8); transform: scaleY(.92); } 50% { filter: brightness(1.25); transform: scaleY(1.05); } }
@keyframes ripple { 0%,100% { transform: translateX(-14px) scaleX(.72); opacity: .32; } 50% { transform: translateX(14px) scaleX(1.06); opacity: .9; } }
@keyframes seedFloat { 0%,100% { translate: 0 0; } 50% { translate: 0 -9px; } }
@keyframes runeFloat { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-16px) rotate(12deg); } }
@keyframes rootTrace { to { stroke-dashoffset: 0; } }

@media (max-width: 920px) {
  body { overflow: auto; }
  .altar { min-height: auto; grid-template-columns: 1fr; grid-template-rows: auto; padding-bottom: 120px; }
  .title-field, .mode-orbit, .central-window, .spore-clock, .moth-relay, .root-memory, .signal-pond, .dream-kernel, .whisper-panel { grid-column: 1; grid-row: auto; }
  .mode-orbit { justify-self: stretch; justify-content: center; flex-wrap: wrap; }
  .network-diagram { height: 320px; }
}
