:root {
  --scene-max-width: 1024px;
  --scene-aspect: 1024 / 640;
  --cream: #f5f1e8;
  --pink-cream: #f8e8e8;
  --vintage-brown: #8b6f47;
  --shadow-dark: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0f0c0b;
  overflow: hidden;
}

#app {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  background: #0f0c0b;
}

/* Visual breathing room: blurred full-bleed backdrop behind the main (uncropped) scene */
.scene::before {
  content: "";
  position: absolute;
  inset: -24px;
  background-image: url("Background2.png");
  background-size: cover;
  background-position: center;
  filter: blur(18px) saturate(0.95) brightness(0.70);
  transform: scale(1.06);
  z-index: 0;
}

/* Cozy ambience layer: vignette + warm glows + drifting dust motes */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  background-image:
    /* dust layer 1 */
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, rgba(255, 255, 255, 0) 2px),
    /* dust layer 2 */
    radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2.4px),
    /* lamp glow (left) */
    radial-gradient(closest-side at 14% 58%, rgba(255, 190, 120, 0.22), rgba(255, 190, 120, 0) 70%),
    /* candle glow (right) - warm amber (subtle base layer) */
    radial-gradient(ellipse 100% 70% at 88% 50%, rgba(255, 170, 90, 0.12), rgba(255, 150, 70, 0) 65%),
    /* soft vignette */
    radial-gradient(closest-side at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.45) 100%);
  background-size:
    180px 180px,
    260px 260px,
    100% 100%,
    100% 100%,
    100% 100%;
  background-position:
    0 0,
    60px 120px,
    center,
    center,
    center;
  background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat;
  mix-blend-mode: screen;
  animation: ambiencePulse 5s ease-in-out infinite;
}


@keyframes ambiencePulse {
  0%, 100% { opacity: 0.90; filter: brightness(0.96); }
  50% { opacity: 1; filter: brightness(1.08); }
}

.scene__fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 1;
  background:
    /* lamp glow - left side */
    radial-gradient(ellipse 35% 45% at 16% 52%, rgba(255, 160, 90, 0.40), rgba(255, 140, 70, 0.15) 60%, transparent 100%),
    /* candle glow extended reach - hits the jar */
    radial-gradient(ellipse 80% 60% at 70% 50%, rgba(255, 150, 70, 0.25), rgba(255, 140, 65, 0.08) 60%, transparent 100%),
    /* candle glow core - warm amber */
    radial-gradient(ellipse 40% 50% at 88% 50%, rgba(255, 150, 70, 0.55), rgba(255, 130, 60, 0.25) 50%, transparent 100%);
  filter: blur(6px);
  transform: translateZ(0);
  will-change: opacity, filter, transform;
  animation:
    candleFlicker 3.5s ease-in-out infinite,
    glowBreath 5s ease-in-out infinite;
}

/* Ambient fog layer - subtle atmospheric depth */
.scene__fog {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 200, 150, 0.03),
    transparent 70%
  );
  animation: fogBreath 12s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes fogBreath {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.55; }
}

/* Drifting dust particles - constrained to background image area */
.dust-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(92vw, 1400px);
  max-height: 92vh;
  width: auto;
  height: auto;
  aspect-ratio: 1536 / 1024; /* Match Background2.png aspect ratio */
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

/* Make sure container sizes correctly */
@media (max-aspect-ratio: 1536/1024) {
  .dust-container {
    width: min(92vw, 1400px);
    height: auto;
  }
}

@media (min-aspect-ratio: 1536/1024) {
  .dust-container {
    width: auto;
    height: 92vh;
  }
}

.dust {
  position: absolute;
  left: var(--x);
  bottom: -3px; /* Start just below container so fade-in is smooth */
  width: 3px;
  height: 3px;
  background: rgba(255, 240, 220, 0.65);
  border-radius: 50%;
  animation: dustFloat var(--duration) linear infinite;
  animation-delay: calc(-1s * var(--i));
  mix-blend-mode: screen;
}

/* Left third - minimal flicker (far from candle) */
.dust:nth-child(1),
.dust:nth-child(2) {
  animation: 
    dustFloat var(--duration) linear infinite,
    dustFlickerWeak 3.5s ease-in-out infinite;
  animation-delay: calc(-1s * var(--i)), 0s;
}

