:root {
  color-scheme: dark;
  --ink: #edf7ef;
  --muted: #8aa79a;
  --faint: #5d7269;
  --bg: #050807;
  --panel: #0b1110;
  --panel-2: #111a18;
  --line: #1e3a32;
  --line-hot: #39ff9c;
  --green: #39ff9c;
  --cyan: #63d8ff;
  --violet: #9d7cff;
  --gold: #f0c15a;
  --rose: #ff6b8f;
  --red: #ff4f5f;
  --glass: rgba(4, 13, 18, 0.62);
  --shadow: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  background:
    linear-gradient(135deg, rgba(1, 5, 9, 0.96), rgba(3, 6, 14, 0.98) 46%, rgba(2, 7, 6, 0.96)),
    #010205;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(57, 255, 156, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 216, 255, 0.028) 1px, transparent 1px),
    linear-gradient(115deg, transparent 0 46%, rgba(157, 124, 255, 0.08) 47%, transparent 52%),
    linear-gradient(245deg, transparent 0 50%, rgba(57, 255, 156, 0.05) 51%, transparent 56%);
  background-size: 34px 34px, 34px 34px, auto, auto;
  opacity: 0.72;
  mix-blend-mode: screen;
}

.celestial-viewport {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 72% 34%, rgba(99, 216, 255, 0.16), transparent 18%),
    radial-gradient(ellipse at 48% 72%, rgba(57, 255, 156, 0.1), transparent 24%),
    radial-gradient(ellipse at 18% 18%, rgba(157, 124, 255, 0.12), transparent 22%),
    linear-gradient(145deg, rgba(2, 5, 16, 0.94), rgba(0, 2, 7, 0.98) 62%, rgba(2, 10, 9, 0.94));
}

.star-stream {
  position: absolute;
  inset: -18%;
  opacity: 0.46;
  background-repeat: repeat;
  will-change: transform;
}

.stream-a {
  background-image:
    radial-gradient(circle, rgba(237, 247, 239, 0.8) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgba(99, 216, 255, 0.72) 0 1px, transparent 1.6px);
  background-size: 84px 84px, 132px 132px;
  background-position: 0 0, 38px 52px;
  animation: starDriftA 92s linear infinite;
}

.stream-b {
  background-image:
    radial-gradient(circle, rgba(240, 193, 90, 0.52) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(157, 124, 255, 0.56) 0 1px, transparent 1.5px);
  background-size: 156px 156px, 210px 210px;
  background-position: 22px 18px, 74px 96px;
  opacity: 0.34;
  animation: starDriftB 138s linear infinite;
}

.spiral-orbit {
  position: absolute;
  width: min(88vw, 980px);
  aspect-ratio: 1;
  right: clamp(-220px, -12vw, -80px);
  top: clamp(20px, 10vh, 150px);
  border-radius: 50%;
  opacity: 0.72;
  background:
    repeating-radial-gradient(ellipse at center, transparent 0 34px, rgba(99, 216, 255, 0.13) 35px 37px, transparent 38px 70px),
    conic-gradient(from 25deg, transparent 0 20deg, rgba(57, 255, 156, 0.18) 32deg, transparent 52deg, rgba(157, 124, 255, 0.12) 94deg, transparent 128deg, rgba(240, 193, 90, 0.12) 220deg, transparent 252deg);
  filter: blur(0.2px) drop-shadow(0 0 34px rgba(99, 216, 255, 0.14));
  transform-origin: 50% 50%;
  animation: spiralOrbit 68s linear infinite;
}

.spiral-orbit::after {
  content: "";
  position: absolute;
  inset: 17%;
  border-radius: 50%;
  border: 1px solid rgba(57, 255, 156, 0.16);
  box-shadow:
    0 0 30px rgba(57, 255, 156, 0.1),
    inset 0 0 42px rgba(99, 216, 255, 0.08);
}

.cockpit-ribs {
  position: absolute;
  inset: 0;
  opacity: 0.62;
  background:
    linear-gradient(72deg, transparent 0 17%, rgba(99, 216, 255, 0.16) 17.15%, transparent 17.6%),
    linear-gradient(108deg, transparent 0 20%, rgba(57, 255, 156, 0.12) 20.15%, transparent 20.6%),
    linear-gradient(90deg, transparent 0 76%, rgba(240, 193, 90, 0.1) 76.1%, transparent 76.45%);
}

.cockpit-ribs::before,
.cockpit-ribs::after {
  content: "";
  position: absolute;
  inset: 7vh 4vw;
  border: 1px solid rgba(99, 216, 255, 0.1);
  clip-path: polygon(10% 0, 90% 0, 100% 18%, 100% 82%, 90% 100%, 10% 100%, 0 82%, 0 18%);
}

.cockpit-ribs::after {
  inset: 13vh 9vw;
  border-color: rgba(57, 255, 156, 0.08);
  transform: perspective(900px) rotateX(2deg);
}

.kundalini-link {
  position: absolute;
  right: min(7vw, 96px);
  bottom: -7vh;
  width: min(42vw, 560px);
  min-width: 340px;
  height: min(78vh, 720px);
  opacity: 0.58;
  filter: drop-shadow(0 0 22px rgba(57, 255, 156, 0.24));
}

.kundalini-link path,
.kundalini-link circle {
  vector-effect: non-scaling-stroke;
}

.serpent,
.spine,
.neural-net path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url("#softGlow");
}

.serpent {
  stroke-width: 2.4;
  stroke-dasharray: 16 18;
  animation: serpentFlow 12s linear infinite;
}

.serpent-a {
  stroke: rgba(57, 255, 156, 0.86);
}

.serpent-b {
  stroke: rgba(255, 107, 143, 0.64);
  animation-duration: 15s;
  animation-direction: reverse;
}

