:root {
  --ink: #201b16;
  --muted: #6e6254;
  --paper: #efe4d2;
  --paper-2: #e4d6c1;
  --paper-3: #fbf7ef;
  --line: rgba(43, 33, 24, 0.24);
  --gold: #b79a68;
  --red: #7e2d26;
  --storm: #10131a;
  --green: #385346;
  --blue: #3f5268;
  --white: #fffaf0;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Noto Serif SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 252, 245, 0.62), transparent 30rem),
    radial-gradient(circle at 20% 12%, rgba(183, 154, 104, 0.14), transparent 25rem),
    linear-gradient(135deg, #f2eadb 0%, #e9dcc7 58%, #dac8ad 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
  opacity: 0;
  background-image:
    radial-gradient(circle at 40% 30%, rgba(79, 55, 31, 0.16) 0 1px, transparent 1px);
  background-size: 9px 9px;
  mix-blend-mode: multiply;
}

.rain-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background-image: repeating-linear-gradient(105deg, transparent 0 26px, rgba(18, 22, 29, 0.44) 27px 28px);
  transform: skewX(-8deg);
}

button,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
}

.screen.active {
  display: grid;
  place-items: center;
}

.quiz-screen {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 252, 245, 0.5), transparent 30rem),
    linear-gradient(135deg, #f3ecdf, #e9dcc8 58%, #deceb5);
}

.quiz-scene-art {
  position: fixed;
  inset: 0 0 auto;
  z-index: 0;
  height: min(54vh, 500px);
  pointer-events: none;
  overflow: hidden;
  opacity: 1;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
}

.quiz-scene-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(243, 236, 223, 0.04), rgba(243, 236, 223, 0.86)),
    linear-gradient(90deg, rgba(243, 236, 223, 0.5), rgba(243, 236, 223, 0.08), rgba(243, 236, 223, 0.5));
}

.quiz-scene-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 14%;
  opacity: 0.42;
  filter: sepia(0.18) saturate(0.72) contrast(0.96);
  mix-blend-mode: multiply;
}

.home-scene-art {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  height: min(62vh, 620px);
  pointer-events: none;
  opacity: 0.88;
  overflow: hidden;
  -webkit-mask-image:
    linear-gradient(180deg, transparent 0%, #000 22%, #000 72%, transparent 100%),
    linear-gradient(90deg, transparent 0%, #000 16%, #000 84%, transparent 100%);
  mask-image:
    linear-gradient(180deg, transparent 0%, #000 22%, #000 72%, transparent 100%),
    linear-gradient(90deg, transparent 0%, #000 16%, #000 84%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.home-scene-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(242, 234, 219, 0.08), rgba(242, 234, 219, 0.48)),
    linear-gradient(90deg, rgba(242, 234, 219, 0.36), rgba(242, 234, 219, 0.04), rgba(218, 200, 173, 0.18));
}

.home-scene-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 0.52;
  filter: sepia(0.18) saturate(0.82) contrast(0.98);
  mix-blend-mode: multiply;
}

.quiz-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 250, 239, 0.72), transparent 22rem),
    linear-gradient(180deg, rgba(19, 17, 15, 0.16), rgba(242, 234, 219, 0) 46%);
}

.quiz-screen.question-enter::before {
  animation: quizVeil 0.9s ease both;
}

.archive-shell {
  width: min(1040px, 100%);
  min-height: min(680px, calc(100vh - 72px));
  border: 1px solid rgba(43, 33, 24, 0.12);
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(255, 250, 239, 0.44), transparent 34%),
    var(--paper);
  box-shadow: 0 22px 70px rgba(33, 25, 16, 0.16);
  position: relative;
  overflow: hidden;
}

.archive-shell::before,
.archive-shell::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(43, 33, 24, 0.1);
  pointer-events: none;
}

.archive-shell::after {
  display: none;
}

.home-layout {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: clamp(34px, 7vw, 78px);
  text-align: center;
}

.home-screen {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 252, 245, 0.55), transparent 31rem),
    linear-gradient(135deg, #f2eadb, #e9dcc7 58%, #dac8ad);
  position: relative;
  overflow: hidden;
}

.home-screen::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 250, 238, 0.34), transparent 18rem),
    linear-gradient(180deg, rgba(242, 234, 219, 0), rgba(183, 154, 104, 0.22));
  transition: opacity 0.8s ease;
}

.home-screen.is-opening::after {
  opacity: 1;
}

