* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, #2e0e37 0%, #170b26 38%, #090610 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.orientation-lock {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 123, 192, 0.12), rgba(9, 6, 16, 0.92));
  color: rgba(255, 236, 248, 0.96);
}

body.is-orientation-locked .orientation-lock {
  display: flex;
}

.orientation-card {
  width: min(90vw, 420px);
  padding: 24px 22px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 157, 206, 0.18), rgba(82, 18, 52, 0.35));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 213, 237, 0.24);
  text-align: center;
}

.phone-icon {
  width: 56px;
  height: 84px;
  margin: 0 auto 16px;
  border: 3px solid rgba(255, 223, 243, 0.88);
  border-radius: 14px;
  position: relative;
  transform: rotate(90deg);
  animation: rotate-phone 1.6s ease-in-out infinite;
}

.phone-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 10px;
  height: 4px;
  margin-left: -5px;
  border-radius: 4px;
  background: rgba(255, 223, 243, 0.85);
}

.orientation-title {
  font-size: 22px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.orientation-subtitle {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 228, 244, 0.84);
}

@keyframes rotate-phone {
  0%,
  100% {
    transform: rotate(90deg) translateY(0);
  }
  50% {
    transform: rotate(90deg) translateY(-5px);
  }
}

.start-layer {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 44%, rgba(255, 125, 188, 0.1), rgba(9, 6, 16, 0.15) 46%, rgba(9, 6, 16, 0.62));
  transition: opacity 0.65s ease, visibility 0.65s ease;
}

.start-layer.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.envelope-btn {
  appearance: none;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  padding: 0;
  color: rgba(255, 231, 248, 0.95);
  transform: translateY(0);
  transition: transform 0.4s ease;
  isolation: isolate;
}

.envelope-btn:hover {
  transform: translateY(-4px);
}

.envelope {
  position: relative;
  display: block;
  width: min(36vw, 240px);
  aspect-ratio: 1.45 / 1;
  perspective: 900px;
  transform-style: preserve-3d;
  overflow: hidden;
  filter: drop-shadow(0 14px 28px rgba(255, 98, 160, 0.38));
}

.envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 10px;
  background: linear-gradient(165deg, #ffb3d9 0%, #ff8fc4 52%, #f973b0 100%);
}

.front {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64%;
  z-index: 4;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(160deg, #ff95c6 0%, #ff72b2 58%, #f1599e 100%);
  box-shadow:
    inset 0 10px 18px rgba(255, 255, 255, 0.14),
    inset 0 -8px 18px rgba(170, 40, 103, 0.28);
}

.front::before,
.front::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(160deg, rgba(255, 184, 215, 0.45), rgba(255, 121, 178, 0.18));
}

.front::before {
  left: 0;
  clip-path: polygon(0 0, 100% 52%, 0 100%);
}

.front::after {
  right: 0;
  clip-path: polygon(100% 0, 0 52%, 100% 100%);
}

.flap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 60%;
  z-index: 5;
  background: linear-gradient(155deg, #ffaad3 0%, #ff7fbc 100%);
  clip-path: polygon(0 0, 100% 0, 50% 88%);
  border-radius: 10px 10px 0 0;
  transform-origin: 50% 0;
  transition: transform 0.75s cubic-bezier(0.2, 0.7, 0.2, 1);
  backface-visibility: hidden;
  box-shadow: inset 0 -8px 16px rgba(192, 50, 118, 0.28);
}

.paper {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 10%;
  height: 72%;
  z-index: 3;
  background: linear-gradient(180deg, #fffafc 0%, #ffe7f4 100%);
  border-radius: 8px;
  transform: translateY(24%);
  transition: transform 0.72s cubic-bezier(0.18, 0.8, 0.18, 1);
  box-shadow: 0 8px 20px rgba(255, 124, 180, 0.22);
}

.paper::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 22%;
  height: 48%;
  background:
    linear-gradient(to bottom, rgba(255, 140, 186, 0.42) 0 2px, transparent 2px 15px),
    linear-gradient(to bottom, rgba(255, 140, 186, 0.38) 0 2px, transparent 2px 15px),
    linear-gradient(to bottom, rgba(255, 140, 186, 0.34) 0 2px, transparent 2px 15px);
  background-size: 100% 15px;
  background-position: 0 0, 0 16px, 0 32px;
  background-repeat: no-repeat;
  opacity: 0.75;
}

.envelope-btn.is-opening .flap {
  transform: rotateX(-172deg);
}

.envelope-btn.is-opening .paper {
  transform: translateY(-26%);
}

.start-text {
  position: relative;
  z-index: 10;
  font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: 0.12em;
  color: rgba(255, 231, 248, 0.9);
  text-shadow: 0 0 10px rgba(255, 108, 174, 0.7);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4vh;
}

.hint {
  color: rgba(255, 225, 246, 0.8);
  letter-spacing: 0.24em;
  font-size: clamp(12px, 1.4vw, 18px);
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 96, 155, 0.65);
  user-select: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.hint.show {
  opacity: 1;
}
