:root {
  color-scheme: light;
  --ink: #4b3c36;
  --muted: #806f67;
  --paper: #fffaf0;
  --paper-deep: #f6ead8;
  --cream: #f8efe2;
  --coral: #d77a68;
  --coral-dark: #a94f45;
  --sage: #8da390;
  --line: rgba(112, 80, 62, 0.17);
  --shadow: 0 22px 60px rgba(89, 63, 49, 0.16);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--cream); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 10%, rgba(215, 122, 104, 0.12), transparent 28rem),
    radial-gradient(circle at 88% 80%, rgba(141, 163, 144, 0.15), transparent 30rem),
    repeating-linear-gradient(0deg, rgba(94, 71, 55, 0.025) 0, rgba(94, 71, 55, 0.025) 1px, transparent 1px, transparent 4px),
    var(--cream);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.68; }

.shell {
  width: min(100% - 32px, 720px);
  margin-inline: auto;
  padding: 40px 0;
}

.shell-centered { min-height: 100vh; display: grid; place-items: center; }

.paper-card {
  position: relative;
  width: 100%;
  padding: clamp(30px, 7vw, 60px);
  border: 1px solid rgba(126, 95, 73, 0.18);
  border-radius: 28px 13px 25px 16px;
  background:
    linear-gradient(95deg, rgba(255,255,255,.45), transparent 35%),
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, var(--line) 32px),
    var(--paper);
  box-shadow: var(--shadow);
}