.home-screen .archive-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  min-height: min(760px, calc(100vh - 28px));
  border: 0;
  background: transparent;
  box-shadow: none;
}

.home-screen .archive-shell::before,
.home-screen .archive-shell::after {
  display: none;
}

.home-copy {
  display: grid;
  justify-items: center;
}

.kicker,
.question-eyebrow,
.letter-trace {
  margin: 0;
  color: #7a321f;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  letter-spacing: 0;
}

h1 {
  margin: 20px 0 0;
  font-size: clamp(3rem, 5.4vw, 5.35rem);
  line-height: 0.96;
  font-weight: 700;
  max-width: 960px;
}

h1 small {
  display: block;
  margin-top: 0.22em;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.45rem, 2.8vw, 2.3rem);
  line-height: 1.1;
  color: rgba(32, 27, 22, 0.72);
}

.lead {
  max-width: 620px;
  margin: 10px 0 0;
  color: rgba(32, 27, 22, 0.58);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(0.98rem, 1.5vw, 1.14rem);
  line-height: 1.8;
  white-space: pre-line;
}

.language-block {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(318px, 76vw);
  margin: clamp(12px, 2vw, 16px) 0 26px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.language-block::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 28px;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.45rem;
  line-height: 1;
  pointer-events: none;
}

.language-block label {
  color: rgba(32, 27, 22, 0.46);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(43, 33, 24, 0.24);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  padding: 6px 44px 9px;
  outline: none;
  text-align: center;
  text-align-last: center;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: 1.18rem;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
}

.language-hint {
  display: none;
}

.note {
  margin: 12px 0 0;
  max-width: 460px;
  color: rgba(32, 27, 22, 0.34);
  font-size: 0.86rem;
  line-height: 1.6;
}

.envelope-panel {
  display: grid;
  place-items: center;
  gap: 14px;
  position: relative;
}

.envelope-button {
  width: min(500px, 100%);
  min-height: 318px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  position: relative;
  padding: 0 22px 8px;
  perspective: 900px;
}

.envelope-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(560px, 92vw);
  height: 280px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255, 246, 220, 0.38), transparent 54%),
    radial-gradient(ellipse at 50% 65%, rgba(133, 99, 51, 0.16), transparent 64%);
  filter: blur(10px);
  opacity: 0.78;
  mix-blend-mode: multiply;
}

.envelope {
  width: min(384px, 82vw);
  aspect-ratio: 1.58 / 1;
  position: relative;
  opacity: 0.92;
  filter:
    sepia(0.08)
    saturate(0.88)
    drop-shadow(0 28px 36px rgba(60, 43, 24, 0.11))
    drop-shadow(0 3px 7px rgba(60, 43, 24, 0.08));
  transition: transform 0.5s ease;
}

.envelope::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 255, 255, 0.18), transparent 44%),
    linear-gradient(180deg, rgba(255, 246, 221, 0.16), rgba(126, 96, 52, 0.08));
  mix-blend-mode: soft-light;
}

.envelope-button:hover .envelope,
.envelope-button:focus-visible .envelope {
  transform: translateY(-8px) rotate(-1deg);
}

.env-back,
.env-front,
.env-flap,
.env-letter {
  position: absolute;
  inset: 0;
}