.spine {
  stroke: rgba(99, 216, 255, 0.42);
  stroke-width: 1.4;
  stroke-dasharray: 8 14;
  animation: serpentFlow 18s linear infinite;
}

.neural-net path {
  stroke: rgba(99, 216, 255, 0.34);
  stroke-width: 1.1;
  stroke-dasharray: 6 12;
  animation: neuralPulse 9s ease-in-out infinite;
}

.neural-net circle {
  fill: rgba(3, 11, 13, 0.58);
  stroke: rgba(99, 216, 255, 0.72);
  stroke-width: 1.2;
  animation: nodeBreathe 5.5s ease-in-out infinite;
}

.neural-net circle:nth-child(2n) {
  stroke: rgba(57, 255, 156, 0.72);
  animation-delay: -1.4s;
}

.neural-net circle:nth-child(3n) {
  stroke: rgba(240, 193, 90, 0.66);
  animation-delay: -2.6s;
}

.hidden {
  display: none !important;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #0e1715;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  transition: padding-top 180ms ease;
}

.token-naked .shell {
  padding-top: 72px;
}

.entry-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.2vw, 22px);
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 107, 143, 0.16), transparent 32%),
    radial-gradient(ellipse at 18% 80%, rgba(57, 255, 156, 0.13), transparent 30%),
    rgba(2, 5, 4, 0.94);
  backdrop-filter: blur(10px);
}

.gate-card {
  width: min(980px, 100%);
  height: min(760px, calc(100vh - 20px));
  overflow: hidden;
  border: 1px solid rgba(57, 255, 156, 0.42);
  background:
    linear-gradient(135deg, rgba(8, 19, 25, 0.88), rgba(4, 9, 14, 0.94)),
    #050807;
  backdrop-filter: blur(18px) saturate(145%);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.65), inset 0 0 44px rgba(57, 255, 156, 0.08);
  padding: clamp(18px, 3.5vw, 38px);
}

.gate-step {
  display: grid;
  gap: clamp(8px, 1.4vh, 13px);
  height: 100%;
  align-content: center;
}

.gate-step.lab-open {
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(57, 255, 156, 0.45) transparent;
}

.gate-speaker {
  color: var(--rose);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
}

.gate-step h2 {
  color: var(--green);
  font: 700 clamp(27px, 5.5vw, 58px)/0.96 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  text-shadow: 0 0 26px rgba(57, 255, 156, 0.2);
}

.gate-step p {
  max-width: 850px;
  color: var(--ink);
  font-size: clamp(13px, 1.75vw, 19px);
  line-height: 1.28;
}

.gate-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.gate-form label {
  color: var(--gold);
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.gate-form input {
  width: 100%;
  height: clamp(42px, 6.5vh, 58px);
  border: 1px solid rgba(57, 255, 156, 0.45);
  background: #020504;
  color: var(--green);
  padding: 0 14px;
  font: 700 clamp(16px, 2.6vw, 28px)/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
}

.gate-form input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(240, 193, 90, 0.22), inset 0 0 28px rgba(57, 255, 156, 0.08);
}

.gate-form button,
.gate-actions button,
.gate-lab-import > button,
.gate-lab-actions button,
.gate-file-button {
  min-height: clamp(38px, 5.8vh, 48px);
  padding: 0 18px;
  border-color: rgba(57, 255, 156, 0.5);
  background: #102019;
  color: var(--green);
  font-weight: 700;
}

.gate-lab-import {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 4px;
}

.gate-lab-import > button {
  width: fit-content;
}

.gate-lab-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(240, 193, 90, 0.42);
  background:
    linear-gradient(135deg, rgba(240, 193, 90, 0.12), rgba(57, 255, 156, 0.06)),
    rgba(2, 7, 9, 0.84);
}

.gate-lab-panel p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(12px, 1.35vw, 14px);
}

.gate-lab-panel textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid rgba(57, 255, 156, 0.45);
  background: #020504;
  color: var(--green);
  padding: 12px;
  outline: none;
  font: 700 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.gate-lab-panel textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(240, 193, 90, 0.18), inset 0 0 28px rgba(57, 255, 156, 0.08);
}

.gate-lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.gate-file-button {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.gate-file-button input {
  display: none;
}

.gate-auth-check {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.gate-auth-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

#gateLabStatus {
  min-height: 16px;
  color: var(--gold);
  font: 700 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.naked-token {
  width: 100%;
  height: clamp(112px, 28vh, 210px);
  border: 1px solid var(--red);
  background:
    linear-gradient(90deg, rgba(255, 79, 95, 0.14), rgba(99, 216, 255, 0.07)),
    #070605;
  color: var(--red);
  padding: clamp(10px, 1.8vw, 18px);
  overflow-wrap: anywhere;
  font: 800 clamp(14px, 4vw, 52px)/1.03 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: 0 0 38px rgba(255, 79, 95, 0.16), inset 0 0 34px rgba(255, 79, 95, 0.08);
}

.gate-warning {
  display: grid;
  gap: 7px;
}

.gate-warning p {
  font-size: clamp(12px, 1.55vw, 17px);
  line-height: 1.24;
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.gate-actions button:first-child {
  border-color: rgba(240, 193, 90, 0.6);
  background: #211809;
  color: var(--gold);
}

.naked-token-banner {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--red);
  background:
    linear-gradient(90deg, rgba(255, 79, 95, 0.22), rgba(5, 14, 19, 0.94) 36%),
    #090706;
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
}

.naked-token-banner span {
  color: var(--red);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
}

.naked-token-banner strong {
  min-width: 0;
  max-height: 46px;
  color: var(--red);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  font: 800 clamp(13px, 2vw, 24px)/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.naked-token-banner button {
  min-height: 40px;
  padding: 0 14px;
  border-color: rgba(240, 193, 90, 0.72);
  background: #211809;
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}

.sidebar {
  min-height: 0;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(5, 14, 20, 0.72), rgba(3, 8, 12, 0.7)),
    var(--glass);
  backdrop-filter: blur(18px) saturate(142%);
  padding: 20px;
  overflow-y: auto;
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.25), inset -1px 0 rgba(99, 216, 255, 0.1);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--green);
  color: var(--green);
  background:
    linear-gradient(135deg, rgba(57, 255, 156, 0.12), rgba(99, 216, 255, 0.06)),
    rgba(3, 12, 15, 0.72);
  font: 700 24px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: inset 0 0 22px rgba(57, 255, 156, 0.12);
}

