:root {
  color-scheme: dark;
  --bg: #111311;
  --panel: #191c19;
  --panel-2: #20241f;
  --text: #f4f0e8;
  --muted: #b6b0a5;
  --line: rgba(244, 240, 232, 0.14);
  --green: #82d173;
  --gold: #e7c86f;
  --red: #d86d5a;
  --blue: #78a6d8;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(130, 209, 115, 0.12), transparent 28%),
    linear-gradient(135deg, #0d0f0d 0%, #171612 48%, #101515 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar,
.hero,
.thesis-strip,
.workspace {
  border: 1px solid var(--line);
  background: rgba(17, 19, 17, 0.72);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
  padding: 18px 22px;
  border-radius: 8px 8px 0 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

h3 {
  margin-bottom: 10px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  color: var(--muted);
  font-size: 0.9rem;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(130, 209, 115, 0.12);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  padding: 28px 22px;
  border-top: 0;
}

.hero-copy p {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-copy .thesis {
  margin-bottom: 8px;
  color: var(--text);
  font-size: clamp(1.6rem, 3vw, 2.65rem);
  font-weight: 800;
  line-height: 1.05;
}

.hero-metric {
  align-self: stretch;
  display: grid;
  align-content: center;
  padding: 18px;
  border: 1px solid rgba(231, 200, 111, 0.3);
  border-radius: 8px;
  background: rgba(231, 200, 111, 0.08);
}

.hero-metric span {
  display: block;
  color: var(--gold);
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 0.9;
}

.hero-metric p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.thesis-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 0;
}

.thesis-strip article {
  min-height: 138px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  background: rgba(25, 28, 25, 0.78);
}

.thesis-strip article:last-child {
  border-right: 0;
}

.thesis-strip h2 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.thesis-strip p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.active-thesis {
  background:
    linear-gradient(135deg, rgba(130, 209, 115, 0.13), rgba(120, 166, 216, 0.08)),
    rgba(25, 28, 25, 0.78) !important;
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(520px, 1fr) 310px;
  gap: 0;
  min-height: 640px;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  background: rgba(25, 28, 25, 0.86);
}

.input-panel {
  border-right: 1px solid var(--line);
}

.output-panel {
  border-left: 1px solid var(--line);
}

.panel-heading {
  min-height: 48px;
}

textarea {
  width: 100%;
  min-height: 420px;
  flex: 1;
  resize: none;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #0d100d;
  color: var(--text);
  line-height: 1.45;
}

textarea:focus {
  border-color: rgba(130, 209, 115, 0.55);
}

.signal-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.signal-row div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.05);
}

.signal-row strong,
.signal-row span {
  display: block;
}

.signal-row strong {
  color: var(--gold);
  font-size: 0.95rem;
}

.signal-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary,
.secondary,
.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.primary {
  background: var(--green);
  color: #071007;
  font-weight: 800;
}

.secondary,
.tab {
  background: rgba(244, 240, 232, 0.06);
}

.stage {
  min-width: 0;
  padding: 18px;
  background:
    linear-gradient(rgba(244, 240, 232, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 240, 232, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.mode-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.7);
}

.tab {
  min-width: 84px;
  min-height: 34px;
}

.tab.active {
  background: var(--text);
  color: #101310;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.map-view {
  display: none;
  grid-template-columns: minmax(320px, 1fr) 280px;
  gap: 18px;
}

.map-view.active {
  display: grid;
}

.map {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.6);
  overflow: hidden;
}

.map::before {
  content: "";
  position: absolute;
  inset: 78px 92px 80px;
  border: 1px solid rgba(130, 209, 115, 0.24);
  transform: rotate(-8deg);
}

.node {
  position: absolute;
  width: 190px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid rgba(244, 240, 232, 0.18);
  border-radius: 8px;
  background: rgba(32, 36, 31, 0.94);
  color: var(--muted);
  text-align: left;
  line-height: 1.28;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}

.node span {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-weight: 800;
}

.node.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(130, 209, 115, 0.12);
}

.root {
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(130, 209, 115, 0.16);
}

.n1 {
  top: 44px;
  left: 40px;
}