.env-back {
  background:
    radial-gradient(circle at 24% 28%, rgba(255, 255, 255, 0.26), transparent 15rem),
    linear-gradient(135deg, #d8c397, #ead8b4 58%, #c4a974);
  border: 1px solid rgba(87, 62, 31, 0.13);
}

.env-letter {
  width: 82%;
  height: 58%;
  left: 9%;
  top: 24%;
  background:
    repeating-linear-gradient(0deg, rgba(83, 61, 34, 0.055) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, #f2e7c7, #eadcb9);
  border: 1px solid rgba(83, 61, 34, 0.12);
  opacity: 0.88;
  transform: rotate(-1.5deg);
  transition: transform 0.7s ease, opacity 0.7s ease;
  z-index: 1;
}

.env-front {
  clip-path: polygon(0 34%, 50% 70%, 100% 34%, 100% 100%, 0 100%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(135deg, #d7c092, #e6d0a8 52%, #bda26d);
  border: 1px solid rgba(87, 62, 31, 0.13);
  z-index: 2;
}

.env-flap {
  clip-path: polygon(0 0, 50% 55%, 100% 0);
  transform-origin: top center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(135deg, #d3bb8f, #c7aa78);
  border-top: 1px solid rgba(87, 62, 31, 0.13);
  transition: transform 0.55s ease;
  z-index: 3;
}

.envelope-button:hover .env-flap,
.envelope-button:focus-visible .env-flap {
  transform: rotateX(16deg) translateY(-4px);
}

.home-screen.is-opening .envelope-button {
  pointer-events: none;
}

.home-screen.is-opening .envelope {
  animation: envelopeLift 0.84s ease forwards;
}

.home-screen.is-opening .env-flap {
  transform: rotateX(168deg) translateY(-8px);
}

.home-screen.is-opening .env-letter {
  opacity: 0.92;
  transform: translateY(-86px) rotate(-1deg);
}

.home-screen.is-opening .wax-seal {
  animation: sealPress 0.72s ease forwards;
}

.home-screen.is-opening .home-copy,
.home-screen.is-opening .lead,
.home-screen.is-opening .note,
.home-screen.is-opening .start-hint {
  animation: softFadeDown 0.7s ease forwards;
}

@keyframes envelopeLift {
  0% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 22px 24px rgba(38, 28, 17, 0.18));
  }
  46% {
    transform: translateY(-10px) scale(1.018);
  }
  100% {
    transform: translateY(10px) scale(0.985);
    filter: drop-shadow(0 8px 12px rgba(12, 10, 9, 0.18));
  }
}

@keyframes sealPress {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  52% {
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0.96;
  }
  100% {
    transform: translate(-50%, -45%) scale(0.86);
    opacity: 0;
  }
}

@keyframes softFadeDown {
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

.wax-seal {
  position: absolute;
  z-index: 2;
  top: 49%;
  left: 50%;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  color: rgba(249, 231, 196, 0.82);
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 700;
  background:
    radial-gradient(circle at 36% 30%, rgba(160, 69, 55, 0.92), rgba(115, 45, 35, 0.96) 66%, rgba(83, 31, 25, 0.96)),
    #7e2d26;
  box-shadow:
    inset 0 2px 5px rgba(255, 241, 211, 0.14),
    inset 0 -5px 10px rgba(56, 23, 18, 0.16),
    0 8px 18px rgba(62, 34, 22, 0.16);
}

.start-hint {
  margin-top: 18px;
  color: rgba(32, 27, 22, 0.36);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.record-card {
  width: min(420px, 100%);
  border: 1px solid rgba(43, 33, 24, 0.14);
  background: rgba(255, 250, 239, 0.34);
  padding: 18px;
}

.record-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.record-card strong {
  display: block;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: 1.45rem;
}

.record-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.quiz-shell {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: clamp(22px, 4vw, 52px);
  padding: clamp(26px, 5vw, 56px);
}

.quiz-screen .archive-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  min-height: min(720px, calc(100vh - 60px));
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.quiz-screen .archive-shell::before,
.quiz-screen .archive-shell::after {
  display: none;
}

.quiz-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.quiz-header .ghost-button {
  position: absolute;
  left: 0;
  border: 0;
  background: transparent;
  color: rgba(32, 27, 22, 0.46);
  box-shadow: none;
}

.progress-wrap {
  width: auto;
  display: grid;
  gap: 8px;
  color: rgba(183, 154, 104, 0.95);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.16em;
}

.progress-bar {
  display: none;
}

.progress-bar span {
  display: block;
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 0.35s ease;
}

.letter-paper {
  width: min(760px, 100%);
  justify-self: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.question-enter .quiz-header {
  animation: fadeDrift 0.5s ease both;
}

.question-enter .letter-paper {
  animation: paperArrive 0.7s cubic-bezier(0.22, 0.75, 0.22, 1) both;
}

.question-enter .question-eyebrow {
  animation: fadeDrift 0.52s ease 0.12s both;
}

.question-enter .letter-paper h2 {
  animation: fadeDrift 0.58s ease 0.2s both;
}

.question-enter .question-prompt {
  animation: fadeDrift 0.58s ease 0.3s both;
}

.letter-paper h2 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  line-height: 1.36;
  font-weight: 500;
}

.question-prompt {
  margin: 18px auto 0;
  max-width: 520px;
  color: rgba(32, 27, 22, 0.5);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.8;
}

.question-eyebrow {
  display: none;
}

.carousel-area {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: auto 18px;
  align-items: center;
  gap: 8px;
  min-height: 250px;
  position: relative;
  z-index: 1;
}

.option-track {
  --drag-offset: 0px;
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(220px, 0.92fr) minmax(280px, 1fr) minmax(220px, 0.92fr);
  gap: clamp(18px, 3vw, 44px);
  align-items: center;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.option-track.dragging {
  cursor: grabbing;
}

.slider-rail {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  width: min(660px, 100%);
  height: 5px;
  justify-self: center;
  border-radius: 999px;
  background: rgba(32, 27, 22, 0.13);
  overflow: hidden;
}

.slider-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(32, 27, 22, 0.38);
  transition: transform 0.32s ease, width 0.32s ease;
  position: relative;
}

.slider-rail span::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2c251f;
  transform: translate(50%, -50%);
  box-shadow: 0 2px 8px rgba(32, 27, 22, 0.16);
}

.option-card {
  --card-scale: 0.91;
  --card-opacity: 0.38;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  min-height: 190px;
  border: 1px solid rgba(43, 33, 24, 0.1);
  border-radius: 2px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.38), transparent 42%),
    rgba(234, 217, 184, 0.22);
  padding: 26px 28px;
  transform: translateX(var(--drag-offset)) scale(var(--card-scale));
  opacity: var(--card-opacity);
  transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.option-track.dragging .option-card {
  transition: opacity 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.option-card.active {
  --card-scale: 1;
  --card-opacity: 1;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.5), transparent 44%),
    rgba(247, 234, 212, 0.62);
  box-shadow: 0 18px 34px rgba(43, 33, 24, 0.1);
}

.question-enter .option-card {
  animation: cardArrive 0.62s ease both;
}

.question-enter .option-card:nth-child(1) {
  animation-delay: 0.24s;
}

.question-enter .option-card:nth-child(2) {
  animation-delay: 0.34s;
}

.question-enter .option-card:nth-child(3) {
  animation-delay: 0.44s;
}

.question-enter .primary-button {
  animation: fadeDrift 0.56s ease 0.58s both;
}

.option-card .num {
  color: #8b3d2e;
  font-size: 0.78rem;
  font-weight: 800;
}

.option-card h3 {
  margin: 12px 0 10px;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  font-size: clamp(1.18rem, 2vw, 1.58rem);
  line-height: 1.08;
}

.option-card p {
  margin: 0;
  color: #5c5145;
  font-family: "Noto Serif SC", serif;
  line-height: 1.58;
}

.nav-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(43, 33, 24, 0.12);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 250, 239, 0.22);
  font-size: 2rem;
  line-height: 1;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 4px;
  padding: 0 18px;
  font-weight: 800;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.primary-button {
  justify-self: center;
  min-width: min(320px, 100%);
  border: 1px solid #271f18;
  color: #fff8e7;
  background: #251e18;
  box-shadow: 0 10px 20px rgba(35, 28, 21, 0.12);
}

.secondary-button {
  border: 1px solid rgba(43, 33, 24, 0.18);
  color: var(--ink);
  background: #ead8b8;
}

.ghost-button {
  border: 1px solid rgba(43, 33, 24, 0.16);
  color: #493b2f;
  background: rgba(255, 250, 239, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.nav-button:hover {
  transform: translateY(-2px);
}

.loading-screen {
  position: relative;
  overflow: hidden;
  color: #fff2cf;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 236, 194, 0.42), transparent 24rem),
    linear-gradient(135deg, #ead1a0, #b89458);
}

.sender-loading-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 54% 28%, rgba(255, 239, 200, 0.36), transparent 24rem),
    linear-gradient(135deg, #ead1a0, #b89458);
}

.sender-loading-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  opacity: 0.86;
  filter: sepia(0.12) saturate(0.85) contrast(0.96);
  animation: senderImageDrift 3.2s ease both;
}

.sender-loading-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(77, 49, 24, 0.22), rgba(77, 49, 24, 0.04) 42%, rgba(77, 49, 24, 0.24)),
    linear-gradient(180deg, rgba(255, 244, 217, 0.08), rgba(58, 38, 18, 0.28));
}

