:root {
  color-scheme: light;
  --paper: #f8f5ea;
  --card: #fffdf4;
  --ink: #173f36;
  --accent: #a94232;
  --line: #c6c9b6;
  --dim: #4d6358;
  --shade: #e8ecdf;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", Georgia, serif;
  font-family: "Inter", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 90% 12%, #ececda70, transparent 54%),
    var(--paper);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #bc7333;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.52;
  cursor: wait;
}
[hidden] {
  display: none !important;
}
.skip {
  position: absolute;
  left: -100vw;
}
.skip:focus {
  left: 6px;
  top: 6px;
  background: white;
  z-index: 10;
}
header {
  border-bottom: 1px solid var(--line);
}
.nav,
main,
footer {
  width: min(1184px, calc(100% - 88px));
  margin: auto;
}
.nav {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}
.brand img {
  width: 44px;
  height: 44px;
}
.brand span {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 2px;
}
.brand small {
  display: block;
  margin-top: 5px;
  font:
    700 9px/1 Arial,
    sans-serif;
  letter-spacing: 1.7px;
}
nav,
footer div,
.actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
nav button,
nav a,
footer button,
.link {
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 10px;
}
nav a:hover,
nav button:hover,
.link:hover,
footer a:hover,
footer button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.nav-mine {
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 9px 18px;
}
main {
  flex: 1;
}
.hero {
  display: grid;
  grid-template-columns: 0.89fr 1.11fr;
  align-items: center;
  gap: clamp(28px, 5vw, 80px);
  padding: 76px 0 69px;
}
.edition {
  display: flex;
  align-items: center;
  gap: 9px;
  font:
    700 11px/1.2 Georgia,
    serif;
  letter-spacing: 2.3px;
  color: var(--accent);
}
.edition span {
  width: 23px;
  height: 1px;
  background: var(--accent);
}
.edition span:last-child {
  width: 9px;
}
.intro h1,
.cal-title {
  font-family: var(--serif);
  font-weight: 800;
  line-height: 1.23;
  letter-spacing: -0.045em;
}
.intro h1 {
  font-size: clamp(45px, 4.8vw, 74px);
  margin: 22px 0;
}
.intro em {
  font-style: normal;
  color: var(--accent);
}
.intro p {
  font-size: 17px;
  line-height: 1.85;
  color: var(--dim);
  margin: 0 0 26px;
}
.actions {
  flex-wrap: wrap;
  gap: 10px;
}
.primary,
.secondary,
.quiet {
  border-radius: 4px;
  font-weight: 650;
  font-size: 15px;
  line-height: 1.4;
  padding: 12px 21px;
  min-height: 44px;
}
.primary {
  color: #fff9e7;
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 2px 0 #743124;
}
.primary:hover {
  background: #8e372b;
}
.secondary {
  background: transparent;
  border: 1px solid var(--ink);
}
.secondary:hover,
.quiet:hover {
  background: var(--shade);
}
.quiet {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 8px 13px;
  min-height: 38px;
}
.intro .hint {
  font-size: 13px;
  margin: 14px 0 0;
}
.postcard {
  margin: 0;
  padding: 13px 13px 10px;
  background: #fffcf0;
  border: 1px solid #bcc2aa;
  box-shadow:
    3px 5px 0 #43574715,
    0 14px 25px #4357470c;
  transform: rotate(1deg);
}
.art-frame {
  background: #254b40;
  overflow: hidden;
  aspect-ratio: 1.58;
}
.scene {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 600 12px/1.3 var(--serif);
  letter-spacing: 0.08em;
  margin: 9px 2px 0;
}
figcaption span:last-child {
  font:
    700 11px/1 Georgia,
    serif;
  letter-spacing: 0.14em;
}
.steps {
  border-top: 2px solid var(--ink);
  padding: 24px 0 48px;
}
.section-head,
.cal-heading,
.card-row,
.dlg-foot,
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.section-head h2,
h2,
h3 {
  font-family: var(--serif);
}
.section-head h2 {
  font-size: 28px;
  margin: 0;
}
.section-head > span {
  font: 600 13px var(--serif);
  color: var(--dim);
}
.step-grid {
  margin-top: 21px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.step-grid article {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 12px 17px 0;
  border-top: 1px solid var(--line);
}
.step-grid img {
  width: 57px;
  height: 62px;
  object-fit: contain;
}
.step-grid h3 {
  font-size: 19px;
  margin: 0 0 6px;
}
.step-grid p,
.muted {
  font-size: 14px;
  line-height: 1.65;
  color: var(--dim);
  margin: 0;
}
footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  min-height: 64px;
  color: var(--dim);
  font-size: 13px;
}
footer button,
footer a {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 0;
}
dialog {
  width: min(510px, calc(100% - 24px));
  max-height: 88dvh;
  border: 1px solid var(--ink);
  border-radius: 7px;
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 18px 80px #132e3360;
}
dialog::backdrop {
  background: #122c29a3;
}
.dialog-inner {
  padding: 30px;
  position: relative;
}
.x {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: none;
  font-size: 27px;
  width: 38px;
  height: 38px;
}
.dialog-inner h2 {
  font-size: 27px;
  margin: 0 34px 15px 0;
}
.dialog-inner h3 {
  font-size: 18px;
  margin: 20px 0 7px;
}
.dialog-inner > p,
.dialog-inner p {
  line-height: 1.65;
}
.dialog-inner form {
  display: grid;
  gap: 15px;
  margin-top: 16px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 650;
}
.inline {
  display: flex;
  align-items: center;
  gap: 9px;
}
.inline input {
  width: 18px;
  height: 18px;
}
.field,
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #929e8c;
  background: #fffdf6;
  border-radius: 4px;
  color: var(--ink);
  font-size: 16px;
}
textarea {
  resize: vertical;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}
