/* ═══════════════════════════════════════════════════════════
   SCENE 09 — The Letter
═══════════════════════════════════════════════════════════ */

/* Parchment scene — the whole screen is the letter */
#scene-09 {
  background-color: #f5e8c8;
  /* Subtle warm-paper texture via layered gradients */
  background-image:
    radial-gradient(ellipse at 15% 25%, rgba(210,165,90,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 75%, rgba(200,155,80,0.14) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(240,210,150,0.10) 0%, transparent 70%);
  z-index: 46;
  overflow: hidden;
}

body.scene9-active #stage #scene-09 {
  animation: s9FadeIn 1.2s both;
  pointer-events: auto;
}
@keyframes s9FadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Scrollable letter area ─────────────────────────────── */
/* Sits above the pinned Continue button */
#s9-letter-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 72px;      /* leave room for Continue button */
  overflow-y: auto;
  overflow-x: hidden;
  /* Custom scrollbar — warm tones to match parchment */
  scrollbar-width: thin;
  scrollbar-color: rgba(160,110,55,0.45) transparent;
}
#s9-letter-area::-webkit-scrollbar {
  width: 5px;
}
#s9-letter-area::-webkit-scrollbar-thumb {
  background: rgba(160,110,55,0.4);
  border-radius: 3px;
}

/* ── Letter card ────────────────────────────────────────── */
#s9-letter {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 48px 28px;
  position: relative;
  animation: s9LetterRise 0.9s 0.5s both;
}
@keyframes s9LetterRise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* Top ornamental border line */
.s9-rule-top {
  height: 2px;
  background: linear-gradient(to right, transparent, #b8803a 20%, #b8803a 80%, transparent);
  margin-bottom: 18px;
}

/* ── Heart ornament ─────────────────────────────────────── */
.s9-ornament {
  text-align: center;
  font-size: 26px;
  color: #b01c1c;
  line-height: 1;
  margin-bottom: 14px;
  text-shadow: 0 1px 6px rgba(176, 28, 28, 0.35);
  letter-spacing: 0;
}

/* ── "To: Kisha" ────────────────────────────────────────── */
.s9-to {
  font-family: 'Georgia', serif;
  font-size: 22px;
  font-style: italic;
  color: #6b1c1c;
  text-align: center;
  margin: 0 0 10px;
  letter-spacing: 0.5px;
}

/* ── Decorative divider ─────────────────────────────────── */
.s9-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
}
.s9-divider-bottom {
  margin: 20px 0 18px;
}
.s9-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #c09050);
}
.s9-divider-bottom .s9-divider-line:last-child {
  background: linear-gradient(to left, transparent, #c09050);
}
.s9-divider-line:last-child {
  background: linear-gradient(to left, transparent, #c09050);
}
.s9-divider-diamond {
  font-size: 9px;
  color: #b8803a;
  line-height: 1;
}

/* ── Letter body ────────────────────────────────────────── */
.s9-body {
  font-family: 'Georgia', serif;
  font-size: 15.5px;
  line-height: 1.82;
  color: #2a150a;
  text-align: justify;
}
.s9-body p {
  margin: 0 0 18px;
}
.s9-body p:last-child {
  margin-bottom: 0;
}

/* ── Signature ──────────────────────────────────────────── */
.s9-signature {
  font-family: 'Georgia', serif;
  font-size: 17px;
  font-style: italic;
  color: #5a1a0e;
  text-align: right;
  margin: 0;
  line-height: 1.6;
}

/* ── Continue button (pinned at bottom of scene) ────────── */
.s9-continue-btn {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  padding: 11px 42px;
  background: #7a2c0e;
  color: #f8edd8;
  font-family: 'Bangers', 'Impact', cursive;
  font-size: 30px;
  letter-spacing: 3px;
  border: 2px solid #3d1207;
  border-radius: 5px;
  box-shadow: 3px 3px 0 #3d1207;
  cursor: pointer;
  z-index: 20;
  white-space: nowrap;
  transition: background 0.08s, box-shadow 0.08s;
}
.s9-continue-btn:hover  { background: #9a3a12; box-shadow: 5px 5px 0 #3d1207; }
.s9-continue-btn:active { background: #5a200a; box-shadow: 1px 1px 0 #3d1207; }

/* Bottom fade — softens the letter into the button bar */
#scene-09::after {
  content: '';
  position: absolute;
  bottom: 72px;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, #f5e8c8);
  pointer-events: none;
  z-index: 10;
}

/* ── Portrait adjustments ───────────────────────────────── */
@media (orientation: portrait) {
  #s9-letter         { padding: 24px 28px 22px; }
  .s9-body           { font-size: 14.5px; }
  .s9-to             { font-size: 19px; }
  .s9-ornament       { font-size: 22px; }
  .s9-signature      { font-size: 15px; }
  .s9-continue-btn   { font-size: 26px; padding: 10px 32px; }
  #s9-letter-area    { bottom: 66px; }
  #scene-09::after   { bottom: 66px; }
}