h1,
h2,
p,
pre {
  margin: 0;
}

h1 {
  font-size: 17px;
  font-weight: 680;
}

.brand p,
.panel-head span,
.eyebrow,
.mode,
.token-actions,
.panel-copy p {
  color: var(--muted);
  font-size: 12px;
}

.token-panel,
.panel {
  position: relative;
  border: 1px solid rgba(99, 216, 255, 0.18);
  background:
    linear-gradient(145deg, rgba(9, 25, 31, 0.58), rgba(6, 15, 17, 0.68)),
    rgba(4, 12, 15, 0.48);
  margin-bottom: 16px;
  box-shadow: 0 18px 48px var(--shadow), inset 0 0 34px rgba(99, 216, 255, 0.045);
  backdrop-filter: blur(12px) saturate(142%);
}

.token-panel::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(99, 216, 255, 0.08), transparent 18% 82%, rgba(57, 255, 156, 0.06)),
    linear-gradient(rgba(237, 247, 239, 0.025) 1px, transparent 1px);
  background-size: auto, 100% 7px;
  opacity: 0.58;
}

.token-panel {
  padding: 14px;
}

.beast-frame {
  min-height: 130px;
  border: 1px solid rgba(57, 255, 156, 0.35);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.12), transparent 42%, rgba(99, 216, 255, 0.12)),
    rgba(2, 8, 12, 0.66);
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.beast-eye {
  width: 72px;
  height: 42px;
  border: 1px solid var(--green);
  background:
    linear-gradient(90deg, transparent 0 31px, var(--green) 31px 39px, transparent 39px),
    rgba(8, 16, 21, 0.72);
  box-shadow: 0 0 24px rgba(57, 255, 156, 0.22), inset 0 0 18px rgba(57, 255, 156, 0.18);
}

.fed .beast-eye {
  border-color: var(--gold);
  background:
    linear-gradient(90deg, transparent 0 30px, var(--gold) 30px 40px, transparent 40px),
    #101009;
  box-shadow: 0 0 26px rgba(240, 193, 90, 0.3), inset 0 0 18px rgba(240, 193, 90, 0.2);
}

.beast-art {
  color: var(--green);
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.panel-copy h2 {
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.panel-copy p {
  line-height: 1.48;
}

.key-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.key-form input,
.terminal-input input {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(2, 7, 10, 0.7);
  color: var(--ink);
  outline: none;
}

.key-form input {
  height: 40px;
  padding: 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.key-form input:focus,
.terminal-input input:focus {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(57, 255, 156, 0.2);
}

.key-form button,
.token-actions button,
.panel-head button,
.terminal-input button {
  padding: 0 12px;
  min-height: 36px;
}

.token-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.token-actions span {
  color: var(--rose);
}

.fed .token-actions span {
  color: var(--gold);
}

.token-actions button {
  min-height: 30px;
  font-size: 12px;
}

.provider-panel {
  padding-bottom: 14px;
}

.provider-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 12px 14px 8px;
}

.provider-options button,
.ollama-config button {
  min-height: 34px;
  padding: 0 8px;
  font-size: 11px;
}

.provider-options button.active {
  border-color: var(--green);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(57, 255, 156, 0.18), 0 0 22px rgba(57, 255, 156, 0.08);
}

.provider-options button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.provider-copy,
.ollama-config small {
  display: block;
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ollama-config {
  display: grid;
  gap: 8px;
  padding: 10px 14px 0;
}

.ollama-config label {
  display: grid;
  gap: 4px;
  color: var(--cyan);
  font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ollama-config .route-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.ollama-config .route-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
}

.ollama-config select {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  background: rgba(2, 7, 10, 0.84);
  color: var(--ink);
  outline: none;
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ollama-config select:disabled {
  color: rgba(232, 245, 237, 0.52);
  border-color: rgba(99, 216, 255, 0.18);
  background: rgba(2, 7, 10, 0.46);
  cursor: not-allowed;
}

.ollama-config select:focus {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(57, 255, 156, 0.2);
}

.timing-body {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.hourglass {
  position: relative;
  width: 46px;
  height: 74px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  filter: drop-shadow(0 0 18px rgba(240, 193, 90, 0.14));
}

.glass {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(240, 193, 90, 0.58);
  background: rgba(4, 12, 15, 0.68);
}

.glass.top {
  clip-path: polygon(10% 0, 90% 0, 58% 100%, 42% 100%);
}

.glass.bottom {
  clip-path: polygon(42% 0, 58% 0, 90% 100%, 10% 100%);
}

.glass span {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: var(--sand-fill, 12%);
  background: linear-gradient(180deg, rgba(240, 193, 90, 0.96), rgba(255, 107, 143, 0.6));
  animation: sandBreathe var(--sand-duration, 15s) ease-in-out infinite;
}

.glass.top span {
  top: 0;
  bottom: auto;
  height: calc(100% - var(--sand-fill, 12%));
}

.sand-thread {
  position: absolute;
  left: calc(50% - 1px);
  top: 31px;
  width: 2px;
  height: 13px;
  background: var(--gold);
  opacity: 0.72;
  animation: sandThread var(--sand-duration, 15s) linear infinite;
}

.timing-readout {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.timing-readout strong {
  color: var(--gold);
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.timing-readout p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.timing-meter {
  height: 7px;
  border: 1px solid rgba(240, 193, 90, 0.32);
  background: rgba(3, 8, 10, 0.74);
  overflow: hidden;
}

.timing-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--green));
  box-shadow: 0 0 18px rgba(240, 193, 90, 0.28);
  transition: width 280ms ease;
}

@keyframes hungerPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes sandBreathe {
  0%, 100% { opacity: 0.7; filter: brightness(0.9); }
  50% { opacity: 1; filter: brightness(1.16); }
}

@keyframes sandThread {
  0%, 100% { transform: scaleY(0.35); opacity: 0.42; }
  50% { transform: scaleY(1); opacity: 0.92; }
}

@keyframes starDriftA {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1.02); }
  100% { transform: translate3d(-9%, 7%, 0) rotate(12deg) scale(1.12); }
}

@keyframes starDriftB {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1.08); }
  100% { transform: translate3d(8%, -6%, 0) rotate(-10deg) scale(1.18); }
}

