@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap");
:root {
  --ink: #232545;
  --muted: #727693;
  --lilac: #7b69cf;
  --ice: #81b7e7;
  --line: rgba(103, 106, 162, 0.19);
  --glass: rgba(255, 255, 255, 0.57);
}
* {
  box-sizing: border-box;
}
html {
  background: #edf0fc;
}
body {
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}
button {
  font: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
a {
  text-decoration: none;
  color: inherit;
}
.experience {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(128deg, #f9faff 0%, #e6eaf9 45%, #f7f8ff 100%);
}
.ambient {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(65px);
  z-index: -1;
}
.ambient-a {
  width: 54vw;
  height: 54vw;
  background: #c5c5fb88;
  left: 27%;
  top: 8%;
}
.ambient-b {
  width: 38vw;
  height: 38vw;
  background: #c5ecff77;
  right: -9%;
  bottom: 0;
}
.glass {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 45px rgba(86, 91, 155, 0.1);
  backdrop-filter: blur(26px);
}
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px clamp(20px, 4vw, 72px);
  border-bottom: 1px solid var(--line);
}
.identity {
  display: flex;
  gap: 12px;
  align-items: center;
  font:
    700 18px "Space Grotesk",
    sans-serif;
  letter-spacing: 0.06em;
}
.identity small {
  display: block;
  color: var(--muted);
  font:
    9px "Space Mono",
    monospace;
  letter-spacing: 0.12em;
  margin-top: 3px;
}
.network,
.tiny-label,
.eyebrow,
.intro-foot,
.specimen-top,
.specimen-bottom,
.detail-line,
.contract-link,
.details-trigger,
.progress-head,
.stage-markers,
footer,
.details-head,
.history-head,
.details-footer {
  font:
    10px "Space Mono",
    monospace;
  letter-spacing: 0.06em;
}
.network {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}
.network-dot,
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #8876d8;
  border-radius: 50%;
  box-shadow: 0 0 0 5px #998be526;
}
.outline-button {
  border: 1px solid #b4b3d4;
  background: #ffffff90;
  color: var(--ink);
  padding: 12px 18px;
  font:
    700 11px "Space Grotesk",
    sans-serif;
  white-space: nowrap;
}
.stage {
  width: min(1500px, 94%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.25fr) minmax(
      260px,
      0.83fr
    );
  align-items: center;
  gap: clamp(16px, 2vw, 34px);
  min-height: 610px;
  padding: 36px 0 24px;
}
.intro {
  position: relative;
  z-index: 2;
}
.eyebrow {
  color: var(--lilac);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.eyebrow-line {
  width: 22px;
  height: 1px;
  background: var(--lilac);
}
.intro h1 {
  font:
    700 clamp(39px, 4.1vw, 70px)/1.04 "Space Grotesk",
    sans-serif;
  letter-spacing: -0.075em;
  margin: 25px 0;
  white-space: nowrap;
}
.intro h1 em {
  font-style: normal;
  color: #8574c6;
}
.intro p {
  font-size: 14px;
  line-height: 1.9;
  max-width: 320px;
  color: #676c89;
}
.intro-foot {
  margin-top: 50px;
  color: var(--lilac);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  max-width: 310px;
  display: flex;
  justify-content: space-between;
}
.specimen {
  position: relative;
  height: 560px;
  min-width: 0;
  overflow: visible;
}
.specimen-glow {
  position: absolute;
  inset: 14% 0;
  background: radial-gradient(
    ellipse,
    #c6c0ff80 0%,
    #d7e6ff50 38%,
    transparent 70%
  );
  pointer-events: none;
}
#organism-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}
#organism-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.specimen-top,
.specimen-bottom {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  color: #898bad;
}
.specimen-top {
  top: 14px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.specimen-top > span:last-child {
  margin-left: auto;
}
.specimen-bottom {
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
}
.specimen-card {
  position: relative;
  z-index: 2;
  padding: clamp(20px, 2.4vw, 36px);
  border-radius: 18px;
  align-self: center;
}
.tiny-label {
  color: var(--muted);
}
.specimen-card > .tiny-label {
  display: flex;
  justify-content: space-between;
}
.specimen-card h2 {
  font:
    700 clamp(27px, 2.5vw, 41px)/1.05 "Space Grotesk",
    sans-serif;
  letter-spacing: -0.065em;
  margin: 28px 0;
}
.stage-pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 50px;
  background: #e5e2ff;
  color: #6c59bd;
  font:
    700 11px "Space Mono",
    monospace;
}
.specimen-card p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin: 18px 0 26px;
}
.detail-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.detail-line strong {
  color: var(--ink);
  text-align: right;
}
.contract-link {
  display: block;
  color: #6659bb;
  margin: 18px 0;
}
.details-trigger {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 17px 0 0;
  background: none;
  color: var(--ink);
  text-align: left;
}
.bottom-ui {
  position: relative;
  z-index: 3;
  width: min(1500px, 94%);
  margin: 0 auto 28px;
  padding: 24px 30px;
  border-radius: 18px;
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(240px, 1.2fr) minmax(
      260px,
      1fr
    );
  align-items: center;
  gap: 35px;
}
.metric {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 8px;
}
.metric strong {
  font:
    600 53px "Space Grotesk",
    sans-serif;
  letter-spacing: -0.06em;
}
.metric span {
  font:
    12px "Space Mono",
    monospace;
  color: var(--muted);
}
.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
.progress {
  height: 7px;
  border-radius: 20px;
  background: #dadcf0;
  margin: 17px 0;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #a99af3, #83b9eb);
  transition: width 0.6s;
}
.stage-markers {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: #9b9bb4;
  font-size: 8px;
}
.action {
  min-width: 0;
}
#feed-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: #7164bc;
  color: white;
  border: 0;
  border-radius: 11px;
  padding: 17px;
  text-align: left;
  font:
    700 12px "Space Grotesk",
    sans-serif;
  letter-spacing: 0.03em;
}
#feed-btn:not(:disabled):hover {
  background: #5e4fa9;
}
.action small {
  display: block;
  font:
    9px "Space Mono",
    monospace;
  margin-top: 5px;
  color: #e2dcff;
}
#action-status {
  font:
    10px/1.6 "Space Mono",
    monospace;
  color: var(--muted);
  margin: 9px 0 0;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 0 4% 25px;
  color: #8c8daa;
}
.details-panel {
  position: fixed;
  z-index: 15;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100dvh;
  overflow: auto;
  margin: 0 0 0 auto;
  max-height: none;
  max-width: none;
  color: var(--ink);
  overscroll-behavior: contain;
  transition: transform 0.35s;
  padding: 32px;
  background: #f6f6ffed;
  border-radius: 0;
  box-shadow: -10px 0 40px #6666a722;
}
.details-panel.open {
  transform: translateX(0);
}
.details-head,
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.details-head button {
  font-size: 28px;
  background: none;
  border: 0;
}
.details-panel h2 {
  font:
    700 44px/1.03 "Space Grotesk",
    sans-serif;
  letter-spacing: -0.06em;
  margin: 50px 0 20px;
}
.details-panel p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.history-head {
  margin: 35px 0 20px;
  font:
    11px "Space Mono",
    monospace;
}
.history-head button {
  border: 0;
  background: none;
  color: #6256b7;
}
.history-list {
  font:
    11px/1.8 "Space Mono",
    monospace;
}
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.history-item a {
  color: #6758bb;
}
.details-footer {
  margin-top: 40px;
  color: var(--muted);
  line-height: 1.8;
}
.toast {
  position: fixed;
  z-index: 20;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 30px);
  opacity: 0;
  pointer-events: none;
  background: #4e468e;
  color: white;
  padding: 14px 22px;
  border-radius: 12px;
  font:
    11px "Space Mono",
    monospace;
  transition: 0.3s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 1150px) {
  .stage {
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr);
    min-height: 0;
  }
  .specimen-card {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 30px;
  }
  .specimen-card > .tiny-label,
  .specimen-card h2,
  .specimen-card p,
  .stage-pill {
    grid-column: 1;
  }
  .specimen-card .detail-line,
  .specimen-card .contract-link,
  .specimen-card .details-trigger {
    grid-column: 2;
  }
  .specimen-card .detail-line:first-of-type {
    grid-row: 1;
  }
  .specimen-card h2 {
    margin: 20px 0;
  }
  .specimen {
    height: 480px;
  }
  .bottom-ui {
    grid-template-columns: 1fr 1.2fr;
  }
  .action {
    grid-column: 1/-1;
  }
  .intro h1 {
    font-size: clamp(38px, 5vw, 64px);
  }
}
@media (max-width: 720px) {
  .topbar {
    padding: 14px 18px;
  }
  .network {
    display: none;
  }
  .identity {
    font-size: 14px;
  }
  .identity small {
    font-size: 7px;
  }
  .outline-button {
    font-size: 9px;
    padding: 11px;
  }
  .stage {
    width: calc(100% - 36px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 36px;
  }
  .intro {
    width: 100%;
  }
  .intro h1 {
    font-size: clamp(38px, 9.5vw, 62px);
    margin: 18px 0;
    white-space: normal;
  }
  .intro p {
    max-width: 360px;
    font-size: 13px;
  }
  .intro-foot {
    margin-top: 25px;
  }
  .specimen {
    width: 100%;
    height: 420px;
  }
  .specimen-card {
    display: block;
    width: 100%;
    padding: 24px;
  }
  .specimen-card h2 {
    font-size: 34px;
  }
  .bottom-ui {
    width: calc(100% - 36px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 22px;
    margin-top: 18px;
  }
  .action {
    grid-column: auto;
  }
  .stage-markers {
    font-size: 7px;
  }
  footer {
    flex-direction: column;
    font-size: 8px;
    padding: 0 20px 20px;
  }
  .specimen-top {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    animation: none !important;
  }
}

/* Preserve the white-glass layout while keeping controls visible and reachable. */
.details-panel::backdrop { background: rgba(35, 37, 69, 0.2); }
:focus-visible { outline: 3px solid #6651b8; outline-offset: 4px; }
#organism-canvas:focus-visible { outline-offset: -4px; border-radius: 12px; }
.specimen-bottom { padding: 0 8px; line-height: 1.7; }
#history-older { margin-top: 18px; white-space: normal; }
[aria-disabled="true"] { cursor: wait; opacity: 0.65; }
.stage > *, .bottom-ui > * { min-width: 0; }
.detail-line, .progress-head, .tiny-label { overflow-wrap: anywhere; }
.toast { max-width: calc(100% - 32px); overflow-wrap: anywhere; }
@media (max-width: 360px) {
  .topbar { gap: 8px; padding-inline: 12px; }
  .identity { gap: 6px; font-size: 12px; }
  .identity small { letter-spacing: 0; }
  .outline-button { padding-inline: 8px; }
  .eyebrow { font-size: 8px; white-space: normal; }
  .specimen-card { padding: 18px; }
  .bottom-ui { padding: 18px; }
  #feed-btn { gap: 8px; padding: 12px; font-size: 11px; }
  .action small { font-size: 8px; }
  .details-panel { padding: 22px; }
  .history-head { gap: 10px; flex-wrap: wrap; }
}

/* Organism identity and shared control finishes. */
.identity { flex: 0 0 auto; gap: 10px; letter-spacing: 0.045em; }
.brand-mark { display: block; flex: 0 0 auto; width: 40px; height: 40px; }
.brand-name { display: block; white-space: nowrap; line-height: 1.2; }
.identity small { line-height: 1.5; }
.outline-button { min-height: 44px; border-radius: 8px; transition: background-color .18s, border-color .18s, box-shadow .18s; }
#connect-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
#feed-btn { min-height: 68px; justify-content: center; padding: 16px 20px; transition: background-color .18s, box-shadow .18s; }
.action-label { display: block; line-height: 1.35; }
.action small { line-height: 1.5; }
.details-trigger { align-items: center; min-height: 44px; padding-bottom: 5px; }
.control-icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#details-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 8px; color: var(--ink); }
#refresh-btn { min-height: 44px; padding: 8px 10px; border-radius: 8px; font: inherit; }
.contract-link { line-height: 1.7; }
@media (hover: hover) {
  .outline-button:not(:disabled):not([aria-disabled="true"]):hover { background: #f1edfc; border-color: #9280c6; box-shadow: 0 3px 12px #7164bc14; }
  #feed-btn:not(:disabled):hover { background: #6252ab; box-shadow: 0 5px 18px #7164bc30; }
  .details-trigger:hover, .contract-link:hover { color: #58459e; }
  #details-close:hover, #refresh-btn:not([aria-disabled="true"]):hover { background: #eae5f8; }
  .identity:hover .brand-name { color: #6651a7; }
}
@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 12px 16px; }
  .identity { gap: 8px; font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .identity small { font-size: 7px; letter-spacing: .06em; }
  #connect-btn { font-size: 9px; padding: 10px 12px; }
}
@media (max-width: 360px) {
  .topbar { gap: 8px; padding-inline: 12px; }
  .identity { font-size: 13px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .identity small { font-size: 6.5px; letter-spacing: .02em; }
  #connect-btn { padding-inline: 10px; }
  #feed-btn { padding: 14px 12px; }
}
