:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #1d2a24;
  --muted: #5d6a63;
  --line: #e8dfd0;
  --red: #b8322a;
  --red-d: #93251f;
  --pine: #1f4d3a;
  --pine-d: #143528;
  --gold: #d9aa3c;
  --gold-l: #f7e7bd;
  --door: #fffaf1;
  --ok: #2f7a4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 6px 20px rgba(20, 30, 25, .07);
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--red-d); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 640px; }

/* header / footer */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.brand img { width: 32px; height: 32px; }
.brand span { font-family: var(--serif); font-size: 1.2rem; }
footer.foot { margin: 56px 0 0; padding: 26px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
footer.foot a { color: var(--muted); }
footer.foot .links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; }

/* type */
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 5.4vw, 3.1rem); }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.15rem; }
.lead { font-size: 1.13rem; color: var(--muted); max-width: 36em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 999px;
  border: 1px solid transparent; background: var(--red); color: #fff; font-weight: 650; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:hover { background: var(--red-d); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.alt { background: var(--pine); }
.btn.alt:hover { background: var(--pine-d); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f3ece0; }
.btn.danger { background: transparent; color: var(--red-d); border-color: #e7c4c0; }
.btn.danger:hover { background: #fbeeec; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .92rem; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--red-d); text-decoration: underline; cursor: pointer; }

/* forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
label.f { display: block; font-weight: 600; margin: 14px 0 6px; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #d9cdb9; border-radius: 10px; background: #fff; font-size: 16px; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .door:focus-visible, .choice:focus-within { outline: 3px solid rgba(217, 170, 60, .55); outline-offset: 1px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.err { color: var(--red-d); font-weight: 600; min-height: 1.4em; margin: 10px 0 0; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.choice input { margin-top: 4px; accent-color: var(--red); }
.choice b { display: block; }
.choice span { color: var(--muted); font-size: .9rem; }
.choice:has(input:checked) { border-color: var(--red); background: #fff7f5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: .93rem; }
.chip[aria-pressed=true] { border-color: var(--pine); background: var(--pine); color: #fff; }

/* home */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px; align-items: start; padding: 26px 0 10px; }
.hero .pitch p { margin: 0 0 14px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--pine); font-weight: 600; font-size: .95rem; margin: 18px 0; padding: 0; list-style: none; }
.badges li::before { content: '✓ '; color: var(--ok); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 40px 0; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--gold-l); color: var(--pine-d); font-weight: 800; margin-bottom: 8px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 650; cursor: pointer; }
.faq details p { margin: 10px 0 2px; color: var(--muted); }
.mini-board { margin-top: 14px; }

/* calendar board */
.board { background: radial-gradient(circle at 20% 10%, #2a6249 0, var(--pine) 45%, var(--pine-d) 100%); border-radius: 20px; padding: 16px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; position: relative; overflow: hidden; }
.board::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: radial-gradient(#fff 1px, transparent 1.5px), radial-gradient(#fff 1px, transparent 1.5px);
  background-size: 46px 46px, 31px 31px; background-position: 0 0, 17px 23px; }
.door { position: relative; aspect-ratio: 1 / 1.05; border-radius: 10px; border: 0; background: var(--door); color: var(--pine-d); cursor: pointer; padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 2px rgba(217, 170, 60, .45), 0 2px 0 rgba(0,0,0,.18);
  transition: transform .12s; font-family: var(--sans); }
.door:hover { transform: translateY(-2px); }
.door .num { font-family: var(--serif); font-size: clamp(1.4rem, 4.2vw, 2rem); font-weight: 700; line-height: 1; color: var(--red); }
.door .tag { font-size: .7rem; font-weight: 650; margin-top: 5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.door.taken .tag { color: var(--pine); }
.door.taken::after { content: ''; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #f6d7d3; }
.door.mine { background: #fff4d6; }
.door.mine .tag { color: #8a5a00; }
.door.mine.todo .tag { color: var(--red-d); }
.door.open { background: #f1e6d2; box-shadow: inset 0 0 0 2px rgba(31, 77, 58, .25); }
.door.open::after { display: none; }
.door.open .icon { font-size: clamp(1.3rem, 4vw, 1.8rem); line-height: 1; }
.door.open .num { font-size: .95rem; color: var(--pine); margin-top: 3px; }
.door.today { background: #fff; box-shadow: 0 0 0 3px var(--gold), 0 0 22px 4px rgba(217, 170, 60, .55); animation: glow 2.2s ease-in-out infinite; }
.door.today.seen { animation: none; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 30px 8px rgba(217, 170, 60, .75); } }
@media (prefers-reduced-motion: reduce) { .door.today { animation: none; } .door { transition: none; } }

/* calendar page */
.cal-head { padding: 8px 0 14px; }
.cal-head h1 { font-size: clamp(1.7rem, 5vw, 2.5rem); margin-bottom: 4px; overflow-wrap: anywhere; }
.meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .95rem; }
.progress { height: 8px; background: #eadfcc; border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); border-radius: 99px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0; }
.notice { border-radius: 12px; padding: 14px 16px; margin: 12px 0; background: #fff; border: 1px solid var(--line); }
.notice.gold { background: #fff8e4; border-color: #efd9a2; }
.notice.pine { background: #edf5ef; border-color: #cfe3d5; }
.notice h3 { margin: 0 0 4px; }
.notice p { margin: 0 0 8px; }
.joinform { display: flex; gap: 10px; margin-top: 8px; }
.joinform input { flex: 1; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.people li { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: .9rem; }
.people li.me { border-color: var(--pine); color: var(--pine); font-weight: 650; }
.section { margin-top: 28px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .85rem; margin: 10px 2px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* dialog sheet */
dialog.sheet { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.sheet::backdrop { background: rgba(15, 30, 22, .55); }
.sheet .in { padding: 22px; overflow: auto; }
.sheet .x { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f3ece0; font-size: 1.3rem; cursor: pointer; line-height: 1; }
.sheet .kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 750; color: var(--red); }
.sheet h2 { margin: 2px 40px 8px 0; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.reveal { background: var(--door); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 10px 0; }
.reveal .big { font-size: 2.4rem; line-height: 1; }
.reveal .from { font-weight: 700; color: var(--pine); margin: 8px 0 6px; }
.reveal .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.08rem; margin: 0; }
.reveal img { display: block; border-radius: 10px; margin: 12px 0 0; max-height: 60vh; object-fit: contain; background: #f3ece0; }
.reveal .lnk { display: inline-flex; margin-top: 12px; }
.reacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reacts button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 1.05rem; min-height: 40px; }
.reacts button[aria-pressed=true] { border-color: var(--red); background: #fff1ef; }
.reacts button span { font-size: .85rem; color: var(--muted); margin-left: 3px; font-weight: 650; }
.photo-prev { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.photo-prev img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 30px); }
.center { text-align: center; }
.hidden { display: none !important; }

/* doc pages */
.doc { padding: 10px 0; }
.doc h2 { margin-top: 1.4em; }
.doc p, .doc li { color: #34413a; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 18px; padding-top: 8px; }
  .steps { grid-template-columns: 1fr; margin: 28px 0; }
  .board { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; border-radius: 16px; }
  .joinform { flex-direction: column; }
  .row { flex-direction: column; gap: 0; }
  dialog.sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; max-height: 92dvh; }
}
