:root {
  --ink: #2f2029;
  --plum: #5a2942;
  --rose: #d33174;
  --coral: #ee765e;
  --sage: #7f9989;
  --sun: #efc768;
  --paper: #fffaf4;
  --milk: #fffefe;
  --line: rgba(86, 42, 64, 0.16);
  --shadow: 0 28px 90px rgba(90, 41, 66, 0.16);
  --body: "Manrope", "Trebuchet MS", sans-serif;
  --display: "Playfair Display", Georgia, serif;
  --serif: "Vollkorn", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #fff5f5;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--body);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.84) 0 14%, transparent 14% 100%),
    repeating-linear-gradient(90deg, rgba(90, 41, 66, 0.035) 0 1px, transparent 1px 86px),
    linear-gradient(180deg, #fff6f7 0%, #fffaf2 52%, #f7fbf7 100%);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
video {
  display: block;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0, 0, 0, 0);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.cursor-light-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.paper-grid {
  position: absolute;
  inset: 0;
  opacity: 0.46;
  background-image:
    linear-gradient(90deg, rgba(90, 41, 66, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(127, 153, 137, 0.09) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
}

.soft-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(239, 199, 104, 0.18), transparent 28%),
    radial-gradient(circle at 82% 4%, rgba(127, 153, 137, 0.15), transparent 24%);
}

.cursor-light {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cursor-light-size, 440px);
  height: var(--cursor-light-size, 440px);
  border-radius: 50%;
  opacity: 0;
  mix-blend-mode: multiply;
  pointer-events: none;
  transform: translate3d(var(--cursor-light-x, -50vw), var(--cursor-light-y, -50vh), 0) translate3d(-50%, -50%, 0);
  transition: opacity 420ms ease;
  will-change: transform, opacity;
}

.cursor-light.is-active {
  opacity: var(--cursor-light-opacity, 0.42);
}

.cursor-light-primary {
  --cursor-light-size: 420px;
  --cursor-light-opacity: 0.52;
  background: radial-gradient(circle, rgba(255, 156, 196, 0.5), rgba(255, 202, 220, 0.24) 38%, transparent 72%);
  filter: blur(6px) saturate(1.08);
}

.cursor-light-secondary {
  --cursor-light-size: 640px;
  --cursor-light-opacity: 0.38;
  background: radial-gradient(circle, rgba(255, 184, 172, 0.38), rgba(255, 224, 206, 0.2) 42%, transparent 76%);
  filter: blur(14px) saturate(1.04);
}

.cursor-light-trail {
  --cursor-light-size: 520px;
  --cursor-light-opacity: 0.36;
  background: radial-gradient(circle, rgba(255, 130, 182, 0.34), rgba(255, 199, 222, 0.17) 40%, transparent 74%);
  filter: blur(20px) saturate(1.08);
}

.auth-return {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 16;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(90, 41, 66, 0.14);
  border-radius: 50%;
  color: var(--plum);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 46px rgba(90, 41, 66, 0.12);
  backdrop-filter: blur(14px) saturate(1.08);
}

.auth-return[hidden] {
  display: none;
}

.auth-return-mark {
  position: relative;
  width: 22px;
  height: 22px;
}

.auth-return-mark::before,
.auth-return-mark::after {
  position: absolute;
  content: "";
  background: currentColor;
}

.auth-return-mark::before {
  top: 5px;
  left: 4px;
  width: 11px;
  height: 11px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  background: transparent;
  transform: rotate(45deg);
}

.auth-return-mark::after {
  top: 10px;
  left: 7px;
  width: 13px;
  height: 2px;
  border-radius: 999px;
}

.auth-return::after {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  padding: 8px 10px;
  border: 1px solid rgba(90, 41, 66, 0.1);
  border-radius: 999px;
  color: var(--plum);
  content: "К входу";
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 34px rgba(90, 41, 66, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(6px, -50%, 0);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.auth-return:hover::after,
.auth-return:focus-visible::after {
  opacity: 1;
  transform: translate3d(0, -50%, 0);
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.auth-screen,
.letter-site,
.reader {
  display: none;
}

.auth-screen.is-visible,
.letter-site.is-visible,
.reader.is-visible {
  display: grid;
}

.auth-screen {
  min-height: calc(100dvh - 64px);
  place-items: center;
  overflow: clip;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 246, 0.78)),
    var(--milk);
  box-shadow: var(--shadow);
}

.auth-screen::before {
  position: absolute;
  inset: 22px;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(90, 41, 66, 0.08);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(239, 199, 104, 0.14), transparent 28%),
    radial-gradient(circle at 82% 20%, rgba(127, 153, 137, 0.13), transparent 24%);
}

.auth-panel {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: start;
  width: min(620px, calc(100% - 48px));
  min-height: auto;
  padding: clamp(34px, 4.5vw, 56px);
  border: 1px solid rgba(90, 41, 66, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 22px 64px rgba(90, 41, 66, 0.09);
}

.kicker,
.chapter-mark {
  margin: 0;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-panel h1,
.letter-hero h2,
.letter-page h2,
.answer-modal h2 {
  margin: 0;
  color: var(--plum);
  font-family: var(--display);
  font-size: clamp(3.2rem, 7vw, 7.2rem);
  line-height: 0.9;
}

.auth-panel h1 {
  max-width: none;
  margin-top: 18px;
  font-size: clamp(3.3rem, 4.9vw, 5.15rem);
  line-height: 0.94;
  white-space: nowrap;
}

.name-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(500px, 100%);
  margin-top: 28px;
  padding: 7px;
  border: 1px solid rgba(211, 49, 116, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 40px rgba(211, 49, 116, 0.11);
  overflow: hidden;
}

.name-control input {
  min-width: 0;
  min-height: 50px;
  padding: 0 17px;
  border: 0;
  outline: 0;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
}

.name-control input::placeholder {
  color: rgba(90, 41, 66, 0.38);
}

.name-control:focus-within {
  outline: 3px solid rgba(211, 49, 116, 0.18);
}

.name-control button,
.primary-action {
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--coral));
  box-shadow: 0 18px 38px rgba(211, 49, 116, 0.27);
  font-weight: 800;
}

.auth-message {
  min-height: 26px;
  margin: 12px 0 0;
  color: #9f2049;
  font-weight: 700;
}

.chapter-card,
.letter-page,
.answer-modal section {
  border: 1px solid rgba(90, 41, 66, 0.12);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 44px rgba(90, 41, 66, 0.08);
}

.letter-site {
  grid-template-columns: minmax(320px, 0.9fr) minmax(480px, 1.1fr);
  gap: 26px;
  min-height: calc(100vh - 64px);
  padding-top: 10px;
}

.letter-hero {
  position: sticky;
  top: 24px;
  display: grid;
  align-content: space-between;
  min-height: calc(100vh - 84px);
  padding: clamp(28px, 4vw, 54px);
  border: 1px solid rgba(90, 41, 66, 0.12);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.56)),
    url("./assets/letter-commissioned-hero.webp") center / cover;
  box-shadow: 0 22px 70px rgba(47, 32, 41, 0.12);
}