.n2 {
  top: 72px;
  right: 38px;
}

.n3 {
  bottom: 64px;
  left: 60px;
}

.n4 {
  bottom: 42px;
  right: 44px;
}

.n5 {
  top: 196px;
  left: 24px;
}

.n6 {
  top: 326px;
  right: 24px;
}

.detail {
  min-height: 520px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 25, 0.9);
}

.detail h3 {
  color: var(--gold);
}

.detail p {
  color: var(--muted);
  line-height: 1.55;
}

.detail strong {
  color: var(--text);
}

.blueprint-view.active {
  display: grid;
  gap: 18px;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.blueprint-card {
  min-height: 420px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.72);
}

.blueprint-card h3 {
  font-size: 1.35rem;
}

.blueprint-card ol {
  display: grid;
  gap: 14px;
  margin: 22px 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.novice-card {
  border-color: rgba(216, 109, 90, 0.32);
}

.expert-card {
  border-color: rgba(130, 209, 115, 0.34);
  background:
    linear-gradient(135deg, rgba(130, 209, 115, 0.11), rgba(13, 16, 13, 0.72)),
    rgba(13, 16, 13, 0.72);
}

.warning-line,
.success-line {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}

.warning-line {
  color: #f0a092;
}

.success-line {
  color: var(--green);
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.audit-grid article {
  min-height: 152px;
  padding: 16px;
  border: 1px solid rgba(120, 166, 216, 0.28);
  border-radius: 8px;
  background: rgba(120, 166, 216, 0.07);
}

.audit-grid h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.audit-grid p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.42;
}

.blueprint-equation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(231, 200, 111, 0.25);
  border-radius: 8px;
  background: rgba(231, 200, 111, 0.08);
  color: var(--muted);
}

.blueprint-equation span,
.blueprint-equation strong {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.6);
}

.blueprint-equation strong {
  color: var(--gold);
}

.extraction-status {
  padding: 12px;
  border: 1px dashed rgba(244, 240, 232, 0.25);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(13, 16, 13, 0.55);
}

.extraction-status.complete {
  border-style: solid;
  border-color: rgba(130, 209, 115, 0.42);
  color: var(--green);
  background: rgba(130, 209, 115, 0.08);
}

.primitive-language,
.validation-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.55);
}

.primitive-definition {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
}

.primitive-language div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.primitive-language span {
  padding: 7px 8px;
  border: 1px solid rgba(231, 200, 111, 0.26);
  border-radius: 8px;
  color: var(--gold);
  background: rgba(231, 200, 111, 0.07);
  font-size: 0.78rem;
  font-weight: 800;
}

.validation-panel {
  display: grid;
  gap: 9px;
  margin-top: auto;
}

.validation-panel div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.validation-panel div:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.validation-panel span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.validation-panel strong {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.validation-panel strong.passed {
  color: var(--green);
}

.artifact-list {
  display: grid;
  gap: 10px;
}

.artifact {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.05);
  opacity: 0.62;
  transform: translateY(0);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.artifact.recovered {
  opacity: 1;
  background: rgba(244, 240, 232, 0.075);
}

.artifact::before {
  content: attr(data-lens);
  display: inline-block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.artifact:nth-child(2n) {
  border-left-color: var(--gold);
}

.artifact:nth-child(3n) {
  border-left-color: var(--red);
}

.artifact strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.artifact p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.thinking-habit,
.reuse-question {
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(244, 240, 232, 0.11);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.46);
}

.thinking-habit span,
.reuse-question span {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thinking-habit p,
.reuse-question p {
  font-size: 0.82rem;
  line-height: 1.32;
}

.reuse-question {
  border-color: rgba(130, 209, 115, 0.18);
}

.reuse-question span {
  color: var(--green);
}

.chat,
.transfer-grid,
.future-view.active {
  min-height: 520px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 13, 0.72);
}

.chat {
  display: grid;
  align-content: start;
  gap: 12px;
}

.bubble {
  max-width: 760px;
  padding: 14px 16px;
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.bubble.system {
  border: 1px solid var(--line);
  color: var(--green);
}

.bubble.user {
  justify-self: end;
  background: rgba(120, 166, 216, 0.16);
  color: var(--text);
}

.bubble.expert {
  background: rgba(244, 240, 232, 0.07);
}

.transfer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.transfer-core {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.05);
}

.transfer-core h3 {
  margin-bottom: 8px;
}

.transfer-core p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.active-transfer {
  border-color: rgba(130, 209, 115, 0.38);
  background: rgba(130, 209, 115, 0.08);
}

.transfer-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 36, 31, 0.9);
}

