:root {
  --wood: #24160c;
  --panel: #3a2514;
  --panel-2: #4a321c;
  --gold: #e0b84a;
  --gold-deep: #b8892a;
  --parchment: #ead6a8;
  --ink: #f4e6c3;
  --ink-dim: #c4b48a;
  --grass: #6b8c3a;
  --road: #9a7348;
  --roof: #c4452d;
  --line: #6a4e28;
  --sans: "Spectral", "Georgia", serif;
  --display: "Cinzel", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--wood);
  line-height: 1.5;
  min-height: 100%;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input { font: inherit; }
[hidden] { display: none !important; }

.wrap {
  width: min(1120px, 100%);
  margin-inline: auto;
  padding-inline: 20px;
}

.site-header, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--gold-deep);
}
.site-footer { border-bottom: 0; border-top: 2px solid var(--gold-deep); color: var(--ink-dim); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
}

.nav { display: flex; align-items: center; gap: 22px; }
.nav a:not(.btn) {
  text-decoration: none;
  color: var(--ink-dim);
  font-size: 0.95rem;
}
.nav a:not(.btn):hover { color: var(--gold); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  background: var(--gold);
  color: var(--wood);
  border: 1px solid var(--gold-deep);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.ghost {
  background: transparent;
  color: var(--parchment);
  border-color: var(--line);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.eyebrow {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 0.6rem; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.lead { font-size: 1.15rem; color: var(--ink-dim); max-width: 38rem; }

.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: center;
  padding: 36px 0 48px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.city-frame {
  border: 6px solid #5a3a18;
  outline: 2px solid var(--gold-deep);
  background: #2a1c0c;
  min-height: 420px;
  height: min(62vh, 560px);
  box-shadow: inset 0 0 0 3px #1a1008;
}
.city-frame canvas, #board {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 12px 0 48px;
}
.feature {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 18px 16px 20px;
}
.feature h3 { font-size: 1.05rem; color: var(--gold); }
.feature p { margin: 0; color: var(--ink-dim); font-size: 0.98rem; }
.ico { width: 28px; height: 28px; display: block; margin-bottom: 10px; }

.steps { padding: 8px 0 48px; }
.step-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.step-grid article {
  border-top: 2px solid var(--gold);
  padding-top: 12px;
}
.step-grid h3 { font-size: 1rem; }
.step-grid p { margin: 0; color: var(--ink-dim); }

.cta-band {
  background: var(--panel);
  border-top: 2px solid var(--gold-deep);
  border-bottom: 2px solid var(--gold-deep);
  padding: 40px 0;
  text-align: center;
}
.cta-inner p { color: var(--ink-dim); }

.app-body { background: #1a1008; }
.app-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
.app-top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 2px solid var(--gold-deep);
  flex-wrap: wrap;
}
.app-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; color: var(--ink-dim); }
.sidebar {
  background: #2a1c10;
  border-right: 2px solid var(--gold-deep);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font-family: var(--display);
  font-size: 0.88rem;
}
.side-link.is-on, .side-link:hover { color: var(--gold); background: #3a2514; }
.app-main { min-width: 0; }
.view { display: none; }
.view.is-on { display: block; }
.stage {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 320px);
  min-height: calc(100vh - 64px);
}
#board { min-height: 480px; background: #4a6a28; }
.plot {
  background: var(--panel);
  border-left: 2px solid var(--gold-deep);
  padding: 18px 16px;
  overflow: auto;
}
.plot .kicker { font-family: var(--display); color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.72rem; margin: 0 0 6px; }
.plot h2 { font-size: 1.35rem; }
.rows { display: grid; gap: 6px; margin: 12px 0; }
.row { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; font-size: 0.92rem; }
.row span:first-child { color: var(--ink-dim); }
.quote { color: var(--ink-dim); font-size: 0.92rem; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field label { font-size: 0.82rem; color: var(--ink-dim); }
.field input {
  background: #1a1008;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 8px;
}
.market { padding: 12px 16px 24px; background: #1a1008; }
.market-row { display: flex; flex-wrap: wrap; gap: 8px; }
.market-item {
  background: var(--panel);
  border: 1px solid var(--gold-deep);
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.empty { color: var(--ink-dim); }
.page-view { padding: 24px; }
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.data button { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; }
.activity { display: grid; gap: 8px; }
.activity-row { display: grid; grid-template-columns: 7rem 1fr 8rem; gap: 8px; font-family: var(--mono); font-size: 0.82rem; }
.token-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 16px; }
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--wood);
  padding: 10px 16px;
  z-index: 20;
  font-family: var(--display);
}
.status-line { font-family: var(--mono); font-size: 0.78rem; }
.docs { padding: 32px 0 64px; max-width: 42rem; }
.docs article { margin: 28px 0; }
.docs p { color: var(--ink-dim); }
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }

@media (max-width: 900px) {
  .hero-split, .features, .step-grid, .stage, .token-grid, .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 2px solid var(--gold-deep); }
  .city-frame { height: 360px; min-height: 300px; }
  .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
