:root {
  --ink: #202b28;
  --ink-soft: #52615b;
  --night: #17211f;
  --night-soft: #263431;
  --paper: #f5f1e8;
  --paper-deep: #ebe5d8;
  --mist: #e3e8e2;
  --sage: #71837a;
  --brass: #a88e64;
  --petal: #b66e78;
  --petal-soft: #e6c0bd;
  --line: rgba(32, 43, 40, 0.16);
  --line-light: rgba(245, 241, 232, 0.26);
  --error: #8d5148;
  --shadow: 0 18px 50px rgba(18, 28, 25, 0.12);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f3efe5;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(168, 142, 100, 0.55);
  outline-offset: 3px;
}

.page-width {
  width: min(calc(100% - 48px), 1100px);
  margin-inline: auto;
}

.kicker {
  margin: 0;
  color: var(--sage);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 1.6px;
}

.kicker span {
  color: var(--brass);
  margin-left: 10px;
}

.soft-punctuation,
.tilde {
  color: var(--brass);
  font-weight: 400;
}

.entry-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(300px, 0.8fr);
  color: var(--paper);
  background-color: var(--night);
  background-image: url("../images/quiet-night.png");
  background-position: center;
  background-size: cover;
}

.entry-panel {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 58px clamp(34px, 7vw, 118px) 42px;
  color: var(--ink);
  background-color: rgba(245, 241, 232, 0.95);
}

.entry-mark {
  width: 34px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-bottom: 56px;
}

.entry-mark span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brass);
}

.entry-mark span:nth-child(2) {
  width: 18px;
  height: 1px;
  border-radius: 0;
  margin-bottom: 3px;
  background: var(--sage);
}

.entry-mark span:nth-child(3) {
  width: 3px;
  height: 3px;
  margin-bottom: 1px;
  background: var(--sage);
}

.entry-copy {
  max-width: 410px;
  margin-top: 54px;
}

.entry-copy h1,
.unlock-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 70px;
  font-weight: 400;
  line-height: 1;
}

.entry-ornament {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 28px;
  margin-top: 32px;
}

.ornament-moon {
  position: relative;
  display: block;
  width: 19px;
  height: 19px;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: var(--brass);
}

.ornament-moon::after {
  position: absolute;
  top: -2px;
  left: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.ornament-line {
  display: block;
  width: 54px;
  height: 1px;
  background: rgba(113, 131, 122, 0.55);
}

.ornament-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sage);
}