@keyframes senderImageDrift {
  from {
    transform: scale(1.025);
    opacity: 0;
  }
  18% {
    opacity: 0.86;
  }
  to {
    transform: scale(1);
    opacity: 0.86;
  }
}

.envelope-loading-screen {
  color: #f8ecd0;
  background:
    radial-gradient(circle at 76% 36%, rgba(122, 84, 53, 0.28), transparent 22rem),
    linear-gradient(135deg, #ead2a3, #d4b982 58%, #a88855);
  overflow: hidden;
}

.envelope-loading-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 28% 52%, rgba(246, 226, 181, 0.2), transparent 22rem),
    linear-gradient(90deg, rgba(245, 224, 181, 0.2), rgba(72, 45, 24, 0.28));
  animation: envelopeImageGlow 1s ease both;
  z-index: 1;
}

.envelope-loading-screen::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(60, 39, 20, 0.04), rgba(60, 39, 20, 0.22)),
    linear-gradient(180deg, rgba(236, 211, 164, 0.02), rgba(60, 39, 20, 0.24));
  animation: envelopeLoadFade 1s ease both;
  z-index: 2;
}

.envelope-loading-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
}

.envelope-loading-art::before {
  content: "";
  position: absolute;
  inset: -8%;
  background:
    radial-gradient(circle at 70% 42%, rgba(219, 181, 126, 0.38), transparent 26rem),
    linear-gradient(135deg, #ead2a3, #c4a16a);
  filter: blur(20px);
  transform: scale(1.08);
}

.envelope-loading-art img {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  object-position: center;
  opacity: 0.82;
  animation: envelopeImageIn 1s ease both;
}

.envelope-loading-content {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: start;
  width: min(520px, calc(100vw - 48px));
  margin: 0 0 clamp(34px, 8vh, 76px) clamp(24px, 8vw, 96px);
  display: grid;
  gap: 14px;
  color: #fff3d6;
  text-shadow: 0 2px 12px rgba(60, 39, 20, 0.35);
  animation: envelopeLoadingTextIn 0.5s ease both;
}

.envelope-loading-content p {
  margin: 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: clamp(1.7rem, 3.4vw, 3rem);
  line-height: 1.1;
}

.envelope-loading-line {
  width: min(320px, 72vw);
  height: 2px;
  background: rgba(255, 243, 214, 0.28);
  overflow: hidden;
}

.envelope-loading-line::before {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  background: #fff3d6;
  animation: envelopeLoadingLine 1s ease both;
}

@keyframes envelopeImageGlow {
  0% {
    opacity: 0;
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes envelopeImageIn {
  from {
    opacity: 0;
    transform: scale(1.015);
  }
  to {
    opacity: 0.96;
    transform: scale(1);
  }
}

@keyframes envelopeLoadFade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

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

@keyframes envelopeLoadingLine {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(145%);
  }
}

@media (orientation: portrait) {
  .envelope-loading-art {
    place-items: start center;
  }

  .envelope-loading-art img {
    width: 100vw;
    height: 100vh;
    min-height: 0;
    max-height: none;
    object-fit: cover;
    object-position: center center;
    margin-top: 0;
    opacity: 0.74;
  }

  .envelope-loading-content {
    justify-self: center;
    align-self: end;
    margin: 0 24px clamp(42px, 10vh, 88px);
    text-align: center;
  }
}

.storm-box,
.loading-card {
  width: min(680px, 100%);
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  border: 1px solid rgba(242, 229, 200, 0.12);
  background: rgba(9, 11, 15, 0.64);
  padding: clamp(24px, 6vw, 58px);
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.loading-card {
  position: relative;
  z-index: 2;
  width: min(680px, calc(100vw - 48px));
  min-height: 0;
  place-items: start;
  align-content: center;
  justify-self: start;
  margin-left: clamp(20px, 7vw, 96px);
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  color: #fff2cf;
  text-shadow: 0 2px 16px rgba(57, 36, 17, 0.38);
}

.fragment-glyph {
  width: 92px;
  height: 92px;
  border: 1px solid rgba(242, 229, 200, 0.24);
  border-radius: 50%;
  position: relative;
  opacity: 0.86;
}

.fragment-glyph::before,
.fragment-glyph::after {
  content: "";
  position: absolute;
  inset: 26px;
  border: 1px solid currentColor;
  color: var(--gold);
  transform: rotate(38deg);
}

.fragment-glyph::after {
  inset: 40px 14px;
  transform: rotate(-26deg);
}

.storm-box p {
  max-width: 620px;
  margin: 0;
  font-family: "Noto Serif SC", "Cormorant Garamond", serif;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.7;
}

.loading-card h2 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.1rem);
  line-height: 1;
}

.loading-lines {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.loading-lines li {
  color: rgba(255, 242, 207, 0.78);
  font-family: "Noto Serif SC", serif;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  animation: lineIn 0.35s ease forwards;
}

.loading-lines li:last-child {
  color: #fff7df;
}

.result-envelope-reveal {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.result-envelope-reveal span {
  width: min(420px, 72vw);
  aspect-ratio: 1.58 / 1;
  border: 1px solid rgba(255, 242, 207, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 247, 226, 0.36), transparent 44%),
    linear-gradient(135deg, rgba(215, 190, 148, 0.86), rgba(248, 226, 185, 0.9) 52%, rgba(173, 137, 82, 0.86));
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  box-shadow: 0 24px 70px rgba(58, 38, 18, 0.28);
  transform: translateY(22px) scale(0.96);
}

.loading-screen.is-revealing .loading-card {
  animation: loadingTextLeave 0.5s ease forwards;
}

.loading-screen.is-revealing .result-envelope-reveal {
  animation: revealEnvelopeLayer 0.65s ease forwards;
}

.loading-screen.is-revealing .result-envelope-reveal span {
  animation: revealEnvelopeOpen 0.65s cubic-bezier(0.2, 0.74, 0.24, 1) forwards;
}

@keyframes loadingTextLeave {
  to {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes revealEnvelopeLayer {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(2px);
  }
}

@keyframes revealEnvelopeOpen {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  55% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-18px) scale(1.08);
    clip-path: polygon(0 0, 50% 18%, 100% 0, 100% 100%, 0 100%);
  }
}

@keyframes lineIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes quizVeil {
  0% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
  }
}

