/* ============================================
   RESET & BASE
   ============================================ */
   *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  
  :root {
    --bg-deep:        #060816;
    --bg-mid:         #0a0f2e;
    --accent-blue:    #89CFF0;
    --accent-gold:    #f0c060;
    --accent-rose:    #e8a0b0;
    --glass-bg:       rgba(255,255,255,0.06);
    --glass-border:   rgba(255,255,255,0.15);
    --glass-blur:     blur(16px);
    --text-primary:   #f0eeff;
    --text-secondary: #a0b0d0;
    --heart-broken:   #4a2030;
    --heart-healed:   #e8607a;
    --moon-glow:      rgba(137,207,240,0.25);
    --safe-top:       env(safe-area-inset-top, 0px);
    --safe-bottom:    env(safe-area-inset-bottom, 0px);
  }
  
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }
  
  /* ============================================
     CANVAS BACKGROUND
     ============================================ */
  #starCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
  }
  
  /* ============================================
     MOON
     ============================================ */
  .moon {
    position: fixed;
    top: clamp(40px, 8vh, 80px);
    right: clamp(20px, 6vw, 60px);
    width: clamp(50px, 10vw, 80px);
    height: clamp(50px, 10vw, 80px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%,
      #e8f4ff 0%,
      #c8e8ff 40%,
      #a0d0f0 100%
    );
    box-shadow:
      0 0 20px 8px var(--moon-glow),
      0 0 60px 20px rgba(137,207,240,0.12),
      0 0 120px 40px rgba(137,207,240,0.06);
    z-index: 1;
    animation: moonPulse 6s ease-in-out infinite;
  }
  
  @keyframes moonPulse {
    0%, 100% { box-shadow:
      0 0 20px 8px var(--moon-glow),
      0 0 60px 20px rgba(137,207,240,0.12),
      0 0 120px 40px rgba(137,207,240,0.06); }
    50% { box-shadow:
      0 0 30px 12px rgba(137,207,240,0.35),
      0 0 80px 30px rgba(137,207,240,0.18),
      0 0 150px 60px rgba(137,207,240,0.08); }
  }
  
  /* ============================================
     SCENE ENGINE
     ============================================ */
  #app {
    position: fixed;
    inset: 0;
    z-index: 2;
  }
  
  .scene {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding:
      calc(var(--safe-top) + clamp(20px, 5vh, 50px))
      clamp(20px, 6vw, 40px)
      calc(var(--safe-bottom) + clamp(20px, 5vh, 50px));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    z-index: 2;
  }
  
  .scene.active {
    opacity: 1;
    pointer-events: all;
  }
  
  /* ============================================
     TYPOGRAPHY
     ============================================ */
  .title-serif {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 7vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-align: center;
  }
  
  .title-serif .highlight {
    color: var(--accent-blue);
    font-style: italic;
  }
  
  .subtitle {
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.7;
    max-width: 340px;
  }
  
  .body-text {
    font-size: clamp(0.9rem, 2.8vw, 1.15rem);
    color: var(--text-primary);
    line-height: 1.8;
    text-align: center;
    max-width: 360px;
  }
  
  .caption {
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  
  /* ============================================
     GLASS CARD
     ============================================ */
  .glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    padding: clamp(20px, 5vw, 36px);
    width: 100%;
    max-width: 380px;
  }
  
  /* ============================================
     BUTTONS
     ============================================ */
  .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg,
      rgba(137,207,240,0.25),
      rgba(137,207,240,0.1)
    );
    border: 1px solid rgba(137,207,240,0.4);
    color: var(--accent-blue);
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 500;
    padding: 14px 32px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    letter-spacing: 0.04em;
    min-height: 52px;
  }
  
  .btn-primary:active {
    transform: scale(0.96);
    background: linear-gradient(135deg,
      rgba(137,207,240,0.35),
      rgba(137,207,240,0.18)
    );
  }
  
  .btn-ghost {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.8rem, 2.2vw, 0.95rem);
    padding: 12px 28px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-height: 48px;
  }
  
  .btn-ghost:active {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: scale(0.96);
  }
  
  .btn-sms {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #e8607a, #c04060);
    border: none;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.9rem, 2.8vw, 1.1rem);
    font-weight: 600;
    padding: 16px 40px;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-height: 56px;
    box-shadow: 0 8px 32px rgba(232,96,122,0.35);
  }
  
  .btn-sms:active {
    transform: scale(0.96);
    box-shadow: 0 4px 16px rgba(232,96,122,0.25);
  }
  
  /* ============================================
     HEART SVG
     ============================================ */
  .heart-container {
    position: relative;
    width: clamp(120px, 35vw, 180px);
    height: clamp(120px, 35vw, 180px);
    margin: 0 auto;
  }
  
  .heart-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(232,96,122,0.4));
    transition: filter 0.8s ease;
  }
  
  .heart-svg.healed {
    filter: drop-shadow(0 0 40px rgba(232,96,122,0.8))
            drop-shadow(0 0 80px rgba(232,96,122,0.4));
  }
  
  /* Heart fill layers */
  #heartBroken {
    fill: var(--heart-broken);
    transition: fill 1.5s ease;
  }
  
  #heartHealed {
    fill: var(--heart-healed);
    clip-path: inset(100% 0 0 0);
    transition: clip-path 2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  #heartHealed.filling {
    clip-path: inset(0% 0 0 0);
  }
  
  /* Crack lines */
  .crack {
    stroke: rgba(255,255,255,0.3);
    stroke-width: 1.5;
    fill: none;
    transition: opacity 1.5s ease;
  }
  
  .crack.healed {
    opacity: 0;
  }
  
  /* ============================================
     PROGRESS DOTS
     ============================================ */
  .progress-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
  }
  
  .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--glass-border);
    transition: all 0.4s ease;
  }
  
  .dot.active {
    background: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue);
    width: 20px;
    border-radius: 3px;
  }
  
  .dot.done {
    background: rgba(137,207,240,0.4);
  }
  
  /* ============================================
     PHOTO FRAMES
     ============================================ */
  .photo-frame {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 4/5;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    overflow: hidden;
    position: relative;
  }
  
  .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  
  .photo-frame .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
  }
  
  .photo-frame .placeholder span {
    font-size: 2rem;
  }
  
  .photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 360px;
  }
  
  .photo-grid .photo-frame {
    max-width: none;
    aspect-ratio: 3/4;
  }
  
  /* ============================================
     HIDDEN STARS
     ============================================ */
  .star-field {
    position: relative;
    width: 100%;
    max-width: 360px;
    height: 220px;
  }
  
  .hidden-star {
    position: absolute;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    color: rgba(137,207,240,0.3);
    animation: starTwinkle 3s ease-in-out infinite;
  }
  
  .hidden-star:nth-child(2) { animation-delay: 1s; }
  .hidden-star:nth-child(3) { animation-delay: 2s; }
  
  @keyframes starTwinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
  }
  
  .hidden-star.found {
    color: var(--accent-gold);
    animation: starFound 0.6s ease forwards;
  }
  
  @keyframes starFound {
    0% { transform: scale(1); }
    50% { transform: scale(1.8); }
    100% { transform: scale(1.2); color: var(--accent-gold); }
  }
  
  .stars-counter {
    font-size: clamp(0.75rem, 2.2vw, 0.9rem);
    color: var(--text-secondary);
    letter-spacing: 0.1em;
  }
  
  .stars-counter span {
    color: var(--accent-gold);
    font-weight: 600;
  }
  
  /* ============================================
     MODAL
     ============================================ */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6,8,22,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
  }
  
  .modal-overlay.open {
    opacity: 1;
    pointer-events: all;
  }
  
  .modal-card {
    background: rgba(10,15,46,0.95);
    border: 1px solid rgba(137,207,240,0.25);
    border-radius: 24px;
    padding: clamp(24px, 6vw, 40px);
    max-width: 340px;
    width: 100%;
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  }
  
  .modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
  }
  
  .modal-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
  }
  
  .modal-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    color: var(--accent-blue);
    margin-bottom: 12px;
  }
  
  .modal-text {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
  }
  
  /* ============================================
     LETTER SCENE
     ============================================ */
  .letter-card {
    background: rgba(10,15,46,0.8);
    border: 1px solid rgba(240,192,96,0.2);
    border-radius: 20px;
    padding: clamp(20px, 5vw, 32px);
    width: 100%;
    max-width: 380px;
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .letter-card::-webkit-scrollbar {
    display: none;
  }
  
  .letter-text {
    font-family: 'Playfair Display', serif;
    font-size: clamp(0.9rem, 2.8vw, 1.05rem);
    color: var(--text-primary);
    line-height: 1.9;
    text-align: left;
  }
  
  .letter-text p + p {
    margin-top: 16px;
  }
  
  .letter-signature {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: var(--accent-gold);
    text-align: right;
    margin-top: 24px;
  }
  
  /* ============================================
     MEMORY CHOICES
     ============================================ */
  .memory-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 340px;
  }
  
  .memory-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    padding: 16px 20px;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    touch-action: manipulation;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .memory-btn:active,
  .memory-btn.selected {
    border-color: var(--accent-blue);
    background: rgba(137,207,240,0.1);
    color: var(--accent-blue);
  }
  
  /* ============================================
     SCENE-SPECIFIC: OPENING
     ============================================ */
  #scene-0 .tagline {
    font-size: clamp(0.75rem, 2.2vw, 0.9rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-blue);
    opacity: 0.7;
  }
  
  #scene-0 .opening-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(16px, 4vh, 28px);
  }
  
  /* ============================================
     SCENE-SPECIFIC: HEART RESTORED
     ============================================ */
  #scene-10 .restored-glow {
    animation: restoredPulse 2s ease-in-out infinite;
  }
  
  @keyframes restoredPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
  }
  
  .confetti-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 50%;
  }
  
  /* ============================================
     SCENE-SPECIFIC: FINAL CTA
     ============================================ */
  #scene-11 .final-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(20px, 5vh, 36px);
    text-align: center;
  }
  
  #scene-11 .final-note {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: var(--text-secondary);
    opacity: 0.6;
    max-width: 280px;
  }
  
  /* ============================================
     UTILITY SPACERS
     ============================================ */
  .gap-sm  { height: clamp(8px,  2vh, 14px); }
  .gap-md  { height: clamp(14px, 3vh, 24px); }
  .gap-lg  { height: clamp(20px, 5vh, 36px); }
  
  /* ============================================
     ENTRANCE ANIMATIONS
     ============================================ */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  
  @keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
  }
  
  .anim-fade-up   { animation: fadeUp  0.7s ease both; }
  .anim-fade-in   { animation: fadeIn  0.7s ease both; }
  .anim-scale-in  { animation: scaleIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both; }
  
  .anim-delay-1 { animation-delay: 0.15s; }
  .anim-delay-2 { animation-delay: 0.30s; }
  .anim-delay-3 { animation-delay: 0.45s; }
  .anim-delay-4 { animation-delay: 0.60s; }
  .anim-delay-5 { animation-delay: 0.75s; }
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-6px); }
    80%       { transform: translateX(6px); }
  }
  
  .shake {
    animation: shake 0.5s ease;
  }
  
  /* Really Modal */
  #reallyModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  #reallyModal.open {
    opacity: 1;
    pointer-events: all;
  }
  
  #reallyModal .modal-box {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 36px 40px;
    text-align: center;
    color: #fff;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
  }
  .btn-close {
    margin-top: 24px;
    padding: 10px 32px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
  }
  
  .btn-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
  }