/* ======================
   RESET & BASE
====================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: linear-gradient(160deg, #000000 0%, #000000 40%, #000000 100%);
  color: #f0e6d8;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  cursor: default;
}

/* ======================
   SNOW CANVAS
====================== */
#snow-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ======================
   FLOATING HEARTS
====================== */
.hearts {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.heart {
  position: absolute;
  color: rgba(255, 182, 193, 0.35);
  font-size: 14px;
  animation: float-heart linear infinite;
  user-select: none;
}

@keyframes float-heart {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ======================
   WORLD & SCENES
====================== */
.world {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease, transform 0.7s ease;
  transform: scale(0.97);
}

.scene.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.content {
  text-align: center;
  max-width: 620px;
  padding: 20px;
}

.soft-label {
  font-size: 0.95rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #b8a99a;
  margin-bottom: 12px;
  opacity: 0.8;
}

h1 {
  font-size: 3.8rem;
  font-weight: 400;
  letter-spacing: 4px;
  margin-bottom: 10px;
  color: #fff5eb;
  text-shadow: 0 0 30px rgba(255, 220, 200, 0.25);
}

h2 {
  font-size: 2.2rem;
  font-weight: 400;
  margin-bottom: 12px;
  color: #fff5eb;
}

.subtitle {
  font-size: 1.2rem;
  color: #d4c4b0;
  margin-bottom: 50px;
  font-style: italic;
}

.scene-desc {
  color: #b8a99a;
  margin-bottom: 40px;
  font-size: 1.05rem;
}

/* ======================
   PATH BUTTONS
====================== */
.paths {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.path-btn {
  background: rgba(255, 245, 235, 0.07);
  border: 1px solid rgba(255, 220, 200, 0.25);
  color: #f0e6d8;
  padding: 16px 36px;
  font-size: 1.1rem;
  font-family: inherit;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.35s ease;
  backdrop-filter: blur(6px);
  min-width: 240px;
  justify-content: center;
}

.path-btn:hover {
  background: rgba(255, 245, 235, 0.15);
  border-color: rgba(255, 220, 200, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.path-btn .icon { font-size: 1.3rem; }

/* ======================
   BACK BUTTON
====================== */
.back-btn {
  position: absolute;
  top: 30px;
  left: 30px;
  background: rgba(255, 245, 235, 0.08);
  border: 1px solid rgba(255, 220, 200, 0.2);
  color: #e8d9c8;
  padding: 10px 20px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 20;
}

.back-btn:hover { background: rgba(255, 245, 235, 0.15); }

/* ======================
   LETTER SECTION
====================== */
.letter-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 420px;
}

.envelope {
  width: 320px;
  height: 210px;
  position: relative;
  cursor: pointer;
  transition: transform 0.4s ease;
}

.envelope:hover { transform: translateY(-6px); }

.envelope-body {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #f8efe4, #e8d9c8);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  color: #5c4a3a;
  position: relative;
  z-index: 2;
}

.envelope-body p { font-size: 1.5rem; letter-spacing: 2px; margin-bottom: 8px; }
.envelope-body .hint { font-size: 0.85rem; opacity: 0.7; font-style: italic; }

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 110px;
  background: linear-gradient(to bottom, #e8d9c8, #d9c8b4);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.6s ease;
  z-index: 3;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.envelope.open .envelope-flap { transform: rotateX(180deg); }

.opened-letter {
  display: none;
  width: 100%;
  max-width: 440px;
  animation: letterAppear 0.6s ease forwards;
}

.opened-letter.show { display: block; }

@keyframes letterAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.letter-paper {
  background: #fdf8f1;
  color: #3d3229;
  padding: 36px 32px 28px;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  position: relative;
}

.handwritten-view img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  cursor: zoom-in;
}

.image-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: #8a7a6a;
  text-align: center;
  font-style: italic;
}

.typed-view { display: none; }
.typed-view.show { display: block; }

.typed-text {
  font-size: 1.15rem;
  line-height: 1.75;
  text-align: left;
}

.typed-text p { margin-bottom: 18px; }
.typed-text .signature { margin-top: 30px; text-align: right; font-style: italic; }

.letter-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

.letter-actions button {
  background: #5c4a3a;
  color: #fdf8f1;
  border: none;
  padding: 11px 22px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.letter-actions button:hover { background: #3d3229; }

/* ======================
   WISHES
====================== */
.wish-area {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
  margin-bottom: 40px;
}

.wish-flake {
  font-size: 2.4rem;
  cursor: pointer;
  transition: all 0.35s ease;
  opacity: 0.85;
  user-select: none;
}

.wish-flake:hover {
  transform: scale(1.25) rotate(15deg);
  opacity: 1;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
}

.wish-display {
  min-height: 60px;
  font-size: 1.2rem;
  color: #f0e6d8;
  font-style: italic;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.wish-display.show { opacity: 1; }

/* ======================
   QUIET NOTE
====================== */
.quiet-card {
  background: rgba(255, 245, 235, 0.06);
  border: 1px solid rgba(255, 220, 200, 0.18);
  padding: 40px 36px;
  border-radius: 16px;
  max-width: 420px;
  margin: 0 auto;
  backdrop-filter: blur(8px);
  line-height: 1.8;
  font-size: 1.15rem;
}

.quiet-card p { margin-bottom: 16px; }
.quiet-end { margin-top: 28px !important; font-style: italic; color: #d4c4b0; }

/* ======================
   LETTER DATE + SIGNATURE
====================== */
.typed-text { position: relative; }

.typed-text .letter-date,
.village-typed-text .letter-date {
  text-align: right;
  font-size: 0.9rem;
  font-style: italic;
  color: #8a7a6a;
  margin-bottom: 22px;
  letter-spacing: 0.5px;
}

.typed-text .signature,
.village-typed-text .signature { text-align: left; }

.village-typed-text {
  margin-top: 22px;
  text-align: left;
  font-size: 1.02rem;
  line-height: 1.7;
  color: #3d3229;
}

.village-typed-text p { margin-bottom: 12px; }
.village-typed-text .signature { margin-top: 18px; font-style: italic; }
.village-typed-text .ps-note {
  margin-top: 16px;
  font-size: 0.88rem;
  font-style: italic;
  color: #8a7a6a;
}

/* ======================
   CHRISTMAS STRING LIGHTS
====================== */
.christmas-string {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  z-index: 10;
  pointer-events: none;
  overflow: visible;
}

.christmas-string svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  pointer-events: none;
}

.christmas-bulb {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 50% 50% 45% 45%;
  top: 0;
  transform: translate(-50%, -50%);
  animation: bulb-glow 2.4s ease-in-out infinite;
  box-shadow: 0 0 8px currentColor, 0 0 14px currentColor;
}

.christmas-bulb::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 6px;
  background: #4a4a4a;
  border-radius: 1px;
}

@keyframes bulb-glow {
  0%, 100% { opacity: 0.55; filter: brightness(0.85); }
  50%      { opacity: 1;    filter: brightness(1.4); }
}

/* ======================
   VILLAGE GAME
====================== */
#village { padding: 0; }

.game-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  touch-action: none;
  cursor: default;
}

.action-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #f0e6d8;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  letter-spacing: 1px;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.4s ease;
  white-space: nowrap;
  z-index: 8;
}

.mute-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 245, 235, 0.12);
  border: 1px solid rgba(255, 220, 200, 0.25);
  color: #f0e6d8;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.3s ease;
  z-index: 10;
}

.mute-btn:hover { background: rgba(255, 245, 235, 0.25); }

/* No touch buttons anymore - hidden everywhere */
.touch-controls {
  display: none !important;
}

.dialogue-box {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 90%);
  background: rgba(28, 22, 16, 0.94);
  border: 2px solid rgba(255, 220, 180, 0.5);
  border-radius: 14px;
  padding: 16px 20px 34px;
  z-index: 15;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.dialogue-box.show { display: block; }

.dialogue-name {
  position: absolute;
  top: -16px;
  left: 18px;
  background: #e8b04a;
  color: #2a1a08;
  padding: 4px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.dialogue-text {
  color: #fdf8f1;
  font-size: 1.05rem;
  line-height: 1.5;
  min-height: 44px;
}

.dialogue-hint {
  position: absolute;
  bottom: 10px;
  right: 18px;
  font-size: 0.75rem;
  color: #b8a99a;
  opacity: 0.8;
  font-style: italic;
}

.game-modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.game-modal.show { display: flex; }

.game-modal-inner {
  background: #fdf8f1;
  color: #3d3229;
  border-radius: 12px;
  padding: 28px 26px 22px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: letterAppear 0.5s ease forwards;
}

.game-modal-inner h3 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  font-weight: 400;
}

.game-letter-img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
}