@keyframes fadeDrift {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes paperArrive {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.985);
    filter: blur(5px);
  }
  60% {
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes cardArrive {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  100% {
    opacity: var(--card-opacity);
    transform: translateX(var(--drag-offset)) translateY(0) scale(var(--card-scale));
  }
}

.result-screen {
  align-items: stretch;
  background:
    radial-gradient(circle at 18% 14%, rgba(126, 45, 38, 0.12), transparent 19rem),
    linear-gradient(135deg, #d5be8b, #f2e4c8 50%, #bda575);
}

.result-layout {
  width: min(1080px, 100%);
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(280px, 0.74fr) minmax(420px, 1.26fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: stretch;
}

.sender-panel,
.result-letter {
  border: 1px solid rgba(43, 33, 24, 0.13);
  border-radius: 2px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.44), transparent 38%),
    rgba(239, 226, 197, 0.82);
  box-shadow: 0 22px 60px rgba(35, 28, 19, 0.13);
}

.sender-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 44px);
}

.portrait {
  width: min(250px, 72vw);
  aspect-ratio: 0.82 / 1;
  margin: 28px auto 22px;
  border: 1px solid rgba(43, 33, 24, 0.13);
  background:
    radial-gradient(circle at 50% 23%, var(--portrait-light, #d9c596) 0 12%, transparent 13%),
    radial-gradient(ellipse at 50% 42%, var(--portrait, #5a564f) 0 25%, transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 42%),
    repeating-linear-gradient(0deg, rgba(35, 25, 17, 0.09) 0 1px, transparent 1px 18px),
    #d7c195;
  position: relative;
  overflow: hidden;
}

.portrait::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 9%;
  width: 46%;
  height: 38%;
  transform: translateX(-50%);
  border-radius: 45% 45% 8px 8px;
  background: var(--portrait, #5a564f);
  opacity: 0.76;
}

.portrait::after {
  content: attr(data-mark);
  position: absolute;
  right: 16px;
  bottom: 12px;
  color: rgba(39, 31, 24, 0.45);
  font-family: "Cormorant Garamond", serif;
  font-size: 3.8rem;
  font-weight: 700;
}

.sender-panel h2 {
  margin: 0;
  font-size: clamp(2.25rem, 4.4vw, 4rem);
  line-height: 0.96;
}

.sender-panel p:not(.kicker) {
  margin: 16px 0 0;
  color: #4c4137;
  font-family: "Noto Serif SC", serif;
  line-height: 1.75;
}

.result-letter {
  padding: clamp(24px, 5vw, 58px);
  overflow: auto;
}

.result-letter h2 {
  margin: 12px 0 22px;
  font-size: clamp(2rem, 3.8vw, 3.7rem);
  line-height: 1;
}

.letter-body {
  display: grid;
  gap: 18px;
  font-family: "Noto Serif SC", serif;
  color: #3f352d;
  font-size: clamp(1rem, 1.42vw, 1.12rem);
  line-height: 1.9;
}

.letter-body p {
  margin: 0;
}

blockquote {
  margin: 30px 0;
  padding: 18px 22px;
  border-left: 3px solid var(--red);
  background: rgba(255, 250, 239, 0.48);
  color: #4a3829;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.35;
}

.share-card {
  margin: 0 0 26px;
  min-height: 190px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  border: 1px solid rgba(43, 33, 24, 0.28);
  background:
    radial-gradient(circle at 88% 24%, rgba(126, 45, 38, 0.1), transparent 10rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.42), transparent 38%),
    repeating-linear-gradient(0deg, rgba(48, 35, 22, 0.08) 0 1px, transparent 1px 24px),
    #ead8b4;
  padding: 22px;
  overflow: hidden;
}

.share-card p,
.share-card span {
  margin: 0;
  color: #7a321f;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.share-card strong {
  display: block;
  max-width: 640px;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: clamp(1.4rem, 3vw, 2.6rem);
  line-height: 1.12;
}

.tonight-action {
  border: 1px solid rgba(43, 33, 24, 0.22);
  background: rgba(232, 212, 168, 0.56);
  padding: 20px;
}

.tonight-action h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.tonight-action p {
  margin: 0;
  color: #4b4035;
  font-family: "Noto Serif SC", serif;
  line-height: 1.7;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button-row .primary-button {
  justify-self: auto;
  min-width: 0;
}

.result-screen {
  align-items: start;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 250, 0.42), transparent 30rem),
    linear-gradient(135deg, #eeeae1, #e9e4da 52%, #ddd8ce);
  padding-block: clamp(28px, 7vw, 78px);
}

.result-paper {
  width: min(900px, calc(100vw - 32px));
  min-height: auto;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 76px) clamp(28px, 7vw, 88px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 250, 0.46), transparent 28rem),
    linear-gradient(180deg, #f0ece4, #e9e5dc);
  border: 0;
  box-shadow: 0 24px 80px rgba(62, 58, 50, 0.1);
  color: #2e2a22;
}

.result-heading {
  text-align: center;
  max-width: 720px;
  margin: 0 auto clamp(40px, 6vw, 64px);
}

.result-status {
  margin: 0 0 16px;
  color: rgba(46, 42, 34, 0.42);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sender-kicker {
  margin: 0 0 18px;
  color: rgba(46, 42, 34, 0.74);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.12rem, 2vw, 1.45rem);
}

.sender-portrait-wrap {
  width: min(260px, 58vw);
  aspect-ratio: 3 / 4;
  margin: 0 auto 24px;
  overflow: hidden;
  opacity: 0.9;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 86%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 8%, #000 86%, transparent 100%);
}

.sender-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: sepia(0.08) saturate(0.82) contrast(0.96);
  mix-blend-mode: multiply;
}

.sender-portrait[hidden] {
  display: none;
}

.result-heading h2 {
  margin: 0;
  color: #a89770;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: clamp(2.8rem, 6vw, 4.7rem);
  line-height: 1.05;
  font-weight: 500;
}

.result-heading p:last-child {
  max-width: 640px;
  margin: 22px auto 0;
  color: rgba(46, 42, 34, 0.54);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  font-style: italic;
  line-height: 1.9;
}

.result-divider {
  position: relative;
  height: 1px;
  margin: 0 auto clamp(34px, 5vw, 54px);
  max-width: 760px;
  background: rgba(46, 42, 34, 0.11);
}

.result-divider span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 24px;
  transform: translate(-50%, -50%);
  background: #e9e5dc;
}

