:root {
  --ink: #08090d;
  --panel: #12141c;
  --panel-2: #1a1e2a;
  --paper: #e7edf2;
  --dim: #8b95a8;
  --seal: #3ee0b0;
  --seal-2: #9af6d8;
  --line: rgba(231, 237, 242, 0.12);
  --good: #c6f25a;
  --display: "Syne", sans-serif;
  --sans: "Outfit", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}
button, input { font: inherit; color: inherit; }
button {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background: #141824;
  border: 1px solid rgba(231, 237, 242, 0.16);
  color: var(--paper);
  border-radius: 999px;
  padding: 8px 13px;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button:hover { border-color: rgba(62, 224, 176, 0.7); background: #1c2433; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:disabled:hover { background: #141824; border-color: rgba(231, 237, 242, 0.16); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }

.mark { width: 28px; height: 28px; display: block; flex: none; }
.mark-lg { width: 84px; height: 84px; }

.boot {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(62, 224, 176, 0.16), transparent 60%),
    var(--ink);
}
.boot-card { width: min(520px, 100%); }
.kicker, .eyebrow {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--seal-2);
}
.boot h1, .pane h1 {
  margin: 8px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(42px, 8vw, 64px);
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.lede { margin: 12px 0 0; max-width: 38rem; color: var(--dim); }
.boot-lines {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.boot-lines li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  opacity: 0;
  animation: arrive 0.45s ease forwards;
}
.boot-lines li:nth-child(1) { animation-delay: 0.25s; }
.boot-lines li:nth-child(2) { animation-delay: 0.55s; }
.boot-lines li:nth-child(3) { animation-delay: 0.85s; }
.boot-lines li:nth-child(4) { animation-delay: 1.15s; }
.boot-lines span { color: var(--dim); }
.boot-bar {
  margin-top: 18px;
  height: 3px;
  background: #1c2230;
  overflow: hidden;
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--seal);
  animation: fill 1.5s ease forwards;
}
@keyframes arrive { to { opacity: 1; } }
@keyframes fill { to { width: 100%; } }

.ack {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 18px 0;
  color: var(--dim);
  font-size: 14px;
}
.ack input { margin-top: 3px; accent-color: var(--seal); }
#light, .primary, .hold {
  border: 0;
  background: var(--seal);
  color: #04241c;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(62, 224, 176, 0.16);
}
#light:hover, .primary:hover, .hold:hover { background: #67f0c4; border: 0; }
#light:disabled, #light:disabled:hover {
  opacity: 0.35;
  cursor: not-allowed;
  background: var(--seal);
  box-shadow: none;
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 14, 12, 0.92);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }
.ticker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--seal-2);
  border: 1px solid rgba(62, 224, 176, 0.35);
  border-radius: 999px;
  padding: 3px 7px;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--dim);
  font-size: 14px;
}
.nav a.on, .nav a:hover {
  color: var(--paper);
  background: rgba(62, 224, 176, 0.12);
  box-shadow: inset 0 0 0 1px rgba(62, 224, 176, 0.35);
}
.status {
  margin: 0 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(214, 226, 106, 0.7);
  animation: pulse 1.8s infinite;
}
.status b { color: var(--paper); font-weight: 500; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(214, 226, 106, 0); } }
.ghost, .textlink, .chip, .install, .discard {
  border: 1px solid rgba(231, 237, 242, 0.16);
  background: #10141e;
  color: var(--paper);
  border-radius: 999px;
  padding: 7px 12px;
}
.ghost { font-size: 13px; color: var(--dim); background: transparent; }
.install { border-color: rgba(62, 224, 176, 0.4); }
.discard { color: var(--dim); background: transparent; }
.textlink {
  display: inline;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--seal-2);
  border-radius: 0;
}
.textlink:hover { background: transparent; border: 0; color: var(--paper); }

