:root {
  --paper: #f8f2e7;
  --paper-2: #efe6d4;
  --card: #fffdf8;
  --ink: #1d2721;
  --ink-2: #4b5a51;
  --muted: #5f6b63;
  --pine: #1f5c3f;
  --pine-2: #174a32;
  --berry: #b3263e;
  --berry-2: #911c31;
  --gold: #d9a441;
  --line: #e2d7c2;
  --ok: #2e7d4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 39, 33, .06), 0 8px 24px rgba(29, 39, 33, .08);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
body[data-style="cranberry"] { --pine: #8e1f33; --pine-2: #74182a; }
body[data-style="midnight"] { --pine: #23375e; --pine-2: #1a2a49; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans);
  background-image: radial-gradient(circle at 20% 0%, rgba(217, 164, 65, .12), transparent 40%),
    radial-gradient(circle at 100% 30%, rgba(31, 92, 63, .08), transparent 35%);
  min-height: 100vh;
}
a { color: var(--pine); }
img, svg { max-width: 100%; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
@media (max-width: 520px) { .top nav a.nav-extra { display: none; } }
.brand { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--berry); }
.top nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; margin-left: 14px; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 18px 0 36px; align-items: center; }
@media (min-width: 860px) { .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); padding-top: 36px; } }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 600; color: var(--berry); background: #fbe3e6; padding: 4px 10px; border-radius: 99px; }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(32px, 7vw, 52px); line-height: 1.05; letter-spacing: -.02em; margin: 12px 0 12px; }
h2 { font-family: var(--serif); font-size: clamp(24px, 4.5vw, 32px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 18px; margin: 0 0 6px; }
.lead { font-size: 18px; color: var(--ink-2); margin: 0 0 20px; }

/* create card */
.create { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.create label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
@media (max-width: 480px) { .row.stack-sm { flex-direction: column; } }
input[type=text], textarea {
  width: 100%; font: inherit; font-size: 17px; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); outline: none; transition: border-color .15s;
}
input[type=text]:focus, textarea:focus { border-color: var(--pine); }
textarea { resize: vertical; min-height: 110px; }
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 17px; border-radius: 12px;
  padding: 13px 18px; background: var(--berry); color: #fff; white-space: nowrap; transition: transform .08s, background .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: var(--berry-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.green { background: var(--pine); }
.btn.green:hover { background: var(--pine-2); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.btn.block { width: 100%; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
.codebox { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.codebox input { text-transform: lowercase; letter-spacing: .08em; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.trust b { color: var(--ink); }

/* doors */
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 560px) { .doors { grid-template-columns: repeat(6, 1fr); } }
.door {
  position: relative; aspect-ratio: 1 / 1.1; border-radius: 12px; border: 0; cursor: pointer; padding: 8px;
  background: linear-gradient(160deg, var(--pine) 0%, var(--pine-2) 100%); color: #fff; font: inherit;
  display: flex; flex-direction: column; justify-content: space-between; text-align: left; box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), var(--shadow);
  transition: transform .12s;
}
.door:hover { transform: translateY(-2px); }
.door .num { font-family: var(--serif); font-size: clamp(20px, 5vw, 28px); font-weight: 700; line-height: 1; }
.door .meta { font-size: 12px; opacity: .9; line-height: 1.2; }
.door .icons { font-size: 15px; letter-spacing: -2px; min-height: 18px; }
.door.empty { background: var(--card); color: var(--ink-2); box-shadow: inset 0 0 0 2px var(--line); }
.door.empty .num { color: var(--muted); }
.door.open { background: linear-gradient(160deg, #f6d88f, var(--gold)); color: var(--ink); }
.door.today { outline: 3px solid var(--berry); outline-offset: 2px; animation: glow 2.2s ease-in-out infinite; }
.door.past.empty { opacity: .45; }
.door .lock { position: absolute; top: 8px; right: 8px; font-size: 12px; opacity: .8; }
@keyframes glow { 50% { outline-color: var(--gold); } }

.demo { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.demo .doors { grid-template-columns: repeat(4, 1fr); }
.demo-note { margin-top: 12px; background: #fff8e6; border: 1px solid #f0dca8; border-radius: 12px; padding: 12px 14px; font-size: 15px; display: none; }
.demo-note.show { display: block; animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* sections */
section { padding: 28px 0; }
.steps { display: grid; gap: 14px; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.step .k { font-family: var(--serif); font-size: 26px; color: var(--berry); font-weight: 700; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--ink-2); }
footer { padding: 28px 0 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 20px; }
footer a { color: var(--ink-2); margin-right: 12px; }

/* calendar page */
.cal-head { padding: 10px 0 16px; }
.cal-head h1 { font-size: clamp(28px, 6vw, 42px); margin: 6px 0 6px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.pill { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; }
.pill.warn { background: #fff1d6; border-color: #f0d49a; }
.sealed { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--pine); font-weight: 600; margin-top: 10px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h2 { font-size: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cta-bar { position: sticky; bottom: 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--paper) 30%); z-index: 5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.copyrow { display: flex; gap: 8px; align-items: stretch; }
.copyrow input { font-size: 14px; padding: 10px 12px; }
.bigcode { font-family: ui-monospace, Menlo, monospace; font-size: 24px; letter-spacing: .16em; font-weight: 700; color: var(--pine); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(20, 26, 22, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 20; padding: 0; }
@media (min-width: 640px) { .modal { align-items: center; padding: 16px; } }
.sheet { background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@media (min-width: 640px) { .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(24px); opacity: .5; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-head h2 { font-size: 22px; margin: 0; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.iconpick { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.iconpick { flex-wrap: nowrap; justify-content: space-between; }
.iconpick button { font-size: 20px; flex: 1 1 0; min-width: 0; max-width: 46px; aspect-ratio: 1; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; padding: 0; }
.iconpick button.on { border-color: var(--berry); background: #fdecee; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; }
.counter { text-align: right; font-size: 12px; color: var(--muted); }
.note { background: #fff8e6; border: 1px solid #f0dca8; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.note .from { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.note .body { white-space: pre-wrap; font-size: 16px; }
.note .body.blur { filter: blur(6px); cursor: pointer; user-select: none; }
.note .tools { display: flex; gap: 10px; margin-top: 8px; font-size: 13px; }
.note .tools button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; text-decoration: underline; font: inherit; }
.doorpick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 6px 0 12px; }
.doorpick button { border: 1.5px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 0; font-weight: 700; cursor: pointer; font: inherit; }
.doorpick button.on { border-color: var(--berry); background: #fdecee; }
.doorpick button.full { opacity: .35; cursor: default; }
.success { text-align: center; }
.success .big { font-size: 46px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 40; box-shadow: var(--shadow); }
.error { color: var(--berry); font-size: 14px; margin-top: 8px; }
.danger { color: var(--berry); }
.skeleton { height: 280px; border-radius: 16px; background: linear-gradient(90deg, var(--paper-2), var(--card), var(--paper-2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---- v2：交互与视觉增强 ---- */
.actions.grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .actions.grid { grid-template-columns: auto auto auto; justify-content: start; } }
.intro { font-size: 15px; color: var(--ink-2); margin: 8px 0 0; }
.sheet .sticky-submit { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--card); padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); margin-top: 6px; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; background: var(--paper); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.linkbtn { background: none; border: 0; color: var(--pine); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.banner { background: #fff1d6; border: 1px solid #f0d49a; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 6px 0 12px; }
.channels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.channels .btn { font-size: 15px; padding: 11px 10px; }
.savebox { background: #eef6f1; border: 1px solid #cfe3d6; border-radius: 12px; padding: 12px; margin: 12px 0; }
.savebox b { display: block; margin-bottom: 4px; }
.story-preview { display: block; width: 60%; max-width: 240px; margin: 10px auto; border-radius: 12px; box-shadow: var(--shadow); }
.progress { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin: 10px 0 4px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--berry)); border-radius: 99px; transition: width .6s ease; }
.lights { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* 门格视觉：包装纸 + 丝带 */
.door:not(.empty) { background-image: linear-gradient(90deg, transparent 44%, rgba(255,255,255,.22) 44%, rgba(255,255,255,.22) 56%, transparent 56%),
  repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 8px, transparent 8px 16px), linear-gradient(160deg, var(--pine), var(--pine-2)); }
.door.ready { background-image: linear-gradient(90deg, transparent 44%, rgba(179,38,62,.85) 44%, rgba(179,38,62,.85) 56%, transparent 56%),
  linear-gradient(160deg, #f6d88f, var(--gold)); color: var(--ink); }
.door.ready::after { content: attr(data-tap); position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 11px; font-weight: 700; background: var(--card); color: var(--berry); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.door.ready .meta { visibility: hidden; }
.door.opened { background: linear-gradient(160deg, #fff6df, #f3e2b6); color: var(--ink); box-shadow: inset 0 0 0 2px #ecd59c; }
.door.mine { box-shadow: inset 0 0 0 3px var(--gold), var(--shadow); }

/* 开门仪式 */
.reveal { text-align: center; }
.reveal .lid { font-size: 64px; display: inline-block; animation: shake .6s ease-in-out 2; }
@keyframes shake { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.reveal .note { text-align: left; animation: pop .35s ease-out both; }
.reactions { display: flex; gap: 6px; margin-top: 8px; }
.reactions button { font-size: 18px; border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 3px 9px; cursor: pointer; }
.reactions button.on { border-color: var(--berry); background: #fdecee; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .9; } }
.got-reaction { font-size: 13px; color: var(--berry); font-weight: 600; margin-top: 6px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
body.modal-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.sheet textarea { min-height: 88px; }

/* 首屏插画 */
.hero-img { display: block; width: 100%; height: auto; border-radius: 14px; margin: -4px 0 10px; }
.hero-mobile { display: none; }
@media (max-width: 859px) {
  .hero-img { display: none; }
  .hero-mobile { display: block; width: 72%; max-width: 300px; height: auto; margin: -6px auto 4px; }
}
.langs { font-size: 14px; }
.langs a, .langs b { margin-right: 0 !important; }
/* 页脚链接之间没有空格，用 flex 换行，防止长单词语言溢出 */
footer p:not(.langs) { display: flex; flex-wrap: wrap; gap: 6px 14px; }
footer a { margin-right: 0; }
.hero-img, .hero-mobile { mix-blend-mode: multiply; }
