:root {
  --bg: #0b1220;
  --panel: #111c2e;
  --line: #22324a;
  --cream: #e4e8ec;
  --dim: #8b9298;
  --faint: #56637a;
  --red: #22c43a;
  --red-dk: #127a26;
  --mint: #4ef0a0;
  --mono: "Space Mono", ui-monospace, monospace;
  --disp: "Space Grotesk", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
.red { color: var(--red); }
.mono { font-family: var(--mono); }
.kicker { color: var(--faint); margin: 0 0 1rem; font-size: 13px; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(11,18,32,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-family: var(--disp); font-weight: 700; font-size: 20px; }
.logo-img { width: 40px; height: 40px; object-fit: contain; }
.nav nav { display: flex; gap: clamp(10px, 2.5vw, 28px); align-items: center; font-size: 13px; }
.nav nav a:not(.btn) { text-decoration: none; color: var(--dim); }
.nav nav a:not(.btn):hover { color: var(--cream); }

.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: 14px;
  padding: 12px 20px; border: 1px solid var(--red); background: var(--red); color: var(--bg);
  text-decoration: none; cursor: pointer; transition: transform .15s, background .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); background: var(--mint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--cream); }
.btn.ghost:hover { border-color: var(--cream); background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 12px; }

section { padding: clamp(56px, 9vw, 110px) clamp(16px, 5vw, 64px); max-width: 1320px; margin: 0 auto; }

/* hero */
.hero { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; min-height: 88vh; }
.logo { display: flex; align-items: center; gap: clamp(14px, 3vw, 36px); }
.logo-img.big { width: clamp(96px, 14vw, 190px); height: auto; flex: none; filter: drop-shadow(0 0 28px rgba(78,240,160,.25)); }
h1 { font-family: var(--disp); font-weight: 700; font-size: clamp(64px, 11vw, 150px); line-height: .9; margin: 0; letter-spacing: -.02em; }
.tag { font-size: clamp(18px, 2.2vw, 26px); margin: 28px 0 4px; }
.sub { color: var(--faint); font-size: clamp(15px, 1.7vw, 20px); margin: 0; letter-spacing: .04em; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }

.lineage { position: relative; height: 460px; }
.links { position: absolute; inset: 0; width: 100%; height: 100%; }
.links path { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 2 6; vector-effect: non-scaling-stroke; }
.card { position: absolute; width: min(300px, 58%); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.4); animation: float 7s ease-in-out infinite; }
.c1 { top: 0; left: 0; }
.c2 { top: 155px; right: 0; animation-delay: -2s; }
.c3 { bottom: 0; left: 12%; animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-8px); } }

.card-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--dim); }
.card-bar .dots::before { content: "▫▫▫"; letter-spacing: 2px; margin-right: 8px; color: var(--faint); }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.status.asleep::before { background: transparent; border: 1px solid var(--dim); box-shadow: none; }
.card-body { display: flex; gap: 16px; padding: 14px; align-items: center; }
.card canvas { width: 96px; height: 96px; image-rendering: pixelated; flex: none; }
.meta { font-size: 12px; line-height: 1.7; color: var(--dim); min-width: 0; }
.meta b { color: var(--cream); font-size: 13px; display: block; margin-bottom: 4px; }
.meta .hi { color: var(--cream); }
.meta .lo { color: var(--faint); }

/* intro */
.intro { padding-top: 40px; }
.lead { font-family: var(--disp); font-weight: 500; font-size: clamp(24px, 3.4vw, 44px); line-height: 1.25; max-width: 1000px; margin: 0; }