.letter-hero h2 {
  max-width: 500px;
  margin-top: 28px;
  font-size: clamp(2.75rem, 4.45vw, 5rem);
}

.letter-hero p:not(.chapter-mark) {
  max-width: 440px;
  margin: 20px 0 26px;
  color: rgba(47, 32, 41, 0.68);
  line-height: 1.72;
}

.progress-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.progress-nav button {
  min-height: 44px;
  border: 1px solid rgba(90, 41, 66, 0.14);
  border-radius: 999px;
  color: rgba(90, 41, 66, 0.6);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.progress-nav button.is-active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--rose), var(--sun));
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(170px, auto);
  gap: 16px;
}

.chapter-card {
  grid-column: span 3;
  overflow: hidden;
  padding: 22px;
  border-radius: 22px;
}

.chapter-card.large {
  grid-column: span 4;
  grid-row: span 2;
  min-height: 356px;
  background: #fff7ee;
}

.chapter-card.tall {
  grid-column: span 2;
  grid-row: span 2;
  background: #f1f7f2;
}

.chapter-card span {
  color: rgba(90, 41, 66, 0.36);
  font-size: 0.82rem;
  font-weight: 800;
}

.chapter-card h3 {
  margin: 14px 0 10px;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  line-height: 1.04;
}

.chapter-card p {
  margin: 0;
  color: rgba(47, 32, 41, 0.66);
  font-size: 0.95rem;
  line-height: 1.58;
}

