:root {
  --bg-deep: #f2ede0;
  --bg-glow: #e8e0cc;
  --dot-color: #9c9690;
  --accent: #8a8478;
  --ink: #2b2822;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  font-family: "Segoe UI", "Poppins", Arial, sans-serif;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-deep);
  background-image: radial-gradient(
    circle,
    var(--dot-color) 1.4px,
    transparent 1.6px
  );
  background-size: 26px 26px;
  background-position: 0 0;
}

.stage::after {
  content: "";
  position: absolute;
  bottom: 6%;
  left: 50%;
  width: min(75vw, 900px);
  height: 40px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.22) 0%, transparent 75%);
  transform: translateX(-50%);
  pointer-events: none;
}

#book-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(80%, 800px);
  height: min(65%, 520px);
  margin: 0 auto;
}

@media (orientation: landscape) and (max-height: 520px) {
  #book-container {
    width: min(60%, 460px);
    height: min(78%, 320px);
  }
}

#book {
  position: relative;
  filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.28));
}

.page {
  background-color: #fff;
  overflow: hidden;
  border: 3px solid #b3a586;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    inset 0 0 30px rgba(0, 0, 0, 0.12),
    0 2px 10px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(110, 95, 65, 0.18);
}

.page-cover {
  border-color: #9e9e9d;
}

#spine-shadow {
  position: absolute;
  top: 0%;
  bottom: 0%;
  left: 50%;
  width: 140px;
  transform: translateX(-50%);
  background:
    linear-gradient(
      to right,
      transparent 30%,
      rgba(255, 255, 255, 0.08) 42%,
      transparent 50%
    ),
    linear-gradient(
      to left,
      transparent 30%,
      rgba(255, 255, 255, 0.08) 42%,
      transparent 50%
    ),
    linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.03) 20%,
      rgba(0, 0, 0, 0.15) 40%,
      rgba(0, 0, 0, 0.35) 48%,
      transparent 50%
    ),
    linear-gradient(
      to left,
      transparent 0%,
      rgba(0, 0, 0, 0.03) 20%,
      rgba(0, 0, 0, 0.15) 40%,
      rgba(0, 0, 0, 0.35) 48%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 25% 100% at 50% 50%,
      rgba(0, 0, 0, 0.75) 0%,
      rgba(0, 0, 0, 0.5) 20%,
      rgba(0, 0, 0, 0.2) 45%,
      transparent 75%
    );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

#spine-shadow.visible {
  opacity: 1;
}

.stf__outerShadow,
.stf__innerShadow,
.stf__hardShadow,
.stf__hardInnerShadow {
  mix-blend-mode: multiply !important;
  opacity: 0.5 !important;
  filter: blur(3px);
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

#spiral-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.18s ease;
}

#spiral-canvas.fade-out {
  opacity: 0;
}

.hint-text {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(43, 40, 34, 0.55);
  font-size: 12.5px;
  font-weight: 400;
  font-family: "Quicksand", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.5px;
  z-index: 20;
  pointer-events: none;
  text-align: center;
}

#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 22px;
  background-color: var(--bg-deep);
  background-image: radial-gradient(
    circle,
    var(--dot-color) 1.4px,
    transparent 1.6px
  );
  background-size: 26px 26px;
  color: #000000;
  text-align: center;
  padding: 32px;
}

#rotate-overlay .phone-icon {
  width: 64px;
  height: 104px;
  border: 5px solid #000000;
  border-radius: 12px;
  position: relative;
  animation: rotateHint 1.8s ease-in-out infinite;
}

#rotate-overlay .phone-icon::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: #000000;
  transform: translateX(-50%);
}

@keyframes rotateHint {
  0% {
    transform: rotate(0deg);
  }
  45% {
    transform: rotate(-90deg);
  }
  75% {
    transform: rotate(-90deg);
  }
  100% {
    transform: rotate(-90deg);
  }
}

#rotate-overlay .rotate-title {
  font-size: 18px;
  font-weight: 500;
  font-family: "Quicksand", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.3px;
  color: #000000;
}

#rotate-overlay .rotate-sub {
  font-size: 13.5px;
  font-family: "Quicksand", "Segoe UI", Arial, sans-serif;
  color: rgba(0, 0, 0, 0.6);
  max-width: 260px;
}

@media (max-width: 480px) {
  .hint-text {
    font-size: 11.5px;
    padding: 0 16px;
  }
}