.modal-close {
  margin-top: 20px;
  background: #5c4a3a;
  color: #fdf8f1;
  border: none;
  padding: 10px 24px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.modal-close:hover { background: #3d3229; }

/* ======================
   CLICK SPARKLE STARS
====================== */
.click-star {
  position: fixed;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 9999;
  color: #ffd84a;
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 220, 80, 0.9), 0 0 14px rgba(255, 200, 60, 0.5);
  animation: star-pop 0.9s ease-out forwards;
  user-select: none;
}

@keyframes star-pop {
  0%   { transform: translate(-50%, -50%) scale(0.4) rotate(0deg); opacity: 1; }
  60%  { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1) rotate(220deg);
    opacity: 0;
  }
}

/* ======================
   LETTER IMAGE ZOOM OVERLAY
====================== */
.letter-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  animation: zoom-fade-in 0.25s ease forwards;
  overflow: auto;
}

.letter-zoom-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
  animation: zoom-img-in 0.3s ease forwards;
  user-select: none;
  -webkit-user-drag: none;
}

.letter-zoom-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255, 245, 235, 0.15);
  border: 1px solid rgba(255, 220, 200, 0.35);
  color: #f0e6d8;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  font-family: inherit;
  z-index: 10001;
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.letter-zoom-close:hover { background: rgba(255, 245, 235, 0.3); }