.entry-note {
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.hint-block {
  margin-top: 56px;
  padding: 17px 19px 18px;
  border-left: 2px solid var(--brass);
  background: rgba(227, 232, 226, 0.58);
}

.field-label {
  margin: 0 0 4px;
  color: var(--sage);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hint-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

.quiet-form {
  margin-top: 20px;
}

.field-row {
  display: flex;
  align-items: stretch;
  gap: 9px;
}

.text-input,
.reply-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.text-input {
  min-height: 48px;
  padding: 11px 14px;
}

.ime-password {
  -webkit-text-security: disc;
  text-security: disc;
}

.ime-password::placeholder {
  -webkit-text-security: none;
  text-security: none;
}

.text-input::placeholder,
.reply-textarea::placeholder {
  color: #82908a;
  opacity: 1;
}

.text-input:hover,
.reply-textarea:hover {
  background: rgba(255, 255, 255, 0.86);
}

.text-input:focus,
.reply-textarea:focus {
  border-color: var(--sage);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(113, 131, 122, 0.13);
  outline: 0;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-button {
  flex: 0 0 auto;
  padding: 11px 22px;
  border: 1px solid var(--night);
  color: var(--paper);
  background: var(--night);
}

.primary-button:hover {
  background: #2c3e38;
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.secondary-button {
  gap: 12px;
  padding: 12px 20px;
  border: 1px solid rgba(32, 43, 40, 0.3);
  color: var(--ink);
  background: transparent;
}

.secondary-button:hover {
  border-color: var(--sage);
  background: rgba(227, 232, 226, 0.75);
}

.text-button {
  min-height: 0;
  padding: 4px 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.text-button:hover {
  color: var(--ink);
}

.form-error {
  margin: 10px 0 0;
  color: var(--error);
  font-size: 13px;
  line-height: 1.55;
}

.entry-footer {
  margin: auto 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.entry-aside {
  align-self: end;
  padding: 0 58px 54px;
  color: rgba(245, 241, 232, 0.82);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.75;
}

.entry-aside p {
  margin: 0;
}

.aside-line {
  display: block;
  width: 86px;
  height: 1px;
  margin-top: 24px;
  background: rgba(245, 241, 232, 0.52);
}

.unlock-copy {
  max-width: 440px;
  margin-top: 130px;
  animation: arrive 420ms ease both;
}

.unlock-symbol,
.success-mark {
  margin: 0 0 28px;
  color: var(--brass);
  font-size: 24px;
}

.unlock-copy h1 {
  font-size: 47px;
  line-height: 1.2;
}

.unlock-copy > p:not(.unlock-symbol) {
  margin: 20px 0 0;
  color: var(--ink-soft);
}

.text-link,
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.text-link {
  margin-top: 36px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--brass);
}

.text-link:hover,
.back-link:hover {
  color: var(--brass);
}

.continue-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-top: 36px;
  padding: 12px 19px 12px 21px;
  border: 1px solid var(--petal);
  border-radius: 999px;
  color: #603c40;
  background: rgba(230, 192, 189, 0.48);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.continue-button:hover {
  border-color: #8e4f59;
  background: rgba(230, 192, 189, 0.78);
  transform: translateY(-1px);
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Letter */
.letter-page,
.reply-page,
.success-page,
.admin-page,
.admin-login-page,
.admin-editor-page,
.error-page {
  background: var(--paper);
}

.letter-page {
  min-height: 100%;
  background: #f3efe5;
  overscroll-behavior-y: none;
}

.letter-hero {
  position: relative;
  height: 100svh;
  min-height: 580px;
  display: flex;
  overflow: hidden;
  color: #17382b;
  background-color: #dcebd8;
  background-image: url("../images/hero-leaf-canopy.jpg");
  background-position: center 66%;
  background-size: cover;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: rgba(242, 249, 238, 0.12);
}

.hero-content {
  position: relative;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: max(36px, env(safe-area-inset-top));
  padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
}

.hero-meta {
  display: flex;
  justify-content: flex-start;
  color: rgba(23, 56, 43, 0.72);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.74);
}

.hero-copy {
  position: absolute;
  top: 34%;
  left: 0;
  max-width: 520px;
  transform: translateY(-50%);
}

.hero-content h1 {
  margin: 0;
  color: #16425b;
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(48px, 5.8vw, 72px);
  font-weight: 400;
  line-height: 1.18;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(245, 252, 255, 0.85), 0 3px 18px rgba(238, 249, 255, 0.82);
}

.hero-subtitle {
  margin: 22px 0 0;
  color: rgba(23, 56, 43, 0.86);
  font-size: 17px;
  line-height: 1.85;
  text-shadow: 0 1px 14px rgba(255, 255, 255, 0.82);
}

.hero-scroll {
  align-self: end;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  color: rgba(23, 56, 43, 0.72);
  font-size: 9px;
  letter-spacing: 0;
  text-decoration: none;
}

.hero-scroll-mark {
  position: relative;
  width: 18px;
  height: 28px;
}

.hero-scroll-mark i {
  position: absolute;
  left: 50%;
  display: block;
}

.hero-scroll-mark i:first-child {
  top: 1px;
  width: 1px;
  height: 18px;
  background: currentColor;
  animation: scroll-cue 1.8s ease-in-out infinite;
}

.hero-scroll-mark i:last-child {
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateX(-3px) rotate(45deg);
}

@keyframes scroll-cue {
  0%, 100% { opacity: 0.35; transform: translate(-0.5px, 0); }
  50% { opacity: 1; transform: translate(-0.5px, 5px); }
}

.letter-main {
  padding: 0;
  background: #f3efe5;
}

.letter-reading-surface {
  padding: 76px clamp(20px, 5vw, 72px) 0;
  background: transparent;
  scroll-margin-top: 0;
}

.letter-content,
.letter-end {
  max-width: 720px;
  margin-inline: auto;
}

.markdown-body {
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  font-size: 19px;
  line-height: 2.12;
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.75em 0 0.75em;
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  line-height: 1.4;
}

.markdown-body h1 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 36px;
  font-weight: 400;
}

.markdown-body h2 { font-size: 26px; }
.markdown-body h3 { font-size: 22px; }

.markdown-body p {
  margin: 1.1em 0;
  text-indent: 2em;
  text-wrap: pretty;
}

.markdown-body h1 + p,
.markdown-body p:last-child {
  text-indent: 0;
}

.markdown-body > p:last-child {
  margin-top: 3em;
  color: var(--ink-soft);
  font-size: 17px;
  text-align: right;
}

.markdown-body strong { font-weight: 700; }
.markdown-body em { color: var(--ink-soft); }

.markdown-body blockquote {
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 2px solid var(--brass);
  color: var(--ink-soft);
}

.markdown-body ul,
.markdown-body ol {
  margin: 1.25em 0;
  padding-left: 1.6em;
}

.markdown-body hr {
  width: 100%;
  height: 1px;
  margin: 3em 0;
  border: 0;
  background: var(--line);
}

.markdown-body a {
  color: #566e61;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.markdown-body code,
.markdown-body pre {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 4px;
  background: var(--paper-deep);
}

.markdown-body figure {
  margin: 2.2em 0;
}

.markdown-body figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.markdown-body figcaption {
  margin-top: 9px;
  color: #78827c;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.letter-end {
  margin-top: 112px;
  padding: 65px 0 86px;
  border-top: 1px solid var(--line);
}

.letter-end h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.55;
}

.letter-end .secondary-button {
  margin-top: 35px;
  border-color: var(--petal);
  color: #603c40;
  background: rgba(230, 192, 189, 0.44);
  box-shadow: 0 10px 24px rgba(182, 110, 120, 0.12);
}

.letter-end .secondary-button:hover {
  border-color: #8e4f59;
  background: rgba(230, 192, 189, 0.78);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding-top: 24px;
  padding-bottom: max(34px, calc(env(safe-area-inset-bottom) + 22px));
  border-top: 1px solid var(--line);
  background: #f3efe5;
  color: #7c8881;
  font-size: 11px;
}

.site-footer-note {
  color: #6f7d75;
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 13px;
}

.letter-exit-form {
  margin: 0;
}

.letter-exit-button {
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid rgba(65, 87, 78, 0.44);
  border-radius: 4px;
  color: #40544c;
  background: rgba(255, 253, 248, 0.58);
  font-size: 12px;
  font-weight: 700;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.letter-exit-button:hover {
  border-color: #2f5143;
  color: #254437;
  background: #fffdf8;
}

/* Image memories and the full-screen viewer */
.image-memory {
  margin: 3.25em 0;
  padding: 20px 0 23px;
  border-top: 1px solid rgba(32, 43, 40, 0.18);
  border-bottom: 1px solid rgba(32, 43, 40, 0.12);
}

.image-memory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.image-memory-kicker,
.image-memory-note {
  margin: 0;
  text-indent: 0;
}

.image-memory-kicker {
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.image-memory-note {
  margin-top: 4px;
  color: var(--ink-soft);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.6;
}

.image-memory--single .image-memory-note {
  display: inline-block;
  margin-top: 9px;
  padding: 5px 9px;
  border-left: 2px solid #75a17f;
  color: #5d6d65;
  background: rgba(222, 235, 220, 0.42);
  font-size: 11px;
}

.image-memory--single {
  margin: 0.4em 0 1.1em;
  padding: 0;
  border: 0;
}

.image-memory--single .image-memory-note {
  margin: 0;
}

.inline-image-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  color: #2f71ad;
  background: transparent;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.inline-image-link:hover {
  color: #17598f;
}

.image-launch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid rgba(32, 43, 40, 0.28);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.7);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.image-launch:hover {
  border-color: var(--sage);
  background: #fffdf8;
  transform: translateY(-1px);
}

.image-launch--accent {
  border-color: var(--petal);
  color: #603c40;
  background: rgba(230, 192, 189, 0.55);
}

.image-launch--accent:hover {
  border-color: #8e4f59;
  background: rgba(230, 192, 189, 0.86);
}

.gallery-thumb-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.gallery-thumb {
  min-width: 0;
  aspect-ratio: 9 / 16;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(32, 43, 40, 0.16);
  border-radius: 4px;
  background: #e5ded2;
  cursor: zoom-in;
  transition: border-color 160ms ease, transform 160ms ease;
}

.gallery-thumb:hover {
  border-color: var(--petal);
  transform: translateY(-2px);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  background: #fffdf8;
}

.image-gallery-sources {
  display: none;
}

.image-viewer {
  width: min(94vw, 1040px);
  height: min(92svh, 900px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(245, 241, 232, 0.25);
  border-radius: 8px;
  color: var(--paper);
  background: #1a2421;
  box-shadow: 0 24px 80px rgba(9, 15, 13, 0.4);
}

.image-viewer::backdrop {
  background: rgba(13, 20, 18, 0.78);
}

.image-viewer-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}

.image-viewer-toolbar,
.image-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
}

.image-viewer-toolbar {
  border-bottom: 1px solid rgba(245, 241, 232, 0.13);
}

.image-viewer-title,
.image-viewer-footer span {
  margin: 0;
  color: rgba(245, 241, 232, 0.78);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.image-viewer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-tool,
.viewer-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(245, 241, 232, 0.24);
  color: var(--paper);
  background: rgba(245, 241, 232, 0.08);
  transition: background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.viewer-tool {
  width: 34px;
  height: 32px;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
}

.viewer-tool[data-viewer-zoom-reset] {
  width: auto;
  padding: 0 8px;
  font-size: 11px;
}

.viewer-tool:hover,
.viewer-nav:hover:not(:disabled) {
  border-color: rgba(230, 192, 189, 0.78);
  background: rgba(230, 192, 189, 0.2);
}

.image-viewer-stage {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  min-height: 0;
  gap: 8px;
  padding: 14px 12px;
}

.viewer-nav {
  width: 42px;
  height: 58px;
  justify-self: center;
  border-radius: 999px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 400;
  line-height: 1;
}

.viewer-nav:disabled {
  cursor: default;
  opacity: 0.25;
}

.image-viewer-image-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 160ms ease;
}

.image-viewer-footer {
  border-top: 1px solid rgba(245, 241, 232, 0.13);
}

.image-viewer.is-image-fullscreen {
  width: 100vw;
  height: 100svh;
  border: 0;
  border-radius: 0;
}

.image-viewer.is-image-fullscreen .image-viewer-image {
  max-height: 86svh;
}

/* Reply */
.reply-shell {
  min-height: 100svh;
  padding-top: 39px;
  padding-bottom: 30px;
}

.subpage-header,
.subpage-footer,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.subpage-index {
  color: #87918b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
}

.reply-intro {
  max-width: 680px;
  margin: 120px auto 54px;
}

.reply-intro h1 {
  margin: 18px 0 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 59px;
  font-weight: 400;
  line-height: 1.15;
}

.reply-intro > p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.reply-form {
  max-width: 680px;
  margin: 0 auto;
}

.textarea-wrap {
  border-bottom: 1px solid var(--line);
}

.reply-textarea {
  display: block;
  min-height: 280px;
  resize: vertical;
  padding: 18px 18px 14px;
  border-color: var(--line);
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  font-size: 18px;
  line-height: 1.95;
}

.textarea-meta {
  display: flex;
  justify-content: space-between;
  padding: 10px 2px 13px;
  color: #7b8780;
  font-size: 12px;
}

.reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 25px;
}

.reply-actions p {
  max-width: 330px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.send-button {
  min-width: 120px;
}

.subpage-footer {
  max-width: 680px;
  margin: 90px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: #89928c;
  font-size: 11px;
}

.confirm-dialog {
  width: min(calc(100% - 32px), 500px);
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(22, 31, 28, 0.48);
}

.dialog-inner {
  padding: 35px;
}

.dialog-inner h2 {
  margin: 20px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 400;
  line-height: 1.45;
}

.dialog-inner > p:not(.kicker) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
}

/* Success and admin */
.success-shell,
.simple-state {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-top: 50px;
  padding-bottom: 50px;
}

.success-shell {
  max-width: 760px;
}

.success-shell h1,
.simple-state h1 {
  margin: 17px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 62px;
  font-weight: 400;
  line-height: 1.15;
}

.success-copy {
  margin-top: 35px;
  color: var(--ink-soft);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.9;
}

.success-copy p {
  margin: 0 0 10px;
}

.success-shell .text-link {
  margin-top: 46px;
}

.admin-entry {
  min-height: 100svh;
  padding-top: 42px;
}

.admin-entry-copy {
  max-width: 470px;
  margin-top: 145px;
}

.admin-entry-copy h1,
.admin-header h1 {
  margin: 17px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  font-weight: 400;
  line-height: 1.15;
}

.admin-entry-copy > p:not(.kicker) {
  margin: 0;
  color: var(--ink-soft);
}

.compact-form {
  max-width: 390px;
  margin-top: 42px;
}

.compact-form .primary-button {
  margin-top: 10px;
}

.admin-shell {
  padding-top: 55px;
  padding-bottom: 70px;
}

.admin-header {
  align-items: flex-end;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.admin-header h1 {
  margin-bottom: 3px;
  font-size: 49px;
}

.admin-count {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.reply-list {
  display: grid;
  gap: 13px;
  margin-top: 23px;
}

.reply-record {
  padding: 25px 27px 27px;
  border: 1px solid rgba(32, 43, 40, 0.12);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.62);
}

.reply-record-meta {
  display: flex;
  justify-content: space-between;
  color: #859089;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.reply-record-content {
  margin: 19px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  font-size: 17px;
  line-height: 1.9;
}

.empty-state {
  padding: 115px 0;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
}

.empty-state span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
}

.simple-state {
  max-width: 700px;
}

.simple-state p:not(.kicker) {
  margin: 22px 0 0;
  color: var(--ink-soft);
}

/* Letter editor */
.admin-editor-page {
  min-height: 100%;
  background: #e8e5dc;
}

.editor-shell {
  padding-top: 42px;
  padding-bottom: 70px;
}

.editor-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.editor-kicker {
  margin-top: 26px;
}

.editor-header h1 {
  margin: 13px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 49px;
  font-weight: 400;
  line-height: 1.15;
}

.editor-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 5px;
}

.editor-flashes {
  min-height: 28px;
  margin-top: 14px;
}

.editor-flash {
  margin: 0;
  color: var(--sage);
  font-size: 13px;
}

.editor-flash--error {
  color: var(--error);
}

.editor-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-top: 17px;
}

.editor-pane {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(32, 43, 40, 0.16);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.62);
  box-shadow: 0 12px 32px rgba(18, 28, 25, 0.07);
}