.chapter-card img {
  width: 100%;
  height: 190px;
  margin-top: 18px;
  border-radius: 16px;
  object-fit: cover;
}

.reader {
  gap: 24px;
  margin-top: 28px;
}

.letter-page {
  min-height: 580px;
  padding: clamp(30px, 6vw, 78px);
  border-radius: 28px;
}

.letter-page h2 {
  margin-top: 14px;
  font-size: clamp(3rem, 6vw, 6.2rem);
}

.copy {
  max-width: 760px;
  margin-top: 28px;
}

.copy p,
.decision-copy p,
.audio-card,
.promise-list {
  color: rgba(47, 32, 41, 0.7);
  font-size: 1.06rem;
  line-height: 1.82;
}

blockquote {
  max-width: 820px;
  margin: 34px 0 0;
  padding-left: 24px;
  border-left: 3px solid var(--rose);
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.08;
}

.poem-page {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: start;
  background: linear-gradient(145deg, rgba(255, 247, 238, 0.9), rgba(241, 247, 242, 0.78));
}

.poem-card {
  padding: clamp(24px, 4vw, 44px);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
}

.poem-card p {
  margin: 0 0 8px;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  line-height: 1.22;
}

.audio-card {
  grid-column: 2;
  padding: 18px;
  border: 1px solid rgba(90, 41, 66, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.audio-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.audio-card audio {
  width: 100%;
}

.video-frame {
  margin-top: 28px;
  overflow: hidden;
  border-radius: 24px;
  background: #1e161b url("./assets/video-poster-letter.webp") center / cover;
  box-shadow: 0 24px 70px rgba(47, 32, 41, 0.24);
}

.video-frame video {
  width: 100%;
  max-height: 72vh;
}

.promise-page {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.86), rgba(255, 250, 244, 0.86)),
    url("./assets/love-sticker-heart.jpg") right 52px bottom 42px / 260px auto no-repeat;
}

.promise-text-page {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 247, 238, 0.8)),
    url("./assets/love-sticker-special.jpg") right 52px bottom 42px / 240px auto no-repeat;
}

.promise-list {
  display: grid;
  gap: 14px;
  max-width: 720px;
  margin-top: 28px;
  padding: 0;
  list-style: none;
}

.promise-list li {
  padding: 18px 20px;
  border: 1px solid rgba(90, 41, 66, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
}

.decision-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  min-height: 520px;
  background:
    linear-gradient(150deg, rgba(241, 247, 242, 0.9), rgba(255, 250, 244, 0.84)),
    url("./assets/love-sticker-together.jpg") right 52px bottom 40px / 240px auto no-repeat;
}

.decision-copy p {
  max-width: 540px;
}

.decision-actions {
  display: grid;
  gap: 12px;
  width: min(320px, 100%);
}

.secondary-action {
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid rgba(90, 41, 66, 0.18);
  border-radius: 999px;
  color: var(--plum);
  background: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.write-action {
  border-color: rgba(211, 49, 116, 0.18);
  color: var(--rose);
  background: rgba(255, 255, 255, 0.9);
}

.send-status {
  grid-column: 1 / -1;
  min-height: 24px;
  margin: 0;
  color: rgba(47, 32, 41, 0.72);
  font-weight: 700;
}

.answer-modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 156, 196, 0.16), transparent 30%),
    rgba(47, 32, 41, 0.42);
  backdrop-filter: blur(16px) saturate(1.06);
  transition: opacity 240ms ease;
}

.message-modal {
  position: fixed !important;
  inset: 0;
  z-index: 22;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 74% 20%, rgba(255, 156, 196, 0.2), transparent 28%),
    rgba(47, 32, 41, 0.42);
  backdrop-filter: blur(16px) saturate(1.08);
  transition: opacity 240ms ease;
}

.message-modal[hidden] {
  display: none !important;
}

.answer-modal.is-open {
  pointer-events: auto;
  opacity: 1;
}

.message-modal.is-open {
  pointer-events: auto;
  opacity: 1;
}

.answer-modal section {
  position: relative;
  width: min(430px, calc(100vw - 32px));
  overflow: hidden;
  padding: clamp(30px, 4vw, 38px);
  border-radius: 24px;
}

