:root {
  --blue: #075c8d;
  --deep-blue: #003a66;
  --ice: #dff8ff;
  --paper: #fff8eb;
  --teal: #06a7bc;
  --gold: #ffc94d;
  --shadow: 0 20px 60px rgba(0, 38, 65, 0.34);
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #062a43;
  color: #073b5c;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  width: min(100vw, 820px);
  height: 100dvh;
  min-height: 620px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #d9e8f3;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.35);
}

.screen {
  position: absolute;
  inset: 0;
}

.ornament {
  position: absolute;
  left: 0;
  right: 0;
  height: 36px;
  z-index: 18;
  background:
    radial-gradient(circle at center, #00588f 0 8px, #fff 9px 12px, transparent 13px),
    repeating-linear-gradient(90deg, transparent 0 16px, #00558b 16px 22px, transparent 22px 32px),
    #fff9ee;
  border-block: 3px solid #075c8d;
}

.ornament-top {
  top: 0;
}

.ornament-bottom {
  bottom: 0;
}

.map-viewport {
  position: absolute;
  inset: 36px 0 106px;
  overflow: hidden;
  touch-action: none;
  background: #99d5e6;
}

.map-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(1180px, calc((100dvh - 142px) * 1.34));
  height: max(885px, calc(100dvh - 142px));
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  background: url("../assets/map-bg.jpg") center / cover no-repeat;
}

.home-btn {
  position: absolute;
  top: 28px;
  left: 28px;
  width: 92px;
  height: 92px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  z-index: 4;
}

.home-btn img,
.map-marker img {
  width: 100%;
  height: 100%;
  display: block;
}

.map-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 96px;
  height: 102px;
  padding: 0;
  transform: translate(-50%, -50%);
  background: transparent;
  z-index: 5;
  filter: drop-shadow(0 0 12px rgba(255,255,255,.9));
  animation: pulse 1.35s ease-in-out infinite;
}

.map-marker.is-viewed {
  animation: none;
  filter: saturate(.9) brightness(.94);
}

.poster-marker {
  width: 106px;
  height: 112px;
}

.instruction {
  position: absolute;
  inset: 36px 0 106px;
  z-index: 25;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  text-align: center;
  color: white;
  font-size: clamp(22px, 5vw, 38px);
  font-weight: 800;
  line-height: 1.45;
  background: rgba(0, 48, 70, .64);
  opacity: 0;
  pointer-events: none;
}

.instruction.is-active {
  animation: guide 3s ease forwards;
}

.instruction img {
  width: min(58vw, 360px);
}

.stamp-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 36px;
  height: 106px;
  z-index: 19;
  background: linear-gradient(#006aa0, #003f72);
  border-top: 4px solid #8adfff;
  display: flex;
  align-items: center;
  padding: 8px max(18px, env(safe-area-inset-left)) 8px max(18px, env(safe-area-inset-right));
}

.stamp-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.stamp {
  min-width: 0;
  height: 88px;
  background: transparent;
  opacity: .38;
  display: grid;
  place-items: center;
  position: relative;
}

.stamp.is-collected {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(255,255,255,.8));
}

.stamp img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.special-stamp {
  position: absolute;
  left: 50%;
  top: -52px;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 25%, #fff, #9fe7ff 54%, #177daf 55%);
  border: 5px solid white;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 35, 70, .35);
  z-index: 3;
}

.special-stamp img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.gift-count {
  position: absolute;
  right: 16px;
  bottom: 10px;
  color: #052c4e;
  font-size: 26px;
  font-weight: 900;
}

.special-stamp.is-unlocked {
  animation: giftPulse 1.1s ease-in-out infinite;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background: rgba(0, 41, 66, .66);
}

.overlay.is-active {
  display: grid;
}

.welcome {
  background: rgba(0, 57, 83, .55);
}

.welcome-card {
  width: min(92vw, 690px);
  position: relative;
  min-height: min(82dvh, 980px);
  display: grid;
  place-items: center;
}