.editor-pane-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 241, 232, 0.78);
}

.editor-pane-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.editor-toolbar,
.editor-view-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.editor-tool,
.editor-view-button {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid rgba(32, 43, 40, 0.2);
  border-radius: 3px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.75);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.editor-tool:hover,
.editor-view-button:hover {
  border-color: var(--sage);
  color: var(--ink);
  background: #fffdf8;
}

.editor-view-button.is-active {
  border-color: var(--night);
  color: var(--paper);
  background: var(--night);
}

.editor-textarea {
  display: block;
  width: 100%;
  min-height: min(70svh, 780px);
  resize: vertical;
  padding: 20px 22px 22px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: #fffdf8;
  font-family: Consolas, "SFMono-Regular", "Cascadia Mono", monospace;
  font-size: 14px;
  line-height: 1.78;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.editor-textarea:focus {
  border: 0;
  box-shadow: inset 0 0 0 2px rgba(113, 131, 122, 0.35);
  outline: 0;
}

.editor-form-error {
  margin: 0;
  padding: 9px 16px 0;
  background: #fffdf8;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 14px 13px;
  border-top: 1px solid var(--line);
  background: #fffdf8;
}

.editor-save-state {
  color: var(--sage);
  font-size: 12px;
}

.editor-save-state.is-dirty {
  color: var(--brass);
}

.editor-save-state.is-error {
  color: var(--error);
}

.editor-save-button {
  min-height: 39px;
  padding: 8px 16px;
  font-size: 13px;
}

.editor-preview-stage {
  min-height: min(70svh, 780px);
  padding: 24px;
  overflow: auto;
  background: #dfe4df;
}

.editor-preview-surface {
  width: min(100%, 720px);
  min-height: 660px;
  margin: 0 auto;
  padding: 58px clamp(20px, 5vw, 72px) 56px;
  background: #f3efe5;
  box-shadow: 0 12px 30px rgba(18, 28, 25, 0.13);
}

.editor-preview-stage.is-phone .editor-preview-surface {
  width: min(390px, 100%);
  min-height: 720px;
  padding: 52px 20px 44px;
}

.editor-preview-stage.is-phone .markdown-body {
  font-size: 17px;
  line-height: 2;
}

.editor-preview-stage.is-phone .markdown-body h1 {
  font-size: 31px;
}

.editor-preview-stage.is-phone .markdown-body h2 {
  font-size: 24px;
}

@media (max-width: 900px) {
  .editor-workspace {
    grid-template-columns: 1fr;
  }

  .editor-textarea,
  .editor-preview-stage {
    min-height: 55svh;
  }
}

@media (max-width: 760px) {
  .admin-header-actions,
  .editor-header-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .editor-shell {
    padding-top: 28px;
    padding-bottom: 40px;
  }

  .editor-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .editor-header h1 {
    font-size: 40px;
  }

  .editor-pane-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .editor-toolbar {
    width: 100%;
  }

  .editor-textarea {
    min-height: 430px;
    padding: 16px;
    font-size: 13px;
  }

  .editor-preview-stage {
    padding: 14px;
  }
}

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
  .page-width {
    width: min(calc(100% - 36px), 680px);
  }

  .entry-shell {
    display: block;
    min-height: 100svh;
    background-position: 63% center;
  }

  .entry-panel {
    min-height: 100svh;
    padding: 33px 25px 28px;
    background-color: rgba(245, 241, 232, 0.94);
  }

  .entry-mark {
    margin-bottom: 40px;
  }

  .entry-copy {
    margin-top: 38px;
  }

  .entry-copy h1 {
    font-size: 54px;
  }

  .entry-note {
    margin-top: 24px;
    font-size: 13px;
  }

  .hint-block {
    margin-top: 40px;
  }

  .field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .primary-button {
    min-height: 48px;
  }

  .entry-aside {
    display: none;
  }

  .unlock-copy {
    margin-top: 90px;
  }

  .unlock-copy h1 {
    font-size: 37px;
  }

  .letter-hero {
    height: 100svh;
    min-height: 590px;
    background-position: left center;
  }

  .hero-content {
    padding-top: max(29px, env(safe-area-inset-top));
    padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  }

  .hero-copy {
    top: 78%;
    max-width: 310px;
  }

  .hero-content h1 {
    font-size: 42px;
    line-height: 1.22;
  }

  .hero-subtitle {
    margin-top: 17px;
    font-size: 15px;
    line-height: 1.8;
  }

  .hero-scroll {
    font-size: 9px;
  }

  .letter-main {
    padding-top: 0;
  }

  .letter-reading-surface {
    padding: 58px 12px 0;
  }

  .markdown-body {
    font-size: 17px;
    line-height: 2;
  }

  .markdown-body h1 {
    font-size: 31px;
  }

  .markdown-body h2 { font-size: 24px; }

  /* Let the closing blessing use the full line on narrow screens. */
  .markdown-body > p:nth-last-of-type(2) {
    text-indent: 0;
    text-wrap: pretty;
  }

  .letter-end {
    margin-top: 74px;
    padding-top: 45px;
    padding-bottom: 65px;
  }

  .letter-end h2 {
    font-size: 25px;
  }

  .site-footer {
    gap: 14px;
    padding-top: 20px;
    font-size: 10px;
  }

  .site-footer-note {
    font-size: 12px;
  }

  .image-memory-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  .image-memory--single .image-memory-heading {
    gap: 0;
  }

  .image-launch {
    min-height: 40px;
  }

  .gallery-thumb-row {
    gap: 6px;
  }

  .image-viewer {
    width: 100vw;
    height: 100svh;
    border: 0;
    border-radius: 0;
  }

  .image-viewer-stage {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 3px;
    padding-inline: 4px;
  }

  .viewer-nav {
    width: 34px;
    height: 50px;
  }

  .image-viewer-toolbar,
  .image-viewer-footer {
    padding-inline: 12px;
  }

  .reply-shell {
    padding-top: 27px;
  }

  .subpage-index {
    max-width: 150px;
    text-align: right;
  }

  .reply-intro {
    margin: 86px auto 38px;
  }

  .reply-intro h1 {
    margin-top: 13px;
    font-size: 45px;
  }

  .reply-intro > p:last-child {
    font-size: 16px;
  }

  .reply-textarea {
    min-height: 240px;
    font-size: 17px;
  }

  .reply-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
    margin-top: 20px;
  }

  .reply-actions p {
    max-width: none;
    font-size: 12px;
  }

  .send-button {
    width: 100%;
  }

  .subpage-footer {
    margin-top: 68px;
  }

  .dialog-inner {
    padding: 27px 23px 24px;
  }

  .dialog-inner h2 {
    font-size: 23px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions > * {
    width: 100%;
  }

  .success-shell h1,
  .simple-state h1 {
    font-size: 48px;
  }

  .success-copy {
    font-size: 18px;
  }

  .admin-entry {
    padding-top: 28px;
  }

  .admin-entry-copy {
    margin-top: 104px;
  }

  .admin-entry-copy h1 {
    font-size: 48px;
  }

  .admin-shell {
    padding-top: 35px;
  }

  .admin-header {
    align-items: flex-start;
    gap: 26px;
  }

  .admin-header h1 {
    font-size: 40px;
  }

  .logout-form {
    flex: 0 0 auto;
    padding-top: 6px;
  }

  .reply-record {
    padding: 20px 18px 22px;
  }

  .reply-record-meta {
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }

  .reply-record-content {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
