:root {
  color-scheme: light;
  --bg: #f6f0e6;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: rgba(255, 248, 238, 0.96);
  --ink: #24313f;
  --muted: #5f6d79;
  --accent: #a04f2b;
  --accent-soft: #f3dfc4;
  --accent-soft-2: #f7ecdd;
  --line: rgba(36, 49, 63, 0.12);
  --shadow: 0 18px 40px rgba(84, 95, 112, 0.12);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(160, 79, 43, 0.16), transparent 34%),
    linear-gradient(180deg, #efe5d2 0%, var(--bg) 36%, #f7f2ea 100%);
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

main.letter {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding:
    calc(18px + env(safe-area-inset-top, 0px))
    14px
    calc(28px + env(safe-area-inset-bottom, 0px));
}

.letter > * + * {
  margin-top: 22px;
}

.letter-hero {
  margin-top: 6px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
figcaption,
blockquote {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

h2,
h3 {
  margin: 0 0 12px;
  font-size: clamp(1.45rem, 6.2vw, 2rem);
  line-height: 1.08;
}

p {
  margin: 0 0 14px;
  font-size: 1rem;
  line-height: 1.72;
}

.lede {
  margin-top: 16px;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.72;
}

.letter-section {
  display: grid;
  gap: 14px;
}

.letter-section.split {
  grid-template-columns: 1fr;
  gap: 12px;
}

.letter-section.split article,
.fact-card,
.note-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.fact-card {
  position: relative;
  padding-left: 20px;
}

.fact-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  border-radius: 18px 0 0 18px;
  background: linear-gradient(180deg, var(--accent), rgba(160, 79, 43, 0.28));
}

.fact-kicker {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.note-card {
  background:
    linear-gradient(135deg, rgba(160, 79, 43, 0.11), rgba(255, 255, 255, 0.5)),
    var(--panel);
}

.fact-card p:last-child,
.note-card p:last-child,
.letter-section p:last-child,
.letter-section.split article p:last-child {
  margin-bottom: 0;
}

.image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 72px));
  justify-content: center;
  gap: 7px;
  margin: 6px 0 2px;
}

.image-pair img {
  width: 72px;
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 11px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 18px rgba(71, 85, 105, 0.1);
}

.image-pair figcaption {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: center;
}

.separate-message {
  padding: 18px 14px;
  border: 1px solid rgba(160, 79, 43, 0.3);
  border-left: 7px solid rgba(160, 79, 43, 0.82);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(184, 118, 79, 0.2), transparent 32%),
    linear-gradient(180deg, rgba(252, 240, 224, 0.97), rgba(243, 223, 196, 0.94));
  box-shadow:
    0 18px 44px rgba(160, 79, 43, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.separate-message-head {
  margin-bottom: 18px;
}

.separate-message-head p:not(.eyebrow) {
  color: #5d4a3f;
}

.separate-message-head p:last-child {
  margin-bottom: 0;
}

.stage-card,
.spoken-text {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stage-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem !important;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3 !important;
  text-transform: uppercase;
}

.stage-card p {
  font-size: 1rem;
}

.declaration {
  color: var(--accent);
  font-size: clamp(1.14rem, 5.2vw, 1.48rem) !important;
  line-height: 1.42;
}

.aside {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: italic;
}

.opera-line,
.poem {
  margin: 22px 0;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--accent);
}

.opera-line {
  color: var(--accent);
  font-size: clamp(1.08rem, 5vw, 1.36rem);
}

.opera-line p,
.poem p {
  margin-bottom: 0;
}

.opera-line span {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9em;
}

.poem {
  color: #3a332c;
  background: rgba(255, 255, 255, 0.38);
  border-radius: 0 14px 14px 0;
}

.poem + .poem {
  margin-top: 14px;
}

.poem em {
  font-style: italic;
  overflow-wrap: break-word;
}

.curtain {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(36, 49, 63, 0.12);
}

.afterword {
  margin: 0;
  color: var(--accent);
  font-size: clamp(1.22rem, 5.8vw, 1.8rem);
  line-height: 1.32;
}

footer {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

footer p,
footer {
  margin-bottom: 0;
}

.end-sentinel {
  height: 1px;
  margin-top: 1px;
}

@media (min-width: 480px) {
  main.letter {
    padding-left: 18px;
    padding-right: 18px;
  }

  .image-pair {
    grid-template-columns: repeat(2, minmax(0, 82px));
  }

  .image-pair img {
    width: 82px;
  }
}

@media (min-width: 700px) {
  body {
    padding: 22px 0;
  }

  main.letter {
    padding: 28px 24px 36px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(84, 95, 112, 0.14);
  }

  .letter > * + * {
    margin-top: 26px;
  }

  .letter-section.split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .letter-section.split article,
  .fact-card,
  .note-card {
    padding: 20px;
  }

  .image-pair {
    grid-template-columns: repeat(2, minmax(0, 96px));
    gap: 9px;
  }

  .image-pair img {
    width: 96px;
  }

  .image-pair figcaption {
    font-size: 0.78rem;
  }

  .separate-message {
    padding: 24px 22px;
    border-left-width: 9px;
    border-radius: 26px;
  }

  .opera-line,
  .poem {
    padding-left: 18px;
  }
}

@media (min-width: 1024px) {
  main.letter {
    max-width: 46rem;
    padding: 36px 34px 44px;
  }

  h1 {
    font-size: clamp(2.6rem, 4.8vw, 4.2rem);
  }

  h2,
  h3 {
    font-size: clamp(1.8rem, 2.8vw, 2.5rem);
  }

  .image-pair {
    grid-template-columns: repeat(2, minmax(0, 108px));
  }

  .image-pair img {
    width: 108px;
  }

  .separate-message {
    padding: 28px 28px 30px;
  }
}