/* Middle third - medium flicker */
.dust:nth-child(3),
.dust:nth-child(4) {
  animation: 
    dustFloat var(--duration) linear infinite,
    dustFlickerMedium 3.5s ease-in-out infinite;
  animation-delay: calc(-1s * var(--i)), 0s;
}

/* Right third - strong flicker (close to candle) */
.dust:nth-child(5),
.dust:nth-child(6) {
  animation: 
    dustFloat var(--duration) linear infinite,
    candleFlicker 3.5s ease-in-out infinite;
  animation-delay: calc(-1s * var(--i)), 0s;
}

@keyframes dustFlickerWeak {
  0%   { opacity: 0.75; }
  20%  { opacity: 0.80; }
  40%  { opacity: 0.77; }
  60%  { opacity: 0.82; }
  80%  { opacity: 0.78; }
  100% { opacity: 0.75; }
}

@keyframes dustFlickerMedium {
  0%   { opacity: 0.70; }
  20%  { opacity: 0.82; }
  40%  { opacity: 0.74; }
  60%  { opacity: 0.86; }
  80%  { opacity: 0.77; }
  100% { opacity: 0.70; }
}

@keyframes dustFloat {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    transform: translate(-15px, calc(-92vh));
    opacity: 0;
  }
}

/* Dust particles use CSS variables for random positioning and timing */

@keyframes candleFlicker {
  0%   { opacity: 0.65; }
  20%  { opacity: 0.85; }
  40%  { opacity: 0.72; }
  60%  { opacity: 0.90; }
  80%  { opacity: 0.78; }
  100% { opacity: 0.65; }
}

@keyframes glowBreath {
  0%, 100% {
    filter: blur(6px) brightness(0.92);
    transform: scale(1);
  }
  50% {
    filter: blur(10px) brightness(1.15);
    transform: scale(1.02);
  }
}


.scene__bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(92vw, 1400px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain; /* show whole image (no crop) */
  object-position: center;
  display: block;
  visibility: visible;
  opacity: 1;
  filter: brightness(0.83) contrast(1.05);
  z-index: 2;
  pointer-events: none;
  border-radius: 16px;
  box-shadow:
    0 26px 90px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Outer UI (title + hint) */
.outer-ui {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.outer-ui__title {
  position: fixed;
  left: 18px;
  top: 18px;
  padding: 10px 12px;
  border-radius: 14px;
  color: rgba(255, 245, 235, 0.92);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  font-family: "Dancing Script", "Pacifico", cursive;
  font-size: 22px;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.outer-ui__hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(760px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.01em;
  text-align: center;
  transition: opacity 600ms ease, transform 600ms ease;
  opacity: 1;
}

body.has-interacted .outer-ui__hint {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

/* Sound toggle button */
.sound-toggle {
  position: fixed;
  right: 18px;
  top: 18px;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  color: rgba(255, 245, 235, 0.92);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 30;
  pointer-events: auto;
}

.sound-toggle:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.24);
  transform: scale(1.05);
}

.sound-toggle:active {
  transform: scale(0.95);
}

.sound-toggle__icon {
  font-size: 22px;
  display: block;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.sound-toggle.muted .sound-toggle__icon {
  opacity: 0.4;
}

.sound-toggle.muted::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 60%;
  background: rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 1px;
}

/* Clickable overlay areas */
.clickable-area {
  position: absolute;
  border: none;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
  z-index: 10;
  pointer-events: auto;
  box-sizing: border-box;
  overflow: visible;
}

.clickable-area:active {
  transform: scale(0.98);
}

/* Visual jar and book (wrapper lets us draw a bottom-only shadow) */
.object-wrap {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  z-index: 4;
  pointer-events: none;
}

.object-img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0.83) contrast(1.05);
}

/* Jar image hidden - using background jar instead, but keep wrapper for hitbox positioning */
.object-wrap--jar .object-img {
  opacity: 0;
  pointer-events: none;
}

/* Hide jar shadow too since we're using background jar */
.object-wrap--jar::before {
  display: none;
}

/* No idle movement animations - just subtle candle flicker affects scene ambience */

@media (prefers-reduced-motion: reduce) {
  .scene::after,
  .scene__fog,
  .scene__fx,
  .dust {
    animation: none !important;
  }
}

/* Bottom-only "ground" shadow (biased to bottom-left) */
.object-wrap::before {
  content: "";
  position: absolute;
  left: 30%;
  bottom: 3%;
  width: 66%;
  height: 16%;
  transform: translateX(-60%);
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
  filter: blur(7px);
  opacity: 0.9;
}