legend {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 8px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px;
  cursor: pointer;
  background: var(--paper);
}
.chip input {
  margin: 0;
  accent-color: var(--accent);
}
.chip:has(:checked) {
  border-color: var(--ink);
  background: #e6eddd;
}
.chip img {
  width: 30px;
  height: 32px;
}
.chip i {
  background: var(--swatch);
  width: 13px;
  height: 13px;
  border-radius: 50%;
}
.dlg-foot {
  margin-top: 16px;
  flex-wrap: wrap;
}
#error {
  color: #9d292b;
  margin: 12px 0 0;
  font-size: 14px;
}
#error:empty {
  display: none;
}
.notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: #173f36;
  color: white;
  padding: 12px 22px;
  border-radius: 5px;
  box-shadow: 0 3px 15px #0003;
  max-width: 90%;
}
.secret {
  overflow-wrap: anywhere;
  font: 600 16px/1.6 monospace;
  display: block;
  border: 1px dashed var(--line);
  padding: 12px;
  user-select: all;
}
.card-row {
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 16px;
}
.card-row small {
  color: var(--dim);
}
.help-text p {
  margin: 8px 0;
}
#calendar {
  padding: 37px 0 46px;
}
.cal-heading {
  align-items: flex-start;
  flex-wrap: wrap;
}
.cal-title {
  font-size: clamp(28px, 4vw, 48px);
  margin: 9px 0;
  overflow-wrap: anywhere;
}
.board {
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
}
.door {
  position: relative;
  text-align: left;
  height: clamp(105px, 10.7vw, 144px);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 4px;
  padding: 11px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
}
.door:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 0 #664a3733;
}
.door:not(.filled)::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 31px;
  width: 76%;
  height: 1px;
  background: #d2d0bd;
  transform: rotate(-24deg);
  pointer-events: none;
}
.door strong {
  font:
    700 clamp(26px, 3vw, 40px)/1 Georgia,
    serif;
}
.door small {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.door img {
  position: absolute;
  width: 42%;
  height: 54%;
  object-fit: contain;
  right: 6%;
  top: 15%;
}
.filled {
  background: #e9eddf;
  border-color: #8f9e83;
}
.filled.foil,
.gold .door {
  background: #f4e7bd;
}
.filled.frost {
  background: #e1edf0;
}
.filled.sky {
  background: #dddce9;
}
.read {
  border-bottom: 3px solid var(--accent);
}
.theme-berry {
  --ink: #6f3138;
  --card: #fff8ed;
  --shade: #f3e3d8;
}
.theme-night {
  --ink: #2e4256;
  --card: #f4f7f1;
  --shade: #e1e8e7;
}
.cal-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.letter {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin: 12px 0;
  padding: 13px;
  background: var(--paper);
}
.letter p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.letter img {
  width: 40px;
  height: 44px;
  object-fit: contain;
}
.letter .day-head {
  justify-content: flex-start;
}
.danger {
  color: #98352d;
}
.song {
  background: #e8eadb;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  margin: 14px 0;
}
.song p {
  margin: 4px 0;
  overflow-wrap: anywhere;
}
.backlink {
  color: var(--accent);
  text-decoration: underline;
}
@media (max-width: 820px) {
  .nav,
  main,
  footer {
    width: calc(100% - 42px);
  }
  .hero {
    gap: 22px;
    padding: 45px 0;
  }
  .intro h1 {
    font-size: clamp(39px, 5.9vw, 56px);
  }
  .intro p {
    font-size: 15px;
  }
  .wide {
    display: none;
  }
  .step-grid {
    gap: 12px;
  }
  .step-grid article {
    align-items: flex-start;
  }
  .step-grid img {
    width: 42px;
  }
  .board {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 620px) {
  .nav,
  main,
  footer {
    width: calc(100% - 32px);
  }
  .nav {
    height: 66px;
  }
  .brand img {
    width: 34px;
    height: 34px;
  }
  .brand {
    gap: 7px;
  }
  .brand span {
    font-size: 20px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1px;
  }
  nav {
    gap: 1px;
  }
  nav button,
  nav a {
    font-size: 13px;
    padding: 8px 5px;
  }
  .nav-mine {
    padding: 6px 8px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 25px;
    padding: 32px 0;
  }
  .intro h1 {
    font-size: 45px;
    margin: 13px 0;
  }
  .intro p {
    margin-bottom: 17px;
  }
  .intro .hint {
    margin-top: 9px;
  }
  .postcard {
    padding: 9px;
    transform: rotate(0.6deg);
  }
  .section-head h2 {
    font-size: 24px;
  }
  .step-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 13px;
  }
  .step-grid article {
    align-items: center;
    padding: 11px 0;
  }
  .steps {
    padding: 18px 0 25px;
  }
  .step-grid img {
    width: 44px;
    height: 47px;
  }
  .step-grid h3 {
    margin-bottom: 2px;
  }
  .board {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .door {
    height: 85px;
    padding: 7px;
  }
  .door small {
    font-size: 11px;
  }
  .door strong {
    font-size: 25px;
  }
  .dialog-inner {
    padding: 24px 20px;
  }
  .section-head > span {
    font-size: 12px;
  }
  footer {
    flex-wrap: wrap;
    padding: 12px 0;
    min-height: 54px;
  }
}
@media (max-width: 360px) {
  nav button[data-act="code"] {
    display: none;
  }
  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: no-preference) {
  .door,
  .primary,
  .secondary {
    transition:
      background 0.15s,
      box-shadow 0.15s;
  }
  .letter {
    animation: unfold 0.3s ease-out;
  }
  @keyframes unfold {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
