:root {
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
.theme-night {
  --bg1: #0f241b; --bg2: #1d3d2e; --card: rgba(255,255,255,0.07); --line: rgba(255,255,255,0.14);
  --text: #f6efe0; --muted: #c8c2b0; --door: #24503b; --door-edge: #33694f;
  --filled: #c9973b; --filled-text: #1a1408; --accent: #e8b85a; --accent-text: #1a1408; --ready: #e8b85a;
}
.theme-paper {
  --bg1: #c69a6d; --bg2: #e9d2ad; --card: rgba(255,250,240,0.55); --line: rgba(58,36,22,0.18);
  --text: #3a2416; --muted: #6b4a33; --door: #b5462f; --door-edge: #93341f;
  --filled: #f3e6cf; --filled-text: #3a2416; --accent: #8f2f1d; --accent-text: #fff8ee; --ready: #2f6b3a;
}
.theme-frost {
  --bg1: #cfe3f1; --bg2: #f5f9fc; --card: rgba(255,255,255,0.7); --line: rgba(29,53,80,0.14);
  --text: #1d3550; --muted: #4e6680; --door: #8fb7d4; --door-edge: #6e9cbd;
  --filled: #ffffff; --filled-text: #1d3550; --accent: #2f6f9e; --accent-text: #ffffff; --ready: #c43c4a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); color: var(--text); line-height: 1.5;
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) fixed;
  transition: background 0.3s;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; }
h1 { font-size: clamp(30px, 6vw, 46px); margin: 0 0 12px; }
h2 { font-size: 26px; margin: 0 0 12px; }
h3 { font-size: 18px; margin: 20px 0 6px; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 880px; margin: 0 auto; padding: 16px 20px;
}
.logo { text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.logo-box { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 16px; }
.lang-switch { font-size: 14px; color: var(--muted); }

main { max-width: 880px; margin: 0 auto; padding: 8px 20px 24px; }
.hero { text-align: center; padding: 24px 0 8px; }
.lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 auto 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(6px); }
.create { max-width: 440px; margin: 8px auto 0; text-align: left; display: grid; gap: 10px; }
label, .label { font-weight: 600; font-size: 15px; }
input[type=text], textarea, select {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.92); color: #222;
}
textarea { resize: vertical; min-height: 110px; }
input:disabled { opacity: 0.5; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-pick {
  font: inherit; font-size: 14px; padding: 10px 6px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); background: transparent; color: var(--text); display: grid; gap: 6px; justify-items: center;
}
.theme-pick.on { border-color: var(--accent); }
.swatch { width: 100%; height: 26px; border-radius: 8px; }
.tp-night .swatch { background: linear-gradient(135deg, #0f241b, #24503b 60%, #c9973b); }
.tp-paper .swatch { background: linear-gradient(135deg, #c69a6d, #b5462f 60%, #f3e6cf); }
.tp-frost .swatch { background: linear-gradient(135deg, #cfe3f1, #8fb7d4 60%, #ffffff); }
.mine-link { margin-top: 14px; display: grid; gap: 4px; font-size: 15px; }

.btn {
  font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; text-align: center;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); display: inline-block;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.big { font-size: 18px; padding: 15px 22px; width: 100%; }
.btn.small { font-size: 14px; padding: 8px 14px; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: #d64545; border-color: rgba(214,69,69,0.4); }
.btn:disabled { opacity: 0.6; cursor: default; }
.row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.row.wrap { flex-wrap: wrap; }
.row .btn.big { flex: 1; }

/* 日历 */
.calendar { text-align: center; }
.cal-head { padding: 8px 0 4px; }
.progress { height: 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); max-width: 360px; margin: 8px auto 6px; overflow: hidden; }
.bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s; }
.count { color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.actions { max-width: 460px; margin: 0 auto 20px; display: grid; gap: 10px; }
.actions .lead { margin-bottom: 4px; font-size: 16px; }
.actions .row { margin-top: 0; flex-wrap: wrap; }
.note-info { font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 620px; margin: 0 auto; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.door {
  position: relative; aspect-ratio: 1 / 1.1; border-radius: 14px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--door); border: 2px solid var(--door-edge); padding: 6px; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: center;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.12); transition: transform 0.12s;
}
.door:active { transform: scale(0.96); }
.door .num { font-family: var(--serif); font-weight: 700; font-size: 22px; align-self: start; justify-self: start; }
.door:not(.filled) .num { grid-row: 1 / 4; align-self: center; justify-self: center; font-size: 28px; opacity: 0.9; }
.door.filled { background: var(--filled); color: var(--filled-text); border-color: transparent; }
.door .icon { font-size: 26px; line-height: 1; }
.door .who { font-size: 11px; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.door.mine { outline: 3px dashed var(--accent); outline-offset: 2px; }
.door.ready { animation: wiggle 2.4s ease-in-out infinite; box-shadow: 0 0 0 3px var(--ready); }
.door.opened { opacity: 0.75; }
@keyframes wiggle { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(-3deg); } 96% { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .door.ready { animation: none; } }

.owner-panel { max-width: 460px; margin: 28px auto 0; text-align: left; }
.owner-panel h3:first-child { margin-top: 0; }
.owner-panel .row { justify-content: flex-start; margin-top: 6px; }
.owner-panel hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.small { font-size: 14px; color: var(--muted); margin: 0 0 8px; }

/* 弹窗 */
dialog {
  border: 0; border-radius: 22px; padding: 0; max-width: min(460px, calc(100vw - 24px)); width: 100%;
  background: var(--bg2); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.theme-night dialog { background: #183527; }
dialog::backdrop { background: rgba(0,0,0,0.55); }
.modal-body { padding: 22px; max-height: 88vh; overflow-y: auto; }
.write { display: grid; gap: 10px; }
.write h2 { margin-bottom: 0; }
.icons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.icon-pick { font-size: 24px; padding: 8px 0; border-radius: 12px; border: 2px solid var(--line); background: rgba(255,255,255,0.08); cursor: pointer; }
.icon-pick.on { border-color: var(--accent); background: rgba(255,255,255,0.25); }
.check { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.counter { font-weight: 400; color: var(--muted); font-size: 13px; float: right; }
.note-card { text-align: center; padding: 8px 0; }
.note-icon { font-size: 56px; }
.note-door { color: var(--muted); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.note-text { font-family: var(--serif); font-size: 22px; white-space: pre-wrap; word-break: break-word; margin: 14px 0; }
.note-from { font-weight: 600; }
.thanks { text-align: center; }
.own-cta { margin-top: 14px; text-align: center; }
.own-cta p { margin-top: 0; }
.link-box { font-family: ui-monospace, Menlo, monospace; font-size: 14px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,0.15); word-break: break-all; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #111; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 50; max-width: 90vw; text-align: center;
}

/* SEO 正文 */
.content { max-width: 720px; margin: 24px auto 0; padding: 0 20px; }
.content section { margin-bottom: 30px; }
.content p, .content li { color: var(--muted); }
.steps li { margin-bottom: 10px; }
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 30px 20px 40px; }
.legal { max-width: 720px; margin: 0 auto; padding: 0 20px 40px; }
.legal p, .legal li { color: var(--muted); }
