:root {
  --ink: #1a1612;
  --paper: #f3ead7;
  --paper-2: #e7dcc4;
  --rule: #c9b89a;
  --accent: #9a3b24;
  --teal: #1f5c57;
  --rain: #2a4a6e;
  --gold: #c9a227;
  --chip: #fff8ea;
  --shadow: 0 18px 40px rgba(40, 28, 12, 0.16);
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff6e4, transparent 60%),
    linear-gradient(180deg, #efe4cc 0%, var(--paper) 40%, #e3d5b6 100%);
  color: var(--ink);
  font-family: var(--sans);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px 10px;
  align-items: flex-end;
}
.brand .kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}
.brand h1 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.05;
  margin: 0;
  max-width: 18ch;
}
.brand .secondary {
  margin: 10px 0 0;
  max-width: 42ch;
  color: #4d453b;
  font-size: 15px;
}
.claims {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 420px;
}
.claims span, .chip {
  background: var(--chip);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.status {
  margin: 8px 28px 0;
  padding: 8px 12px;
  background: #1f1b16;
  color: #f4ead6;
  font-size: 12px;
  border-radius: 8px;
  font-family: var(--mono);
}
.status .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
.status .dot.live { background: #6ee7b7; }
.status .dot.shim { background: #fbbf24; }
.status code { color: #f3d27a; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  padding: 16px 28px 40px;
}

.mast {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.9fr;
  gap: 12px;
  margin-bottom: 14px;
}
.mast article {
  background: #fffdf6;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 14px;
  min-height: 118px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.mast h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b6256;
}
.mast p { margin: 8px 0 0; font-family: var(--serif); font-size: 22px; }
.mast .fine { font-family: var(--sans); font-size: 12px; color: #6b6256; }
.map-tile {
  background:
    linear-gradient(135deg, rgba(31,92,87,0.18), rgba(154,59,36,0.12)),
    repeating-linear-gradient(0deg, transparent, transparent 18px, rgba(26,22,18,0.06) 19px),
    repeating-linear-gradient(90deg, transparent, transparent 18px, rgba(26,22,18,0.06) 19px),
    #d7ecdf;
}
.pin {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(154,59,36,0.2);
}
.pin:nth-child(2) { top: 38%; left: 28%; }
.pin:nth-child(3) { top: 52%; left: 61%; background: var(--teal); box-shadow: 0 0 0 6px rgba(31,92,87,0.2); }
.pin:nth-child(4) { top: 70%; left: 44%; background: var(--gold); }

.weather {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.weather b {
  background: #2a4a6e;
  color: white;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.day-index {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.day-chip {
  text-align: left;
  background: #fffdf6;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: default;
  position: relative;
  min-height: 72px;
}
.day-chip span { display: block; font-weight: 700; font-size: 13px; }
.day-chip small { color: #6b6256; font-size: 11px; }
.day-chip.is-focus {
  outline: 2px solid var(--accent);
  background: #fff1e4;
}
.rain-dot {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rain);
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.day-col {
  background: rgba(255,253,246,0.72);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 14px;
}
.day-col.is-focus { outline: 2px solid var(--accent); }
.day-col header h3 { margin: 0; font-family: var(--serif); font-size: 26px; }
.day-col header p { margin: 4px 0 12px; color: #6b6256; }

.stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.block {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 10px;
  min-height: 108px;
  position: relative;
}
.block:nth-child(3) { transform: rotate(-1.2deg); margin-top: -6px; }
.block:nth-child(4) { transform: rotate(1.1deg); }
.block.rain {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #e8f0f8, #d5e4f3);
  border-color: #8aa4c2;
}
.block.rain.is-active {
  box-shadow: 0 0 0 3px #2a4a6e;
}
.block.intent { border-style: dashed; }
.block h4 { margin: 18px 0 4px; font-size: 16px; }
.block p { margin: 0; font-size: 12px; color: #5c564c; }
.tag, .period {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tag {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--accent);
}
.block.intent .tag { color: var(--teal); }
.block.rain .tag { color: var(--rain); }
.period { color: #8a8072; }

.legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: #5c564c;
}

.agent {
  background: #171410;
  color: #f6efe1;
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
}
.agent h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
}
.agent .query {
  margin-top: 12px;
  background: #2a241d;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #3d3429;
}
.agent .query.is-live { border-color: #c9a227; }
.agent .query p { margin: 6px 0 0; font-size: 16px; }
.agent .who { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #c9a227; }
button#play-demo, .ghost {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}
button#play-demo { background: #f3d27a; color: #171410; }
.flow {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: #f3d27a;
}
#rain-answer {
  margin-top: 12px;
  background: #24384f;
  border-radius: 12px;
  padding: 12px;
}
#rain-answer h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
#rain-answer .lead { color: #f3d27a; }
#rain-answer .excerpt { font-family: var(--serif); font-size: 18px; }
#rain-answer .fine { font-size: 11px; color: #c9d6e4; }

#invocation-log { margin-top: 12px; max-height: 420px; overflow: auto; }
.call {
  background: #221c16;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #3d3429;
}
.call header { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.call .step {
  background: #f3d27a;
  color: #171410;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.call .ms { margin-left: auto; color: #9a9083; }
.call .args { margin: 6px 0; font-family: var(--mono); font-size: 11px; color: #c9b89a; }
.call pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 10px;
  color: #d9d0c2;
  max-height: 140px;
  overflow: auto;
}
.muted { color: #9a9083; font-size: 12px; }

@media (max-width: 1100px) {
  .layout, .mast, .board, .day-index { grid-template-columns: 1fr; }
  .agent { position: static; }
}
