:root {
  color-scheme: light;
  --white: #fff;
  --ink: #302726;
  --muted: #695a54;
  --line: #f0e7e3;
  --pink: #ffe6e3;
  --soft: #fff8f6;
  --berry: #993b3d;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--white);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 15px; line-height: 1.65; }
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; }
button { min-height: 44px; cursor: pointer; }
button, input, textarea { transition: background-color .18s, border-color .18s; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid #b64f50; outline-offset: 3px; }
.primary, .quiet { border: 1px solid transparent; border-radius: 999px; padding: 8px 17px; }
.primary { background: var(--pink); color: #832f32; font-weight: 700; }
.primary:hover:enabled { background: #ffd7d1; }
.quiet { background: transparent; color: var(--muted); }
.quiet:hover { background: var(--soft); color: var(--ink); }
.muted { color: var(--muted); font-size: .875rem; }
label { display: block; font-weight: 600; margin-bottom: 7px; }
input, textarea {
  color: var(--ink);
  background: var(--white);
  border: 1px solid #a9928a;
  border-radius: 14px;
  padding: 10px 14px;
  min-height: 46px;
  max-width: 100%;
}
.error { color: #9a3335; font-size: .875rem; }
.error:empty { display: none; }

.cover { min-height: 100svh; display: grid; place-items: center; padding: 42px 22px 66px; }
.cover-copy { width: min(100%, 332px); text-align: center; }
.cover h1 { font-size: clamp(1.95rem, 6.5vw, 2.72rem); line-height: 1.23; letter-spacing: -.045em; }
.cover form { display: grid; gap: 8px; margin-top: 31px; text-align: start; }
.cover label { margin: 0; padding-left: 2px; font-size: .875rem; }
.cover input { border-radius: 999px; }
.cover .primary { min-height: 48px; margin-top: 6px; }
.cover .primary [aria-hidden] { display: inline-block; margin-left: 3px; font-size: 1.12rem; line-height: 1; }
.cover-sticker { display: block; width: 128px; height: 128px; margin: 0 auto 14px; object-fit: contain; }

#mailbox { max-width: 810px; margin: 0 auto; padding: 16px clamp(16px, 4vw, 38px) 64px; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.masthead-name { font-size: .94rem; font-weight: 750; }
.masthead-name span { color: var(--berry); font: 1.38rem/1 Georgia, serif; vertical-align: -.08em; }
.anniversary { display: grid; justify-items: center; text-align: center; gap: 17px; padding: clamp(34px, 7vw, 64px) 12px 32px; }
.anniversary h1 { font-size: clamp(1.75rem, 5vw, 2.85rem); line-height: 1.2; letter-spacing: -.045em; overflow-wrap: anywhere; }
.anniversary h1:focus { outline: none; }
.anniversary-copy p { color: var(--muted); margin-top: 7px; font-size: .82rem; }
.day-count {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  width: fit-content;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--soft);
  font-size: .81rem;
}
.day-count strong { color: var(--berry); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.day-count .little-heart { color: var(--berry); margin-left: 3px; }
.tasks {
  padding: clamp(14px, 3vw, 22px);
  margin-bottom: 26px;
  border: 1px solid #f4ded9;
  border-radius: 24px;
  background: var(--soft);
}
.tasks-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tasks-header h2 { font-size: 1.16rem; letter-spacing: -.025em; }
.tasks-header button { margin-left: auto; }
.task-mascot {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--pink);
}
.task-mascot img { display: block; object-fit: contain; }
.task-empty { margin: 10px 0 0; font-size: .875rem; color: var(--muted); }
.task-list { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.task-list:not(:empty) { margin-top: 10px; }
.task-card { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid #f4e7e3; border-radius: 17px; background: var(--white); }
.task-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 9px; color: var(--muted); font-size: .78rem; }
.task-state { color: var(--berry); font-weight: 600; }
.task-prompt, .task-reply, .task-question { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-prompt { font-weight: 650; }
.task-reply, .task-question { border-radius: 12px; padding: 9px 12px; background: var(--soft); }
.task-reply-button { justify-self: end; }
#task-history { margin-top: 7px; }
#task-history summary { width: fit-content; min-height: 44px; padding: 10px 5px 6px 1px; color: var(--berry); font-size: .875rem; cursor: pointer; }
#task-count { margin-left: 4px; }
.task-question { margin-bottom: 15px; }
#task-text { width: 100%; min-height: 98px; resize: vertical; }
#task-error { margin-top: 5px; }
.attachment-actions { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.attach-label { display: inline-flex; align-items: center; min-height: 44px; margin: 0; cursor: pointer; }
.file-picker { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
.attachment-actions:has(input:focus-visible) .attach-label { outline: 2px solid var(--berry); outline-offset: 2px; }
.attachment-preview { margin-top: 8px; }
.attachment-preview img, .attachment-preview video { display: block; max-width: 100%; max-height: 210px; border-radius: 12px; }
.attachment-preview audio { display: block; width: min(100%, 320px); }
.task-media { display: grid; gap: 5px; justify-items: start; }
.task-media .attachment-preview { width: 100%; max-width: 420px; min-width: 0; }
.task-media a { min-height: 44px; display: inline-flex; align-items: center; color: var(--berry); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.switcher { display: flex; gap: 2px; flex-wrap: wrap; padding: 3px; background: #f8f4f2; border-radius: 999px; }
.switcher button { padding: 6px 13px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; }
.switcher button:hover { color: var(--ink); }
.switcher [aria-pressed="true"] { color: var(--ink); background: var(--white); box-shadow: 0 1px 4px #42303e13; font-weight: 700; }
.unread-count { margin-left: 2px; color: var(--berry); font-variant-numeric: tabular-nums; }
.letters { padding: 0; margin: 0; list-style: none; }
.letters li { border-bottom: 1px solid var(--line); }
.letter-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 15px 8px;
  color: var(--ink);
  text-align: left;
}
.letter-row:hover { background: var(--soft); }
.letter-marker { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--soft); color: var(--berry); font: 1.22rem Georgia, serif; }
.letter-marker .heart { animation: beat 1.25s ease-in-out 2; }
@keyframes beat { 18% { transform: scale(1.25); } 35% { transform: scale(1); } }
.letter-detail { min-width: 0; }
.letter-detail strong { display: block; font-weight: 700; overflow-wrap: anywhere; }
.preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .86rem; }
.row-aside { display: grid; justify-items: end; gap: 3px; color: var(--muted); font-size: .75rem; }
.row-state { font-weight: 650; color: var(--berry); }
.empty, .mail-status { padding: 34px 12px; color: var(--muted); }
.empty { text-align: center; }

dialog {
  width: min(590px, calc(100% - 28px));
  max-height: min(88svh, 760px);
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 65px #3d223524;
}
dialog::backdrop { background: #37263455; }
dialog[open] { animation: unfold .25s ease-out; }
@keyframes unfold { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.sheet { padding: clamp(18px, 5vw, 34px); }
.sheet-header { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 10px; }
.sheet-header h2 { padding-top: 6px; font-size: clamp(1.25rem, 4vw, 1.7rem); letter-spacing: -.025em; overflow-wrap: anywhere; }
.close { min-width: 44px; padding: 0; font-size: 1.5rem; line-height: 1; }
.handwriting { font-size: 1.05rem; line-height: 1.85; }
#letter-body { margin: 18px 0; padding: 16px; border-radius: 16px; background: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.signature { text-align: right; color: var(--berry); overflow-wrap: anywhere; }
#message { width: 100%; resize: vertical; min-height: 150px; max-height: 60svh; }
.send-options { margin: 15px 0; }
.send-options p { margin-top: 6px; }
.send-actions { display: flex; justify-content: end; gap: 8px; margin-top: 16px; }
.petal { position: fixed; top: -18px; z-index: 2; pointer-events: none; width: 7px; height: 10px; background: #efa99f; opacity: .38; border-radius: 65% 25% 62% 35%; animation: fall linear both; }
@keyframes fall { to { transform: translate(48px, calc(100dvh + 25px)) rotate(300deg); } }
@media (max-width: 420px) {
  .switcher button, #compose { padding-inline: 9px; font-size: .875rem; }
  .letter-marker { width: 36px; height: 36px; }
  .letter-row { padding-inline: 4px; gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #petals { display: none; }
}

