:root {
  --ink: #151515;
  --muted: #5d625f;
  --line: #d9ded9;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --mint: #d9f2df;
  --leaf: #247a4b;
  --cyan: #ccecf1;
  --blue: #255c99;
  --coral: #f7c6b8;
  --amber: #f4dd95;
  --shadow: 0 18px 48px rgba(28, 36, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
  background: rgba(247, 248, 244, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #ffffff;
  background: var(--ink);
  border-radius: 8px;
  font-size: 22px;
}

.nav-links {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a {
  text-decoration: none;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 0.72fr);
  gap: 44px;
  align-items: center;
  min-height: calc(100vh - 64px);
  padding: 56px clamp(24px, 5vw, 72px) 64px;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--leaf);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.lead {
  max-width: 650px;
  color: var(--muted);
  font-size: 21px;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.primary-action,
.secondary-action,
.wide-action,
.filter {
  border: 1px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.primary-action,
.secondary-action {
  min-height: 44px;
  padding: 12px 18px;
  font-weight: 750;
}

.primary-action {
  color: #ffffff;
  background: var(--ink);
}

.secondary-action {
  background: transparent;
}

.primary-action:hover,
.secondary-action:hover,
.wide-action:hover,
.filter:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(18, 24, 20, 0.12);
}

.goal-console {
  position: relative;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.goal-console::before {
  content: "";
  position: absolute;
  inset: 14px 14px auto auto;
  width: 96px;
  height: 96px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(36, 122, 75, 0.18) 48% 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(36, 122, 75, 0.18) 48% 52%, transparent 53%);
  background-size: 24px 24px;
  pointer-events: none;
}

.console-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  font-weight: 800;
}

.status-pill {
  padding: 4px 8px;
  color: var(--leaf);
  background: var(--mint);
  border-radius: 999px;
  font-size: 12px;
}

.goal-console label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

textarea,
select {
  width: 100%;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  min-height: 180px;
  margin-bottom: 14px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

select {
  height: 42px;
  padding: 0 10px;
}

.console-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide-action {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  color: #ffffff;
  background: var(--leaf);
  border-color: var(--leaf);
  font-weight: 800;
}

.prompt-output {
  min-height: 160px;
  max-height: 260px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 14px;
  color: #233029;
  background: #eef5ef;
  border: 1px solid #c8dccd;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.42;
}

.system-band,
.loop-band,
.gates-band {
  padding: 72px clamp(24px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ladder article,
.loop-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ladder article {
  min-height: 190px;
  padding: 22px;
}

.ladder span {
  display: inline-flex;
  margin-bottom: 40px;
  color: var(--blue);
  font-weight: 840;
}

.ladder p,
.loop-card p {
  color: var(--muted);
  line-height: 1.5;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.filter {
  min-height: 38px;
  padding: 8px 13px;
  background: #ffffff;
  border-color: var(--line);
  font-weight: 740;
}

.filter.is-active {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.loop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.loop-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 360px;
  padding: 20px;
}

.loop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 780;
}

.tag.mode {
  background: var(--cyan);
  color: var(--blue);
}

.tag.lane {
  background: var(--amber);
}

.card-list {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.receipt {
  margin-top: 18px;
  padding: 12px;
  background: #f8eadf;
  border: 1px solid #efc8b5;
  border-radius: 8px;
  color: #633223;
  font-size: 13px;
  line-height: 1.4;
}

.gate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.gate-grid div {
  display: grid;
  min-height: 96px;
  place-items: center;
  padding: 16px;
  background: var(--coral);
  border: 1px solid #df9f8e;
  border-radius: 8px;
  font-weight: 840;
  text-align: center;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(24px, 5vw, 72px);
  color: var(--muted);
  font-size: 14px;
}

.footer a {
  font-weight: 780;
}

@media (max-width: 980px) {
  .hero-band {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .ladder,
  .loop-grid,
  .gate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .hero-band,
  .system-band,
  .loop-band,
  .gates-band {
    padding: 36px 18px;
  }

  h1 {
    font-size: 42px;
  }

  .lead {
    font-size: 18px;
  }

  .console-grid,
  .ladder,
  .loop-grid,
  .gate-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer {
    flex-direction: column;
    padding: 24px 18px;
  }
}
