:root {
  --paper: #f2eee4;
  --ink: #18201d;
  --muted: #5d655f;
  --line: #26312c;
  --panel: #dfe7dc;
  --stone: #303937;
  --sand: #d8a94e;
  --water: #3c8fa3;
  --seed: #d95f48;
  --plant: #477c4c;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; z-index: 20; top: .5rem; left: .5rem; padding: .7rem 1rem; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.topbar { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.topbar a { text-decoration: none; }
.topbar p { margin: 0; }
.opening { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: clamp(2rem, 7vw, 8rem); align-items: end; padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 6vw, 7rem); border-bottom: 1px solid var(--line); }
.eyebrow, .control-title { margin: 0 0 1rem; color: #9c3f31; font-size: .7rem; font-weight: 850; text-transform: uppercase; }
.opening h1 { margin: 0; font: 400 clamp(4rem, 9vw, 9rem)/.84 var(--serif); }
.opening > p { max-width: 540px; margin: 0; font-size: clamp(1rem, 1.5vw, 1.25rem); }
.workbench { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); min-height: 720px; background: #bcc9bd; border-bottom: 1px solid var(--line); }
.controls { padding: 1.5rem; border-right: 1px solid var(--line); background: var(--panel); }
.control-group { padding: 0 0 1.4rem; margin-bottom: 1.4rem; border-bottom: 1px solid rgba(24, 32, 29, .28); }
.materials { display: grid; gap: .45rem; }
.materials button { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: .7rem; width: 100%; min-height: 46px; padding: .55rem .7rem; border: 1px solid var(--line); background: #f7f4ec; text-align: left; cursor: pointer; }
.materials button[aria-checked="true"] { background: var(--ink); color: #fff; box-shadow: 4px 4px 0 #87958a; }
.swatch { display: block; width: 20px; height: 20px; border: 1px solid currentColor; }
.swatch.stone, .rule-icon.stone { background: var(--stone); }
.swatch.sand, .rule-icon.sand { background: var(--sand); }
.swatch.water, .rule-icon.water { background: var(--water); }
.swatch.seed, .rule-icon.seed { background: var(--seed); border-radius: 50%; }
.swatch.erase { background: repeating-linear-gradient(45deg, transparent 0 4px, currentColor 4px 5px); }
kbd { padding: .12rem .35rem; border: 1px solid currentColor; font-size: .65rem; font-family: inherit; }
.brush-control label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.brush-control output { min-width: 2rem; text-align: right; }
.brush-control input { width: 100%; accent-color: var(--seed); }
.transport > div { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.transport button, .actions button { min-height: 44px; border: 1px solid var(--line); background: #f7f4ec; font-weight: 750; cursor: pointer; }
.transport button:hover, .actions button:hover { background: #fff; }
.actions { display: grid; gap: .5rem; }
.actions #download { background: var(--ink); color: #fff; }
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; background: rgba(24, 32, 29, .24); border: 1px solid rgba(24, 32, 29, .24); }
.counters div { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem; background: var(--panel); font-size: .7rem; }
.counters dd { margin: 0; font-weight: 850; }
.status { min-height: 2.6em; margin: 1rem 0 0; color: var(--muted); font-size: .72rem; }
.world-wrap { display: grid; place-content: center; min-width: 0; width: 100%; padding: clamp(1rem, 4vw, 4rem); overflow: hidden; }
#world { display: block; width: min(100%, 960px); height: auto; aspect-ratio: 3 / 2; background: #f8f6ef; border: 2px solid var(--line); box-shadow: 12px 12px 0 rgba(24, 32, 29, .16); cursor: crosshair; touch-action: none; image-rendering: pixelated; }
.canvas-help { max-width: 960px; margin: 1.2rem 0 0; color: #35413b; font-size: .72rem; }
.rules { padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 6vw, 7rem); }
.rules-head, .note { display: grid; grid-template-columns: 48px minmax(0, 900px); gap: 1rem; }
.number { margin: .2rem 0 0; color: #9c3f31; font-weight: 900; }
.rules h2, .note h2 { margin: 0; font: 400 clamp(2.8rem, 5vw, 5.5rem)/.92 var(--serif); }
.rules ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; max-width: 1300px; margin: 4rem auto 0; padding: 0; background: var(--line); border: 1px solid var(--line); list-style: none; }
.rules li { min-height: 260px; display: flex; flex-direction: column; padding: 1.5rem; background: #faf7ef; }
.rule-icon { width: 42px; height: 42px; display: block; margin-bottom: auto; border: 1px solid var(--line); }
.rules strong { display: block; margin-top: 2rem; font-family: var(--serif); font-size: 1.4rem; line-height: 1.1; }
.rules li p { margin-bottom: 0; color: var(--muted); }
.note { padding: clamp(4rem, 8vw, 8rem) clamp(1rem, 8vw, 9rem); background: var(--ink); color: #f2eee4; }
.note > div > p:last-child { max-width: 680px; color: #cbd0cc; }
footer { display: flex; justify-content: space-between; gap: 2rem; padding: 2rem clamp(1rem, 4vw, 4rem); border-top: 1px solid var(--line); font-size: .78rem; }
footer p { margin: 0; }
button:focus-visible, input:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid #d95f48; outline-offset: 3px; }
@media (max-width: 900px) { .opening { display: block; }.opening h1 { margin-bottom: 2rem; }.workbench { grid-template-columns: 1fr; }.controls { border-right: 0; border-bottom: 1px solid var(--line); }.materials { grid-template-columns: 1fr 1fr; }.world-wrap { padding: 1rem; }.rules ol { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .topbar p { display: none; }.opening h1 { font-size: clamp(3.5rem, 18vw, 5rem); }.materials { grid-template-columns: 1fr; }.rules-head, .note { grid-template-columns: 34px minmax(0, 1fr); }.rules h2, .note h2 { font-size: 2.3rem; }.rules ol { grid-template-columns: 1fr; }.rules li { min-height: 190px; }.transport > div { grid-template-columns: 1fr; } footer { display: block; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