@keyframes spiralOrbit {
  0% { transform: rotate(0deg) scale(1) translate3d(0, 0, 0); }
  50% { transform: rotate(180deg) scale(1.08) translate3d(-2%, 1%, 0); }
  100% { transform: rotate(360deg) scale(1) translate3d(0, 0, 0); }
}

@keyframes serpentFlow {
  0% { stroke-dashoffset: 0; opacity: 0.42; }
  45% { opacity: 0.95; }
  100% { stroke-dashoffset: -170; opacity: 0.42; }
}

@keyframes neuralPulse {
  0%, 100% { stroke-dashoffset: 0; opacity: 0.28; }
  50% { stroke-dashoffset: -42; opacity: 0.78; }
}

@keyframes nodeBreathe {
  0%, 100% { transform: scale(0.94); opacity: 0.45; }
  50% { transform: scale(1.16); opacity: 0.95; }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.stat {
  padding: 11px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
}

.stat strong {
  display: block;
  color: var(--green);
  font: 700 18px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stat span {
  color: var(--muted);
  font-size: 11px;
}

.discovery-panel .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.file-list {
  max-height: 390px;
  overflow: auto;
  padding: 7px;
}

.map-empty {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.map-empty strong {
  color: var(--ink);
}

.map-empty code {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tree-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 8px 8px calc(8px + var(--depth, 0) * 14px);
  border: 0;
  border-bottom: 1px solid rgba(30, 58, 50, 0.7);
  background: transparent;
  color: var(--ink);
}

.tree-item:hover {
  background: rgba(57, 255, 156, 0.06);
  transform: none;
}

.tree-kind {
  display: inline-block;
  min-width: 30px;
  margin-right: 7px;
  color: var(--cyan);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.tree-item.dir .tree-kind {
  color: var(--gold);
}

.tree-item.image .tree-kind {
  color: var(--rose);
}

.tree-item.pdf .tree-kind {
  color: var(--gold);
}

.tree-item.unlocked {
  border-left: 2px solid var(--green);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.11), transparent 68%),
    transparent;
}

.tree-item.unlocked strong,
.tree-item.unlocked small {
  color: var(--green);
}

.tree-item strong {
  display: inline;
  font-size: 12px;
  color: var(--ink);
}

.tree-item small {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.fact-list {
  max-height: 300px;
  overflow: auto;
  padding: 7px;
}

.fact-empty {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fact-empty strong {
  color: var(--ink);
}

.fact-item {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(30, 58, 50, 0.75);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.fact-item.fruit {
  border-left: 2px solid rgba(240, 193, 90, 0.58);
  background:
    linear-gradient(90deg, rgba(240, 193, 90, 0.06), transparent 54%),
    transparent;
}

.fact-item.fruit.unclaimed {
  box-shadow: inset 0 0 24px rgba(240, 193, 90, 0.045);
}

.fact-item.fruit.claimed {
  border-left-color: rgba(57, 255, 156, 0.72);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.08), transparent 58%),
    rgba(57, 255, 156, 0.02);
}

.fact-item:hover {
  background: rgba(240, 193, 90, 0.065);
  transform: none;
}

.fact-item strong {
  font-size: 12px;
  line-height: 1.35;
}

.fact-item small {
  color: var(--faint);
  font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.fact-item.open {
  border: 1px solid rgba(99, 216, 255, 0.28);
  background: rgba(99, 216, 255, 0.045);
  margin-bottom: 7px;
}

.fact-trigger {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 9px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.fact-trigger:hover {
  transform: none;
  color: var(--ink);
}

.fruit-state {
  width: fit-content;
  color: var(--gold);
  border: 1px solid rgba(240, 193, 90, 0.34);
  background: rgba(240, 193, 90, 0.08);
  padding: 2px 5px;
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fact-item.claimed .fruit-state {
  color: var(--green);
  border-color: rgba(57, 255, 156, 0.36);
  background: rgba(57, 255, 156, 0.08);
}

.fact-summary {
  display: grid;
  gap: 8px;
  padding: 0 9px 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fact-summary p {
  margin: 0;
}

.fact-summary blockquote {
  margin: 0;
  padding-left: 10px;
  border-left: 2px solid rgba(99, 216, 255, 0.38);
  color: var(--ink);
}

.fact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.fact-actions button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--cyan);
  border-color: rgba(99, 216, 255, 0.35);
  background: #07100d;
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.terminal-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(4, 12, 18, 0.58), rgba(2, 7, 10, 0.44)),
    rgba(3, 6, 9, 0.44);
  backdrop-filter: blur(8px) saturate(125%);
}

.terminal-wrap::before,
.terminal-wrap::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.terminal-wrap::before {
  inset: 12px 18px 86px;
  border: 1px solid rgba(99, 216, 255, 0.14);
  clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
  box-shadow: inset 0 0 56px rgba(99, 216, 255, 0.045);
}

.terminal-wrap::after {
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0 48%, rgba(57, 255, 156, 0.035) 49%, transparent 50%),
    linear-gradient(90deg, transparent 0 63%, rgba(157, 124, 255, 0.045) 64%, transparent 65%);
  opacity: 0.62;
}

.terminal-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 30px 16px;
  border-bottom: 1px solid rgba(30, 58, 50, 0.86);
  background:
    linear-gradient(90deg, rgba(10, 24, 31, 0.72), rgba(5, 11, 15, 0.58)),
    rgba(5, 9, 8, 0.5);
  backdrop-filter: blur(12px) saturate(138%);
}

.eyebrow {
  color: var(--rose);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.terminal-head h2 {
  font: 500 clamp(24px, 3.8vw, 42px)/1.05 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
}

.mode-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.identity-form {
  display: flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(57, 255, 156, 0.28);
  background: rgba(5, 15, 18, 0.7);
  color: var(--green);
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.identity-form input {
  width: 94px;
  height: 34px;
  border: 0;
  padding: 0 0 0 10px;
  background: transparent;
  color: var(--green);
  font: inherit;
  text-transform: lowercase;
}

.identity-form input:focus {
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(57, 255, 156, 0.62);
}

.identity-form span {
  padding-right: 10px;
  color: var(--muted);
}

.mode {
  border: 1px solid rgba(99, 216, 255, 0.28);
  padding: 8px 10px;
  color: var(--green);
  background: rgba(5, 15, 18, 0.7);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mode.subtle {
  color: var(--gold);
}

.suggestions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 30px;
  border-bottom: 1px solid rgba(30, 58, 50, 0.8);
  background: rgba(4, 13, 18, 0.48);
  backdrop-filter: blur(10px) saturate(130%);
}

.suggestions button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  background: rgba(5, 16, 20, 0.7);
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.terminal {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 30px 18px;
  font: 14px/1.52 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background:
    linear-gradient(180deg, rgba(57, 255, 156, 0.022), transparent 34%),
    linear-gradient(90deg, rgba(99, 216, 255, 0.018), transparent 16% 84%, rgba(157, 124, 255, 0.018)),
    rgba(3, 6, 9, 0.12);
}

.term-block {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.term-block.command {
  grid-template-columns: minmax(48px, max-content) minmax(0, 1fr);
}

.term-prefix {
  color: var(--faint);
  text-align: right;
  user-select: none;
  white-space: nowrap;
}

.term-body {
  min-width: 0;
  color: var(--ink);
}

.term-block.command .term-prefix,
.term-block.command .term-body code {
  color: var(--green);
}

.term-block.ai .term-prefix {
  color: var(--rose);
}

.term-block.gate .term-prefix {
  color: var(--gold);
}

.term-block.error .term-prefix {
  color: var(--red);
}

.term-block.loading .term-body {
  color: var(--muted);
  animation: pulse 1.35s ease-in-out infinite;
}

.term-block.archive .term-prefix {
  color: var(--green);
}

.archive-card {
  border: 1px solid rgba(57, 255, 156, 0.34);
  background:
    linear-gradient(135deg, rgba(57, 255, 156, 0.09), rgba(3, 9, 12, 0.82)),
    rgba(3, 9, 12, 0.72);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34), inset 0 0 28px rgba(57, 255, 156, 0.045);
}

.archive-head {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(57, 255, 156, 0.24);
}

.archive-head span {
  color: var(--green);
  font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.1em;
}

.archive-head strong {
  color: var(--ink);
}

.archive-head small {
  color: var(--muted);
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.archive-raw {
  max-height: min(58vh, 620px);
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--green);
  background: rgba(1, 5, 5, 0.72);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.48 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.archive-raw code {
  display: block;
  color: inherit;
  border: 0;
  background: transparent;
  padding: 0;
  white-space: inherit;
}

.archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(57, 255, 156, 0.18);
}

.archive-actions button {
  min-height: 34px;
  color: var(--green);
  border-color: rgba(57, 255, 156, 0.42);
  background: rgba(5, 20, 15, 0.76);
}

.term-body p {
  margin: 0 0 12px;
  white-space: normal;
}

.term-body p:last-child {
  margin-bottom: 0;
}

.term-body code {
  color: var(--cyan);
  background: rgba(99, 216, 255, 0.08);
  border: 1px solid rgba(99, 216, 255, 0.18);
  padding: 1px 4px;
}

.term-code-block {
  position: relative;
  max-width: 100%;
  margin: 2px 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid rgba(99, 216, 255, 0.24);
  background:
    linear-gradient(90deg, rgba(99, 216, 255, 0.1), transparent 42%),
    rgba(3, 10, 13, 0.72);
  backdrop-filter: blur(8px);
  color: var(--ink);
  white-space: pre;
}

.term-code-block::before {
  content: attr(data-lang);
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.term-code-block:not([data-lang])::before {
  content: none;
}

.term-code-block code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  white-space: pre;
}

.term-table-scroll {
  max-width: 100%;
  max-height: 360px;
  margin: 8px 0 16px;
  overflow: auto;
  border: 1px solid rgba(99, 216, 255, 0.24);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.08), transparent 48%),
    rgba(3, 10, 13, 0.72);
  backdrop-filter: blur(8px);
}

.term-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: clamp(14px, 1.3vw, 16px);
  line-height: 1.35;
}

.term-table th,
.term-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(99, 216, 255, 0.14);
  text-align: left;
  vertical-align: top;
}