/* Slight per-object tuning */
.object-wrap--jar::before {
  left: 34%;
  bottom: 5%;
  width: 64%;
  height: 12%;
  transform: translateX(-56%);
  filter: blur(4px);
  opacity: 0.62;
}

.object-wrap--book::before {
  left: 28%;
  bottom: 7%;
  width: 72%;
  height: 14%;
  transform: translateX(-63%);
  filter: blur(6px);
  opacity: 0.5;
}

/* Jar shake animation */
@keyframes jarShake {
  0%   { transform: rotate(0deg)  scale(1); }
  10%  { transform: rotate(-2deg) scale(1.03); }
  20%  { transform: rotate(2deg)  scale(1.03); }
  30%  { transform: rotate(-2deg) scale(1.03); }
  40%  { transform: rotate(2deg)  scale(1.03); }
  55%  { transform: rotate(-1deg) scale(1.015); }
  70%  { transform: rotate(1deg)  scale(1.01); }
  100% { transform: rotate(0deg)  scale(1); }
}

.object-wrap--book.shaking .object-img {
  animation: jarShake 0.8s cubic-bezier(0.2, 0.9, 0.2, 1);
  transform-origin: center center;
}

/* Book glow animation */
@keyframes bookGlow {
  0%, 100% { 
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
    filter: drop-shadow(0 22px 14px rgba(0, 0, 0, 0.35));
  }
  50% { 
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 22px 14px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
  }
}

.object-wrap--book.glowing {
  animation: bookGlow 0.3s ease-in-out;
}

.clickable-area:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 6px;
  border-radius: 12px;
}

.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;
}

/* Note Card Styles */
.note-card-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(closest-side at 50% 45%, rgba(255, 210, 160, 0.18), rgba(0, 0, 0, 0) 65%),
    rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.note-card-overlay.active {
  display: flex;
}

