:root {
  --bg: #000;
  --line: #1a1a1a;
  --text: #fff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-columns: 200px minmax(280px, 1fr) minmax(420px, 1.05fr);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.panel-head,
.feed-head {
  padding: 22px 20px 16px;
  font-size: 11px;
  color: #888;
}

.feed-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

#round-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
  animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.28;
  }
}

.pipeline {
  display: flex;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.pipeline li {
  flex: 1;
  padding: 8px 4px;
  color: #444;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.pipeline li.on {
  color: #eee;
}

.pipeline li.done {
  color: #7a7a7a;
}

.roster .agent-state {
  display: block;
  margin-top: 3px;
  color: #555;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.roster li.busy .agent-state {
  color: #aaa;
}

.muted {
  color: #555;
  letter-spacing: 0.08em;
}

.roster {
  list-style: none;
  overflow: auto;
  flex: 1;
}

.roster li {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.2em;
}

.roster li:hover,
.roster li.active {
  background: #0d0d0d;
}

.roster .mini {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.nav {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.nav button {
  padding: 14px 20px;
  text-align: left;
  letter-spacing: 0.22em;
  border-top: 1px solid var(--line);
}

.nav button:hover {
  background: #0d0d0d;
}

.feed-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.pane-head {
  padding: 10px 20px 8px;
  color: #555;
  font-size: 10px;
  letter-spacing: 0.2em;
}

.library-pane,
.live-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.library-pane {
  border-bottom: 1px solid var(--line);
}

.library {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  align-content: start;
  gap: 10px;
  padding: 8px 16px 16px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 3 / 4;
  padding: 10px 9px;
  background: #0d0d0d;
  border: 1px solid #262626;
  text-align: left;
  animation: enter 0.4s ease;
}

.box:hover,
.box:focus {
  border-color: #fff;
}

.box .cite {
  letter-spacing: 0.16em;
  font-size: 12px;
}

.box .meta {
  color: #666;
  font-size: 9px;
  letter-spacing: 0.1em;
  line-height: 1.45;
}

.box .spine {
  height: 4px;
  margin: 8px 0;
  background: #fff;
  opacity: 0.85;
}

.live-pane .logs {
  flex: 1;
  overflow: auto;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.logs.packing {
  animation: pack-away 0.55s ease forwards;
}

.log {
  display: grid;
  grid-template-columns: 96px 78px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line);
  animation: enter 0.3s ease;
}

.log time,
.log .state {
  color: #666;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.log .body {
  color: #d8d8d8;
  letter-spacing: 0.03em;
  line-height: 1.55;
  white-space: pre-wrap;
}

.log.thinking .body {
  color: #9a9a9a;
}

.log.thinking .body::after {
  content: "▍";
  animation: caret 0.8s step-end infinite;
}

.log.ok .state {
  color: #bdbdbd;
}

.log.sys .who,
.log.sys .body {
  color: #6a6a6a;
}

.mesh-wrap {
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--line);
}

.mesh,
.nodes {
  position: absolute;
  inset: 0;
}

.mesh {
  width: 100%;
  height: 100%;
}

.node {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0;
}

.node .status {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  color: #555;
  font-size: 9px;
  letter-spacing: 0.16em;
  white-space: nowrap;
  pointer-events: none;
}

.node.thinking .status {
  color: #ccc;
}

.node.god .status {
  top: calc(100% + 14px);
}

.node.active .face,
.roster li.active .face {
  box-shadow: 0 0 0 2px #fff;
}

.node.thinking .face {
  box-shadow: 0 0 0 2px currentColor, 0 0 22px currentColor;
}

.node.god {
  z-index: 3;
}

.node.god.writing .face {
  box-shadow: 0 0 22px 6px rgba(255, 248, 220, 0.28);
}

.node.god.dispatching .face {
  box-shadow: 0 0 16px 4px rgba(255, 236, 180, 0.22);
}

.spoke.active {
  stroke-opacity: 1 !important;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 4px currentColor);
}

.node.god.writing .eye {
  animation: none;
  transform: scaleY(0.16);
  border-radius: 999px;
}

.face {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--skin, #fff);
  overflow: hidden;
}

.node.god .face {
  width: 196px;
  height: 196px;
  background: #fff;
  box-shadow: 0 0 16px 3px rgba(255, 236, 180, 0.16);
}

.node.god .aura {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 132px;
  height: 168px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 38% 48% at 50% 62%, rgba(255, 248, 220, 0.22) 0%, transparent 72%),
    radial-gradient(ellipse 22% 40% at 40% 50%, rgba(244, 208, 63, 0.14) 0%, transparent 70%),
    radial-gradient(ellipse 20% 38% at 62% 46%, rgba(255, 230, 150, 0.1) 0%, transparent 68%);
  filter: blur(9px);
  animation: flame-flicker 1.7s ease-in-out infinite;
}

.node.god .aura::before,
.node.god .aura::after {
  content: "";
  position: absolute;
  left: 50%;
  border-radius: 50%;
  transform: translateX(-50%);
  filter: blur(11px);
}

.node.god .aura::before {
  top: 4%;
  width: 42%;
  height: 58%;
  background: radial-gradient(ellipse at 50% 80%, rgba(255, 250, 230, 0.2), transparent 68%);
  animation: flame-wisp 2.3s ease-in-out infinite;
}

.node.god .aura::after {
  top: -6%;
  width: 28%;
  height: 46%;
  background: radial-gradient(ellipse at 50% 90%, rgba(241, 196, 15, 0.14), transparent 70%);
  animation: flame-wisp 1.9s ease-in-out infinite reverse;
}

