:root {
  --bg: #04080f;
  --deep: #0a1622;
  --sand: #e6d8bd;
  --amber: #e2b16a;
  --teal: #6d9ba1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--sand);
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.experience,
.panel,
.scene-shell {
  position: absolute;
  inset: 0;
}

.experience {
  z-index: 2;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.scene-shell {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 56%, rgba(236, 228, 210, 0.018), transparent 24%),
    radial-gradient(circle at 72% 34%, rgba(109, 155, 161, 0.045), transparent 28%),
    radial-gradient(circle at 28% 78%, rgba(226, 177, 106, 0.032), transparent 20%),
    linear-gradient(180deg, #02060b, #08111a 56%, #061018);
}

.scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  animation: page-canvas-fade-in 900ms cubic-bezier(0.2, 0.8, 0.18, 1) both;
}

.epilogue-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.016), transparent 18%),
    radial-gradient(circle at 50% 54%, rgba(236, 228, 210, 0.016), transparent 24%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 58px,
      rgba(255, 255, 255, 0.006) 59px
    );
  mix-blend-mode: soft-light;
}

.epilogue-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 54%, transparent 14%, rgba(2, 7, 14, 0.26) 68%, rgba(2, 7, 14, 0.42) 100%),
    linear-gradient(180deg, rgba(2, 7, 14, 0.18), transparent 18%, transparent 74%, rgba(2, 7, 14, 0.34));
}

.epilogue-overlay {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  padding: 6vh clamp(1.4rem, 3.8vw, 4rem) 4vh;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 2rem;
  animation: page-ui-fade-in 780ms cubic-bezier(0.2, 0.8, 0.18, 1) both;
  animation-delay: 90ms;
  pointer-events: none;
}

.epilogue-hero {
  position: absolute;
  right: 3rem;
  bottom: calc(50% + 3.9rem);
  z-index: 12;
  width: min(42rem, 72vw);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  pointer-events: none;
}

.epilogue-title {
  margin: 0;
  font-size: clamp(3.4rem, 7.8vw, 6.2rem);
  line-height: 0.94;
  font-weight: 500;
  letter-spacing: -0.045em;
  color: rgba(236, 228, 210, 0.92);
  text-shadow:
    0 0 14px rgba(232, 219, 188, 0.05),
    0 0 34px rgba(226, 177, 106, 0.024),
    0 20px 48px rgba(0, 0, 0, 0.46);
}

.epilogue-description {
  margin: 2.2rem 0 0;
  width: 100%;
  color: rgba(227, 223, 212, 0.66);
  line-height: 1.9;
  font-size: clamp(0.98rem, 1.02vw, 1.06rem);
  letter-spacing: 0.012em;
  word-break: keep-all;
  text-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    0 0 18px rgba(236, 228, 210, 0.018);
}

.epilogue-description span {
  display: block;
  white-space: nowrap;
}

.epilogue-ticker {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  justify-self: end;
  color: rgba(224, 220, 209, 0.26);
  font-family: "Courier New", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  padding-bottom: 0.45rem;
  animation: page-ui-fade-in 780ms cubic-bezier(0.2, 0.8, 0.18, 1) both;
  animation-delay: 140ms;
  pointer-events: none;
}

.epilogue-ticker p {
  margin: 0;
}

.epilogue-ticker p::after {
  content: " /";
  margin-left: 1.25rem;
  color: rgba(226, 177, 106, 0.24);
}

.epilogue-ticker p:last-child::after {
  content: "";
  margin: 0;
}

.panel-nav {
  position: absolute;
  z-index: 11;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.92rem 1rem;
  color: var(--sand);
  border: 1px solid rgba(230, 216, 189, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.006)),
    rgba(7, 12, 20, 0.56);
  box-shadow:
    inset 0 0 0 1px rgba(226, 177, 106, 0.025),
    0 18px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
  animation: page-ui-fade-in 820ms cubic-bezier(0.2, 0.8, 0.18, 1) both;
  animation-delay: 180ms;
}

.panel-prev {
  left: 3rem;
}

.panel-prev::after {
  content: "\2190";
  font-size: 1rem;
}

.panel-next {
  right: 3rem;
}

.panel-next::after {
  content: "\2192";
  font-size: 1rem;
}