.note-card {
  /* Positioned in viewport so it can animate from jar location */
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(92vw, 460px);
  min-height: 320px;
  padding: 44px 34px 26px;
  border-radius: 18px;
  transform-origin: center;
  opacity: 0;

  /* Paper look */
  background:
    radial-gradient(closest-side at 20% 18%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%),
    radial-gradient(closest-side at 85% 30%, rgba(255, 210, 210, 0.22), rgba(255, 255, 255, 0) 60%),
    repeating-linear-gradient(0deg, rgba(120, 90, 70, 0.03), rgba(120, 90, 70, 0.03) 1px, rgba(255, 255, 255, 0) 6px, rgba(255, 255, 255, 0) 14px),
    linear-gradient(135deg, #fbf3ef 0%, #f7efe7 40%, #f6eee8 100%);

  border: 1px solid rgba(120, 90, 70, 0.18);
  box-shadow:
    0 26px 90px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;

  /* Animation variables are set by JS */
  --from-x: 0px;
  --from-y: 0px;
  --note-rise: 140px;

  /* Base transform (end state) */
  transform: translate3d(-50%, -50%, 0) scale(1) rotate(0deg);
  will-change: transform, opacity;
  animation: noteCardFromJar 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes noteCardFromJar {
  0%   { opacity: 0; transform: translate3d(calc(-50% + var(--from-x)), calc(-50% + var(--from-y)), 0) scale(0.07) rotate(-12deg); }
  3%   { opacity: 0.7; transform: translate3d(calc(-50% + (var(--from-x) * 0.985)), calc(-50% + (var(--from-y) * 0.985)), 0) scale(0.085) rotate(-11.6deg); }
  6%   { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.97)), calc(-50% + (var(--from-y) * 0.97)), 0) scale(0.10) rotate(-11deg); }
  10%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.92)), calc(-50% + (var(--from-y) * 0.92)), 0) scale(0.12) rotate(-10deg); }
  12%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.89)), calc(-50% + (var(--from-y) * 0.89) - (var(--note-rise) * 0.06)), 0) scale(0.14) rotate(-9.6deg); }
  15%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.86)), calc(-50% + (var(--from-y) * 0.86) - (var(--note-rise) * 0.10)), 0) scale(0.16) rotate(-9deg); }
  20%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.78)), calc(-50% + (var(--from-y) * 0.78) - (var(--note-rise) * 0.25)), 0) scale(0.20) rotate(-8deg); }
  23%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.73)), calc(-50% + (var(--from-y) * 0.73) - (var(--note-rise) * 0.38)), 0) scale(0.24) rotate(-7.5deg); }
  26%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.69)), calc(-50% + (var(--from-y) * 0.69) - (var(--note-rise) * 0.48)), 0) scale(0.28) rotate(-7deg); }
  32%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.60)), calc(-50% + (var(--from-y) * 0.60) - (var(--note-rise) * 0.72)), 0) scale(0.36) rotate(-6deg); }
  38%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.51)), calc(-50% + (var(--from-y) * 0.51) - (var(--note-rise) * 0.86)), 0) scale(0.44) rotate(-5deg); }
  44%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.42)), calc(-50% + (var(--from-y) * 0.42) - (var(--note-rise) * 0.95)), 0) scale(0.52) rotate(-4deg); }
  48%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.37)), calc(-50% + (var(--from-y) * 0.37) - 58px), 0) scale(0.59) rotate(-3.4deg); }
  52%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.33)), calc(-50% + (var(--from-y) * 0.33) - 48px), 0) scale(0.64) rotate(-3deg); }
  60%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.24)), calc(-50% + (var(--from-y) * 0.24) - 34px), 0) scale(0.76) rotate(-2deg); }
  70%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.16)), calc(-50% + (var(--from-y) * 0.16) - 20px), 0) scale(0.86) rotate(-1.2deg); }
  78%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.10)), calc(-50% + (var(--from-y) * 0.10) - 10px), 0) scale(0.92) rotate(-0.6deg); }
  82%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.085)), calc(-50% + (var(--from-y) * 0.085) - 8px), 0) scale(0.94) rotate(-0.48deg); }
  85%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.070)), calc(-50% + (var(--from-y) * 0.070) - 6px), 0) scale(0.955) rotate(-0.38deg); }
  88%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.05)), calc(-50% + (var(--from-y) * 0.05) - 4px), 0) scale(0.97) rotate(-0.25deg); }
  90%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.040)), calc(-50% + (var(--from-y) * 0.040) - 3px), 0) scale(0.978) rotate(-0.20deg); }
  92%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.032)), calc(-50% + (var(--from-y) * 0.032) - 2px), 0) scale(0.985) rotate(-0.16deg); }
  94%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.02)), calc(-50% + (var(--from-y) * 0.02) - 1px), 0) scale(0.99) rotate(-0.1deg); }
  96%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.015)), calc(-50% + (var(--from-y) * 0.015) - 0.6px), 0) scale(0.994) rotate(-0.07deg); }
  98%  { opacity: 1; transform: translate3d(calc(-50% + (var(--from-x) * 0.008)), calc(-50% + (var(--from-y) * 0.008) - 0.25px), 0) scale(0.997) rotate(-0.03deg); }
  100% { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .note-card {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.note-card::before {
  /* Inner border + vintage corners */
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 14px;
  border: 1px solid rgba(139, 111, 71, 0.22);
  pointer-events: none;
  opacity: 0.9;
  background:
    radial-gradient(circle at 0 0, rgba(139, 111, 71, 0.20), rgba(139, 111, 71, 0) 55%),
    radial-gradient(circle at 100% 0, rgba(139, 111, 71, 0.16), rgba(139, 111, 71, 0) 55%),
    radial-gradient(circle at 0 100%, rgba(139, 111, 71, 0.14), rgba(139, 111, 71, 0) 55%),
    radial-gradient(circle at 100% 100%, rgba(139, 111, 71, 0.18), rgba(139, 111, 71, 0) 55%);
  mix-blend-mode: multiply;
}

.note-card::after {
  /* Subtle fold line */
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 34%;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(120, 90, 70, 0.18), rgba(0, 0, 0, 0));
  opacity: 0.55;
  pointer-events: none;
}

.note-card__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(139, 111, 71, 0.12);
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: var(--vintage-brown);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.note-card__close:hover {
  background: rgba(139, 111, 71, 0.2);
  transform: scale(1.1);
}

.note-card__content {
  text-align: center;
  margin-bottom: 30px;
}

.note-card__content::before {
  content: "From the Love Jar";
  display: block;
  font-family: "Caveat", cursive;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
  color: rgba(90, 70, 50, 0.75);
  margin-bottom: 12px;
}

.note-card__text {
  font-family: 'Dancing Script', 'Pacifico', cursive;
  font-size: 30px;
  line-height: 1.6;
  color: var(--vintage-brown);
  margin-bottom: 20px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.note-card__decoration {
  font-size: 32px;
  opacity: 0.6;
  animation: heartFloat 2s ease-in-out infinite;
}

@keyframes heartFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.note-card__button {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, rgba(168, 125, 86, 0.95) 0%, rgba(146, 102, 71, 0.95) 100%);
  border: none;
  border-radius: 10px;
  color: rgba(255, 250, 245, 0.98);
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.note-card__button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.note-card__button:active {
  transform: translateY(0);
}

/* Journal Styles */
.journal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.journal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 180ms ease;
}

.journal {
  position: relative;
  width: 90%;
  max-width: 900px;
  height: 85vh;
  max-height: 700px;
  background: linear-gradient(135deg, var(--cream) 0%, #f0ead6 100%);
  border-radius: 12px;
  box-shadow: 0 25px 80px var(--shadow-dark), 0 0 0 1px rgba(139, 111, 71, 0.15);
  padding: 0;
  overflow: hidden;
  transform: scale(0.9);
  opacity: 0;
  animation: journalAppear 0.4s ease-out forwards;
}

@keyframes journalAppear {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.journal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(139, 111, 71, 0.15);
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: var(--vintage-brown);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
}

.journal__close:hover {
  background: rgba(139, 111, 71, 0.25);
  transform: scale(1.1);
}

.journal__pages {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.journal__spread {
  position: absolute;
  inset: 0;
  display: flex;
}

.journal__spread--single {
  display: block;
}

.journal__spread--single .journal-page {
  width: 100%;
  border-radius: 12px;
  border-right: none;
}

.journal__spread--single .journal-page--right {
  display: none;
}

.journal__spread--single .journal-page--left {
  border-right: none;
}

.journal-page {
  position: relative;
  width: 50%;
  height: 100%;
  padding: 50px 40px 88px;
  background: var(--cream);
  overflow-y: auto;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  backface-visibility: hidden;
}

.journal-page::-webkit-scrollbar {
  width: 8px;
}

.journal-page::-webkit-scrollbar-track {
  background: rgba(139, 111, 71, 0.1);
}

.journal-page::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 71, 0.3);
  border-radius: 4px;
}

.journal-page--left {
  left: auto;
  border-right: 2px solid rgba(139, 111, 71, 0.2);
  border-radius: 12px 0 0 12px;
}

.journal-page--right {
  right: auto;
  border-radius: 0 12px 12px 0;
}

/* Page turn overlay */
.page-flip {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 9;
  pointer-events: none;
  perspective: 1400px;
}

/* Hide 3D flip overlay on small screens (we'll do simple transitions in JS) */
@media (max-width: 760px) {
  .page-flip {
    display: none !important;
  }
}

.page-flip--next {
  right: 0;
}

.page-flip--prev {
  left: 0;
}

.page-flip__sheet {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

.page-flip__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  overflow: hidden;
}

.page-flip__back {
  transform: rotateY(180deg);
}

.page-flip__mirror {
  width: 100%;
  height: 100%;
}

.journal-page--flip {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border-right: none;
}

/* Animations */
@keyframes flipNextSheet {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(-180deg); }
}

