:root {
  --night: #0d1f38;
  --night-2: #13304f;
  --ink: #1d2433;
  --muted: #5d6677;
  --paper: #fffaf2;
  --card: #ffffff;
  --line: #e7dfd2;
  --red: #c8332c;
  --red-dark: #a3241e;
  --gold: #e9b237;
  --green: #2f7d4f;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(6, 16, 32, 0.22);
  --serif: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 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;
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(1200px 700px at 50% -10%, #1f4570 0%, var(--night) 60%) fixed, var(--night);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; }
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* Snow: two layers of drifting dots behind everything. */
.snow, .snow::after {
  position: fixed; inset: -50px 0 0 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(1.5px 1.5px at 90px 120px, #fff, transparent),
    radial-gradient(2.5px 2.5px at 160px 60px, rgba(255,255,255,.8), transparent), radial-gradient(1.5px 1.5px at 240px 200px, #fff, transparent),
    radial-gradient(2px 2px at 300px 90px, rgba(255,255,255,.7), transparent);
  background-size: 320px 260px;
  opacity: .55;
  animation: snow 18s linear infinite;
}
.snow::after { content: ''; inset: 0; background-size: 210px 190px; opacity: .45; animation-duration: 26s; }
@keyframes snow { from { background-position: 0 0; } to { background-position: 40px 260px; } }
@media (prefers-reduced-motion: reduce) { .snow, .snow::after { animation: none; } }
main, header, footer { position: relative; z-index: 1; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; color: #fff; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; letter-spacing: .2px; }
.brand svg { width: 30px; height: 30px; }
.top nav a { color: #d6e2f1; text-decoration: none; font-size: .95rem; margin-left: 16px; }
.top nav a:hover { color: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font-weight: 700; font-size: 1.02rem; text-decoration: none;
  box-shadow: 0 4px 0 var(--red-dark), 0 8px 18px rgba(200, 51, 44, .35);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.btn:hover { background: #d43b33; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark), 0 3px 8px rgba(200, 51, 44, .3); }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn.gold { background: var(--gold); color: #3b2a00; box-shadow: 0 4px 0 #b98712, 0 8px 18px rgba(233, 178, 55, .3); }
.btn.gold:hover { background: #f1bd45; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: #f6f1e8; }
.btn.light { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.btn.light:hover { background: rgba(255,255,255,.2); }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: .92rem; }
.link { background: none; border: 0; padding: 6px 2px; cursor: pointer; color: var(--muted); text-decoration: underline; font-size: .93rem; }

/* Home hero */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 34px; align-items: center; padding-top: 26px; padding-bottom: 40px; color: #fff; }
.hero h1 { font-family: var(--serif); font-size: clamp(2.1rem, 5vw, 3.5rem); line-height: 1.06; margin: 0 0 14px; letter-spacing: -.5px; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero .lead { font-size: 1.15rem; color: #d6e2f1; margin: 0 0 22px; max-width: 34em; }
.hero-tree { position: relative; }
.hero-tree svg { width: 100%; max-width: 420px; margin: 0 auto; filter: drop-shadow(0 20px 40px rgba(0,0,0,.35)); }
.bubble {
  position: absolute; background: var(--paper); color: var(--ink); border-radius: 14px; padding: 8px 12px; font-size: .88rem;
  box-shadow: var(--shadow); max-width: 190px;
}
.bubble b { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
.bubble.b1 { left: -6px; top: 26%; transform: rotate(-3deg); }
.bubble.b2 { right: -4px; top: 58%; transform: rotate(2.5deg); }

.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; color: var(--ink); }
.panel h2 { font-family: var(--serif); margin: 0 0 4px; font-size: 1.45rem; }
.panel .sub { color: var(--muted); margin: 0 0 16px; font-size: .95rem; }
label.f { display: block; font-weight: 650; font-size: .93rem; margin: 14px 0 6px; }
input[type=text], input[type=datetime-local], textarea {
  width: 100%; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 1.05rem; outline: none;
}
input:focus, textarea:focus { border-color: #8fb0d8; box-shadow: 0 0 0 4px rgba(61, 123, 224, .14); }
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.hint { font-size: .84rem; color: var(--muted); margin-top: 6px; }
.err { color: var(--red); font-weight: 600; font-size: .92rem; min-height: 1.2em; margin: 10px 0 0; }

.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice { position: relative; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 8px 6px 6px; text-align: center; cursor: pointer; font-size: .86rem; font-weight: 600; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice svg { width: 100%; height: 74px; }
.choice:has(input:checked) { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 51, 44, .15); }
.choice:has(input:focus-visible) { outline: 3px solid #8fb0d8; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; cursor: pointer; }
.radio input { margin-top: 4px; accent-color: var(--red); }
.radio span small { display: block; color: var(--muted); font-size: .82rem; }
.radio:has(input:checked) { border-color: var(--red); }

/* Sections */
.section { padding: 34px 0; color: #fff; }
.section h2 { font-family: var(--serif); font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0 0 18px; text-align: center; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 20px; }
.step .n { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #3b2a00; display: grid; place-items: center; font-weight: 800; margin-bottom: 10px; }
.step h3 { margin: 0 0 6px; font-size: 1.1rem; }
.step p { margin: 0; color: #cfdbeb; font-size: .97rem; }
.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { color: #cfdbeb; margin: 10px 0 2px; }
.mytrees { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.mytrees a { display: flex; justify-content: space-between; gap: 10px; background: var(--paper); color: var(--ink); text-decoration: none; border-radius: 14px; padding: 14px 16px; font-weight: 650; }
.mytrees a small { color: var(--muted); font-weight: 500; }
footer { color: #9fb2c9; font-size: .88rem; padding: 30px 0 40px; text-align: center; }
footer a { color: #cfdbeb; margin: 0 8px; }

/* Tree page */
.tree-head { text-align: center; color: #fff; padding: 4px 0 2px; }
.tree-head h1 { font-family: var(--serif); font-size: clamp(1.8rem, 6vw, 2.6rem); margin: 0; line-height: 1.1; }
.tree-head .meta { color: #d6e2f1; margin: 6px 0 0; font-size: 1.02rem; }
.count-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px 12px; font-weight: 700; color: #fff; }
.countdown { display: flex; justify-content: center; gap: 8px; margin: 12px 0 0; }
.countdown div { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 12px; min-width: 64px; padding: 6px 8px; color: #fff; text-align: center; }
.countdown b { display: block; font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.countdown small { font-size: .72rem; color: #b9c9dc; text-transform: uppercase; letter-spacing: .6px; }
.stage { position: relative; max-width: 460px; margin: 6px auto 0; }
.stage svg.tree { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 18px 34px rgba(0,0,0,.35)); }
.orn { cursor: pointer; outline: none; }
.orn .orn-in { transition: transform .15s ease; transform-box: fill-box; transform-origin: 50% 0%; }
.orn:hover .orn-in, .orn:focus-visible .orn-in { transform: scale(1.18); }
.orn.mine .orn-in { animation: sway 3.2s ease-in-out infinite; }
.orn.drop .orn-in { animation: drop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.orn.unread .orn-in { filter: drop-shadow(0 0 6px #fff6c4) drop-shadow(0 0 10px #ffd65a); }
@keyframes sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes drop { from { transform: translateY(-120px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.bulb { animation: twinkle 2.4s ease-in-out infinite; }
.bulb:nth-of-type(3n) { animation-delay: .8s; }
.bulb:nth-of-type(3n+1) { animation-delay: 1.6s; }
@keyframes twinkle { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .bulb, .orn.mine .orn-in, .orn.drop .orn-in { animation: none; } }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; color: #fff; margin-top: 6px; font-weight: 600; }
.pager button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 1.2rem; cursor: pointer; }
.pager button[disabled] { opacity: .3; cursor: default; }
.actions { display: grid; gap: 10px; max-width: 420px; margin: 16px auto 0; }
.actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tip { position: absolute; z-index: 5; transform: translate(-50%, -100%); background: var(--paper); color: var(--ink); border-radius: 12px; padding: 7px 11px; font-size: .86rem; box-shadow: var(--shadow); white-space: nowrap; pointer-events: none; }
.tip::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.card-box { background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); max-width: 460px; margin: 16px auto 0; }
.card-box h2, .card-box h3 { font-family: var(--serif); margin: 0 0 8px; }
.card-box p { margin: 0 0 10px; }
.list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.list li { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 10px; }
.list li .grow { flex: 1; min-width: 0; }
.list li .grow p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .9rem; }
.ownerlink { display: flex; gap: 8px; }
.ownerlink input { font-size: .9rem; padding: 10px; }
.banner { background: linear-gradient(135deg, #ffe9a6, #ffd36b); color: #3b2a00; border-radius: 14px; padding: 12px 14px; font-weight: 650; margin: 12px auto 0; max-width: 460px; text-align: center; }
.banner.warn { background: #fff1d6; color: #6a4500; font-weight: 500; text-align: left; font-size: .93rem; }
.loading { color: #d6e2f1; text-align: center; padding: 80px 0; }

/* Sheets (bottom sheet on phones, centred dialog on desktop) */
dialog.sheet {
  border: 0; padding: 0; background: var(--paper); color: var(--ink); width: min(520px, 100%); max-height: 92vh; overflow: auto;
  border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
dialog.sheet::backdrop { background: rgba(5, 12, 24, .6); backdrop-filter: blur(2px); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; max-width: 100%; width: 100%; border-radius: 22px 22px 0 0; max-height: 94vh; }
}
.sheet-in { padding: 18px 18px 22px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h2 { font-family: var(--serif); margin: 0; font-size: 1.35rem; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f0e9dd; cursor: pointer; font-size: 1.3rem; line-height: 1; }
.picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 6px; }
.picker button { border: 2px solid transparent; background: #fff; border-radius: 12px; padding: 4px 0; cursor: pointer; display: grid; place-items: center; }
.picker button svg { width: 38px; height: 46px; }
.picker button[aria-pressed=true] { border-color: var(--red); background: #fff5f3; }
.swatches { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.swatches button[aria-pressed=true] { box-shadow: 0 0 0 3px var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 11px; font-size: .85rem; cursor: pointer; }
.chips button:hover { background: #f6f1e8; }
.preview-orn { display: flex; align-items: center; gap: 12px; margin: 6px 0 2px; }
.preview-orn svg { width: 56px; height: 68px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.counter { text-align: right; font-size: .8rem; color: var(--muted); }

/* Opened note */
.note-card { background: #fff; border-radius: 18px; padding: 22px 20px; box-shadow: inset 0 0 0 1px var(--line); text-align: center; position: relative; }
.note-card .ornbig { margin: -6px auto 8px; width: 80px; }
.note-card .ornbig svg { width: 80px; height: 97px; }
.note-card .text { font-family: var(--serif); font-size: 1.28rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.note-card .from { color: var(--muted); font-weight: 650; }
.note-card.open { animation: unfold .55s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes unfold { from { transform: scale(.7) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.reader-nav span { color: var(--muted); font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; z-index: 50; font-weight: 600; box-shadow: var(--shadow); max-width: 92vw; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.prose { background: var(--paper); border-radius: var(--radius); padding: 24px; margin: 10px auto 40px; max-width: 760px; }
.prose h1 { font-family: var(--serif); margin-top: 0; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 16px; padding-top: 8px; }
  .hero-tree { order: -1; max-width: 330px; margin: 0 auto; }
  .bubble { font-size: .78rem; max-width: 150px; }
  .steps { grid-template-columns: 1fr; }
  .stage { max-width: 330px; }
  .top nav a.hide-sm { display: none; }
}