.welcome-placeholder {
  position: relative;
  z-index: 3;
  width: min(86vw, 560px);
  min-height: min(58dvh, 620px);
  padding: 56px 28px 30px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 42px;
  border: 3px dashed rgba(4, 82, 126, .5);
  background: linear-gradient(135deg, #f9fbff, #dff5ff);
  color: rgba(0, 70, 112, .55);
  font-size: clamp(18px, 4vw, 30px);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.welcome-actions {
  width: 100%;
  display: grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.primary-btn,
.download-btn,
.poster-btn,
.detail-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 0 28px;
  border-radius: 999px;
  border: 3px solid #23c4d8;
  background: linear-gradient(#087ea9, #005984);
  color: white;
  text-decoration: none;
  font-weight: 800;
  font-size: clamp(16px, 4vw, 28px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 8px 20px rgba(0, 62, 91, .22);
}

.primary-btn::before,
.poster-btn::before,
.download-btn::before {
  content: "";
  width: 22px;
  height: 22px;
  margin-right: 10px;
  flex: 0 0 auto;
  background:
    linear-gradient(45deg, transparent 42%, #fff 43% 57%, transparent 58%) right 3px top 3px / 13px 13px no-repeat,
    linear-gradient(90deg, #fff, #fff) left center / 18px 5px no-repeat;
  filter: drop-shadow(0 1px 0 rgba(0, 45, 78, .45));
}

.poster-btn::before,
.download-btn::before {
  border-radius: 5px;
  background:
    linear-gradient(#fff, #fff) 50% 22% / 68% 16% no-repeat,
    linear-gradient(#fff, #fff) 50% 58% / 16% 60% no-repeat,
    linear-gradient(#fff, #fff) 50% 50% / 70% 54% no-repeat;
}

.ghost-btn,
.back-btn {
  margin-top: 0;
  color: var(--deep-blue);
  background: transparent;
  font-weight: 800;
  font-size: clamp(16px, 3.8vw, 25px);
}

.ghost-btn,
.back-btn,
.detail-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-btn::before,
.detail-share-btn::before {
  content: "";
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 50%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 68% 32%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 68% 68%, #fff 0 3px, transparent 4px),
    var(--blue);
}

.back-btn::before {
  content: "";
  width: 26px;
  height: 22px;
  margin-right: 8px;
  background:
    linear-gradient(45deg, transparent 42%, var(--blue) 43% 57%, transparent 58%) left 3px center / 14px 14px no-repeat,
    linear-gradient(90deg, var(--blue), var(--blue)) center / 22px 6px no-repeat;
}

.olaf {
  position: absolute;
  right: -58px;
  bottom: 0;
  width: min(64vw, 430px);
  pointer-events: none;
  z-index: 2;
}

.share-overlay {
  place-items: start end;
  padding-top: calc(88px + env(safe-area-inset-top));
  text-align: right;
  color: white;
  font-size: 24px;
  font-weight: 800;
}

.share-overlay img {
  width: min(70vw, 420px);
}

.message-card,
.detail-panel,
.poster-panel {
  position: relative;
  width: min(92vw, 690px);
  background: var(--paper);
  border: 4px solid rgba(7, 92, 141, .18);
  box-shadow: var(--shadow);
  text-align: center;
}

.message-card {
  padding: 54px 28px 38px;
}

.message-card img {
  width: min(70vw, 410px);
}

.message-card p {
  margin: 18px auto 0;
  max-width: 460px;
  font-weight: 800;
  font-size: clamp(17px, 4vw, 28px);
  line-height: 1.45;
}

.close-btn {
  position: absolute;
  right: 18px;
  top: 16px;
  width: 50px;
  height: 50px;
  line-height: 48px;
  border-radius: 50%;
  background: transparent;
  color: var(--blue);
  font-size: 48px;
  z-index: 2;
}

.detail-panel {
  padding: 72px 34px 30px;
}

.carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 582 / 406;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #bfefff;
}

.carousel > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.arrow {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 72px;
  padding: 0;
  transform: translateY(-50%);
  background: rgba(255,255,255,.16);
  z-index: 1;
}

.arrow.left { left: 10px; }
.arrow.right { right: 10px; }
.arrow img { width: 100%; height: 100%; object-fit: contain; }

.detail-panel h2 {
  margin: 22px 0 10px;
  color: var(--deep-blue);
  font-size: clamp(24px, 5vw, 38px);
}

.detail-panel p {
  margin: 0 0 22px;
  font-size: clamp(15px, 3.5vw, 24px);
  line-height: 1.55;
  font-weight: 700;
}

.poster-btn {
  display: inline-flex;
  margin-top: 6px;
}

.detail-share-btn {
  margin-top: 18px;
  color: var(--deep-blue);
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 36px;
  padding: 0 18px;
}

.welcome-actions .primary-btn {
  min-height: 56px;
  padding: 0 30px;
  border-radius: 9px;
}

.poster-panel {
  padding: 72px 34px 40px;
}

.poster-preview {
  width: min(76vw, 500px);
  max-height: 68dvh;
  object-fit: contain;
  background: linear-gradient(135deg, #dff8ff, #89cadd);
  border: 8px solid white;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.download-btn {
  margin-top: 26px;
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.back-btn {
  width: fit-content;
  margin: 20px auto 0;
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.12); }
}

@keyframes giftPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.12); }
}

@keyframes guide {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

@media (min-width: 768px) {
  .app {
    width: min(82vw, 820px);
  }

  .map-canvas {
    width: max(1280px, calc((100dvh - 142px) * 1.34));
    height: max(955px, calc(100dvh - 142px));
  }
}

@media (max-width: 390px) {
  .olaf {
    right: -84px;
  }
}