.term-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(2, 13, 17, 0.95);
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.term-table tr:hover td {
  background: rgba(57, 255, 156, 0.045);
}

.repo-ref {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: min(100%, 680px);
  margin: 0 2px;
  padding: 2px 6px;
  border-color: rgba(99, 216, 255, 0.3);
  background: rgba(99, 216, 255, 0.08);
  color: var(--cyan);
  font: inherit;
  vertical-align: baseline;
}

.repo-ref:hover {
  transform: none;
  background: rgba(99, 216, 255, 0.14);
}

.repo-ref span {
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
}

.repo-ref.image {
  border-color: rgba(255, 107, 143, 0.34);
  background: rgba(255, 107, 143, 0.08);
  color: var(--rose);
}

.repo-ref.markdown {
  border-color: rgba(57, 255, 156, 0.26);
  background: rgba(57, 255, 156, 0.07);
  color: var(--green);
}

.repo-ref.pdf {
  border-color: rgba(240, 193, 90, 0.34);
  background: rgba(240, 193, 90, 0.08);
  color: var(--gold);
}

.external-link {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(246, 199, 91, 0.42);
}

.external-link:hover {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.youtube-card {
  display: inline-grid;
  max-width: 100%;
  gap: 8px;
  vertical-align: baseline;
}

.youtube-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  max-width: 100%;
}