.primitive-used {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 8px;
  border: 1px solid rgba(130, 209, 115, 0.22);
  border-radius: 8px;
  color: var(--green);
  background: rgba(130, 209, 115, 0.07);
  font-size: 0.78rem;
  font-weight: 800;
}

.transfer-grid p {
  color: var(--muted);
  line-height: 1.45;
}

.impact-ledger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.impact-ledger article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.05);
}

.impact-ledger strong,
.impact-ledger em,
.impact-ledger span {
  display: block;
}

.impact-ledger strong {
  margin-bottom: 7px;
  color: var(--gold);
}

.impact-ledger span {
  color: var(--muted);
  line-height: 1.4;
}

.impact-ledger em {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.future-view.active {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 18px;
}

.future-panel,
.future-challenge {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 25, 0.9);
}

.future-panel h3,
.future-challenge h3 {
  font-size: 1.45rem;
  line-height: 1.15;
}

.future-panel p,
.future-challenge p,
.future-challenge span {
  color: var(--muted);
  line-height: 1.55;
}

.future-button {
  width: 100%;
  margin-top: 12px;
}

.future-challenge {
  border-color: rgba(231, 200, 111, 0.3);
  background:
    linear-gradient(135deg, rgba(231, 200, 111, 0.1), rgba(25, 28, 25, 0.9)),
    rgba(25, 28, 25, 0.9);
}

.future-challenge strong,
.future-challenge span {
  display: block;
}

.future-challenge strong {
  margin-top: 18px;
  margin-bottom: 8px;
  color: var(--gold);
}

.primitive-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.primitive-stack .eyebrow {
  flex-basis: 100%;
  margin-bottom: 0;
}

.primitive-stack span {
  width: auto;
  padding: 8px 10px;
  border: 1px solid rgba(130, 209, 115, 0.28);
  border-radius: 8px;
  background: rgba(130, 209, 115, 0.08);
  color: var(--text);
  font-size: 0.85rem;
}

.transfer-proof {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(120, 166, 216, 0.3);
  border-radius: 8px;
  background: rgba(120, 166, 216, 0.08);
}

.transfer-proof .eyebrow {
  margin-bottom: 6px;
}

.transfer-proof strong,
.transfer-proof span {
  display: block;
}

.transfer-proof strong {
  margin-bottom: 6px;
  color: var(--blue);
}

.transfer-proof span {
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .output-panel {
    border: 0;
    border-top: 1px solid var(--line);
  }

  .stage {
    order: 3;
  }

  .output-panel {
    order: 2;
  }

  textarea {
    min-height: 260px;
  }

  .thesis-strip,
  .audit-grid,
  .impact-ledger {
    grid-template-columns: 1fr;
  }

  .thesis-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .thesis-strip article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 1320px) {
  .map {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
    padding: 12px;
  }

  .map::before {
    display: none;
  }

  .node,
  .root,
  .n1,
  .n2,
  .n3,
  .n4,
  .n5,
  .n6 {
    position: static;
    width: auto;
    min-height: 100px;
    transform: none;
  }

  .root {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1440px);
    padding: 9px 0;
  }

  .topbar,
  .hero,
  .stage-header {
    display: grid;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .status {
    min-width: 0;
  }

  .mode-tabs,
  .button-row,
  .transfer-grid,
  .blueprint-grid,
  .future-view.active,
  .map-view.active {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    display: grid;
  }

  .map {
    min-height: 760px;
  }

  .node {
    position: static;
    width: auto;
    margin: 12px;
    transform: none;
  }

  .map::before {
    display: none;
  }
}
