:root {
  --bg: #f5f0e8;
  --card: #fffdf9;
  --ink: #26211c;
  --muted: #74695d;
  --line: #e6dccd;
  --accent: #c4553a;
  --accent-hover: #ab4630;
  --accent-soft: #f8e4dc;
  --ok: #2f7553;
  --ok-soft: #e3f0e8;
  --must: #8a5a00;
  --must-soft: #fbefd2;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1815; --card: #24201c; --ink: #f1ebe3; --muted: #aa9f92; --line: #3a332c;
    --accent: #e0745a; --accent-hover: #ea8770; --accent-soft: #3d2620;
    --ok: #7cc79f; --ok-soft: #1f3329; --must: #f0c36b; --must-soft: #3a2f18;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font);
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand:hover { color: var(--ink); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--line); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--card); box-shadow: var(--shadow); }

/* ---------- hero ---------- */
.hero { padding: 40px 0 24px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: end; }
.hero h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.1; margin: 0 0 8px; letter-spacing: -.02em; }
.hero .sub { font-size: 19px; color: var(--muted); margin: 0 0 16px; }
.hero p.intro { margin: 0; max-width: 62ch; }
.stats {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px;
}
.stats .big { font-size: 40px; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.stats .big small { font-size: 17px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stats .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.stats .legend b { color: var(--ink); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 12px; display: flex; }
.bar i { display: block; height: 100%; background: var(--ok); transition: width .5s ease; }
.bar i + i { background: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.stats .actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.privacy { font-size: 14px; color: var(--muted); margin-top: 14px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 18px; }
.seg { display: inline-flex; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.live { margin-left: auto; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #bbb; }
.live.on::before { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.adminbar {
  background: var(--must-soft); color: var(--must); border-radius: 12px; padding: 8px 14px; font-size: 14px;
  display: flex; gap: 12px; align-items: center;
}

/* ---------- zones grid ---------- */
.zones { columns: 3 340px; column-gap: 18px; padding-bottom: 48px; }
.zone {
  break-inside: avoid; margin: 0 0 18px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.zone header { padding: 16px 18px 12px; }
.zone .zh { display: flex; align-items: center; gap: 10px; }
.zone .emoji { font-size: 26px; line-height: 1; }
.zone h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.zone .count { margin-left: auto; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.zone .count.done { color: var(--ok); font-weight: 600; }
.zone .bar { margin-top: 10px; height: 6px; }
.zone .znote { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.zone ul { list-style: none; margin: 0; padding: 0 8px 8px; }
.zone .empty { padding: 4px 18px 16px; color: var(--muted); font-size: 14px; }

.item {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start;
  padding: 10px 10px; border-radius: 12px; transition: background .3s;
}
.item + .item { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.item .mark {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); margin-top: 2px;
  display: grid; place-items: center; font-size: 12px; color: #fff;
}
.item.is-claimed .mark { border-color: var(--ok); background: var(--ok-soft); }
.item.is-received .mark { border-color: var(--ok); background: var(--ok); }
.item.is-received .mark::after { content: "✓"; font-weight: 700; }
.item .t { font-weight: 550; }
.item.is-claimed .t, .item.is-received .t { color: var(--muted); }
.item .n { font-size: 14px; color: var(--muted); }
.item .n a { font-size: 14px; }
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 7px; border-radius: 6px; vertical-align: 2px; margin-left: 6px;
  background: var(--must-soft); color: var(--must);
}
.who { margin-top: 4px; font-size: 14px; color: var(--ok); font-weight: 500; }
.who .priv { display: block; color: var(--muted); font-weight: 400; white-space: pre-wrap; }
.item.is-mine { background: var(--ok-soft); }
.item .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.item.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.item.is-mine.flash { animation: none; }

.addrow { display: flex; gap: 8px; padding: 0 16px 16px; }
.addrow input { flex: 1; }

/* ---------- buttons & forms ---------- */
.btn {
  font: inherit; font-weight: 600; border: 0; cursor: pointer; border-radius: 999px;
  padding: 9px 18px; background: var(--accent); color: #fff; text-decoration: none; display: inline-block;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--line); }
.btn.sm { padding: 5px 12px; font-size: 14px; white-space: nowrap; }
.btn.xs { padding: 3px 9px; font-size: 13px; font-weight: 500; }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.soft:hover { background: var(--accent); color: #fff; }
.linkbtn { border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }
.linkbtn:hover { color: var(--accent); }

input[type=text], input[type=url], textarea, select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: block; margin: 0 0 12px; font-size: 14px; font-weight: 600; }
label.f > span.h { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 13px; }
label.f input, label.f textarea, label.f select { margin-top: 5px; font-weight: 400; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.choice label {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-size: 14px;
}
.choice label b { display: block; font-size: 15px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

dialog {
  border: 0; border-radius: 20px; padding: 0; width: min(460px, calc(100vw - 24px));
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(30, 20, 10, .45); backdrop-filter: blur(2px); }
dialog form { padding: 22px; }
dialog h3 { margin: 0 0 4px; font-size: 21px; }
dialog .dsub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
dialog .alert { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 100;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.foot { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: 14px; }
.skeleton { color: var(--muted); padding: 40px 0; }

/* ---------- fund page ---------- */
.page { max-width: 820px; margin: 0 auto; padding: 36px 20px 56px; }
.page h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.12; margin: 0 0 12px; letter-spacing: -.02em; }
.page .lead { font-size: 19px; color: var(--muted); margin: 0 0 28px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin: 0 0 18px; }
.card h2 { margin: 0 0 10px; font-size: 21px; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 18px; }
.fact { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.fact b { display: block; font-size: 22px; letter-spacing: -.01em; }
.fact span { color: var(--muted); font-size: 14px; }
ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
ol.steps li { counter-increment: s; position: relative; padding: 0 0 12px 42px; }
ol.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 14px;
}
ol.steps li:last-child { padding-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.links a {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: border-color .15s;
}
.links a:hover { border-color: var(--accent); color: var(--ink); }
.links a b { font-size: 16px; }
.links a span { color: var(--muted); font-size: 14px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.src { font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; gap: 20px; }
  .facts { grid-template-columns: 1fr; }
  .links { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 14px; }
  .item { grid-template-columns: 22px 1fr; }
  .item .acts { grid-column: 2; justify-content: flex-start; }
  .choice { grid-template-columns: 1fr; }
  .live { margin-left: 0; }
}
@media (max-width: 420px) {
  .top .wrap { gap: 8px; }
  .brand { font-size: 14px; white-space: nowrap; }
  .brand > span:first-child { display: none; }
  .nav a { padding: 6px 10px; font-size: 15px; }
}