.youtube-link,
.youtube-open-link {
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(246, 199, 91, 0.42);
  background: transparent;
  color: var(--gold);
  font: inherit;
  text-align: left;
  text-decoration: none;
  white-space: normal;
}

.youtube-link:hover,
.youtube-open-link:hover {
  color: var(--ink);
  border-bottom-color: var(--gold);
  background: transparent;
  transform: none;
}

.youtube-open-link {
  color: var(--faint);
  border-bottom-color: rgba(151, 178, 164, 0.34);
  font-size: 0.92em;
}

.youtube-player-host {
  display: block;
  max-width: min(720px, 100%);
}

.youtube-player-shell {
  display: grid;
  width: min(720px, 100%);
  max-width: 100%;
  gap: 7px;
  margin: 8px 0 12px;
}

.youtube-player-note {
  display: block;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(99, 216, 255, 0.24);
  background: rgba(4, 18, 22, 0.82);
  color: var(--faint);
  font-size: 0.82em;
  line-height: 1.35;
}

.youtube-inline-fallback {
  color: var(--gold);
  white-space: nowrap;
}

.youtube-player {
  display: block;
  width: min(720px, 100%);
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(240, 193, 90, 0.42);
  background:
    linear-gradient(135deg, rgba(5, 16, 18, 0.96), rgba(1, 5, 8, 0.96)),
    rgba(3, 10, 13, 0.94);
  box-shadow: 0 0 22px rgba(240, 193, 90, 0.08);
}

.youtube-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.term-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 4px;
}

.term-actions button {
  min-height: 44px;
  padding: 0 16px;
  border-color: rgba(240, 193, 90, 0.78);
  background:
    linear-gradient(135deg, rgba(240, 193, 90, 0.2), rgba(16, 32, 25, 0.92)),
    #211809;
  color: var(--gold);
  font-weight: 850;
  box-shadow: 0 0 24px rgba(240, 193, 90, 0.12);
}

.term-block.error .term-actions button {
  border-color: var(--red);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 79, 95, 0.3), rgba(33, 24, 9, 0.9)),
    #241010;
}

.source {
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 8px;
  font-size: 11px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(5, 15, 18, 0.68);
  text-align: left;
}

.source.fruit-source.unclaimed {
  border-color: rgba(240, 193, 90, 0.58);
  background:
    linear-gradient(90deg, rgba(240, 193, 90, 0.13), rgba(5, 15, 18, 0.68) 78%);
  color: var(--gold);
  box-shadow: inset 0 0 22px rgba(240, 193, 90, 0.055);
}

.source.fruit-source.claimed {
  border-color: rgba(99, 216, 255, 0.2);
  background: rgba(5, 15, 18, 0.52);
  color: var(--faint);
  opacity: 0.72;
}

.source:hover {
  transform: none;
  color: var(--green);
  border-color: var(--green);
}

.source.image {
  color: var(--rose);
  border-color: rgba(255, 107, 143, 0.34);
}

.source.pdf {
  color: var(--gold);
  border-color: rgba(240, 193, 90, 0.34);
}

.terminal-input {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 16px 30px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(57, 255, 156, 0.08), rgba(4, 13, 18, 0.86)),
    rgba(4, 11, 15, 0.84);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 -22px 50px rgba(0, 0, 0, 0.34);
}

.prompt {
  color: var(--green);
  font: 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.terminal-input input {
  height: 46px;
  padding: 0 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.terminal-input button {
  min-width: 80px;
  border-color: rgba(57, 255, 156, 0.52);
  background: rgba(12, 32, 30, 0.78);
  color: var(--green);
}

.image-viewer {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(circle at 50% 50%, rgba(99, 216, 255, 0.1), transparent 54%),
    rgba(2, 5, 4, 0.97);
  border-left: 1px solid var(--line);
}

.image-viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 8, 0.92);
}

.image-viewer-bar div {
  min-width: 0;
}

.image-viewer-bar span {
  display: block;
  margin-bottom: 4px;
  color: var(--rose);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
}

.image-viewer-bar strong {
  display: block;
  min-width: 0;
  color: var(--ink);
  font: 700 15px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer-bar button {
  min-height: 38px;
  padding: 0 14px;
  border-color: rgba(99, 216, 255, 0.52);
  color: var(--cyan);
  white-space: nowrap;
}

.image-viewer-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid rgba(99, 216, 255, 0.36);
  background: #030504;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.58), 0 0 40px rgba(99, 216, 255, 0.1);
}

.document-viewer {
  position: absolute;
  inset: 0;
  z-index: 19;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(circle at 44% 18%, rgba(57, 255, 156, 0.12), transparent 48%),
    rgba(2, 5, 4, 0.98);
  border-left: 1px solid var(--line);
}

.document-viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(57, 255, 156, 0.28);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.12), rgba(5, 9, 8, 0.94)),
    rgba(5, 9, 8, 0.94);
}

