:root {
  color-scheme: light;
  --ink: #202522;
  --muted: #5e675f;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #d9ddd4;
  --green: #2f6f5e;
  --blue: #385f88;
  --gold: #b67a25;
  --rose: #9b4d5d;
  --lavender: #74639a;
  --shadow: 0 18px 50px rgba(31, 37, 34, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(47, 111, 94, 0.08), transparent 34%),
    linear-gradient(180deg, #f2f7f5 0, #fbfaf6 44%, #f1f4f8 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  border: 1px solid rgba(32, 37, 34, 0.12);
  border-radius: 8px;
  background: rgba(251, 250, 246, 0.92);
  box-shadow: 0 10px 34px rgba(31, 37, 34, 0.08);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: white;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

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

.brand-title {
  display: block;
  font-size: 1.16rem;
  font-weight: 850;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-actions a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: white;
  font-size: 0.9rem;
  font-weight: 750;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: 22px;
  align-items: center;
  min-height: calc(100vh - 104px);
  padding: 30px 0 22px;
}

.hero-copy {
  padding: clamp(8px, 2vw, 28px);
}

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

h1 {
  max-width: 850px;
  margin-bottom: 18px;
  font-size: clamp(2.5rem, 6vw, 5.9rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.hero-copy p,
.section-heading p,
.mission-detail p,
.packet-body,
.ledger-entry p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-actions,
.packet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 820;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.primary-button {
  color: white;
  background: var(--green);
  box-shadow: 0 12px 28px rgba(47, 111, 94, 0.25);
}

.secondary-button,
.ghost-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
}

.ghost-button {
  color: var(--green);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.top-actions a:hover,
.mission-button:hover {
  transform: translateY(-1px);
}

.hero-map {
  overflow: hidden;
  border: 1px solid rgba(32, 37, 34, 0.12);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.hero-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.map-ring {
  fill: none;
  stroke: rgba(47, 111, 94, 0.22);
  stroke-linecap: round;
  stroke-width: 18;
}

.map-ring.second {
  stroke: rgba(56, 95, 136, 0.2);
}

.map-node circle,
.map-center circle {
  fill: white;
  stroke: rgba(32, 37, 34, 0.16);
  stroke-width: 2;
}

.map-center circle {
  fill: #202522;
}

.map-node text,
.map-center text {
  text-anchor: middle;
  font-weight: 850;
}

.map-node text + text,
.map-center text + text {
  font-size: 18px;
  font-weight: 650;
}

.map-center text {
  fill: white;
  font-size: 28px;
}

.map-center text + text {
  fill: #d9e8df;
}

.intent circle {
  stroke: var(--green);
}

.relief circle {
  stroke: var(--blue);
}

.proof circle {
  stroke: var(--gold);
}

.fund circle {
  stroke: var(--rose);
}

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

.score-strip div {
  min-height: 110px;
  padding: 18px;
  border: 1px solid rgba(32, 37, 34, 0.1);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 28px rgba(31, 37, 34, 0.06);
}

.score-strip span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.score-strip strong {
  color: var(--muted);
  font-size: 0.9rem;
}

.board-section,
.workshop-section,
.relay-section,
.ledger-section {
  padding: 34px 0;
}

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

.section-heading p {
  max-width: 620px;
  margin-bottom: 0;
}

.mission-layout,
.workshop-grid,
.relay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: 18px;
  align-items: start;
}

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

.mission-button {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 96px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: white;
  text-align: left;
  cursor: pointer;
}

.mission-button.active {
  border-color: rgba(47, 111, 94, 0.72);
  box-shadow: 0 12px 26px rgba(47, 111, 94, 0.12);
}

.mission-sigil {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-weight: 900;
}

.mission-button:nth-child(2n) .mission-sigil {
  background: var(--blue);
}

.mission-button:nth-child(3n) .mission-sigil {
  background: var(--gold);
}

.mission-button:nth-child(5n) .mission-sigil {
  background: var(--rose);
}

.mission-title {
  display: block;
  font-weight: 850;
}

.mission-small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.mission-detail,
.intake-panel,
.packet-panel,
.relay-panel,
.relay-note {
  border: 1px solid rgba(32, 37, 34, 0.12);
  border-radius: 8px;
  padding: 18px;
  background: white;
  box-shadow: var(--shadow);
}

.mission-metrics {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.mission-metrics div {
  padding: 12px;
  border-left: 4px solid var(--green);
  background: #f6faf8;
}

.mission-metrics dt {
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.mission-metrics dd {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.45;
}

.intake-panel,
.relay-panel {
  display: grid;
  gap: 14px;
}

label,
legend {
  color: var(--ink);
  font-weight: 780;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fffdfa;
}

textarea {
  resize: vertical;
}

fieldset {
  margin: 0;
  border: 0;
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.segmented label,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffdfa;
  font-size: 0.92rem;
}

.segmented input,
.check-row input {
  width: auto;
  margin: 0;
}

.privacy-note {
  margin: 0;
  border: 1px solid rgba(116, 99, 154, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f8f5ff;
  font-size: 0.9rem;
  line-height: 1.45;
}

.safety-warning {
  margin: 0;
  border: 1px solid rgba(155, 77, 93, 0.34);
  border-radius: 8px;
  padding: 10px 12px;
  color: #703041;
  background: #fff3f5;
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.45;
}

.packet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

#packetStatus {
  border: 1px solid #cadfd5;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--green);
  background: #eef8f3;
  font-size: 0.8rem;
  font-weight: 850;
}

#relayStatus {
  border: 1px solid #d8d4e8;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--lavender);
  background: #f4f1fb;
  font-size: 0.8rem;
  font-weight: 850;
}

.packet-body {
  min-height: 340px;
}

.relay-note {
  min-height: 260px;
}

.relay-note > p {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.62;
}

.packet-body h4 {
  margin: 18px 0 6px;
  font-size: 1rem;
}

.packet-body ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.packet-body li {
  margin: 6px 0;
}

.ledger-list {
  display: grid;
  gap: 12px;
}

.ledger-entry {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.ledger-entry time,
.ledger-entry span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.ledger-entry strong {
  display: block;
  margin-bottom: 4px;
}

.ledger-entry p {
  margin-bottom: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(182, 122, 37, 0.55);
  outline-offset: 2px;
}

@media (max-width: 1060px) {
  .hero,
  .mission-layout,
  .workshop-grid,
  .relay-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .section-heading,
  .packet-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions a,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  h1 {
    font-size: clamp(2.2rem, 14vw, 4rem);
  }

  .score-strip,
  .mission-list,
  .segmented,
  .ledger-entry {
    grid-template-columns: 1fr;
  }
}
