/* Eleventh chapter: a warm, intentionally blank letter for the final words. */

.scene--finale {
  color: #4b302f;
  background: #dda77f;
}

.finale__atmosphere {
  position: absolute;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 37%, rgba(255, 247, 206, 0.92) 0 8%, rgba(255, 223, 174, 0.5) 24%, transparent 56%),
    linear-gradient(136deg, #c98068 0%, #e5a47e 30%, #f3c596 58%, #d99977 100%);
}

.finale__atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background-image:
    radial-gradient(circle, rgba(102, 54, 47, 0.22) 0 1px, transparent 1.4px),
    repeating-linear-gradient(114deg, transparent 0 53px, rgba(255, 244, 220, 0.18) 54px, transparent 55px 108px);
  background-size: 22px 22px, auto;
  mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, 0.38) 56%, transparent 94%);
}

.finale__atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 232, 198, 0.16), transparent 32% 68%, rgba(117, 66, 58, 0.1)),
    linear-gradient(180deg, rgba(255, 247, 224, 0.18), transparent 54%, rgba(92, 52, 48, 0.14));
}

.finale__sun {
  position: absolute;
  top: 11%;
  left: 50%;
  width: clamp(210px, 27vw, 430px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 246, 202, 0.55);
  box-shadow:
    0 0 0 36px rgba(255, 240, 192, 0.08),
    0 0 120px 52px rgba(255, 228, 168, 0.24);
  transform: translateX(-50%);
}

.finale__haze {
  position: absolute;
  right: 10%;
  bottom: 18%;
  width: 42vw;
  height: 25vh;
  background: rgba(255, 239, 209, 0.16);
  filter: blur(52px);
  border-radius: 50%;
  transform: rotate(-8deg);
}

.finale__landscape {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 58%;
}

.scene--finale .scene__top {
  padding: 7px 10px;
  color: rgba(72, 43, 40, 0.72);
  background: rgba(255, 247, 229, 0.3);
  backdrop-filter: blur(8px);
}

.scene--finale .scene__top b {
  color: #88494d;
}

.finale__layout {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: min(1120px, calc(100vw - 10vw));
  height: 100%;
  padding: 82px 0 70px;
  margin: 0 auto;
}

.finale__letter {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(800px, 78vw);
  height: min(72svh, 700px);
  min-height: 480px;
  padding: clamp(38px, 4.2vw, 62px);
  background:
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(126, 89, 66, 0.075) 39px, transparent 40px),
    linear-gradient(132deg, rgba(255, 255, 255, 0.65), transparent 44%),
    rgba(255, 250, 237, 0.97);
  border: 1px solid rgba(116, 68, 58, 0.22);
  box-shadow:
    0 38px 84px rgba(101, 56, 48, 0.25),
    10px 11px 0 rgba(255, 245, 222, 0.27);
  transform: rotate(-0.35deg);
}

.finale__letter::before {
  content: "";
  position: absolute;
  inset: 17px;
  pointer-events: none;
  border: 1px solid rgba(116, 68, 58, 0.11);
}

.finale__ribbon {
  position: absolute;
  top: -16px;
  left: 50%;
  z-index: 4;
  width: 138px;
  height: 34px;
  background:
    linear-gradient(90deg, transparent 0 7%, rgba(255, 255, 255, 0.22) 8% 13%, transparent 14% 86%, rgba(255, 255, 255, 0.18) 87% 92%, transparent 93%),
    rgba(180, 104, 86, 0.8);
  box-shadow: 0 4px 9px rgba(109, 61, 52, 0.12);
  transform: translateX(-50%) rotate(1.5deg);
}

.finale__message {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px clamp(16px, 4vw, 58px);
  color: #5c3b38;
  font-family: var(--story-hand);
  font-size: clamp(21px, 2vw, 29px);
  line-height: 1.82;
  letter-spacing: 0.04em;
  text-align: center;
  text-wrap: pretty;
  white-space: pre-line;
}

.finale__message p {
  margin: 0;
}

.finale__message p + p {
  margin-top: 0.42em;
}

.finale__message .nowrap {
  white-space: nowrap;
}

.finale__actions {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 22px;
}

.back-button--finale {
  color: #7e4f4c;
  background: rgba(255, 250, 238, 0.45);
  border-color: rgba(126, 79, 76, 0.3);
}

