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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
  background: #1d1833;
  color: #463245;
  user-select: none;
  touch-action: none;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------------- Intro Overlay (Disc Insertion) ---------------- */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 20%, rgba(255, 224, 240, 0.86) 0%, rgba(226, 200, 238, 0.84) 48%, rgba(164, 180, 238, 0.86) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.intro-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-card {
  max-width: 410px;
  width: 100%;
  padding: 34px 26px 30px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 64px rgba(96, 58, 108, 0.25);
  text-align: center;
}

.intro-disc {
  width: 152px;
  height: 152px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 17%, rgba(255,255,255,0.75) 18%, rgba(255,255,255,0.12) 22%, transparent 23%),
    conic-gradient(from 0deg, #f8bfd9, #b2e2ff, #d6c2ff, #ffe8b3, #ffbde0, #a2efe7, #e0c2ff, #f8bfd9);
  box-shadow: inset 0 0 24px rgba(255,255,255,0.9), 0 12px 32px rgba(155, 100, 165, 0.34);
  animation: discSpin 9s linear infinite;
  position: relative;
}

.intro-disc::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid rgba(230, 190, 220, 0.75);
}

@keyframes discSpin {
  to { transform: rotate(360deg); }
}

.intro-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #a15284;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.intro-card h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #9d457c, #5f5aa8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-card p {
  font-size: 14px;
  line-height: 1.65;
  color: #60495e;
  margin-bottom: 22px;
}

.btn-start {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #e76fa2, #8c7ae6);
  box-shadow: 0 10px 26px rgba(180, 96, 175, 0.38);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-start:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(180, 96, 175, 0.45); }
.btn-start:active { transform: scale(0.97); }

/* ---------------- HUD ---------------- */
.hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.glass-pill {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(45, 28, 62, 0.16);
}

.zone-banner {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.zone-flag { font-size: 22px; line-height: 1; }
.zone-title { font-size: 14px; font-weight: 700; color: #3d2a42; }
.zone-style { font-size: 11px; font-weight: 600; color: #8c5a86; margin-top: 2px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-btn {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 700;
  color: #4b344d;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(45, 28, 62, 0.14);
  transition: transform 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover { background: rgba(255, 255, 255, 0.96); transform: translateY(-1px); }
.action-btn:active { transform: scale(0.95); }

.action-btn.secret-ready {
  background: linear-gradient(135deg, #ff7eb3, #8e7cf5);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.7);
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 126, 179, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(255, 126, 179, 0); }
}

.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.prompt-chip {
  pointer-events: auto;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff79ab, #8a78eb);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 28px rgba(130, 68, 150, 0.35);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.prompt-chip.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(40, 24, 58, 0.2);
  max-width: 100%;
  overflow-x: auto;
}

.dock-btn {
  border: none;
  background: transparent;
  padding: 7px 11px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  color: #543d57;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.dock-btn:hover { background: rgba(235, 190, 225, 0.35); }
.dock-btn.active { background: rgba(232, 130, 180, 0.24); color: #9c3d75; }
.dock-btn.stamped::after {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #f06ba2;
  color: #fff;
  font-size: 10px;
}

.controls-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 6px rgba(24, 15, 38, 0.6);
  text-align: center;
}

/* ---------------- Modals (Polaroid Memory & Secret Letter) ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(28, 18, 42, 0.56);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.polaroid-card {
  max-width: 420px;
  width: 100%;
  background: #fffdfb;
  border-radius: 22px;
  padding: 16px 16px 22px;
  box-shadow: 0 24px 64px rgba(20, 10, 35, 0.42);
  transform: scale(0.92) translateY(14px);
  transition: transform 0.28s ease;
  position: relative;
}

.modal-backdrop.open .polaroid-card,
.modal-backdrop.open .letter-card {
  transform: scale(1) translateY(0);
}

.polaroid-photo {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  margin-bottom: 14px;
  background: #f3e8f0;
}

.polaroid-meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #b05c8c;
  margin-bottom: 6px;
}

.polaroid-title {
  font-size: 19px;
  font-weight: 800;
  color: #3a263d;
  margin-bottom: 10px;
}

.polaroid-note {
  font-size: 14px;
  line-height: 1.75;
  color: #5b455e;
  margin-bottom: 18px;
}

.letter-card {
  max-width: 460px;
  width: 100%;
  background: linear-gradient(180deg, #fffafc 0%, #fff4f8 100%);
  border: 2px solid #f5cbe0;
  border-radius: 26px;
  padding: 28px 24px 24px;
  box-shadow: 0 26px 70px rgba(32, 12, 46, 0.46);
  transform: scale(0.92) translateY(14px);
  transition: transform 0.28s ease;
}

.letter-card p {
  font-size: 15px;
  line-height: 1.85;
  color: #523b54;
  margin-bottom: 12px;
}

.letter-sig {
  text-align: right;
  font-weight: 800;
  color: #a64a7e;
  margin-top: 14px;
  margin-bottom: 18px;
}

.modal-close-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #e76fa2, #8c7ae6);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 600px) {
  .zone-banner { padding: 8px 12px; }
  .action-btn { padding: 8px 10px; font-size: 12px; }
  .dock-btn { padding: 6px 9px; font-size: 11px; }
}