.panel-next-arrow {
  width: 4.35rem;
  height: 4.35rem;
  padding: 0;
  justify-content: center;
  border-color: rgba(230, 216, 189, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), rgba(255, 255, 255, 0.004)),
    rgba(7, 12, 20, 0.4);
  box-shadow:
    inset 0 0 0 1px rgba(226, 177, 106, 0.02),
    0 14px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(4px);
}

.panel-next-arrow::after {
  content: "";
}

.panel-next-arrow span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: 0;
  transform: translateX(0.06rem);
}

.panel-nav:hover {
  transform: translateY(calc(-50% - 2px));
  border-color: rgba(226, 177, 106, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(226, 177, 106, 0.08),
    0 24px 42px rgba(0, 0, 0, 0.26);
}

.chapter-transition {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  transition: opacity 220ms ease;
}

.transition-film {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 46% 52%, rgba(255, 247, 228, 0.18), transparent 24%),
    linear-gradient(90deg, rgba(226, 177, 106, 0), rgba(226, 177, 106, 0.08), rgba(226, 177, 106, 0));
}

body.arrival-transition .chapter-transition,
body.departure-transition .chapter-transition {
  opacity: 1;
}

body.arrival-transition .transition-film {
  animation: transition-film-fade 860ms cubic-bezier(0.18, 0.82, 0.14, 1) forwards;
}

body.departure-transition .transition-film {
  animation: transition-film-fade 720ms cubic-bezier(0.18, 0.82, 0.14, 1) forwards reverse;
}

body.arrival-transition .epilogue-shell {
  animation: epilogue-shell-arrive 900ms cubic-bezier(0.18, 0.82, 0.14, 1) both;
}

body.departure-transition .epilogue-shell {
  animation: epilogue-shell-depart 720ms cubic-bezier(0.2, 0.78, 0.14, 1) both;
}

body:not(.text-ready) .epilogue-overlay,
body:not(.text-ready) .panel-nav {
  opacity: 0;
  transform: translateY(12px);
  filter: blur(8px);
  pointer-events: none;
  animation: none !important;
}

body.text-ready .epilogue-overlay,
body.text-ready .epilogue-ticker,
body.text-ready .panel-nav {
  animation: page-ui-fade-in 780ms cubic-bezier(0.2, 0.8, 0.18, 1) both;
}

@keyframes epilogue-shell-arrive {
  0% {
    opacity: 0.5;
    transform: scale(1.018);
    filter: blur(8px) brightness(0.72) saturate(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0) brightness(1) saturate(1);
  }
}

@keyframes epilogue-shell-depart {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0) brightness(1) saturate(1);
  }
  100% {
    opacity: 0.72;
    transform: scale(1.014);
    filter: blur(6px) brightness(0.8) saturate(0.9);
  }
}

@keyframes page-ui-fade-in {
  0% {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes page-canvas-fade-in {
  0% {
    opacity: 0;
    filter: blur(12px) brightness(0.72);
  }
  100% {
    opacity: 1;
    filter: blur(0) brightness(1);
  }
}

@keyframes transition-film-fade {
  0% {
    opacity: 0;
    transform: scale(1.04);
    filter: blur(10px);
  }
  48% {
    opacity: 0.84;
  }
  100% {
    opacity: 0;
    transform: scale(1);
    filter: blur(0);
  }
}

@media (max-width: 900px) {
  .epilogue-hero {
    right: 1.4rem;
    bottom: 8.5rem;
    width: min(36rem, calc(100vw - 2.8rem));
  }

  .panel-prev {
    left: 1.4rem;
  }

  .panel-next {
    right: 1.4rem;
  }
}

@media (max-width: 720px) {
  .epilogue-overlay {
    padding: 1.25rem;
  }

  .epilogue-hero {
    bottom: 7.4rem;
    width: calc(100vw - 2.5rem);
  }

  .epilogue-title {
    font-size: clamp(2.9rem, 13vw, 4.2rem);
  }

  .epilogue-description {
    margin-top: 1.4rem;
    font-size: 0.94rem;
    line-height: 1.8;
  }

  .epilogue-description span {
    white-space: normal;
  }

  .epilogue-ticker {
    justify-self: start;
    padding-bottom: 5.8rem;
    font-size: 0.58rem;
    letter-spacing: 0.2em;
  }
}