.document-viewer-bar div {
  min-width: 0;
}

.document-viewer-bar span {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
}

.document-viewer-bar strong,
.document-viewer-bar small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-viewer-bar strong {
  color: var(--ink);
  font: 700 15px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.document-viewer-bar small {
  margin-top: 4px;
  color: var(--muted);
  font: 11px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.document-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.document-viewer-actions button {
  min-height: 38px;
  padding: 0 14px;
  border-color: rgba(57, 255, 156, 0.52);
  color: var(--green);
  white-space: nowrap;
}

.document-viewer-actions button:first-child {
  border-color: rgba(240, 193, 90, 0.62);
  color: var(--gold);
  background: #211809;
}

.document-viewer-stage {
  min-height: 0;
  margin: 0;
  padding: clamp(16px, 2vw, 28px);
  overflow: auto;
  color: var(--green);
  background:
    linear-gradient(rgba(57, 255, 156, 0.028) 1px, transparent 1px),
    rgba(1, 5, 5, 0.7);
  background-size: 100% 8px;
  white-space: normal;
  overflow-wrap: anywhere;
  font: clamp(12px, 1.1vw, 15px)/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.document-viewer-stage.pdf-reader-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

.pdf-reader {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(57, 255, 156, 0.34);
  background: #050908;
}

.pdf-fallback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(240, 193, 90, 0.28);
  background: rgba(12, 9, 4, 0.78);
  color: var(--muted);
  font-size: 12px;
}

.pdf-fallback a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-doc {
  width: min(100%, 1040px);
  margin: 0 auto;
  color: rgba(210, 255, 228, 0.92);
}

.markdown-doc > *:first-child {
  margin-top: 0;
}

.markdown-doc > *:last-child {
  margin-bottom: 0;
}

.markdown-doc h1,
.markdown-doc h2,
.markdown-doc h3,
.markdown-doc h4,
.markdown-doc h5,
.markdown-doc h6 {
  margin: 1.35em 0 0.55em;
  color: var(--green);
  line-height: 1.18;
  letter-spacing: 0;
  scroll-margin-top: 18px;
}

.markdown-doc h1 {
  font-size: clamp(24px, 4.6vw, 44px);
}

.markdown-doc h2 {
  font-size: clamp(19px, 2.8vw, 28px);
  color: var(--cyan);
}

.markdown-doc h3 {
  font-size: clamp(16px, 2vw, 21px);
  color: var(--gold);
}

.markdown-doc h4,
.markdown-doc h5,
.markdown-doc h6 {
  font-size: 1em;
  color: var(--ink);
}

.markdown-doc p,
.markdown-doc li {
  margin: 0 0 0.95em;
  color: rgba(237, 247, 239, 0.91);
}

.markdown-doc ul,
.markdown-doc ol {
  margin: 0 0 1.15em;
  padding-left: 1.35em;
}

.markdown-doc li {
  padding-left: 0.25em;
}

.markdown-doc blockquote {
  margin: 1em 0 1.25em;
  padding: 0.7em 1em;
  border-left: 2px solid rgba(99, 216, 255, 0.45);
  background: rgba(99, 216, 255, 0.055);
  color: rgba(237, 247, 239, 0.86);
}

.markdown-doc hr {
  height: 1px;
  margin: 1.45em 0;
  border: 0;
  background: linear-gradient(90deg, transparent, rgba(57, 255, 156, 0.46), transparent);
}

.markdown-doc code {
  color: var(--cyan);
  border: 1px solid rgba(99, 216, 255, 0.22);
  background: rgba(99, 216, 255, 0.08);
  padding: 1px 4px;
}

.doc-code-block {
  position: relative;
  max-width: 100%;
  margin: 1em 0 1.25em;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid rgba(57, 255, 156, 0.26);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.08), transparent 48%),
    rgba(3, 10, 13, 0.78);
  color: rgba(237, 247, 239, 0.93);
}