.answer-dialog {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 246, 0.92)),
    radial-gradient(circle at 16% 0%, rgba(255, 156, 196, 0.12), transparent 36%);
  box-shadow:
    0 34px 100px rgba(47, 32, 41, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.answer-dialog::before {
  position: absolute;
  top: 0;
  right: clamp(24px, 4vw, 34px);
  left: clamp(24px, 4vw, 34px);
  height: 5px;
  border-radius: 0 0 999px 999px;
  content: "";
  background: linear-gradient(90deg, rgba(211, 49, 116, 0.18), rgba(238, 118, 94, 0.62), rgba(239, 199, 104, 0.22));
}

.answer-dialog-copy {
  display: grid;
  gap: 10px;
  padding-right: 48px;
}

.answer-modal .chapter-mark {
  color: rgba(211, 49, 116, 0.86);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.answer-modal h2 {
  max-width: 300px;
  margin: 0;
  font-size: clamp(2.1rem, 4.1vw, 2.85rem);
  line-height: 0.98;
}

.answer-modal p:not(.chapter-mark) {
  max-width: 330px;
  margin: 0;
  color: rgba(47, 32, 41, 0.68);
  font-size: 0.98rem;
  line-height: 1.56;
}

.message-dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: visible;
  padding: clamp(28px, 3.6vw, 36px);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 246, 0.92)),
    radial-gradient(circle at 15% 8%, rgba(255, 156, 196, 0.16), transparent 38%),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    0 38px 110px rgba(47, 32, 41, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.message-dialog-header {
  display: grid;
  gap: 7px;
  max-width: 390px;
  padding-right: 58px;
}

.message-dialog h2 {
  margin: 0;
  color: var(--plum);
  font-family: var(--display);
  font-size: clamp(1.95rem, 3.35vw, 2.7rem);
  line-height: 1.02;
}

.message-field {
  display: grid;
  gap: 10px;
}

.message-field span,
.message-dialog-footer span {
  color: rgba(90, 41, 66, 0.6);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message-field textarea {
  width: 100%;
  height: clamp(130px, 20dvh, 170px);
  min-height: 124px;
  max-height: 36dvh;
  resize: vertical;
  padding: 20px 22px;
  border: 1px solid rgba(90, 41, 66, 0.13);
  border-radius: 22px;
  outline: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 253, 250, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 18px 44px rgba(90, 41, 66, 0.06);
  font: inherit;
  line-height: 1.65;
}

.message-field textarea::placeholder {
  color: rgba(90, 41, 66, 0.32);
}

.message-field textarea:focus {
  border-color: rgba(211, 49, 116, 0.34);
  box-shadow:
    0 0 0 4px rgba(211, 49, 116, 0.1),
    0 22px 56px rgba(211, 49, 116, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.message-dialog-footer,
.message-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-dialog-footer {
  padding-top: 2px;
  justify-content: space-between;
}

.message-actions {
  justify-content: flex-end;
}

.message-actions .primary-action,
.message-actions .secondary-action {
  min-width: 140px;
}

.message-status {
  margin-top: -4px;
}

.modal-close {
  position: absolute !important;
  top: 22px;
  right: 22px;
  left: auto !important;
  z-index: 2;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(90, 41, 66, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  box-shadow:
    0 12px 32px rgba(90, 41, 66, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.modal-close::before,
.modal-close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  content: "";
  background: var(--plum);
}

.modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

@media (max-width: 980px) {
  .site-shell {
    padding: 18px;
  }

  .site-shell:has(.auth-screen.is-visible) {
    padding: 12px;
  }

  .auth-screen,
  .letter-site,
  .poem-page,
  .decision-page {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .auth-screen,
  .auth-panel {
    min-height: auto;
  }

  .auth-screen {
    align-content: start;
    min-height: calc(100dvh - 24px);
    padding: clamp(14px, 5dvh, 36px) 0;
    overflow: visible;
    border-radius: 24px;
  }

  .auth-screen:focus-within {
    place-items: start center;
    padding-top: 12px;
  }

  .auth-screen.is-keyboard-active {
    min-height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .auth-screen::before {
    inset: 10px;
    border-radius: 22px;
  }

  .auth-panel {
    width: min(420px, calc(100% - 28px));
    padding: clamp(24px, 7vw, 34px);
    border-radius: 24px;
  }

  .auth-panel h1 {
    max-width: 300px;
    margin-top: 12px;
    font-size: clamp(2.55rem, 12.5vw, 3.45rem);
    line-height: 0.96;
    white-space: normal;
  }

  .auth-return {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
  }

  .auth-return::after {
    display: none;
  }

  .name-control {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    margin-top: 24px;
    padding: 6px;
    border-radius: 999px;
  }

  .name-control input {
    min-height: 50px;
    padding: 0 14px;
    font-size: 1rem;
  }

  .name-control button {
    min-height: 50px;
    padding: 0 20px;
    white-space: nowrap;
  }

  .letter-hero {
    position: relative;
    top: auto;
    min-height: 560px;
  }

  .letter-page h2 {
    font-size: clamp(2.8rem, 14vw, 4.2rem);
  }

  .letter-hero h2 {
    font-size: clamp(2.55rem, 12vw, 3.8rem);
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .chapter-card,
  .chapter-card.large,
  .chapter-card.tall {
    grid-column: auto;
    grid-row: auto;
  }

  .letter-page {
    width: 100%;
    min-width: 0;
    min-height: auto;
    padding: 28px;
  }

  .answer-modal {
    padding: 18px;
  }

  .answer-modal section {
    width: min(380px, calc(100vw - 32px));
    padding: 30px 22px 24px;
    border-radius: 22px;
  }

  .answer-dialog-copy {
    gap: 9px;
    padding-right: 44px;
  }

  .answer-modal h2 {
    max-width: 240px;
    font-size: clamp(2rem, 10vw, 2.65rem);
    line-height: 1;
  }

  .answer-modal p:not(.chapter-mark) {
    max-width: 270px;
    font-size: 0.95rem;
  }

  .reader,
  .copy,
  .poem-card,
  .audio-card,
  .video-frame,
  .promise-list,
  .decision-actions {
    min-width: 0;
  }

  .audio-card {
    grid-column: auto;
  }

  .decision-actions {
    width: 100%;
  }

  .message-dialog-footer,
  .message-actions {
    align-items: stretch;
  }

  .message-dialog {
    width: calc(100vw - 32px);
    max-height: calc(100dvh - 24px);
    gap: 12px;
    padding: 44px 18px 20px;
    border-radius: 22px;
  }

  .message-dialog-header {
    padding-right: 0;
  }

  .message-dialog h2 {
    font-size: clamp(1.9rem, 9.6vw, 2.45rem);
    line-height: 1.04;
  }

  .message-field textarea {
    height: clamp(118px, 20dvh, 148px);
    min-height: 118px;
    max-height: 30dvh;
    border-radius: 18px;
  }

  .message-dialog-footer {
    flex-direction: column;
    gap: 10px;
  }

  .message-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .message-actions .primary-action,
  .message-actions .secondary-action {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .site-shell:has(.auth-screen.is-visible) {
    padding: 10px;
  }

  .auth-screen {
    min-height: calc(100dvh - 20px);
    padding: clamp(10px, 3.5dvh, 24px) 0;
    border-radius: 22px;
  }

  .auth-screen::before {
    inset: 8px;
    border-radius: 20px;
  }

  .auth-panel {
    width: min(390px, calc(100% - 20px));
    padding: 24px;
    border-radius: 22px;
  }

  .auth-panel h1 {
    max-width: 240px;
    margin-top: 10px;
    font-size: clamp(2.38rem, 11.2vw, 3rem);
    line-height: 0.98;
  }

  .name-control {
    gap: 6px;
    margin-top: 22px;
    padding: 5px;
    border-radius: 24px;
  }

  .name-control input {
    min-height: 48px;
    padding: 0 14px;
  }

  .name-control button {
    min-height: 48px;
    padding: 0 18px;
  }

  .auth-screen.is-keyboard-active {
    min-height: auto;
    padding-top: 8px;
  }

  .auth-screen.is-keyboard-active .auth-panel {
    padding-top: 22px;
    padding-bottom: 22px;
  }
}

@media (max-height: 620px) {
  .message-dialog {
    max-height: calc(100dvh - 20px);
    overflow: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