@keyframes flipPrevSheet {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

.page-flip--next.is-flipping .page-flip__sheet {
  transform-origin: left center;
  animation: flipNextSheet 0.72s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.page-flip--prev.is-flipping .page-flip__sheet {
  transform-origin: right center;
  animation: flipPrevSheet 0.72s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

/* Shadow during flip */
.page-flip--next.is-flipping::before,
.page-flip--prev.is-flipping::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.14), rgba(0,0,0,0));
  opacity: 0.28;
  filter: blur(1px);
}

.page-flip--prev.is-flipping::before {
  background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,0.14));
}

.journal-page__date-container {
  position: relative;
  margin-bottom: 30px;
}

.journal-page__date {
  font-family: 'Dancing Script', cursive;
  font-size: 24px;
  color: var(--vintage-brown);
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(139, 111, 71, 0.2);
  text-align: center;
}

.journal-page__date--clickable {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.journal-page__secret-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: min(90%, 500px);
  max-height: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #fbf3ef 0%, #f7efe7 100%);
  border: 1px solid rgba(139, 111, 71, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  margin-top: 8px;
  pointer-events: none;
  visibility: hidden;
}

@media (max-width: 768px) {
  .journal-page__secret-dropdown {
    width: min(95%, 400px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
  }
  
  .journal-page__secret-dropdown.active {
    transform: translateX(-50%) translateY(0);
  }
}

.journal-page__secret-dropdown.active {
  max-height: 300px;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  overflow: visible;
}

.journal-page__secret-content {
  padding: 20px 24px;
  font-family: 'Caveat', 'Dancing Script', cursive;
  font-size: 18px;
  line-height: 1.8;
  color: #5a4a3a;
  white-space: pre-wrap;
  text-align: left;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  display: block;
}

.journal-page__secret-content::-webkit-scrollbar {
  width: 6px;
}

.journal-page__secret-content::-webkit-scrollbar-track {
  background: rgba(139, 111, 71, 0.08);
  border-radius: 3px;
}

.journal-page__secret-content::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 71, 0.25);
  border-radius: 3px;
}

