:root {
  --paper: #f3ead9;
  --ink: #211910;
  --muted: #6b5748;
  --rule: #d7c4aa;
  --card: #fff8ee;
  --paprika: #b23a22;
  --paprika-dark: #8c2c19;
  --olive: #3f5a38;
  --stamp: #e7d3b4;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #fbeed4 0%, transparent 55%),
    linear-gradient(180deg, #f7efe1 0%, var(--paper) 40%, #eadcc6 100%);
  color: var(--ink);
  font: 17px/1.5 "Segoe UI", "Avenir Next", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    -18deg,
    transparent 0 18px,
    rgb(33 25 16 / 0.015) 18px 19px
  );
}

.page {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 80px;
  position: relative;
}

.mast h1 {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: clamp(2.4rem, 6vw, 4.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin: 8px 0 14px;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--paprika);
  font-weight: 700;
}

.lede {
  margin: 0 0 22px;
  max-width: 40rem;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.nav a:hover { border-color: var(--ink); }

.board, .gate {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 40px rgb(33 25 16 / 0.08);
}

label, fieldset {
  display: block;
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}

label span, legend {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

label span em, .hint {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

input, select, textarea, button {
  font: inherit;
  color: var(--ink);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--rule);
  background: #fffdf8;
  border-radius: 12px;
  padding: 11px 12px;
}

textarea { resize: vertical; min-height: 120px; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--olive);
  outline-offset: 1px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 14px;
}

.field-row.three { grid-template-columns: repeat(3, 1fr); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fffdf8;
  font-size: 0.92rem;
  cursor: pointer;
}

.chip input { width: auto; accent-color: var(--olive); }

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}

button {
  border: 0;
  background: var(--paprika);
  color: #fff8ee;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--paprika-dark); }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.hint { margin: 0; font-size: 0.86rem; max-width: 22rem; }
.error { color: var(--paprika); margin: 0 0 12px; }
.banner {
  background: #e7f0dc;
  color: var(--olive);
  border: 1px solid #c9d9b8;
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.count {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.2rem;
}

.stack { display: grid; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 16px 18px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card h2 {
  margin: 0 0 6px;
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

button.remove {
  flex: 0 0 auto;
  padding: 7px 12px;
  font-size: 0.86rem;
  color: var(--paprika);
  border-color: #e3c2b6;
}

button.remove:hover {
  background: #f8e6df;
  color: var(--paprika-dark);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta span {
  background: var(--stamp);
  border-radius: 999px;
  padding: 3px 8px;
}

.note { margin: 0; white-space: pre-wrap; }
.empty { color: var(--muted); }

@media (max-width: 720px) {
  .field-row, .field-row.three, .toolbar, .actions {
    grid-template-columns: 1fr;
    display: grid;
  }
  .actions { justify-items: start; }
}
