/* nudisco-zedoris-chamber-v4 — still idle; small, deliberately excessive ASCII ritual. */
:root { color-scheme: dark; }
* { box-sizing: border-box; }
html { background: #000000; }
body {
  margin: 0;
  background: #000000;
  color: #B3ECD8;
  font: 13px/1.4 monospace;
  min-height: 100svh;
}
.z-main {
  width: min(780px, calc(100% - 36px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 32px 0 20px;
  display: flex;
  flex-direction: column;
}
.z-header, .z-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  letter-spacing: .045em;
}
.z-header { color: #177874; border-bottom: 1px solid #177874; padding-bottom: 12px; }
#z-mode { color: #00F600; }
.z-firmament {
  margin-top: clamp(30px, 8vh, 76px);
  text-align: center;
  color: #177874;
  letter-spacing: .12em;
  white-space: nowrap;
  overflow: hidden;
}
.z-scene {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 380px;
  padding: 14px 0 30px;
}
.z-assembly {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.3fr) minmax(120px, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 640px;
}
/* Real buttons, not pretend clickable <pre> tags. Hover produces no tooltip. */
.z-alien {
  position: relative;
  display: block;
  justify-self: center;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  appearance: none;
  text-align: center;
  font: 13px/1.2 monospace;
  color: #CDE67E;
  transform-origin: center bottom;
  cursor: default;
  /* Intentionally no transition: 11:14 snaps straight to the idle pose. */
}
.z-ascii { display: block; white-space: pre; font: inherit; }
body[data-ritual="idle"] .z-alien { cursor: pointer; }
.z-alien:focus-visible { outline: 1px dotted #CDE67E; outline-offset: 5px; }
.z-reply {
  position: absolute;
  top: -1.65em;
  right: -1.45em;
  min-width: 2.5em;
  text-align: left;
  color: #B3ECD8;
  white-space: nowrap;
  pointer-events: none;
  font: 12px/1.2 monospace;
}
.z-left { transform: rotate(-6deg); }
.z-right { transform: rotate(6deg); color: #B3ECD8; }
/* Former foreground alien is now at the far side of the altar, back to us. */
.z-back {
  margin: 0 auto -17px;
  color: #B3ECD8;
  font-size: 11px;
  z-index: 2;
}
.z-back .z-reply { z-index: 5; top: -1.2em; }
.z-altar { display: flex; flex-direction: column; align-items: center; text-align: center; }
.z-runes { color: #369D69; letter-spacing: .35em; position: relative; z-index: 2; }
.z-sigil { margin: 8px 0 7px; color: #369D69; letter-spacing: .3em; position: relative; z-index: 2; }
.z-stones { margin: 8px 0 0; color: #177874; }
.z-altar-base { white-space: pre; font: 12px/1.15 monospace; color: #177874; }
.z-floor {
  color: #000000;
  font-size: 11px;
  letter-spacing: .04em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}
.z-cauldron {
  position: relative;
  z-index: 3;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 122px;
  padding: 4px 10px;
  color: #B3ECD8;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  outline-offset: 2px;
}
.z-cauldron:hover, .z-cauldron:focus-visible { color: #CDE67E; border-color: #00F600; }
.z-pot { white-space: pre; font: 13px/1.15 monospace; }
.z-steam { color: #B3ECD8; font-size: 12px; margin-bottom: 3px; }
.z-chants {
  height: 18px;
  visibility: hidden;
  display: flex;
  gap: 25px;
  color: #CDE67E;
  font-size: 13px;
  position: relative;
  z-index: 2;
}
.z-chants span { display: inline-block; }
.z-footer { border-top: 1px solid #177874; padding: 12px 0; font-size: 11px; color: #177874; }
.z-footer strong { color: #00F600; font-weight: normal; font-variant-numeric: tabular-nums; }
#z-next { color: #369D69; font-variant-numeric: tabular-nums; }
.z-return { padding: 6px 0 0; text-align: center; font: 13px/1.4 monospace; }
.z-return a, .z-return a:visited { color: #00F600; text-decoration: none; text-shadow: none; transform: none; transition: none; }
.z-return a:hover { color: #CDE67E; text-decoration: underline; }
.z-return a:focus-visible { outline: 1px dotted currentColor; outline-offset: 3px; }

/* The show is a SINGLE pre element, refreshed ~4 times/sec ONLY for the final
   20 seconds. It never runs while idle and has no images, canvas, or audio. */
.z-ascii-show {
  display: none;
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 18px 10px;
  pointer-events: none;
  white-space: pre;
  text-align: center;
  font: 15px/1.16 monospace;
  letter-spacing: 0;
  color: #00F600;
  text-shadow: none;
  /* The stage goes dark behind the text: no visual collision with the pot. */
  background: #000000;
}
body[data-phase="5"] .z-ascii-show { display: block; }
body[data-phase="5"] .z-assembly { opacity: .63; }

/* Minute one: V3's light sway and steam; no work at all while idle. */
body[data-ritual="active"] #z-mode { color: #00F600; }
body[data-ritual="active"] .z-alien { color: #CDE67E; }
body[data-ritual="active"] .z-chants { visibility: visible; }
body[data-ritual="active"] .z-sigil { color: #369D69; }
body[data-ritual="active"] .z-steam { color: #CDE67E; }
body[data-ritual="active"] .z-left  { animation: z-left-sway 4s ease-in-out infinite; }
body[data-ritual="active"] .z-right { animation: z-right-sway 4.4s ease-in-out infinite; }
body[data-ritual="active"] .z-back  { animation: z-back-bob 3.5s ease-in-out infinite; }
body[data-ritual="active"] .z-steam { animation: z-steam 2.8s ease-in-out infinite; }
body[data-ritual="active"] .z-sigil { animation: z-glimmer 2.5s steps(2, end) infinite; }
body[data-ritual="active"] .z-chants span { animation: z-incantation 1.8s steps(2, end) infinite; }
body[data-ritual="active"] .z-chants span:nth-child(2) { animation-delay: .6s; }
body[data-ritual="active"] .z-chants span:nth-child(3) { animation-delay: 1.2s; }

/* Minute two: escalation — faster, wider gestures and an awake altar. */
body[data-phase="2"] .z-left,
body[data-phase="2"] .z-right,
body[data-phase="2"] .z-back { animation-duration: 1.85s; }
body[data-phase="2"] .z-chants { color: #00F600; font-size: 16px; }
body[data-phase="2"] .z-runes { color: #CDE67E; }
body[data-phase="2"] .z-cauldron { color: #CDE67E; }
body[data-phase="2"] .z-steam { animation-duration: 1.6s; }
body[data-phase="2"] .z-firmament { color: #369D69; }
body[data-phase="2"] .z-stones { animation: z-stones-tremble 1.65s steps(2, end) infinite; }

/* Minute three, 0–20s: lift-off. */
body[data-phase="3"] .z-left,
body[data-phase="3"] .z-right,
body[data-phase="3"] .z-back { animation-duration: 1.25s; }
body[data-phase="3"] .z-chants { font-size: 19px; color: #00F600; }
body[data-phase="3"] .z-cauldron { color: #CDE67E; }
body[data-phase="3"] .z-sigil { color: #00F600; font-size: 16px; }
body[data-phase="3"] .z-stones { animation: z-stones-tremble 1s steps(2, end) infinite; }
body[data-phase="3"] .z-steam { animation-duration: 1.15s; }

/* Minute three, 20–40s: commotion. Three ASCII beings, maximum drama. */
body[data-phase="4"] .z-left { animation: z-left-frenzy .8s steps(3, end) infinite; }
body[data-phase="4"] .z-right { animation: z-right-frenzy .7s steps(3, end) infinite; }
body[data-phase="4"] .z-back { animation: z-back-frenzy .9s steps(3, end) infinite; }
body[data-phase="4"] .z-chants { font-size: 21px; color: #00F600; }
body[data-phase="4"] .z-cauldron { color: #CDE67E; }
body[data-phase="4"] .z-sigil { color: #369D69; font-size: 19px; animation-duration: .6s; }
body[data-phase="4"] .z-steam { animation-duration: .75s; }
body[data-phase="4"] .z-runes { color: #369D69; animation: z-glimmer .7s steps(2, end) infinite; }
body[data-phase="4"] .z-stones { animation: z-stones-tremble .65s steps(2, end) infinite; }

/* Minute three, 40–60s: the great and powerful ASCII finale. */
body[data-phase="5"] .z-left { animation: z-left-frenzy .6s steps(3, end) infinite; }
body[data-phase="5"] .z-right { animation: z-right-frenzy .55s steps(3, end) infinite; }
body[data-phase="5"] .z-back { animation: z-back-frenzy .65s steps(3, end) infinite; }
body[data-phase="5"] .z-steam { animation-duration: .65s; }
body[data-phase="5"] .z-cauldron { color: #CDE67E; }
body[data-phase="5"] .z-chants { color: #00F600; }

@keyframes z-left-sway {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(-16deg) translateY(-8px); }
}
@keyframes z-right-sway {
  0%, 100% { transform: rotate(6deg) translateY(0); }
  50% { transform: rotate(16deg) translateY(-8px); }
}
@keyframes z-back-bob {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-9px) rotate(4deg); }
}
@keyframes z-left-frenzy {
  0%, 100% { transform: rotate(-7deg) translateY(0); }
  33% { transform: rotate(-24deg) translateY(-12px); }
  66% { transform: rotate(6deg) translateY(3px); }
}
@keyframes z-right-frenzy {
  0%, 100% { transform: rotate(7deg) translateY(0); }
  33% { transform: rotate(22deg) translateY(-13px); }
  66% { transform: rotate(-6deg) translateY(2px); }
}
@keyframes z-back-frenzy {
  0%, 100% { transform: rotate(0) translateY(0); }
  33% { transform: rotate(-12deg) translateY(-14px); }
  66% { transform: rotate(12deg) translateY(2px); }
}
@keyframes z-steam {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(-8px); opacity: 1; }
}
@keyframes z-glimmer {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
@keyframes z-incantation {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}
@keyframes z-stones-tremble {
  0%, 100% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
}
@media (max-width: 520px) {
  .z-main { width: min(100% - 24px, 500px); padding-top: 16px; }
  .z-assembly { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .z-left { grid-column: 1; grid-row: 1; }
  .z-right { grid-column: 2; grid-row: 1; }
  .z-altar { grid-column: 1 / -1; grid-row: 2; }
  .z-firmament { margin-top: 24px; font-size: 11px; }
  .z-scene { min-height: 420px; }
  .z-header, .z-footer { font-size: 10px; }
  .z-ascii-show { font-size: clamp(9px, 2.6vw, 12px); padding: 10px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* The final art stays on one still frame: no CSS or text-frame motion. */
}
