@font-face {
  font-family: "Fraunces";
  src: url("/assets/fraunces.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #151e31;
  --surface: #202c44;
  --text: #f8efdb;
  --muted: #bfc6d3;
  --gold: #f2c179;
  --line: #ffffff29;
  --ink: #292536;
  --danger: #ffc0ba;
  --display: "Fraunces", Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --body: "DM Sans", system-ui, -apple-system, "PingFang SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  font: 400 15px/1.55 var(--body);
  color: var(--text);
  background: radial-gradient(ellipse at 64% -10%, #283857 0, transparent 57%), var(--background);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
p { margin: 0; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.shell { width: min(1180px, calc(100% - 80px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 3; transform: translateY(-110%); padding: 12px; background: var(--background); }
.skip-link:focus { transform: none; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 79px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.wordmark, .footer-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark { white-space: nowrap; font: 600 21px/1.2 var(--display); }
.mark {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: 1px solid #f2c1799c;
  color: var(--gold);
  font: 19px/1 var(--body);
}
.site-header nav, .site-footer > div { display: flex; align-items: center; gap: 24px; }
.nav-link, .text-button { background: none; border: none; padding: 1px 0; color: var(--muted); text-decoration: none; white-space: nowrap; }
.nav-link:hover, .text-button:hover, .site-footer a:hover { color: var(--text); }
.nav-short { display: none; }
.language { flex-shrink: 0; white-space: nowrap; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; color: var(--text); min-height: 32px; padding: 4px 9px; background: transparent; }

.hero { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr); align-items: center; gap: clamp(30px, 5vw, 82px); padding: clamp(36px, 6vw, 78px) 0 58px; }
.date-line { display: flex; gap: 9px; align-items: center; color: var(--gold); font-size: 11px; letter-spacing: .18em; font-weight: 700; }
.date-line > span:first-child { display: block; width: 20px; height: 1px; background: var(--gold); }
.hero h1, .calendar-title {
  font: 500 clamp(46px, 5.1vw, 76px)/.99 var(--display);
  letter-spacing: -.06em;
  margin: 14px 0 16px;
  overflow-wrap: anywhere;
}
.hero h1 em { color: var(--gold); font-style: normal; }
html[lang="zh-CN"] .hero h1 { font-size: clamp(42px, 5vw, 74px); letter-spacing: -.045em; line-height: 1.16; }
.hero-description { max-width: 35ch; color: var(--muted); font-size: clamp(15px, 1.5vw, 18px); }
.create-form { display: grid; gap: 14px; max-width: 424px; margin-top: 27px; }
.reply-draft { display: grid; gap: 5px; justify-items: start; padding: 9px 12px; border: 1px solid #f2c17955; border-radius: 8px; background: #f2c1790f; }
.reply-draft .text-button { color: var(--gold); font-size: 12px; }
.field { display: grid; gap: 5px; }
.field > span:first-child, legend { color: var(--text); font-size: 13px; font-weight: 650; }
input:not([type="radio"], [type="checkbox"]), select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  color: var(--text);
  border: 1px solid #ffffff30;
  border-radius: 8px;
  background: #131d2f;
}
input::placeholder, textarea::placeholder { color: #a1aabd; }
textarea { min-height: 116px; resize: vertical; }
.form-options { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 11px 14px; }
fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 5px; }
.theme-row, .segmented { display: flex; gap: 5px; }
.theme-choice, .segmented label { cursor: pointer; position: relative; }
.theme-choice input, .segmented input, .sticker-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-choice { display: grid; place-items: center; gap: 3px; width: 42px; color: var(--muted); font-size: 11px; }
.swatch {
  display: grid;
  place-items: center;
  height: 34px;
  width: 34px;
  border: 1px solid #ffffff40;
  border-radius: 50%;
  font-size: 17px;
}
.swatch-night { background: #303e5a; color: #f5ca93; }
.swatch-snow { background: #cecbd6; color: #30415f; }
.swatch-pine { background: #3b5a4b; color: #efe7c4; }
.theme-choice input:checked + span, .theme-choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.theme-choice input:checked ~ span:last-child { color: var(--text); }
.segmented { gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.segmented span { display: block; padding: 5px 9px; font-size: 13px; border-radius: 5px; white-space: nowrap; color: var(--muted); }
.segmented input:checked + span { background-color: #3a465d; color: #fff5e2; }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  padding: 8px 15px;
}
.primary { background: var(--gold); color: #30231e; box-shadow: 0 2px 0 #ba8545; }
.primary:hover { background: #ffd395; }
.secondary { border-color: var(--line); color: var(--text); background: #ffffff08; }
.secondary:hover { background: #ffffff16; }
.danger { color: var(--danger); border-color: #ffc0ba59; background: #541f2e44; }
.create-button { justify-content: space-between; min-height: 49px; padding-inline: 15px; }
.create-button > span:last-child { font-size: 19px; font-weight: 500; }
.form-error { color: var(--danger); font-size: 13px; }
.form-hint { font-size: 13px; color: var(--muted); }

.board {
  --board: #222e46;
  --edge: #64708b;
  --label: #d9ddee;
  --paper: #f1e5cc;
  --paper-strong: #f7c985;
  --seal: #a84a49;
  --empty: #dde3f4;
  --empty-fill: #ffffff08;
  padding: 10px;
  background: var(--board);
  border-radius: 16px;
  border: 1px solid var(--edge);
  box-shadow: 0 18px 46px #080c194a;
  min-width: 0;
}
.board[data-theme="snow"] { --board: #3a4d69; --edge: #91a6c0; --label: #f0f6ff; --paper: #e8eff9; --paper-strong: #c9e4fc; --seal: #475981; --empty: #f1f6ff; --empty-fill: #c8dfff16; }
.board[data-theme="pine"] { --board: #203b36; --edge: #6f8a77; --label: #e0ebd8; --paper: #e5e7cb; --paper-strong: #eacb87; --seal: #40715c; --empty: #dbe8d9; --empty-fill: #d3e6ca12; }
.board-header {
  position: relative;
  display: flex;
  align-items: end;
  min-height: 155px;
  overflow: hidden;
  isolation: isolate;
  padding: 17px 16px;
  border-radius: 9px;
  background: #19243b url("/assets/winter-post-office.webp") center 92% / cover no-repeat;
}
.board-header::before { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg, #121a2de8 0%, #121a2d96 38%, #121a2d04 80%); }
.board[data-theme="snow"] .board-header::before { background: linear-gradient(90deg, #283d5af5 0%, #5d749256 54%, #b3c9e81f); }
.board[data-theme="pine"] .board-header::before { background: linear-gradient(90deg, #142d29f2 0%, #21443970 55%, #21443920); }
.board-heading { min-width: 0; width: 100%; max-width: 72%; }
.board-label { color: #ffe6b5; font-size: 11px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.board-title { margin: 2px 0 0; overflow-wrap: anywhere; font: 500 clamp(24px, 3.1vw, 37px)/1.09 var(--display); letter-spacing: -.025em; color: #fff2d8; }
.board-meta { color: #fff2d8; font-size: 13px; margin-top: 4px; }
.board-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; padding: 11px 1px 0; }
.door {
  color: var(--empty);
  background: var(--empty-fill);
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 2px;
  text-align: left;
  padding: 7px 8px;
  min-width: 0;
  min-height: 60px;
  overflow: hidden;
  isolation: isolate;
  border: 1px dashed #e6edf255;
  border-radius: 5px;
  transition: transform .18s ease, background-color .18s ease;
}
.door:hover { background-color: #e7edff21; transform: translateY(-2px); }
.door.filled { border: 1px solid #3127372b; background: var(--paper); color: #3e3544; }
.door.readable { background: var(--paper-strong); color: #3d2c26; }
.door.filled:hover { filter: brightness(1.05); }
.door::before {
  content: "";
  width: 80%;
  height: 95%;
  position: absolute;
  z-index: -1;
  right: -4%;
  top: -52%;
  transform: rotate(33deg);
  border-radius: 8px;
  border: 1px solid currentColor;
  opacity: .09;
}
.door-day { font: 600 18px/1.05 var(--display); font-variant-numeric: tabular-nums; }
.door-icon { position: absolute; right: 6px; top: 6px; font-size: 11px; line-height: 1; }
.door-from { display: block; width: 100%; align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 650; }
.door.filled .door-icon { color: var(--seal); }
.board-footer { padding: 10px 4px 1px; display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--label); font-size: 12px; }
.board-count { font-variant-numeric: tabular-nums; }
.board-count::before { content: "✦"; color: var(--gold); margin-right: 6px; font-size: 10px; }

.how { padding: 25px 0 42px; border-top: 1px solid var(--line); scroll-margin-top: 20px; }
.how h2, .side-title { margin: 0 0 13px; font: 550 25px/1.15 var(--display); }
.how-grid { padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 32px; list-style: none; }
.how-grid li { display: flex; align-items: start; gap: 11px; }
.step { display: grid; place-items: center; background: #ffffff09; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); width: 30px; height: 30px; flex: 0 0 30px; font: 600 16px/1 var(--display); }
.how-grid h3 { font-size: 14px; font-weight: 700; margin: 0 0 1px; }
.how-grid p { font-size: 13px; color: var(--muted); }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 13px; padding: 16px 0 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer a { text-decoration: none; }

#calendar-page { padding: 37px 0 54px; min-height: 60vh; }
.calendar-kicker { color: var(--gold); font-weight: 650; font-size: 13px; }
.calendar-title { font-size: clamp(38px, 5vw, 66px); margin: 6px 0 10px; }
.calendar-description { color: var(--muted); }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(250px, 1fr); gap: clamp(20px, 3vw, 45px); align-items: start; margin-top: 25px; }
.calendar-layout .board-header { min-height: 178px; }
.calendar-layout .door { min-height: 74px; }
.calendar-layout .door-day { font-size: 22px; }
.calendar-layout .door-from { font-size: 12px; }
.sidebar { display: grid; gap: 12px; }
.sidebar-card { display: grid; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff06; }
.sidebar-card .side-title { margin: 0; }
.sidebar .text-button { justify-self: start; text-align: left; white-space: normal; }
.calendar-code { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.code-value { font: 600 16px/1.2 ui-monospace, monospace; letter-spacing: .13em; color: var(--gold); }
.sidebar .danger { color: var(--danger); }
.empty-state { display: grid; justify-items: start; gap: 12px; padding: 35px 0; }
.empty-state h1 { font: 550 clamp(29px, 5vw, 50px)/1.1 var(--display); margin: 0; }

dialog {
  color: var(--text);
  width: min(480px, calc(100% - 32px));
  max-height: min(80vh, 760px);
  border: 1px solid #738098;
  border-radius: 14px;
  padding: 21px;
  background: #212d42;
  box-shadow: 0 18px 60px #0a0e1cba;
}
dialog::backdrop { background: #0a1025bd; backdrop-filter: blur(4px); }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin: 0 0 13px; }
.dialog-header h2 { font: 550 28px/1.05 var(--display); margin: 4px 0 0; overflow-wrap: anywhere; }
.close-dialog { flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 1px solid var(--line); color: var(--text); background: #ffffff09; font-size: 21px; line-height: 1; }
.dialog-body, .dialog-form { display: grid; gap: 12px; }
.dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding-top: 3px; }
.dialog-body .own-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.own-list a { display: block; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; text-decoration: none; overflow-wrap: anywhere; }
.own-list a:hover { background: #ffffff0e; }
.own-list small { color: var(--muted); }
.stickers { display: flex; flex-wrap: wrap; gap: 5px; }
.sticker-choice { position: relative; display: block; cursor: pointer; }
.sticker-choice span { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 7px; font-size: 17px; }
.sticker-choice input:checked + span { border-color: var(--gold); background: #f2c17926; }
.sticker-choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.checkline { display: flex; gap: 7px; align-items: center; font-size: 13px; }
.checkline input { width: 15px; height: 15px; margin: 0; accent-color: var(--gold); }
.text-count { text-align: right; font-size: 11px; color: var(--muted); margin-top: -3px; }
.letter {
  padding: 17px 18px;
  border-radius: 7px;
  color: var(--ink);
  background: #f3e7ce;
  box-shadow: inset 0 0 0 3px #fff6e650;
  overflow-wrap: anywhere;
}
.letter p { white-space: pre-wrap; }
.letter-from { margin: 12px 0 0; font-weight: 700; }
.letter-sticker { display: block; margin: 0 0 5px; color: #a3494a; font-size: 24px; }
.toast { position: fixed; z-index: 2; bottom: 18px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); padding: 9px 16px; border: 1px solid #a6875f; border-radius: 8px; background: #2b3142; color: var(--text); box-shadow: 0 10px 24px #0a0e1c90; }

@media (max-width: 1020px) {
  .shell { width: calc(100% - 48px); }
  .hero h1 { font-size: clamp(40px, 6vw, 64px); }
  .site-header nav { gap: 15px; }
  .hero { gap: 30px; }
  .board-grid { gap: 5px; }
  .door { padding: 6px; }
}
@media (max-width: 760px) {
  .shell { width: min(560px, calc(100% - 32px)); }
  .site-header { min-height: 64px; gap: 8px; }
  .site-header nav { gap: 10px; font-size: 12px; }
  .nav-how { display: none; }
  .wordmark { gap: 6px; font-size: 16px; }
  .mark { width: 25px; height: 25px; font-size: 15px; }
  .hero { grid-template-columns: 1fr; gap: 27px; padding: 33px 0; }
  .hero h1 { font-size: clamp(46px, 8.4vw, 65px); }
  .create-form { margin-top: 21px; }
  .how { padding: 21px 0 25px; }
  .how-grid { grid-template-columns: 1fr; gap: 13px; }
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-layout .board-header { min-height: 151px; }
  #calendar-page { padding-top: 24px; }
}
@media (max-width: 440px) {
  .wordmark { font-size: 15px; }
  .site-header nav { gap: 8px; }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .language { padding-inline: 6px; }
  .board { padding: 7px; }
  .board-header { min-height: 131px; padding: 11px; }
  .board-grid { padding-top: 7px; gap: 4px; }
  .door { min-height: 48px; }
  .door-day { font-size: 15px; }
  .door-from { font-size: 9px; }
  .door-icon { font-size: 9px; top: 5px; right: 4px; }
  .calendar-layout .board-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .calendar-layout .door { min-height: 57px; }
  .board-footer { font-size: 11px; }
  .site-footer > div { gap: 12px; }
}
@media (max-width: 365px) {
  .wordmark { font-size: 13px; }
  .site-header nav { gap: 6px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