.doc-code-block::before {
  content: attr(data-lang);
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-code-block:not([data-lang])::before {
  content: none;
}

.doc-code-block code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.doc-plain-block {
  display: grid;
  gap: 6px;
  max-width: 100%;
  margin: 1em 0 1.25em;
  padding: 13px 16px;
  overflow-x: auto;
  border: 1px solid rgba(57, 255, 156, 0.24);
  background:
    linear-gradient(90deg, rgba(57, 255, 156, 0.07), transparent 52%),
    rgba(1, 12, 9, 0.66);
  color: rgba(210, 255, 228, 0.94);
}

.doc-plain-block div {
  min-height: 1.35em;
  white-space: pre-wrap;
}

.doc-plain-block code {
  display: inline;
  white-space: normal;
}

.doc-table-scroll {
  max-width: 100%;
  margin: 1em 0 1.25em;
  overflow: auto;
  border: 1px solid rgba(57, 255, 156, 0.24);
  background: rgba(3, 10, 13, 0.76);
}

.doc-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.doc-table th,
.doc-table td {
  padding: 9px 11px;
  border-bottom: 1px solid rgba(57, 255, 156, 0.13);
  text-align: left;
  vertical-align: top;
}

.doc-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(2, 13, 17, 0.95);
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.doc-link {
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
  min-height: 0;
  margin: 0 2px;
  padding: 2px 6px;
  border: 1px solid rgba(57, 255, 156, 0.3);
  background: rgba(57, 255, 156, 0.07);
  color: var(--green);
  font: inherit;
  text-align: left;
  vertical-align: baseline;
  white-space: normal;
  overflow-wrap: anywhere;
}

.doc-link:hover {
  background: rgba(57, 255, 156, 0.13);
  transform: none;
}

.doc-link.image {
  border-color: rgba(255, 107, 143, 0.34);
  background: rgba(255, 107, 143, 0.08);
  color: var(--rose);
}

.doc-link.pdf {
  border-color: rgba(240, 193, 90, 0.34);
  background: rgba(240, 193, 90, 0.08);
  color: var(--gold);
}

.doc-link.section {
  border-color: rgba(99, 216, 255, 0.34);
  background: rgba(99, 216, 255, 0.08);
  color: var(--cyan);
}

.doc-link.missing {
  border-style: dashed;
  color: var(--faint);
  cursor: default;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 940px) {
  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  body.viewer-open {
    height: 100dvh;
    overflow: hidden;
  }

  .token-naked .shell {
    padding-top: 0;
  }

  .naked-token-banner {
    top: auto;
    bottom: 0;
    height: auto;
    min-height: 96px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: center;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--red);
    border-bottom: 0;
  }

  .naked-token-banner span {
    grid-column: 1 / -1;
  }

  .naked-token-banner strong {
    max-height: 34px;
    font-size: 14px;
  }

  .naked-token-banner button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .entry-gate {
    padding: 8px;
  }

  .gate-card {
    height: min(720px, calc(100dvh - 16px));
    padding: 16px;
  }

  .gate-step h2 {
    font-size: clamp(24px, 8vw, 40px);
  }

  .gate-step p,
  .gate-warning p {
    font-size: clamp(12px, 3.2vw, 16px);
  }

  .naked-token {
    height: clamp(94px, 24vh, 160px);
  }

  .gate-form input {
    height: 42px;
  }

  .gate-form button,
  .gate-actions button,
  .gate-lab-import > button,
  .gate-lab-actions button,
  .gate-file-button {
    min-height: 38px;
  }

  .gate-lab-import > button,
  .gate-lab-actions button,
  .gate-file-button {
    width: 100%;
  }

  .gate-lab-panel {
    padding: 10px;
  }

  .gate-lab-panel textarea {
    min-height: 96px;
  }

  .shell {
    display: grid;
    grid-template-columns: 1fr;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .spiral-orbit {
    width: 118vw;
    right: -55vw;
    top: 14vh;
    opacity: 0.46;
  }

  .kundalini-link {
    width: 88vw;
    min-width: 0;
    right: -26vw;
    bottom: 6vh;
    opacity: 0.38;
  }

  .sidebar {
    display: none;
  }

  .terminal-wrap {
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 100dvh;
    height: 100dvh;
    height: 100svh;
    overflow: hidden;
  }

  .terminal-head,
  .suggestions,
  .terminal,
  .terminal-input {
    padding-left: 12px;
    padding-right: 12px;
  }

  .terminal-head {
    display: none;
  }

  .suggestions {
    display: none !important;
  }

  .terminal {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 16px;
    font-size: 13px;
    line-height: 1.48;
    -webkit-overflow-scrolling: touch;
  }

  .term-block,
  .term-block.command {
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 14px;
  }

  .term-prefix,
  .term-block.command .term-prefix {
    text-align: left;
    font-size: 12px;
  }

  .term-body {
    min-width: 0;
  }

  .term-code-block,
  .term-table-scroll {
    margin-left: 0;
    margin-right: 0;
  }

  .repo-ref,
  .source {
    max-width: 100%;
    min-height: 40px;
    align-items: center;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }

  .repo-ref {
    padding: 7px 9px;
    margin: 4px 2px;
    line-height: 1.25;
  }

  .repo-ref span {
    display: none;
  }

  .youtube-card {
    display: grid;
    width: 100%;
    max-width: 100%;
    margin: 6px 0 10px;
  }

  .youtube-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
  }

  .youtube-link,
  .youtube-open-link {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(246, 199, 91, 0.34);
    background: rgba(246, 199, 91, 0.07);
    overflow-wrap: anywhere;
  }

  .youtube-open-link {
    border-color: rgba(151, 178, 164, 0.28);
    background: rgba(151, 178, 164, 0.06);
  }

  .youtube-player-host,
  .youtube-player-shell,
  .youtube-player {
    width: 100%;
    max-width: 100%;
  }

  .youtube-player {
    min-height: 180px;
    margin: 0;
  }

  .youtube-player-note {
    font-size: 0.78em;
  }

  .sources {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .source {
    width: 100%;
    min-height: 44px;
    padding: 9px 10px;
  }

  .terminal-input {
    position: relative;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .prompt {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }

  .terminal-input input {
    height: 44px;
    font-size: 16px;
  }

  .terminal-input button {
    min-width: 64px;
    height: 44px;
    padding: 0 12px;
  }

  .term-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .term-actions button,
  .archive-actions button {
    min-height: 44px;
    width: 100%;
  }

  .token-panel,
  .panel {
    margin-bottom: 12px;
  }

  .beast-frame {
    min-height: 104px;
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .beast-eye {
    width: 58px;
    height: 36px;
  }

  .key-form {
    grid-template-columns: 1fr;
  }

  .key-form button {
    width: 100%;
  }

  .image-viewer,
  .document-viewer {
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    height: 100dvh;
    width: 100vw;
  }

  .image-viewer-bar,
  .document-viewer-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: flex-start;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .document-viewer-bar {
    flex-direction: column;
  }

  .image-viewer-bar div,
  .document-viewer-bar > div:first-child {
    width: 100%;
  }

  .image-viewer-bar strong,
  .document-viewer-bar strong,
  .document-viewer-bar small {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .document-viewer-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .image-viewer-bar button,
  .document-viewer-actions button {
    min-height: 44px;
    padding: 0 12px;
    font-size: 13px;
  }

  .image-viewer-stage {
    padding: 10px 10px max(12px, env(safe-area-inset-bottom));
  }

  .image-viewer-stage img {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 86px);
  }

  .document-viewer-stage {
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
    font-size: 12px;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
  }

  .archive-raw {
    max-height: 52vh;
  }
}