.back-button--finale:hover {
  color: #5f3434;
  background: rgba(255, 250, 238, 0.78);
  border-color: rgba(126, 79, 76, 0.52);
}

.finale__seal {
  position: absolute;
  right: -30px;
  bottom: 34px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: rgba(255, 246, 228, 0.82);
  background: #a45158;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 5px rgba(255, 237, 216, 0.13),
    0 12px 25px rgba(92, 48, 45, 0.2);
  transform: rotate(8deg);
}

.finale__seal svg {
  width: 31px;
  fill: currentColor;
}

.finale__sprig {
  position: absolute;
  z-index: 2;
  width: 100px;
  height: 180px;
  opacity: 0.32;
  border-left: 1px solid #8a6c4e;
  border-radius: 50%;
}

.finale__sprig::before,
.finale__sprig::after {
  content: "";
  position: absolute;
  width: 42px;
  height: 20px;
  border: 1px solid #8a6c4e;
  border-radius: 100% 0 100% 0;
}

.finale__sprig::before {
  top: 43px;
  left: -42px;
  transform: rotate(21deg);
}

.finale__sprig::after {
  top: 80px;
  left: 0;
  transform: rotate(-36deg);
}

.finale__sprig--left {
  bottom: 66px;
  left: 51px;
  transform: rotate(-29deg);
}

.finale__sprig--right {
  top: 51px;
  right: 58px;
  transform: rotate(151deg);
}

.scene--finale .stage__footer {
  color: rgba(74, 43, 40, 0.62);
}

.scene--finale .scene-number b {
  color: #8d4a4f;
}

.scene--finale .scene-number i {
  background: rgba(74, 43, 40, 0.23);
}

.next-button--qingdao {
  color: #fffaf0;
  background: #a55947;
  border-color: #bb725b;
}

.next-button--qingdao:hover {
  color: #fffaf0;
  background: #7e3f36;
  border-color: #7e3f36;
}

@media (max-width: 900px) {
  .finale__layout {
    width: calc(100vw - 42px);
    padding: 68px 0 58px;
  }

  .finale__letter {
    width: min(680px, 90vw);
    height: min(70svh, 660px);
    min-height: 420px;
    padding: 34px 44px;
  }

  .finale__message {
    font-size: clamp(19px, 3.2vw, 25px);
  }

  .finale__seal {
    right: -24px;
    bottom: 30px;
    width: 62px;
    height: 62px;
  }
}

@media (max-width: 680px) {
  .finale__layout {
    width: calc(100vw - 38px);
    padding: 57px 0 48px;
  }

  .finale__letter {
    width: calc(100vw - 32px);
    height: min(73svh, 640px);
    min-height: 390px;
    padding: 26px 25px 22px;
  }

  .finale__letter::before {
    inset: 11px;
  }

  .finale__ribbon {
    top: -11px;
    width: 100px;
    height: 25px;
  }

  .finale__message {
    min-height: 0;
    padding: 14px 8px;
    font-size: clamp(18px, 5.2vw, 22px);
    line-height: 1.74;
  }

  .finale__actions {
    padding-top: 8px;
  }

  .back-button--finale {
    min-height: 39px;
    padding: 7px 12px;
    font-size: 10px;
  }

  .finale__seal {
    right: -15px;
    bottom: 24px;
    width: 50px;
    height: 50px;
    box-shadow:
      inset 0 0 0 4px rgba(255, 237, 216, 0.13),
      0 9px 18px rgba(92, 48, 45, 0.18);
  }

  .finale__seal svg {
    width: 23px;
  }

  .finale__sprig {
    width: 70px;
    height: 130px;
    opacity: 0.23;
  }

  .finale__sprig::before,
  .finale__sprig::after {
    width: 30px;
    height: 15px;
  }

  .finale__sprig--left {
    bottom: 53px;
    left: 34px;
  }

  .finale__sprig--right {
    top: 42px;
    right: 38px;
  }
}

@media (max-height: 650px) {
  .finale__layout {
    padding: 51px 0 40px;
  }

  .finale__letter {
    height: 73svh;
    min-height: 330px;
    padding-top: 23px;
    padding-bottom: 19px;
  }

  .finale__message {
    min-height: 165px;
    font-size: clamp(17px, 4.2vw, 21px);
    line-height: 1.64;
  }
}

@media (prefers-reduced-motion: reduce) {
  .finale__atmosphere *,
  .finale__letter {
    transition: none;
  }
}