.node.god.writing .aura,
.node.god.dispatching .aura {
  animation-duration: 0.9s;
  opacity: 1;
}

.node-name {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  color: #bdbdbd;
  font-size: 10px;
  letter-spacing: 0.26em;
  white-space: nowrap;
  pointer-events: none;
}

.node.god .node-name {
  bottom: calc(100% + 12px);
  color: #ead9a0;
  font-size: 12px;
  letter-spacing: 0.32em;
}

.node.god .eyes {
  top: 32%;
  z-index: 2;
  gap: 16%;
}

.eyes {
  position: absolute;
  top: 32%;
  left: 50%;
  display: flex;
  gap: 14%;
  transform: translateX(-50%) rotate(18deg);
}

.eye {
  display: block;
  width: 11px;
  height: 28px;
  border-radius: 999px;
  background: #000;
  transform-origin: 50% 50%;
  animation: blink var(--blink-dur, 4.2s) var(--blink-delay, 0s) infinite;
}

.node.god .eye {
  width: 18px;
  height: 38px;
}

.orbs {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.orb {
  position: absolute;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: var(--c, #fff);
  box-shadow:
    0 0 8px 3px var(--c),
    0 0 18px 7px var(--c);
  opacity: 0.95;
}

.live-grible {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 6;
  width: 248px;
  height: 240px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  animation: float-book 4.5s ease-in-out infinite;
}

.live-grible.inscribing {
  animation: none;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.28));
}

.live-label {
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: 0.34em;
  font-size: 10px;
}

.live-page {
  flex: 1;
  min-height: 0;
  padding: 16px 8px 16px 22px;
  background: #fff;
  color: #111;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(255, 255, 255, 0.12);
  position: relative;
}

.live-page::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 9px;
  width: 5px;
  border-radius: 999px;
  background: #000;
}

.live-scripture {
  height: 100%;
  overflow: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.live-scripture .verse {
  padding: 8px 4px 10px 0;
}

.live-scripture .verse p {
  font-size: 10px;
}

.live-scripture .verse p.writing::after {
  content: "▍";
  color: #000;
  animation: caret 0.8s step-end infinite;
}

.verse .hash {
  display: block;
  margin-top: 4px;
  color: #aaa;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.roster .eye {
  width: 4px;
  height: 10px;
}

.roster .eyes {
  top: 30%;
  gap: 18%;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}

.overlay.hidden {
  display: none;
}

.modal[hidden] {
  display: none !important;
}

.modal h2 {
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.28em;
}

.modal p {
  color: #bdbdbd;
  line-height: 1.7;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 22px;
  color: #888;
}

.book-modal {
  width: min(520px, 92vw);
  height: min(78vh, 740px);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
}

.process-modal {
  width: min(560px, 92vw);
  max-height: min(82vh, 760px);
  overflow: auto;
}

.process-modal h2 {
  margin-bottom: 8px;
}

.process-verse {
  color: #cfcfcf;
  line-height: 1.65;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.process-modal .log {
  padding-left: 0;
  padding-right: 0;
}

.grible-mark {
  display: flex;
  gap: 7px;
  transform: rotate(18deg);
  margin-bottom: 14px;
}

.grible-mark span {
  width: 8px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
}

.book-modal h2 {
  margin-bottom: 16px;
}

.book {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 22px 8px 22px 28px;
  background: #fff;
  border-radius: 28px;
  color: #000;
  position: relative;
}

.book::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 14px;
  width: 8px;
  border-radius: 999px;
  background: #000;
}

.scripture {
  height: 100%;
  overflow: auto;
  padding-right: 16px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.verse {
  padding: 12px 8px 12px 0;
  border-bottom: 1px solid #eee;
  animation: enter 0.35s ease;
}

.verse .cite {
  display: block;
  margin-bottom: 6px;
  color: #888;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.verse p {
  color: #111;
  margin: 0;
  line-height: 1.65;
  letter-spacing: 0.04em;
}

@keyframes blink {
  0%,
  86%,
  100% {
    transform: scaleY(1);
  }
  88%,
  90% {
    transform: scaleY(0.08);
  }
  91% {
    transform: scaleY(1);
  }
  93%,
  95% {
    transform: scaleY(0.08);
  }
}

@keyframes pack-away {
  to {
    opacity: 0;
    transform: translateY(-18px) scale(0.92);
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes flame-flicker {
  0%,
  100% {
    opacity: 0.45;
    transform: translate(-50%, -50%) scale(0.98, 1);
  }
  40% {
    opacity: 0.7;
    transform: translate(-50%, -52%) scale(1.02, 1.06);
  }
  70% {
    opacity: 0.38;
    transform: translate(-49%, -50%) scale(0.97, 1.03);
  }
}

@keyframes flame-wisp {
  0%,
  100% {
    opacity: 0.35;
    transform: translateX(-50%) translateY(0) scaleY(1);
  }
  50% {
    opacity: 0.65;
    transform: translateX(-50%) translateY(-6px) scaleY(1.12);
  }
}

@keyframes god-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 6px rgba(255, 255, 255, 0.28),
      0 0 34px 8px #fff,
      0 0 80px 24px rgba(255, 255, 255, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(255, 255, 255, 0.5),
      0 0 55px 16px #fff,
      0 0 120px 40px rgba(255, 255, 255, 0.55);
  }
}

@keyframes caret {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes float-book {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 180px 1fr;
  }

  .mesh-wrap {
    display: none;
  }
}