.result-divider span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 16px;
  transform: translate(-50%, -50%);
  border: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='16' viewBox='0 0 22 16' fill='none'%3E%3Crect x='1.5' y='2.5' width='19' height='11' rx='1.5' stroke='%23a89770' stroke-width='1.8'/%3E%3Cpath d='M3 4l8 6 8-6M3 12l5.6-4.4M19 12l-5.6-4.4' stroke='%23a89770' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.result-divider span::after {
  content: none;
}

.result-paper .letter-trace {
  display: none;
}

.result-paper > h2 {
  max-width: 720px;
  margin: 0 auto clamp(22px, 3.2vw, 32px);
  color: rgba(46, 42, 34, 0.8);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(1.04rem, 1.75vw, 1.2rem);
  font-weight: 400;
  line-height: 2.05;
  text-align: left;
}

.result-paper .letter-body {
  max-width: 720px;
  margin: 0 auto;
  gap: clamp(22px, 3.2vw, 32px);
  color: rgba(46, 42, 34, 0.8);
  font-size: clamp(1.04rem, 1.75vw, 1.2rem);
  line-height: 2.05;
}

.result-paper blockquote {
  max-width: 720px;
  margin: clamp(42px, 6vw, 68px) auto;
  padding: clamp(22px, 4vw, 34px) clamp(24px, 4vw, 42px);
  border-left: 4px solid #9b8a65;
  background: rgba(231, 226, 216, 0.72);
  color: rgba(46, 42, 34, 0.82);
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  line-height: 1.55;
}

