:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #5b665f;
  --paper: #f7f5ee;
  --panel: #fffdf7;
  --line: #d8d1c0;
  --leaf: #2f7d5a;
  --moss: #6d8a45;
  --sun: #d6a441;
  --clay: #a55844;
  --water: #3b77a1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(47, 125, 90, .09) 1px, transparent 1px),
    linear-gradient(180deg, rgba(59, 119, 161, .08) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  color: var(--ink);
}

a {
  color: var(--leaf);
  font-weight: 750;
  text-decoration: none;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 42px) 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, .9);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 3.4vw, 4rem);
  line-height: .95;
}

h2 {
  font-size: 1.2rem;
}

.top-actions,
.button-row,
footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill,
button {
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 800;
}

button:hover,
.pill.active {
  background: var(--ink);
  color: #fffdf7;
}

.shell {
  width: min(1200px, calc(100vw - 28px));
  margin: 22px auto;
}

.workspace {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .84);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  min-height: 48px;
  background: transparent;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  background: #e8eee2;
  color: var(--ink);
  box-shadow: inset 0 -4px 0 var(--leaf);
}

.view {
  display: none;
  padding: clamp(16px, 2.8vw, 30px);
}

.view.active {
  display: block;
}

.intro-row,
.map-layout,
.brief-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr);
  gap: 18px;
  align-items: stretch;
}

.intro-copy {
  padding: 22px;
  border: 1px solid var(--line);
  background: #fffdf7;
}

.intro-copy p {
  max-width: 68ch;
  color: var(--muted);
  line-height: 1.55;
}

.snapshot {
  min-height: 160px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #f3e3bc, #dbe9df 42%, #bfd4df);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px;
}

.snapshot span {
  border: 2px solid rgba(23, 33, 28, .72);
  background: linear-gradient(180deg, rgba(255, 253, 247, .68), rgba(47, 125, 90, .34));
  border-radius: 80px 80px 18px 18px;
  position: relative;
}

.snapshot span::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 13px;
  height: 10px;
  background: var(--clay);
  border-radius: 6px;
}

.form-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdb5a4;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px;
}

input[type="range"] {
  accent-color: var(--leaf);
}

.canvas-wrap {
  border: 1px solid var(--line);
  background: #fffdf7;
  min-height: 420px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.panel,
.score-panel {
  border: 1px solid var(--line);
  background: #fffdf7;
  padding: 18px;
}

.score-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.score-row span {
  color: var(--muted);
  font-weight: 750;
}

.score-row strong {
  font-size: 1.45rem;
}

.legend,
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.swatch {
  width: 16px;
  height: 16px;
  display: inline-block;
  border: 1px solid rgba(23, 33, 28, .35);
}

.swatch.low {
  background: #668aa2;
}

.swatch.good {
  background: #4f9466;
}

.swatch.hot {
  background: #c36b44;
}

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

ol {
  margin: 16px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

li + li {
  margin-top: 8px;
}

.chip {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #eef3e8;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 750;
}

.wide {
  grid-column: span 2;
}

textarea {
  min-height: 240px;
  margin: 14px 0;
  line-height: 1.45;
  resize: vertical;
}

.next-move {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed var(--leaf);
  background: #edf4ed;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.45;
  font-weight: 750;
}

.status {
  color: var(--leaf);
  font-weight: 800;
  min-height: 24px;
}

footer {
  width: min(1200px, calc(100vw - 28px));
  margin: 18px auto 38px;
}

.doc {
  background: var(--paper);
}

.doc-shell {
  width: min(820px, calc(100vw - 30px));
  margin: 36px auto;
  padding: 26px;
  background: #fffdf7;
  border: 1px solid var(--line);
}

.doc-shell h1 {
  margin: 18px 0;
}

.doc-shell section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
  line-height: 1.6;
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar,
  .intro-row,
  .map-layout,
  .brief-layout,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

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

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

  .wide {
    grid-column: auto;
  }
}

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

  .view {
    padding: 12px;
  }

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

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