/* Mobile first. One file, no build step. Colours are tokens on :root. */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #24201d;
  --muted: #6f6660;
  --line: #e4ddd3;
  --accent: #a8324a;
  --accent-text: #ffffff;
  --free: #dff3e3;      --free-text: #1d5b2c;
  --claimed: #fdecc8;   --claimed-text: #6b4a00;
  --bought: #dbe8fb;    --bought-text: #1c437e;
  --wrapped: #e9dff7;   --wrapped-text: #4a2a80;
  --removed: #ececec;   --removed-text: #555555;
  --danger: #a12727;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1917;
    --card: #262320;
    --text: #f1ece6;
    --muted: #a89f97;
    --line: #3a3531;
    --accent: #e0788d;
    --accent-text: #1b1917;
    --free: #1f3b26;      --free-text: #a9e2b6;
    --claimed: #45360f;   --claimed-text: #f4d58a;
    --bought: #1c2f4d;    --bought-text: #a9c8f5;
    --wrapped: #33244f;   --wrapped-text: #cdb6f3;
    --removed: #34312e;   --removed-text: #bdb5ad;
    --danger: #f08a8a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0.5rem 0 0.75rem; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
.card h2 { margin-top: 0; }
p { margin: 0.5rem 0; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.25rem 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }
.top form { margin: 0; }
main { max-width: 42rem; margin: 0 auto; padding: 1rem 1rem 4rem; }

.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.9rem 1rem; margin: 0.6rem 0;
}
.rows { list-style: none; margin: 0; padding: 0; }
a.row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 1rem; text-decoration: none; color: var(--text); }
a.row:hover, a.row:focus-visible { border-color: var(--accent); }
.title { font-weight: 600; font-size: 1.05rem; text-decoration: none; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin-top: 0.35rem; }
.note { white-space: pre-line; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 0.92rem; }
.crumb { margin: 0; font-size: 0.95rem; }
.alert { background: var(--claimed); color: var(--claimed-text); border-radius: 12px; padding: 0.75rem 1rem; }

.badge {
  display: inline-block; border-radius: 999px; padding: 0.1rem 0.65rem;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  background: var(--removed); color: var(--removed-text);
}
.badge.free { background: var(--free); color: var(--free-text); }
.badge.claimed { background: var(--claimed); color: var(--claimed-text); }
.badge.bought { background: var(--bought); color: var(--bought-text); }
.badge.wrapped { background: var(--wrapped); color: var(--wrapped-text); }
.badge.secret { background: var(--text); color: var(--bg); }
.badge.unread { background: var(--accent); color: var(--accent-text); }

label, .label { display: block; font-weight: 600; font-size: 0.95rem; }
input:not([type=checkbox]), textarea {
  display: block; width: 100%; margin-top: 0.25rem; padding: 0.6rem 0.7rem;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.stack > * + * { margin-top: 0.8rem; }
.stack { margin: 0.6rem 0; }
.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; margin: 0.8rem 0; }
.inline label { flex: 1 1 12rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.8rem 0.7rem; margin-inline: 0; }
legend { font-weight: 600; font-size: 0.95rem; padding: 0 0.3rem; }
.check { font-weight: 400; padding: 0.3rem 0; }
.check input { width: 1.1rem; height: 1.1rem; vertical-align: -0.15rem; margin-right: 0.3rem; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: 0.6rem 1rem; min-height: 2.75rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.current { background: var(--text); border-color: var(--text); color: var(--bg); cursor: default; }
.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0 0.2rem; }
.buttons form { margin: 0; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 0.6rem; }
details.card form + form { margin-top: 0.8rem; }

.people { margin: 0.5rem 0; padding-left: 1.2rem; }
.event { color: var(--muted); font-size: 0.92rem; margin: 0.6rem 0; }
.msg { border-left: 3px solid var(--line); padding: 0.1rem 0 0.1rem 0.75rem; margin: 0.8rem 0; }
.msg.mine { border-left-color: var(--accent); }
.msg p { margin: 0.15rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