#view { min-height: 0; overflow: auto; }
.pane { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 64px; }
.pane h1 { font-size: clamp(36px, 5vw, 52px); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.chip.on {
  background: rgba(62, 224, 176, 0.16);
  color: var(--paper);
  border-color: var(--seal);
  box-shadow: inset 0 0 0 1px rgba(62, 224, 176, 0.28);
}
.search {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
}
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card, .slip, .rail, .thread, .composer, .detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.card { padding: 16px; display: flex; flex-direction: column; gap: 8px; min-height: 210px; }
.card h2, .detail h2 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.meta { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }
.card p { margin: 0; color: var(--dim); }
.card .row, .slip-actions, .composer, .starters { display: flex; gap: 8px; align-items: center; }
.card .row { margin-top: auto; flex-wrap: wrap; }
.detail .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hook-arm {
  flex: 1 1 140px;
  min-width: 0;
  background: #10141e;
  border: 1px solid rgba(231, 237, 242, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
}
.arm-note { flex: 1 0 100%; margin: 0; color: var(--seal-2); font-family: var(--mono); font-size: 12px; }
.intent { margin-top: 10px; }
.intent .kind { margin: 0 0 6px; }
.kind {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--seal-2);
}
.standing { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.standing.sealed { color: var(--good); }
.standing.probation { color: #f0c36a; }
.standing.open { color: var(--dim); }

.desk {
  height: 100%;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 0;
}
.rail, .stage { min-height: 0; overflow: auto; }
.rail { border-right: 1px solid var(--line); padding: 16px; background: #0d1016; }
.rail h2 { margin: 18px 0 8px; font-size: 13px; font-family: var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 500; }
.rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rail button.item, .rail a.item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 12px;
}
.rail a.item b, .rail a.item .meta { display: block; }
.rail .empty { color: var(--dim); font-size: 14px; }
.stage { display: grid; grid-template-rows: minmax(240px, 42%) minmax(0, 1fr) auto; padding: 16px; gap: 12px; }
.stage.quiet { grid-template-rows: minmax(0, 1fr) auto; }
.stage.quiet .thread { display: none; }
.stage.has-thread { grid-template-rows: 230px minmax(0, 1fr) auto; }
.stage.has-thread .roster, .stage.has-thread .trace { display: none; }
.cortex {
  position: relative;
  min-height: 0;
  height: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(460px 240px at 46% 46%, rgba(62, 224, 176, 0.16), transparent 68%),
    var(--panel);
  overflow: hidden;
}
.cortex::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 22%;
  background: linear-gradient(transparent, rgba(62, 224, 176, 0.07), transparent);
  animation: scan 7.5s linear infinite;
  pointer-events: none;
}
@keyframes scan { from { top: -24%; } to { top: 110%; } }
.cortex-top {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cortex-top .eyebrow { margin: 0; }
.cortex-top .meta { display: flex; align-items: center; gap: 6px; }
#brain-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--seal);
  box-shadow: 0 0 0 0 rgba(62, 224, 176, 0.65);
  animation: pulse 1.8s infinite;
}
#brain-dot.reading { background: var(--dim); box-shadow: none; animation: none; }
.brain-frame { position: absolute; inset: 36px 188px 78px 210px; }
.brain { width: 100%; height: 100%; overflow: visible; }
.lobe { fill: rgba(62, 224, 176, 0.045); stroke: #3ee0b0; stroke-width: 1.6; }
.stem { fill: none; stroke: rgba(154, 246, 216, 0.45); stroke-width: 1.4; stroke-linecap: round; }
.fold, .link { fill: none; stroke: #9af6d8; stroke-width: 1.25; stroke-linecap: round; opacity: 0.55; }
.fold { stroke-dasharray: 7 9; animation: drift 16s linear infinite; }
.link { opacity: 0.35; }
@keyframes drift { to { stroke-dashoffset: -160; } }
.soma { fill: #3ee0b0; transform-box: fill-box; transform-origin: center; animation: soma 2.6s ease-in-out infinite; }
.soma.core { fill: #e7edf2; }
@keyframes soma { 0%, 100% { opacity: 0.28; } 50% { opacity: 1; } }
.spark { fill: #e7edf2; }
.spark.dim { fill: #9af6d8; }
.nucleus {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.nucleus span, .nucleus em {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.nucleus strong {
  display: block;
  margin: 2px 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 4vw, 56px);
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.trace {
  position: absolute;
  z-index: 2;
  left: 16px;
  top: 48px;
  width: min(200px, 32%);
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}
.trace li {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}
.trace li:first-child { color: var(--seal-2); }
.roster {
  position: absolute;
  z-index: 2;
  right: 14px;
  top: 44px;
  bottom: 78px;
  width: 164px;
  overflow: hidden;
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}
.roster-track { list-style: none; margin: 0; padding: 0; animation: rise 32s linear infinite; }
@keyframes rise { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.roster li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}
.roster li i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(231, 237, 242, 0.28);
  flex: none;
}
.roster li.on { color: var(--paper); }
.roster li.on i { background: var(--seal); box-shadow: 0 0 8px rgba(62, 224, 176, 0.85); }
.vitals {
  position: absolute;
  z-index: 2;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.vitals div {
  background: rgba(8, 9, 13, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.vitals span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.vitals b {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
}
.thread { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: min(68ch, 100%); }
.msg.you { align-self: flex-end; }
.msg .who { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.bubble { margin: 0; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); overflow-wrap: anywhere; }
.msg.you .bubble { background: #222838; }
.textlink { display: inline; padding: 0 2px; border: 0; color: var(--seal-2); border-radius: 0; }
.slip { margin-top: 8px; padding: 12px; }
.slip h3 { margin: 0 0 8px; font-family: var(--display); font-size: 20px; }
.slip dl { margin: 0; display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 4px 10px; font-family: var(--mono); font-size: 12px; }
.slip dt { color: var(--dim); }
.slip dd { margin: 0; overflow-wrap: anywhere; }
.held { margin: 8px 0 0; color: var(--good); font-family: var(--mono); font-size: 12px; }
.composer { padding: 8px; }
.composer input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px;
}
.starters { flex-wrap: wrap; padding: 0 4px 8px; }
.starters button {
  font-size: 13px;
  color: var(--paper);
  background: #10141e;
  border-color: rgba(62, 224, 176, 0.32);
}
.starters button:hover { background: rgba(62, 224, 176, 0.12); border-color: var(--seal); }

.detail { padding: 20px; display: grid; gap: 10px; }
.detail p { margin: 0; }
.detail .touches { color: var(--dim); }

@media (max-width: 860px) {
  .status { display: none; }
  .grid { grid-template-columns: 1fr; }
  .desk { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); max-height: 200px; }
  .brain-frame { inset: 28px 8px 108px; }
  .roster, .trace { display: none; }
  .vitals { grid-template-columns: 1fr 1fr; }
  .stage.has-thread { grid-template-rows: 250px minmax(180px, 1fr) auto; }
  .composer { flex-wrap: wrap; }
  .starters { flex: 1 0 100%; }
  .composer .primary { flex: none; }
  .top { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .boot-lines li { opacity: 1; }
  .boot-bar i { width: 100%; }
}