.tape {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 104px;
  height: 32px;
  transform: translateX(-50%) rotate(-2deg);
  opacity: 0.75;
  clip-path: polygon(5% 4%, 98% 0, 94% 96%, 0 100%);
}
.tape-coral { background: #e8a897; }
.tape-sage { background: #b6c8b5; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.19em;
}

h1 { margin: 0; font-family: Georgia, "STKaiti", "KaiTi", serif; font-size: clamp(2.15rem, 9vw, 4rem); line-height: 1.08; }
.slogan, .intro { margin: 14px 0 30px; color: var(--muted); line-height: 1.8; }

.form-stack { display: grid; gap: 19px; }
.form-stack label { display: grid; gap: 8px; font-weight: 700; }
.form-stack label > span { font-size: 0.92rem; }

input, textarea {
  width: 100%;
  border: 1px solid rgba(111, 78, 61, 0.24);
  border-radius: 13px;
  outline: 0;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  padding: 14px 15px;
  transition: border-color 160ms, box-shadow 160ms;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(215, 122, 104, 0.13); }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 800;
}
.primary-button { background: var(--coral); color: #fff; box-shadow: 0 9px 22px rgba(169, 79, 69, 0.23); }
.primary-button:hover { background: var(--coral-dark); }
.secondary-button { display: block; margin: 28px auto 0; background: #e4eadf; color: #4e6252; }

.form-message { min-height: 1.5em; margin: 0; color: var(--muted); line-height: 1.5; }
.form-message[data-type="error"] { color: #a73e37; }
.signature { margin: 32px 0 0; color: var(--muted); text-align: center; font-family: Georgia, "STKaiti", "KaiTi", serif; font-style: italic; }
.draft-note { margin: -7px 0 0; color: var(--muted); font-size: 0.78rem; }

.question-note {
  position: relative;
  margin: 0 0 28px;
  padding: 20px 22px 20px 36px;
  border-left: 4px solid var(--sage);
  background: rgba(226, 235, 223, 0.65);
  transform: rotate(-0.45deg);
}
.question-note p { margin: 0; font-family: Georgia, "STKaiti", "KaiTi", serif; font-size: 1.22rem; line-height: 1.7; }
.question-mark { position: absolute; top: 4px; left: 9px; color: var(--sage); font: 2.4rem Georgia, serif; }

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: min(100% - 32px, 860px);
  margin: 0 auto;
  padding: 34px 0 18px;
}
.site-header h1 { font-size: clamp(2rem, 7vw, 3.2rem); }
.text-button { border: 0; border-bottom: 1px dashed var(--muted); background: transparent; color: var(--muted); padding: 8px 0 4px; }

.timeline-shell { width: min(100% - 32px, 760px); margin-inline: auto; padding: 12px 0 56px; }
.timeline-intro { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-bottom: 34px; color: var(--muted); }
.timeline-intro p { margin: 0; font-family: Georgia, "STKaiti", "KaiTi", serif; font-size: 1.12rem; }
.section-title { margin: 0 0 10px; font: 1.65rem Georgia, "STKaiti", "KaiTi", serif; }
.timeline-list { position: relative; display: grid; gap: 24px; padding: 15px 0 0 27px; }
.timeline-list::before { content: ""; position: absolute; top: 0; bottom: 0; left: 8px; width: 2px; background: linear-gradient(var(--coral), var(--sage)); opacity: 0.55; }
.timeline-card { position: relative; padding: 24px; border: 1px solid rgba(112,80,62,.15); border-radius: 10px 24px 13px 21px; background: var(--paper); box-shadow: 0 12px 34px rgba(89,63,49,.10); }
.timeline-dot { position: absolute; left: -26px; top: 28px; width: 14px; height: 14px; border: 3px solid var(--cream); border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px rgba(215,122,104,.3); }
.event-date { color: var(--coral-dark); font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.event-title { margin: 7px 0 10px; font: 1.55rem Georgia, "STKaiti", "KaiTi", serif; }
.event-body, .answer-text { margin: 0; color: var(--muted); line-height: 1.75; }
.origin-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 19px; }
.answer-note { padding: 16px; border-radius: 12px 18px 10px 15px; background: rgba(232, 219, 196, 0.46); }
.answer-note:nth-child(even) { background: rgba(218, 230, 216, 0.58); transform: rotate(.4deg); }
.answer-name { margin: 0 0 5px; }
.answer-date { margin: 0 0 8px; color: var(--coral-dark); font-size: .86rem; font-weight: 800; }

[hidden] { display: none !important; }

@media (max-width: 520px) {
  .shell { width: min(100% - 24px, 720px); padding: 26px 0; }
  .paper-card { padding: 36px 23px 30px; border-radius: 22px 10px 20px 13px; }
  .site-header, .timeline-shell { width: min(100% - 24px, 760px); }
  .site-header { padding-top: 25px; }
  .text-button { font-size: .82rem; }
  .timeline-list { padding-left: 23px; }
  .timeline-dot { left: -22px; }
  .timeline-card { padding: 20px 18px; }
  .origin-answers { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* M2: journal panels, safe-area navigation, album and shared rituals */
body[data-nav] { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
h2, h3 { overflow-wrap: anywhere; }
a { color: var(--coral-dark); text-underline-offset: 4px; }
p, span, .answer-text, .event-body { overflow-wrap: anywhere; }
button, summary, .nav-link, input:not([type="hidden"]), select { min-height: 44px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--coral-dark); outline-offset: 4px; }
select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; }
.panel { margin: 18px 0; padding: 22px; border: 1px solid var(--line); border-radius: 17px 25px 15px 20px; background: var(--paper); box-shadow: 0 8px 23px rgba(89,63,49,.07); }
.panel h2, .panel h3 { margin-top: 0; }
.card-list { display: grid; gap: 0; }
.muted, .back-link { color: var(--muted); }
.back-link { display: inline-block; padding: 0 0 12px; }
.empty-state { padding: 28px 8px; color: var(--muted); line-height: 1.8; }
.dashboard { position: relative; margin-bottom: 26px; border-radius: 25px; background: linear-gradient(120deg,#f2d9c8,#edf0e2); padding: 26px; text-align: center; }
.dashboard p { margin: 8px 0; }
.big-number { display: inline-block; margin: 0 8px; font-size: clamp(3rem,16vw,6rem); font-family: Georgia,serif; color: var(--coral-dark); line-height: 1.15; }
.countdown { color: var(--coral-dark); font-weight: 800; font-size: 1.3rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 12px; }
.action-row .secondary-button { margin: 0; }
.checkbox-label { display: flex !important; align-items: center; gap: 12px; }
.checkbox-label input { width: 24px; height: 24px; min-height: 24px; accent-color: var(--sage); flex-shrink: 0; }
.bottom-nav { position: fixed; z-index: 20; inset: auto 0 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); padding: 7px max(8px, env(safe-area-inset-right, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)); background: rgba(255,250,240,.97); border-top: 1px solid var(--line); box-shadow: 0 -5px 30px rgba(89,63,49,.06); }
.nav-link { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; gap: 3px; text-decoration: none; font-size: .82rem; color: var(--muted); border-radius: 15px; }
.nav-link.active { background: #f6e1d5; color: var(--coral-dark); font-weight: 800; }
.nav-icon { font-size: 1.55rem; line-height: 1.2; }
.floating-add { position: fixed; bottom: calc(93px + env(safe-area-inset-bottom, 0px)); right: max(20px,calc((100vw - 800px)/2)); z-index: 10; border: 0; width: 58px; height: 58px; border-radius: 50%; background: var(--coral); color: white; font-size: 2rem; box-shadow: 0 7px 20px rgba(89,63,49,.25); }
.edit-dialog { width: min(100% - 24px,560px); max-height: 85dvh; overflow-y: auto; padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(45,30,26,.55); }
.photo-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.photo-tile { display: grid; gap: 5px; align-content: start; min-width: 0; border: 1px solid var(--line); padding: 6px 6px 10px; border-radius: 10px; background: var(--paper); color: var(--ink); text-align: left; }
.photo-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.photo-tile span { font-size: .83rem; }
.photo-tile small { color: var(--muted); }
.photo-viewer { width: 100%; height: 100%; max-width: 100vw; max-height: 100dvh; inset: 0; margin: 0; padding: calc(14px + env(safe-area-inset-top,0px)) 12px calc(14px + env(safe-area-inset-bottom,0px)); border: 0; background: #241d1b; color: #fffaf0; }
.photo-viewer[open] { display: flex; flex-direction: column; }
.viewer-toolbar, .viewer-controls { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.photo-viewer button { padding: 10px 15px; background: #4b3c36; color: white; border: 0; border-radius: 12px; }
#viewer-image { flex: 1; min-height: 0; width: 100%; object-fit: contain; margin: 12px 0; }
#viewer-caption { text-align: center; white-space: pre-wrap; }
.entry-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.entry-card { margin: 0; color: var(--ink); text-decoration: none; }
.entry-card > span { font-size: 2rem; color: var(--coral-dark); }
.entry-card h2 { margin: 12px 0; font-size: 1.2rem; }
.entry-card p { color: var(--muted); margin: 0; font-size: .9rem; line-height: 1.7; }
.letter-body, .answer-text, .event-body { white-space: pre-wrap; }
.envelope-small { border-top: 8px solid #e5d3bb; }
summary { cursor: pointer; padding: 12px 0; }
.wish-card.done .wish-title { color: var(--muted); text-decoration: line-through; animation: gentle-check .3s ease-out; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 15px; }
.mood-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.mood-choice { position: relative; display: flex !important; flex-direction: column; align-items: center; text-align: center; min-height: 88px; border: 2px solid transparent; padding: 12px 4px; border-radius: 14px; background: #f4eadb; cursor: pointer; }
.mood-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 1px; }
.mood-choice:has(input:checked) { border-color: var(--coral); background: #f3dfd3; }
.mood-choice:has(input:focus-visible) { outline: 3px solid var(--coral-dark); }
.mood-emoji { font-size: 2rem; }
.mood-row { display: flex; gap: 6px; overflow-x: auto; padding: 4px; }
.mood-dot { display: flex; flex: 0 0 44px; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line); border-radius: 50%; background: #f0e8db; font-size: 1.15rem; }
.mood-happy, .mood-miss { background: #f7dfd2; }
.mood-calm { background: #e3ebdf; }
.mood-tired, .mood-down { background: #e4e6eb; }
.mood-angry { background: #efccc5; }
.celebration { position: relative; overflow: hidden; padding: 22px; margin-bottom: 20px; border-radius: 20px; text-align: center; background: #f9dfd7; color: var(--coral-dark); line-height: 1.7; }
.petal { position: absolute; top: -30px; font-size: 22px; opacity: .6; animation: petal-fall 6s ease-in both; pointer-events: none; }
.petal-0 { left: 8%; animation-delay: 0s; }.petal-1 { left: 24%; animation-delay: .15s; }.petal-2 { left: 40%; animation-delay: .3s; }.petal-3 { left: 56%; animation-delay: .45s; }.petal-4 { left: 72%; animation-delay: .6s; }.petal-5 { left: 88%; animation-delay: .4s; }
@keyframes petal-fall { to { transform: translate(20px,170px) rotate(110deg); opacity: 0; } }
@keyframes gentle-check { 50% { transform: scale(1.03); } }
@media (min-width:600px) { .bottom-nav { padding-inline: max(15px,calc((100vw - 800px)/2)); } }
@media (max-width:380px) { .entry-card { padding: 16px; }.photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }.panel { padding: 18px; } }
@media (prefers-reduced-motion:reduce) { .petal, .wish-card.done .wish-title { animation: none; } }

/* M2.1: each a shared page and a private page, in the existing warm-paper system. */
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px; max-width: 48%; }
.miss-small { padding: 8px 13px; border: 1px solid var(--coral); border-radius: 18px; color: var(--coral-dark); background: #fae9df; font: inherit; font-size: .82rem; }
.miss-banner { padding: 12px 16px; border-radius: 12px 18px 12px 18px; background: #f5e4d5; color: var(--coral-dark); font-size: .88rem; line-height: 1.6; }
.miss-beat { animation: heart-note .6s ease-in-out; }
@keyframes heart-note { 30%,70% { transform: scale(1.04); } 50%,100% { transform: scale(1); } }
.us-ritual, .quiz-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.us-ritual > div { flex: 1; text-align: center; }
.us-ritual .muted { font-size: .84rem; margin-bottom: 0; }
.quiz-stamp { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 135px; min-height: 135px; flex: 0 0 135px; padding: 12px; border: 2px dashed var(--coral-dark); border-radius: 50%; color: var(--coral-dark); transform: rotate(-4deg); text-decoration: none; text-align: center; }
.quiz-stamp strong { font-size: 1.65rem; line-height: 1.2; }
.quiz-stamp small { font-size: .7rem; line-height: 1.5; }
.settings-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.settings-actions button { width: 100%; margin: 0; font-size: .95rem; }
.profile-link { display: block; padding: 10px 0 18px; line-height: 1.6; }
.profile-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.profile-card { margin: 0; min-width: 0; padding: 20px; }
.profile-card:nth-child(2) { background: #eef0e4; }
.profile-details dt { font-size: .85rem; font-weight: 800; color: var(--coral-dark); margin-top: 16px; }
.profile-details dd { margin: 5px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.profile-card h2 { font-size: 1.2rem; }
.setup-shell { max-width: 580px; }.setup-paper { padding-block: 32px; }
.setup-progress { display: flex; justify-content: center; gap: 18px; margin: 20px 0 30px; }
.progress-dot { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #eee1cf; color: var(--muted); font-size: .85rem; }
.progress-dot.active { background: var(--coral); color: white; }
.setup-paper legend { font-size: 1.2rem; line-height: 1.6; }.setup-paper fieldset label + label { margin-top: 18px; }
.quiz-heading { margin: 15px 0 24px; }.quiz-options { display: grid; gap: 10px; margin: 18px 0; }
.quiz-option { width: 100%; margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8efe1; color: var(--ink); text-align: left; font: inherit; line-height: 1.6; overflow-wrap: anywhere; }
button.quiz-option:active { background: #eddbc9; }.quiz-result { color: var(--coral-dark); font-weight: 800; }.quiz-latest { border-top: 7px solid #e9c9b3; }
body.page-whisper[data-nav] { padding-bottom: calc(340px + env(safe-area-inset-bottom,0px)); }
.whisper-paper { background-image: repeating-linear-gradient(transparent,transparent 29px,rgba(189,154,119,.12) 30px); }
.whisper-body { white-space: pre-wrap; line-height: 1.9; overflow-wrap: anywhere; }
.whisper-composer { position: fixed; z-index: 15; bottom: calc(73px + env(safe-area-inset-bottom,0px)); left: 50%; transform: translateX(-50%); width: min(100%,760px); padding: 12px; background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -5px 20px rgba(89,63,49,.08); }
.whisper-composer textarea { max-height: 25dvh; resize: vertical; }.composer-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(110px,.7fr); align-items: end; gap: 12px; }
.composer-actions label { font-size: .8rem; }.composer-actions button { margin: 0; }.composer-actions input { padding: 9px 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width:380px) { .nav-link { font-size: .74rem; }.nav-icon { font-size: 1.4rem; }.us-ritual { gap: 12px; }.quiz-stamp { width: 112px; min-height: 112px; flex-basis: 112px; padding: 8px; }.quiz-stamp strong { font-size: 1.4rem; }.profile-grid { gap: 10px; }.profile-card { padding: 14px; }.header-actions { max-width: 46%; } }
@media (prefers-reduced-motion:reduce) { .miss-beat { animation: none; }.quiz-stamp { transform: none; } }

