:root {
  --paper: #f1efe8;
  --panel: #fbfaf6;
  --ink: #20231f;
  --muted: #6f736c;
  --line: #d2d0c5;
  --dark: #23352f;
  --dark-2: #172620;
  --accent: #d96c43;
  --accent-dark: #ad4d2d;
  --yellow: #d8ac45;
  --green: #547665;
  --shadow: 0 10px 30px rgba(32,35,31,.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(35,53,47,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35,53,47,.025) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.masthead {
  background: var(--dark);
  color: #f4f1e7;
  border-bottom: 7px solid var(--yellow);
}
.masthead-inner {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  gap: 64px;
  padding: 44px 0 36px;
}
.overline, .eyebrow {
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: 10px;
  font-weight: 800;
}
.overline { color: #b5c6bb; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 {
  margin: 2px 0 12px;
  font-size: clamp(48px, 7vw, 86px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .96;
}
.title-block p {
  max-width: 820px;
  margin: 0;
  color: #d0d8d2;
  font-size: 16px;
}
.header-notes {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px 14px;
  align-content: end;
  padding-bottom: 2px;
}
.header-notes strong { display: block; font-family: Georgia, serif; font-size: 16px; font-weight: 500; }
.header-notes span { display: block; color: #b9c5bd; font-size: 12px; margin-top: 2px; }
.note-number {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  color: var(--yellow);
  font: 700 11px/1 Consolas, monospace;
}
.header-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-top: 6px;
}
.header-links a {
  color: #f4f1e7;
  text-decoration: none;
  border-bottom: 1px solid rgba(244,241,231,.4);
  font-size: 11px;
  font-weight: 700;
}

.layout {
  width: min(1480px, calc(100% - 32px));
  margin: 26px auto 42px;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.controls {
  position: sticky;
  top: 14px;
  background: #e7e3d8;
  border: 1px solid #c8c4b8;
  box-shadow: var(--shadow);
}
.control-section { padding: 18px 20px; border-bottom: 1px solid #c8c4b8; }
.control-section:last-child { border-bottom: 0; }
.primary-controls { background: #ede9df; }
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  font: 800 11px/1.2 Consolas, "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: #68746d;
  font-size: 10px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 750; }
.field small, .microcopy, .budget-box small { color: var(--muted); font-size: 10px; font-weight: 500; }
.strong-field { margin-bottom: 14px; }
.strong-field > span { font-family: Georgia, serif; font-size: 17px; font-weight: 600; }
input[type="number"], select {
  width: 100%;
  min-width: 0;
  border: 1px solid #bdb8a9;
  background: #faf8f1;
  border-radius: 0;
  padding: 9px 10px;
  color: var(--ink);
  outline: none;
}
input[type="number"]:focus, select:focus { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.column-heads, .type-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.column-heads {
  margin-bottom: 6px;
  color: var(--muted);
  font: 700 9px/1 Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.type-controls { display: grid; gap: 7px; }
.type-row .type-label { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; }
.type-swatch { width: 13px; height: 13px; border: 1px solid rgba(0,0,0,.18); flex: 0 0 auto; }
.type-row input { padding: 7px 8px; font-size: 12px; }
.type-row .reference { padding: 7px 4px; color: #7c7b73; font-size: 10px; font-style: italic; }
.normalization-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #bbb7a9;
  font-size: 10px;
}
.normalization-line strong { font-family: Consolas, monospace; text-align: right; font-size: 10px; font-weight: 600; }
.microcopy { margin: 8px 0 0; }
details summary { cursor: pointer; font: 800 11px/1.2 Consolas, monospace; text-transform: uppercase; letter-spacing: .07em; }
.detail-fields { margin-top: 14px; }
.input-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.input-with-unit span { padding: 9px 8px; border: 1px solid #bdb8a9; border-left: 0; background: #ddd8ca; color: #5c605b; font-size: 11px; }
.budget-box { background: var(--dark); color: white; padding: 9px 10px; display: grid; align-content: center; }
.budget-box span { color: #b9c5bd; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.budget-box strong { font: 600 18px/1.1 Georgia, serif; color: #fff; }
.budget-box small { color: #afbbb4; }
.actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 8px; }
.primary-button, .secondary-button, .export-actions button {
  min-height: 42px;
  border-radius: 0;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { background: var(--accent); color: white; border: 1px solid var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: transparent; border: 1px solid #8f9088; }
.secondary-button:hover { background: rgba(255,255,255,.45); }
button:disabled { opacity: .45; cursor: not-allowed; }
.status { min-height: 18px; margin-top: 9px; color: #686d67; font-size: 11px; }
.status.busy { color: #8a5b1d; }
.status.error { color: #a43324; font-weight: 700; }

.workspace { min-width: 0; display: grid; gap: 18px; }
.run-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 4px solid var(--dark);
  border-bottom: 1px solid var(--line);
  background: rgba(251,250,246,.72);
}
.run-summary > div { padding: 13px 15px; border-right: 1px solid var(--line); display: grid; gap: 1px; }
.run-summary > div:last-child { border-right: 0; }
.run-summary span { font: 800 9px/1.2 Consolas, monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.run-summary strong { font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.run-summary small { color: var(--muted); font-size: 9px; }
.landscape-panel, .gallery-panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.landscape-panel, .gallery-panel { padding: 18px; }
.panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 14px; }
.eyebrow { color: #7f827b; }
h2 { margin: 2px 0 0; font-size: 25px; font-weight: 500; letter-spacing: -.02em; }
.export-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.export-actions button { min-height: 34px; padding: 7px 11px; border: 1px solid #8e9189; background: transparent; font-size: 10px; }
.export-actions button:not(:disabled):hover { background: var(--dark); color: white; }
.landscape-body { display: grid; grid-template-columns: minmax(360px, 1.15fr) minmax(310px, .85fr); gap: 20px; align-items: start; }
.main-canvas-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #e4e0d4;
  border: 1px solid #bcb9af;
  padding: 12px;
}
#landscapeCanvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; background: #d9d5ca; }
.selected-info { min-width: 0; }
.land-legend { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-bottom: 14px; }
.land-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; }
.legend-swatch { width: 12px; height: 12px; border: 1px solid rgba(0,0,0,.18); }
.metric-strip { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-bottom: 15px; }
.metric-strip > div { padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; }
.metric-strip span { color: var(--muted); font: 700 9px/1.2 Consolas, monospace; text-transform: uppercase; }
.metric-strip strong { font-family: Georgia, serif; font-size: 17px; font-weight: 500; }
.ok-text { color: #386b50; }
.limit-text { color: #a25c27; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { text-align: left; color: var(--muted); font: 800 9px/1.2 Consolas, monospace; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid #b8b6ad; padding: 7px 5px; }
td { border-bottom: 1px solid #dedbd1; padding: 8px 5px; font-variant-numeric: tabular-nums; }
.type-cell { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.compact-heading { align-items: center; }
.gallery-hint { color: var(--muted); font-size: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-card { border: 1px solid #c8c5ba; background: #f3f0e7; padding: 8px; cursor: pointer; text-align: left; }
.gallery-card:hover { border-color: #7c817b; }
.gallery-card.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.gallery-card canvas { width: 100%; aspect-ratio: 1; display: block; image-rendering: pixelated; background: #ddd8cd; }
.gallery-caption { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-top: 6px; }
.gallery-caption strong { font: 600 13px Georgia, serif; }
.gallery-caption span { color: var(--muted); font-size: 9px; }
.empty-gallery { display: block; }
.empty-state { min-height: 220px; display: grid; place-items: center; align-content: center; gap: 7px; color: #73766f; text-align: center; }
.empty-state strong { font-family: Georgia, serif; font-size: 18px; font-weight: 500; color: #4f534e; }
.empty-state span { font-size: 11px; }
.empty-grid { width: 76px; height: 76px; opacity: .45; background: linear-gradient(90deg, #587868 50%, #d0a847 50%) 0 0 / 24px 24px; border: 1px solid #9c9b93; }

footer {
  background: var(--dark-2);
  color: #c7d1ca;
  padding: 24px max(20px, calc((100% - 1480px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 10px;
}
footer > div:first-child { display: flex; gap: 12px; align-items: baseline; }
footer strong { color: white; font: 500 17px Georgia, serif; }

@media (max-width: 1120px) {
  .masthead-inner { grid-template-columns: 1fr; gap: 28px; }
  .header-notes { grid-template-columns: 34px 1fr; max-width: 700px; }
  .layout { grid-template-columns: 1fr; }
  .controls { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .control-section { border-right: 1px solid #c8c4b8; }
  .action-section { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .masthead-inner { width: min(100% - 28px, 1480px); }
  .layout { width: min(100% - 18px, 1480px); }
  .controls { grid-template-columns: 1fr; }
  .action-section { grid-column: auto; }
  .run-summary { grid-template-columns: 1fr 1fr; }
  .run-summary > div:nth-child(2) { border-right: 0; }
  .landscape-body { grid-template-columns: 1fr; }
  .main-canvas-frame { max-width: 640px; margin: 0 auto; }
}
@media (max-width: 520px) {
  .masthead-inner { padding-top: 30px; }
  h1 { font-size: 50px; }
  .two-fields, .actions { grid-template-columns: 1fr; }
  .column-heads, .type-row { grid-template-columns: 60px minmax(0,1fr) minmax(0,1fr); }
  .panel-heading { display: grid; align-items: start; }
  .run-summary { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  footer { display: grid; }
}
