:root {
  color-scheme: light dark;
  --bg: #f6efe2;
  --card: #fffdf8;
  --ink: #22302a;
  --muted: #68736c;
  --line: #e4dccb;
  --green: #1f5c43;
  --green-ink: #ffffff;
  --red: #b3312c;
  --gold: #b9832a;
  --soft: #efe7d6;
  --shadow: 0 1px 2px rgb(60 40 10 / 0.06), 0 8px 24px rgb(60 40 10 / 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1814;
    --card: #17231e;
    --ink: #ece6d8;
    --muted: #98a59d;
    --line: #2a3a33;
    --green: #6fc49b;
    --green-ink: #0d1a14;
    --red: #ea7f77;
    --gold: #e0b060;
    --soft: #1e2d27;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 80px; }
[hidden] { display: none !important; }
h1, h2, .display { font-family: ui-serif, Georgia, "Times New Roman", serif; font-weight: 600; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; margin: 0 0 10px; }
h3 { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
a { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.strong { font-weight: 600; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 140px; min-width: 0; }

/* Tabs */
nav.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  margin: 0 -16px 14px;
  padding: 8px 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button { border-radius: 999px; padding: 6px 14px; min-height: 36px; white-space: nowrap; flex: none; font-weight: 500; }
nav.tabs button[aria-selected="true"] { background: var(--green); border-color: var(--green); color: var(--green-ink); font-weight: 600; }

header.hero { text-align: center; padding: 18px 0 6px; }
.eyebrow { color: var(--red); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; margin-bottom: 6px; }
header.hero .meta { color: var(--muted); margin-top: 8px; }
header.hero .status { display: inline-block; margin-top: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

/* The draw card */
.tag { text-align: center; padding: 28px 18px; border: 2px dashed var(--gold); }
.tag .label { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.tag .name { font-size: 2.4rem; line-height: 1.1; margin: 8px 0 14px; color: var(--red); overflow-wrap: anywhere; }

button, a.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  min-height: 40px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover, a.btn:hover { border-color: var(--muted); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary, a.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
button.danger { color: var(--red); }
button.big { font-size: 1.05rem; padding: 12px 22px; }
button.sm { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; }
button.icon { border: 0; background: none; padding: 4px 8px; min-height: 32px; color: var(--muted); font-weight: 400; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

input[type="text"], input[type="date"], input[type="time"], input[type="password"], input[type="url"], textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); flex: none; margin: 0; }
textarea { resize: vertical; min-height: 96px; display: block; }
label.field { display: grid; gap: 4px; font-size: 0.875rem; color: var(--muted); min-width: 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list > li { padding: 10px 0; border-top: 1px solid var(--line); }
ul.list > li:first-child { border-top: 0; padding-top: 0; }
ul.list > li:last-child { padding-bottom: 0; }

.chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  white-space: nowrap;
}
.chip.ok { color: var(--green); }
.chip.hot { background: var(--red); color: #fff; }

details > summary { cursor: pointer; font-weight: 600; }
details > summary .muted { font-weight: 400; }
details > div { margin-top: 6px; }

/* Itinerary */
.plan-item { display: grid; grid-template-columns: 76px 1fr auto; gap: 10px; align-items: start; }
.plan-item .time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; padding-top: 1px; }

/* Draw rules */
.rule { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.pick { border-radius: 999px; font-weight: 500; }
.pick[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; text-decoration: line-through; }
.pick:disabled { opacity: 1; }

/* Lists */
.item { display: flex; gap: 10px; align-items: center; }
.item .label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item.done .label { text-decoration: line-through; color: var(--muted); }

/* Message board */
.board { max-height: 440px; overflow-y: auto; margin: 0 -6px 12px; padding: 0 6px; }
.msg { padding: 10px 0; border-top: 1px solid var(--line); }
.msg:first-child { border-top: 0; padding-top: 0; }
.msg .who.anon { color: var(--red); }
.msg .when { color: var(--muted); font-size: 0.8rem; margin-left: 6px; }

dialog.sheet {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  padding: 20px;
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
}
dialog.sheet::backdrop { background: rgb(10 20 15 / 0.55); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  width: max-content;
  max-width: calc(100vw - 32px);
  z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); color: #fff; }

@media (max-width: 420px) {
  .plan-item { grid-template-columns: 64px 1fr auto; }
  .tag .name { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}