.journal-page__secret-content::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 111, 71, 0.35);
}

.journal-page__entry {
  font-family: 'Caveat', 'Dancing Script', cursive;
  font-size: 20px;
  line-height: 1.8;
  color: #5a4a3a;
  white-space: pre-wrap;
  text-align: left;
}

.journal__nav {
  position: absolute;
  bottom: 18px;
  top: auto;
  transform: none;
  padding: 12px 20px;
  background: rgba(139, 111, 71, 0.15);
  border: 2px solid rgba(139, 111, 71, 0.3);
  border-radius: 8px;
  color: var(--vintage-brown);
  font-family: 'Caveat', cursive;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.journal__nav:hover {
  background: rgba(139, 111, 71, 0.25);
  border-color: rgba(139, 111, 71, 0.5);
  transform: scale(1.05);
}

.journal__nav:active {
  transform: scale(0.98);
}

.journal__nav--prev {
  left: 20px;
}

.journal__nav--next {
  right: 20px;
}

.journal__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.journal__nav:disabled:hover {
  transform: none;
  background: rgba(139, 111, 71, 0.15);
}

/* Page flip animations */
@keyframes pageFlipNext {
  0% {
    transform: perspective(1000px) rotateY(0deg);
  }
  100% {
    transform: perspective(1000px) rotateY(-180deg);
  }
}

@keyframes pageFlipPrev {
  0% {
    transform: perspective(1000px) rotateY(0deg);
  }
  100% {
    transform: perspective(1000px) rotateY(180deg);
  }
}

.journal-page.flipping-next {
  animation: pageFlipNext 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.journal-page.flipping-prev {
  animation: pageFlipPrev 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .note-card {
    width: 95%;
    padding: 30px 20px 25px;
    min-height: 250px;
  }

  .note-card__text {
    font-size: 24px;
    min-height: 100px;
  }

  .journal {
    width: 95%;
    height: 90vh;
  }

  .journal-page {
    padding: 30px 25px;
  }

  .journal-page__date {
    font-size: 20px;
  }

  .journal-page__secret-dropdown {
    width: min(95%, 450px);
  }

  .journal-page__secret-content {
    font-size: 16px;
    padding: 16px 20px;
    max-height: 220px;
  }

  .journal-page__entry {
    font-size: 18px;
  }

  .journal__nav {
    padding: 10px 16px;
    font-size: 16px;
  }

  .journal__nav--prev {
    left: 10px;
  }

  .journal__nav--next {
    right: 10px;
  }
}

/* Mobile-first polish */
@media (max-width: 760px) {
  .scene::before {
    filter: blur(16px) saturate(0.95) brightness(0.78);
  }

  .scene__bg {
    max-width: min(96vw, 980px);
    max-height: 86vh;
    border-radius: 14px;
  }

  .outer-ui__title {
    display: none;
  }

  .outer-ui__hint {
    bottom: max(12px, env(safe-area-inset-bottom));
    font-size: 12px;
    padding: 10px 12px;
  }

  .note-card {
    width: min(94vw, 420px);
    min-height: 280px;
    padding: 38px 22px 18px;
  }

  .note-card__text {
    font-size: 26px;
  }

  .journal {
    width: 96vw;
    height: 92vh;
    max-height: none;
  }

  .journal-page {
    padding: 30px 20px 92px;
  }

  .journal-page__date {
    font-size: 20px;
    margin-bottom: 18px;
  }

  .journal-page__entry {
    font-size: 18px;
    line-height: 1.7;
  }

  .journal__nav {
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 10px 14px;
    font-size: 16px;
  }

  .journal__nav--prev {
    left: 12px;
  }

  .journal__nav--next {
    right: 12px;
  }
}
