:root {
  --ink: #211b18;
  --paper: #eadfcb;
  --paper-dark: #c9b88f;
  --wood: #6f4630;
  --wood-dark: #36231d;
  --wall: #8b7b66;
  --wall-shadow: #574b43;
  --blue: #496a73;
  --red: #8d3d34;
  --gold: #c29a4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #141212;
  font-family: Georgia, "Times New Roman", serif;
}

button,
input {
  font: inherit;
}

.scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.door-view {
  position: absolute;
  inset: 0;
}

.door-view {
  display: block;
  background: #141212;
}

.door-view[hidden] {
  display: none;
}

.door-view::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.16)),
    url("/assets/entry/hall-door.png") center / cover;
  transform: scale(1);
  animation: firstWalk 1500ms linear forwards, cameraBob 1250ms ease-in-out 1;
}

.door-view.is-close::before {
  animation: none;
  transform: scale(1.52);
}

.door-view.entering::before {
  opacity: 0;
}

.door-frame {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: min(52vw, 520px);
  height: min(78vh, 760px);
  padding: 18px;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -48%);
  transform-origin: center bottom;
}

.door {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.key-label {
  position: absolute;
  z-index: 4;
  left: 55vw;
  top: 44vh;
  width: min(42vw, 680px);
  aspect-ratio: 1619 / 971;
  padding: 0;
  background: transparent;
  border: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
  transition: opacity 500ms ease, transform 700ms ease;
}

.door-view.key-ready .key-label {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  animation: hoverNote 3600ms ease-in-out 700ms infinite;
}

.door-view.key-ready .key-label.denied {
  animation: keyDenied 420ms ease-in-out;
}

.door-view.key-ready .door-frame,
.door-view.entering .door-frame {
  pointer-events: none;
}

.fade-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fade-overlay {
  z-index: 6;
  background: #050404;
  opacity: 0;
  transition: opacity 450ms ease;
}

.fade-overlay.visible {
  opacity: 1;
}

.phone-notice {
  width: min(88vw, 390px);
  padding: 28px 26px 24px;
  border: 1px solid rgba(194, 154, 74, 0.48);
  border-radius: 3px;
  color: #e6d9c2;
  background:
    linear-gradient(rgba(23, 19, 17, 0.96), rgba(12, 10, 9, 0.98)),
    #171311;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
  text-align: center;
}

.phone-notice::backdrop {
  background: rgba(5, 4, 4, 0.82);
  backdrop-filter: blur(4px);
}

.phone-notice h1 {
  margin: 0 0 14px;
  color: #eadfcb;
  font-size: 1.38rem;
  font-weight: 500;
}

.phone-notice p {
  margin: 0;
  color: #cbbda6;
  font-size: 0.98rem;
  line-height: 1.55;
}

.phone-notice form {
  margin-top: 22px;
}

.phone-notice button {
  min-width: 150px;
  padding: 10px 18px;
  border: 1px solid rgba(194, 154, 74, 0.56);
  border-radius: 2px;
  color: #eadfcb;
  background: rgba(86, 59, 38, 0.72);
  cursor: pointer;
}

.phone-notice button:focus-visible {
  outline: 2px solid #d2aa62;
  outline-offset: 3px;
}

.key-paper-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scaleX(-1);
  pointer-events: none;
}

.key-label input {
  position: absolute;
  left: 16%;
  top: 66%;
  width: 55%;
  height: 15%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 2%;
  color: #4b382b;
  caret-color: #4b382b;
  font-family: "Segoe Print", "Bradley Hand", cursive;
  font-size: clamp(16px, 2vw, 30px);
  letter-spacing: 0.14em;
  text-align: center;
  transform: rotate(-3.5deg);
  transform-origin: center;
  appearance: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes firstWalk {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.052);
  }
}

@keyframes cameraBob {
  0%,
  100% {
    background-position: center center;
  }
  25% {
    background-position: center calc(50% - 8px);
  }
  50% {
    background-position: center calc(50% + 4px);
  }
  75% {
    background-position: center calc(50% - 5px);
  }
}

@keyframes hoverNote {
  0%,
  100% {
    transform: translateY(0) rotate(0.5deg);
  }
  50% {
    transform: translateY(-8px) rotate(-0.5deg);
  }
}

@keyframes keyDenied {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-14px) rotate(-1deg);
  }
  40% {
    transform: translateX(12px) rotate(1deg);
  }
  60% {
    transform: translateX(-9px) rotate(-0.6deg);
  }
  80% {
    transform: translateX(6px) rotate(0.4deg);
  }
}

@media (max-width: 720px) {
  .key-label {
    left: 43vw;
    top: 44vh;
    width: 86vw;
  }

}