/* life */
.stages { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.stages li { padding: 28px 24px 32px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .2s; }
.stages li:hover { background: var(--panel); }
.stages li:last-child h3 { color: var(--red); }
.num { color: var(--red); font-size: 12px; }
.stages h3 { font-family: var(--disp); font-size: 22px; margin: 10px 0 12px; line-height: 1.2; }
.stages p { color: var(--dim); margin: 0; font-size: 14px; }

/* founders */
.founders { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 6vw, 80px); align-items: center; }
.count { font-family: var(--disp); font-weight: 700; font-size: clamp(110px, 20vw, 260px); line-height: .8; color: var(--red); }
.count small { font-size: .2em; color: var(--faint); margin-left: 8px; }
h2 { font-family: var(--disp); font-size: clamp(30px, 4vw, 52px); line-height: 1.05; margin: 0 0 16px; }
.founders p:last-child { color: var(--dim); font-size: 17px; max-width: 520px; margin: 0; }

/* colony */
.colony-head { display: flex; justify-content: space-between; align-items: baseline; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0; padding: 0 1px 1px 0; }
.cell { background: var(--bg); border: 1px solid var(--line); margin: 0 -1px -1px 0; padding: 14px 12px 12px; text-align: center; font-size: 11px; color: var(--dim); transition: background .2s; }
.cell:hover { background: var(--panel); }
.cell canvas { width: 88px; height: 88px; image-rendering: pixelated; display: block; margin: 0 auto 8px; }
.cell b { color: var(--cream); display: block; font-size: 12px; }
.cell.dead { opacity: .35; }

/* spawn */
.spawn { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 6vw, 80px); align-items: center; border-top: 1px solid var(--line); }
#spawn-canvas { width: clamp(180px, 26vw, 320px); height: auto; aspect-ratio: 1; image-rendering: pixelated; }
#spawn-desc { color: var(--dim); white-space: pre-line; margin: 0; }
.ca { margin-top: 24px; font-size: 13px; color: var(--faint); }
.ca code { color: var(--cream); background: var(--panel); padding: 3px 8px; border: 1px solid var(--line); word-break: break-all; }

.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px clamp(16px, 5vw, 64px); border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.links-row { display: flex; gap: 20px; }
.links-row a { text-decoration: none; }
.links-row a:hover { color: var(--cream); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .lineage { height: auto; display: flex; flex-direction: column; gap: 14px; }
  .links { display: none; }
  .card { position: relative; inset: auto; width: 100%; max-width: 380px; }
  .c2 { margin-left: auto; }
  .founders, .spawn { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .nav nav a:not(.btn) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  html { scroll-behavior: auto; }
}

.mint { color: var(--mint); }
.note { color: var(--faint); font-size: 12px; max-width: 520px; margin-top: 20px; }
.status-line { min-height: 1.6em; color: var(--mint); font-size: 13px; margin-top: 10px; word-break: break-word; }
.status-line.err { color: #ff6b6b; }
.status-line a { color: var(--mint); }
.cell { text-decoration: none; display: block; }
.cell .thought { color: var(--faint); font-size: 11px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cell .btn { margin-top: 10px; }
.empty { color: var(--faint); padding: 32px 0; }

/* strain page */
.strain { padding-top: 48px; }
.strain-head { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 5vw, 56px); align-items: center; margin-bottom: 48px; }
.strain-head canvas { width: clamp(160px, 24vw, 280px); height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.strain-name { font-size: clamp(40px, 6vw, 72px); margin: 0 0 8px; }
.strain-name small { font-size: .35em; color: var(--mint); font-family: var(--mono); }
.dim { color: var(--dim); }
.hi { color: var(--cream); }
.small { font-size: 12px; }
.strain a { color: var(--mint); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 20px 0; }
.stats div { background: var(--bg); padding: 12px 14px; }
.stats span { display: block; color: var(--faint); font-size: 11px; }
.stats b { font-size: 16px; }
.thoughts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.thoughts li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.thoughts p { font-family: var(--disp); font-size: clamp(17px, 2vw, 21px); margin: 0 0 6px; line-height: 1.4; }
.thoughts span { color: var(--faint); font-size: 11px; }
@media (max-width: 700px) { .strain-head { grid-template-columns: 1fr; } }
