:root {
  color-scheme: light;
  --paper: #f7efd8;
  --ink: #5f4527;
  --gold: #d5a748;
  --gold-soft: rgba(213, 167, 72, 0.34);
  --shadow: rgba(103, 75, 36, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  padding: 0;
  font: inherit;
}

.card-app {
  min-height: 100svh;
  display: block;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 249, 232, 0.84), transparent 42%),
    var(--paper);
}

.screen {
  width: 100%;
  min-height: 100svh;
  display: none;
}

.screen.is-active {
  display: block;
  animation: screen-in 420ms ease both;
}

.image-stage {
  position: relative;
  width: min(100vw, 941px);
  display: block;
  margin: 0 auto;
  background: transparent;
}

.image-stage > img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center top;
  user-select: none;
}

.photo-hotspot,
.seal-hotspot,
.music-toggle {
  position: absolute;
  z-index: 2;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.seal-hotspot {
  left: 42%;
  top: 46%;
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.photo-hotspot {
  width: 37.4%;
  height: 15.6%;
}

.photo-forest {
  left: 13.2%;
  top: 57.1%;
}

.photo-lake {
  left: 52.5%;
  top: 57.1%;
}

.photo-graduation {
  left: 13.8%;
  top: 74.8%;
}

.photo-hat {
  left: 52.4%;
  top: 74.8%;
}

.music-toggle {
  right: 4.6%;
  bottom: 3.3%;
  width: 10.2%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.envelope-music-toggle {
  left: 43.6%;
  right: auto;
  bottom: 8.2%;
  width: 12.8%;
}

.music-toggle.is-playing {
  box-shadow:
    0 0 0 8px rgba(255, 238, 190, 0.42),
    0 0 28px rgba(211, 157, 55, 0.45);
}

.music-wave {
  position: absolute;
  inset: -10%;
  border: 1px solid rgba(186, 130, 33, 0.36);
  border-radius: 50%;
  opacity: 0;
}

.music-toggle.is-playing .music-wave {
  animation: pulse 1600ms ease-out infinite;
}

.photo-hotspot:focus-visible,
.seal-hotspot:focus-visible,
.music-toggle:focus-visible,
.back-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -4px;
}

.photo-hotspot:active,
.seal-hotspot:active,
.music-toggle:active,
.back-button:active {
  transform: scale(0.992);
}

.back-button {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 6;
  min-width: 58px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(172, 126, 45, 0.35);
  border-radius: 999px;
  color: #76531f;
  background: rgba(255, 244, 211, 0.86);
  box-shadow: 0 10px 24px rgba(103, 75, 36, 0.16);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
}

.photo-viewer[hidden] {
  display: none;
}

.photo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 31, 18, 0.72);
  backdrop-filter: blur(12px);
}

.photo-frame {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  max-height: 92svh;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 250, 236, 0.96);
  box-shadow: 0 24px 80px rgba(35, 21, 10, 0.38);
}

.viewer-image {
  width: 100%;
  max-height: calc(92svh - 70px);
  display: block;
  object-fit: contain;
  border-radius: 6px;
  background: #eee3c8;
}

.viewer-caption {
  min-height: 22px;
  color: #76592b;
  font-size: 0.95rem;
  text-align: center;
}

.close-photo {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #7b5822;
  background: #fff2cd;
  box-shadow: 0 10px 24px var(--shadow);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  from {
    opacity: 0.8;
    transform: scale(0.84);
  }

  to {
    opacity: 0;
    transform: scale(1.45);
  }
}

@media (max-aspect-ratio: 3 / 4) {
  .image-stage {
    width: 100vw;
  }
}
