:root {
  --bg: #fbf7f2; --card: #fff; --ink: #2b2433; --muted: #6f6779; --line: #ebe3da;
  --accent: #e2574c; --accent-ink: #fff; --soft: #fde8e4; --ok: #2f8a5b;
  --radius: 16px; --shadow: 0 1px 2px rgba(43,36,51,.06), 0 6px 20px rgba(43,36,51,.06);
  --head: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
  --pattern: radial-gradient(circle at 20% 30%, #f6d6cf 0 3px, transparent 4px), radial-gradient(circle at 70% 70%, #f2e2c4 0 2px, transparent 3px);
  color-scheme: light;
}
[data-theme="holiday"] { --bg: #f5f8f4; --accent: #c8333b; --soft: #fbe3e2; --line: #dfe8de; --pattern: radial-gradient(circle at 15% 25%, #dce9dc 0 3px, transparent 4px), radial-gradient(circle at 65% 75%, #f4d9d7 0 2px, transparent 3px), radial-gradient(circle at 85% 20%, #e4eee3 0 4px, transparent 5px); }
[data-theme="birthday"] { --bg: #fff8ec; --accent: #d9457a; --soft: #ffe3ee; --line: #f2e4cf; --pattern: linear-gradient(45deg, transparent 46%, #ffd36e 46% 54%, transparent 54%), radial-gradient(circle at 70% 70%, #b9e3f5 0 3px, transparent 4px), radial-gradient(circle at 30% 80%, #ffc2d6 0 2px, transparent 3px); }
[data-theme="baby"] { --bg: #f4f8fb; --accent: #4f8fbf; --soft: #e2f0f8; --line: #dde8ef; --pattern: radial-gradient(circle at 20% 30%, #d9efe6 0 4px, transparent 5px), radial-gradient(circle at 70% 70%, #e9e0f6 0 3px, transparent 4px); }
[data-theme="wedding"] { --bg: #fbf9f4; --accent: #a5803e; --soft: #f5eddc; --line: #ece4d2; --head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; --pattern: radial-gradient(circle at 30% 40%, #efe5cf 0 2px, transparent 3px), radial-gradient(circle at 75% 65%, #f2dfe0 0 2px, transparent 3px); }
[data-theme="general"] { --accent: #6a55d8; --soft: #ece8fd; --pattern: radial-gradient(circle at 20% 30%, #e3ddfb 0 3px, transparent 4px), radial-gradient(circle at 70% 70%, #f6d6cf 0 2px, transparent 3px); }

* { 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;
  background-image: var(--pattern); background-size: 90px 90px;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 48px; flex: 1; }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; margin: 0 0 .4em; overflow-wrap: break-word; }
h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; max-width: 680px; margin: 0 auto; padding: 14px 16px 0; width: 100%; }
.brand { display: inline-flex; gap: 8px; align-items: center; font: 700 1.1rem var(--head); color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.top nav a { color: var(--muted); text-decoration: none; font-size: .95rem; margin-left: 14px; }
.top nav a:hover { color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.hero { text-align: center; padding: 28px 4px 8px; }
.hero-em { font-size: 2.6rem; display: block; margin-bottom: 4px; }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 30em; margin: 0 auto 1.2em; }

label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
input[type=text], input[type=url], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; min-height: 46px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 1rem/1 system-ui, sans-serif;
  border: 0; border-radius: 999px; padding: 13px 20px; min-height: 46px; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.ghost { background: var(--soft); color: var(--ink); }
.btn.plain { background: transparent; color: var(--muted); padding: 8px 10px; min-height: 40px; }
.btn.danger { background: #fbe4e4; color: #a3242b; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: .9rem; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; color: var(--muted); font-size: 1rem; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--ink); background: var(--soft); }

.occasions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.occasions input { position: absolute; opacity: 0; pointer-events: none; }
.occasions label { margin: 0; text-align: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px 2px; cursor: pointer; font-weight: 500; font-size: .78rem; background: #fff; }
.occasions label span { display: block; font-size: 1.4rem; }
.occasions input:checked + label { border-color: var(--accent); background: var(--soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.occasions input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }

.steps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 8px 0 20px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.step b { display: block; font-family: var(--head); margin-bottom: 2px; }
.step .em { font-size: 1.6rem; }

.list-head { text-align: center; padding: 22px 4px 6px; }
.list-head .em { font-size: 2.6rem; display: block; }
.countdown { display: inline-block; background: var(--soft); border-radius: 999px; padding: 4px 12px; font-size: .9rem; font-weight: 600; }

.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.item .body { flex: 1 1 200px; min-width: 0; }
.item .title { font-weight: 650; font-size: 1.05rem; overflow-wrap: anywhere; }
.item .title a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); text-underline-offset: 3px; }
.item .meta { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.item .note { font-size: .93rem; margin: 4px 0 0; overflow-wrap: anywhere; }
.item .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.claimed { opacity: .55; box-shadow: none; }
.item.claimed .title { text-decoration: line-through; text-decoration-color: var(--muted); }
.item.mine { border-color: var(--ok); opacity: 1; }
.item.mine .title { text-decoration: none; }
.badge { display: inline-block; white-space: nowrap; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--accent); vertical-align: middle; margin-left: 4px; }
.badge.ok { background: #e2f3ea; color: var(--ok); }
.claim-form { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.claim-form input { flex: 1 1 140px; min-height: 40px; padding: 8px 10px; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }

.share { display: flex; gap: 8px; }
.share input { flex: 1; min-width: 0; font-size: .9rem; background: var(--bg); }
.notice { background: var(--soft); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.notice.warn { background: #fff3d6; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details[open] summary { margin-bottom: 10px; }

.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.people li:last-child { border-bottom: 0; }
.people .name { flex: 1; font-weight: 600; min-width: 90px; }
.inputs-list { display: grid; gap: 8px; margin-bottom: 8px; }
.inputs-list .r { display: flex; gap: 6px; align-items: center; }
.inputs-list .r > input, .inputs-list .r > select { flex: 1; }

.reveal-box { text-align: center; padding: 30px 16px; }
.reveal-box .match { font: 800 clamp(2rem, 10vw, 3.4rem)/1.1 var(--head); color: var(--accent); margin: 10px 0 16px; overflow-wrap: anywhere; }
.gift { font-size: 4rem; display: inline-block; }
.gift.shake { animation: shake .6s ease-in-out 2; }
@keyframes shake { 0%, 100% { transform: rotate(0) } 25% { transform: rotate(-12deg) } 75% { transform: rotate(12deg) } }
.pop { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .gift.shake, .pop { animation: none; } }

.faq h3 { font-size: 1.05rem; margin-top: 1.2em; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 600; opacity: 0; transition: .2s; pointer-events: none; z-index: 9; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.error { color: #a3242b; font-weight: 600; margin: 8px 0 0; }

footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 18px 16px 28px; line-height: 2; }
footer a { color: var(--muted); }
@media (min-width: 640px) { main { padding-top: 24px; } .card { padding: 22px; } }