.result-paper .tonight-action {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 36px) 0 0;
  border: 0;
  border-top: 1px solid rgba(46, 42, 34, 0.13);
  background: transparent;
}

.result-paper .tonight-action h3 {
  margin: 0 0 18px;
  color: rgba(46, 42, 34, 0.48);
  font-family: "Noto Serif SC", serif;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.result-paper .tonight-action p {
  color: #2e2a22;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.65;
  white-space: pre-line;
}

.result-paper .button-row {
  justify-content: center;
  margin-top: clamp(42px, 6vw, 68px);
}

.result-paper .button-row button {
  box-shadow: none;
}

.result-paper #saveButton {
  border: 1px solid rgba(46, 42, 34, 0.48);
  color: #2e2a22;
  background: transparent;
}

.result-paper #shareButton {
  border: 1px solid #a89770;
  color: #f3ecd8;
  background: #a89770;
}

.result-paper #restartButton {
  border: 0;
  color: rgba(46, 42, 34, 0.56);
  background: transparent;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 8;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 13px 16px;
  color: #fff8e7;
  background: rgba(32, 27, 22, 0.94);
  border-radius: 4px;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .screen {
    padding: 14px;
  }

  .home-scene-art {
    height: 44vh;
    opacity: 0.68;
  }

  .home-scene-art img {
    object-position: 58% bottom;
    opacity: 0.38;
  }

  .sender-loading-art img {
    object-position: center center;
  }

  .loading-card {
    justify-self: center;
    margin: 0 20px;
    width: calc(100vw - 40px);
    text-align: center;
    place-items: center;
  }

  .loading-card h2 {
    font-size: clamp(1.8rem, 9vw, 3rem);
  }

  .loading-lines {
    justify-items: center;
  }

  .quiz-scene-art {
    height: 38vh;
  }

  .quiz-scene-art img {
    object-position: 60% 8%;
    opacity: 0.28;
  }

  .archive-shell {
    min-height: calc(100vh - 28px);
  }

  .home-layout {
    justify-content: flex-start;
    padding: clamp(34px, 8vh, 58px) 18px 34px;
  }

  .language-block {
    width: min(330px, 82vw);
    margin-left: auto;
    margin-right: auto;
  }

  .home-copy {
    order: initial;
  }

  .envelope-panel {
    order: initial;
  }

  .envelope-button {
    min-height: 270px;
    padding: 6px;
  }

  .record-card {
    display: none;
  }

  .quiz-shell {
    padding: 22px;
    gap: 18px;
  }

  .quiz-header {
    align-items: center;
    flex-direction: row;
  }

  .quiz-header .ghost-button {
    position: static;
  }

  .progress-wrap {
    width: auto;
  }

  .letter-paper {
    padding: 22px;
  }

  .carousel-area {
    grid-template-columns: 38px 1fr 38px;
    grid-template-rows: auto 16px;
    min-height: 236px;
  }

  .option-track {
    min-height: 236px;
    grid-template-columns: 1fr;
    cursor: grab;
  }

  .slider-rail {
    grid-column: 2;
    width: 100%;
  }

  .option-card {
    display: none;
    min-height: 218px;
    text-align: left;
  }

  .option-card.active {
    display: block;
  }

  .nav-button {
    width: 36px;
    height: 36px;
  }

  .result-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sender-panel {
    min-height: auto;
  }

  .portrait {
    width: min(220px, 70vw);
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.9rem;
  }

  .archive-shell::before,
  .archive-shell::after {
    inset: 12px;
  }

  .home-layout,
  .quiz-shell,
  .sender-panel,
  .result-letter {
    padding: 20px;
  }

  .button-row {
    display: grid;
  }

  .button-row button {
    width: 100%;
  }
}