@keyframes zoom-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes zoom-img-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ======================
   MOBILE FIXES
====================== */
.world, .scene {
  height: 100vh;
}

@supports (height: 100dvh) {
  .world, .scene { height: 100dvh; }
}

.letter-paper,
.opened-letter {
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 700px) {
  .action-hint { display: none; }
}

/* ======================
   RESPONSIVE
====================== */
@media (max-width: 600px) {
  h1 { font-size: 2.8rem; }
  .path-btn { min-width: 200px; padding: 14px 28px; }
  .envelope { width: 280px; height: 185px; }
  .letter-paper { padding: 28px 22px 22px; }
  .back-btn { top: 18px; left: 18px; }
  .christmas-string { height: 55px; }
  .christmas-string svg { height: 55px; }
}




/* ======================
   VILLAGE LETTER BUTTONS — match homepage exactly
====================== */
.game-modal-inner .letter-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

.game-modal-inner .letter-actions button {
  background: #5c4a3a;
  color: #fdf8f1;
  border: none;
  padding: 11px 22px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.game-modal-inner .letter-actions button:hover {
  background: #3d3229;
}

/* ======================
   VILLAGE LETTER BUTTONS — force match homepage
====================== */
.game-modal-inner .letter-actions {
  display: flex !important;
  gap: 12px !important;
  justify-content: center !important;
  margin-top: 28px !important;
  flex-wrap: wrap !important;
}

.game-modal-inner .letter-actions button,
.game-modal-inner .letter-actions button.modal-close,
.game-modal-inner #village-toggle-btn,
.game-modal-inner #letter-modal-close {
  background: #5c4a3a !important;
  color: #fdf8f1 !important;
  border: none !important;
  padding: 11px 22px !important;
  border-radius: 30px !important;
  font-family: inherit !important;
  font-size: 0.95rem !important;
  cursor: pointer !important;
  transition: background 0.3s ease !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.game-modal-inner .letter-actions button:hover,
.game-modal-inner .letter-actions button.modal-close:hover {
  background: #3d3229 !important;
}