/* ==========================================================================
   Cozy Watercolor Design System - Posy's Blended Meadow
   ========================================================================== */

   :root {
    /* Natural Earthy HSL Palette */
    --paper: #fffdfa;
    --paper-card: rgba(254, 252, 248, 0.95);
    --ink: #55443b;
    --ink-strong: #332721;
    --ink-light: #8e7b70;
    --green-leaf: #7b8e73;
    --green-bright: #8aac6f;
    --gold: #dfb26c;
    --gold-glow: rgba(223, 178, 108, 0.7);
    --rose: #dfa0a5;
    --rose-soft: #f2dcdb;
    --border: rgba(142, 123, 112, 0.22);
    
    /* Typography */
    --font-text: "EB Garamond", Georgia, serif;
    --font-hand: "Architects Daughter", cursive, sans-serif;
    --font-title: "Playfair Display", Didot, serif;
  }
  
  /* ==========================================================================
     Global Resets & Setup
     ========================================================================== */
  
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  
  body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 1.15rem;
    line-height: 1.6;
    user-select: none;
    position: relative;
  }
  
  /* Vector Watercolor Paper Grain Overlay (Vector & lightweight) */
  body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100;
    pointer-events: none;
    opacity: 0.055;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  }
  
  /* ==========================================================================
     Music Box Toggle Button
     ========================================================================== */
  
  #music-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 105;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--paper-card);
    border: 1.5px dashed var(--ink-light);
    border-radius: 30px;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--font-hand);
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(90, 75, 65, 0.06);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }
  
  #music-toggle:hover {
    transform: translateY(-2px);
    border-style: solid;
    border-color: var(--green-leaf);
    color: var(--green-leaf);
    box-shadow: 0 6px 20px rgba(90, 75, 65, 0.1);
  }
  
  #music-toggle.playing {
    border-style: solid;
    border-color: var(--gold);
    color: var(--ink-strong);
    box-shadow: 0 4px 18px rgba(223, 178, 108, 0.18);
  }
  
  .icon-music-box {
    width: 18px;
    height: 18px;
    transition: transform 0.8s ease;
  }
  
  #music-toggle.playing .icon-music-box {
    animation: rotateBox 4s linear infinite;
  }
  
  .notes-sparkle {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
  }
  
  #music-toggle.playing .notes-sparkle {
    animation: sparkleNote 2s infinite ease-in-out;
  }
  
  /* ==========================================================================
     Viewport & Panorama Horizontal Slide System
     ========================================================================== */
  
  #story-viewport {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
  }
  
  #panorama-container {
    display: flex;
    width: 700vw; /* 7 slides */
    height: 100%;
    transform: translateX(0vw);
    transition: transform 1.6s cubic-bezier(0.25, 1, 0.35, 1);
  }
  
  /* Slide Layout */
  .story-slide {
    width: 100vw;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: flex-end; /* Bottom alignment for cards */
    justify-content: flex-start;
    padding: 10vh 8vw 15vh; /* Safe zones for progress bar and cards */
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--paper);
    transition: opacity 1.2s ease;
  }
  
  /* Slide Specific Adjustments */
  #slide-cover {
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  
  #slide-6 {
    background: radial-gradient(circle at center, #fffefc 0%, #f6ede3 100%);
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw 14vh;
  }
  
  /* Hand-Drawn Watercolor Edge Effect on Cards */
  .story-card {
    background: var(--paper-card);
    border: 2px solid rgba(142, 122, 110, 0.18);
    /* Magic CSS hand-drawn sketch border-radius contour! */
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 0 12px 35px rgba(90, 75, 65, 0.1), inset 0 0 50px rgba(90, 75, 65, 0.02);
    padding: clamp(20px, 4.5vh, 40px) clamp(24px, 4vw, 42px);
    max-width: min(90vw, 550px);
    backdrop-filter: blur(3px);
    text-align: left;
    z-index: 10;
    transform: translateY(20px);
    opacity: 0;
    cursor: pointer;
    user-select: none;
    padding-bottom: clamp(35px, 6vh, 48px);
    transition: opacity 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.6s, 
                transform 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.6s;
  }

  .story-card::before {
    content: 'Tap card to tuck away ✕';
    position: absolute;
    bottom: 8px;
    right: 18px;
    font-family: var(--font-hand);
    font-size: 0.72rem;
    color: var(--ink-light);
    opacity: 0.6;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }

  .story-card:hover::before {
    opacity: 0.9;
  }
  
  /* Slide Is Active State animations */
  .story-slide.active .story-card {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                transform 0.8s cubic-bezier(0.25, 1, 0.5, 1),
                padding 0.5s ease, background-color 0.3s ease;
  }

  /* Minimized Card State */
  .story-card.minimized {
    transform: translateY(calc(100% - 24px)) !important;
    opacity: 0.95;
    padding: 6px 20px !important;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    box-shadow: 0 -4px 15px rgba(90, 75, 65, 0.08);
  }

  .story-card.minimized::before {
    opacity: 0;
  }

  .story-card.minimized::after {
    content: '📖 Read Story';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-hand);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-strong);
    opacity: 1;
    pointer-events: none;
  }

  .story-card.minimized * {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease;
  }
  
  /* Card Typography */
  .chapter-number {
    display: block;
    font-family: var(--font-hand);
    font-size: 0.95rem;
    color: var(--green-leaf);
    margin-bottom: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  
  .story-card h2 {
    font-family: var(--font-title);
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    color: var(--ink-strong);
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.2;
  }
  
  .story-card p {
    font-size: clamp(1.05rem, 2vh, 1.25rem);
    color: var(--ink);
    line-height: 1.65;
  }
  
  /* Cover Card Styling */
  .cover-panel {
    background: var(--paper-card);
    border: 2px solid rgba(142, 122, 110, 0.2);
    border-radius: 20px 225px 25px 255px/225px 25px 255px 20px;
    box-shadow: 0 15px 40px rgba(90, 75, 65, 0.12);
    padding: clamp(35px, 6vh, 60px) clamp(30px, 5vw, 55px);
    max-width: min(90vw, 640px);
    text-align: center;
    z-index: 15;
    animation: floatingPlate 6s ease-in-out infinite;
  }
  
  .vignette-eyebrow {
    display: inline-block;
    font-family: var(--font-hand);
    color: var(--ink-light);
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 14px;
  }
  
  .cover-panel h1 {
    font-family: var(--font-title);
    font-size: clamp(2.4rem, 6.5vw, 3.8rem);
    color: var(--ink-strong);
    line-height: 1.1;
    margin-bottom: 16px;
    font-weight: 800;
  }
  
  .cover-description {
    font-size: clamp(1.1rem, 2.2vh, 1.3rem);
    color: var(--ink);
    margin-bottom: 30px;
    line-height: 1.5;
  }
  
  .primary-btn {
    font-family: var(--font-hand);
    font-size: 1.1rem;
    background: var(--ink-strong);
    color: var(--paper);
    border: none;
    padding: 12px 34px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(90, 75, 65, 0.25);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }
  
  .primary-btn:hover {
    transform: scale(1.05) translateY(-2px);
    background: var(--green-leaf);
    box-shadow: 0 8px 25px rgba(123, 142, 115, 0.35);
  }
  
  /* ==========================================================================
     Slide 6 Keepsake Layout (Interactive Cards & Blessing Jar)
     ========================================================================== */
  
  .keepsake-container {
    width: 100%;
    max-width: 1100px;
    height: 100%;
    max-height: 680px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 30px;
    z-index: 10;
    align-items: stretch;
  }
  
  .family-column, .jar-column {
    background: var(--paper-card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(90, 75, 65, 0.04);
    padding: 24px 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  
  .keepsake-container h2 {
    font-family: var(--font-title);
    font-size: 1.7rem;
    color: var(--ink-strong);
    margin-bottom: 4px;
    text-align: center;
  }
  
  .column-desc {
    font-family: var(--font-text);
    font-size: 0.95rem;
    font-style: italic;
    color: var(--ink-light);
    margin-bottom: 20px;
    text-align: center;
  }
  
  /* Family Character Cards Grid */
  .family-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  
  .family-card-btn {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }
  
  .family-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 75, 65, 0.05);
    border-color: var(--green-leaf);
  }
  
  .family-card-btn.active {
    background: var(--rose-soft);
    border-color: var(--rose);
    box-shadow: 0 4px 15px rgba(223, 160, 165, 0.2);
  }
  
  .char-emoji {
    font-size: 1.4rem;
    margin-bottom: 4px;
  }
  
  .char-name {
    font-family: var(--font-title);
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--ink-strong);
  }
  
  .char-role {
    font-size: 0.72rem;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
  }
  
  /* Character Bio Panel */
  .bio-display-panel {
    flex-grow: 1;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 0 10px rgba(90, 75, 65, 0.01);
  }
  
  .bio-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
  }
  
  .bio-icon {
    font-size: 2rem;
  }
  
  .bio-header h3 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    color: var(--ink-strong);
    line-height: 1.1;
  }
  
  .bio-title {
    font-family: var(--font-hand);
    font-size: 0.75rem;
    color: var(--green-leaf);
    text-transform: uppercase;
  }
  
  .bio-description {
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.5;
  }
  
  .bio-wish {
    margin-top: auto;
    font-size: 0.82rem;
    color: var(--ink-light);
    background: rgba(223, 178, 108, 0.08);
    padding: 6px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--gold);
  }
  
  /* Blessing Jar Column */
  .jar-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
  }
  
  /* Glass Jar Rendering */
  .watercolor-jar-wrapper {
    position: relative;
    width: 170px;
    height: 240px;
    filter: drop-shadow(0 15px 30px rgba(90, 75, 65, 0.08));
  }
  
  .jar-lid {
    position: absolute;
    top: 0;
    left: 20px;
    width: 130px;
    height: 20px;
    background: linear-gradient(90deg, #dbcfc4 0%, #bcaea1 50%, #dbcfc4 100%);
    border: 1.5px solid var(--ink-light);
    border-radius: 8px 8px 3px 3px;
    z-index: 5;
  }
  
  .jar-body {
    position: absolute;
    top: 18px;
    left: 0;
    width: 170px;
    height: 222px;
    background: rgba(255, 255, 255, 0.15);
    border: 2.2px solid rgba(142, 123, 112, 0.45);
    /* Glass jar curved contour */
    border-radius: 20px 20px 50px 50px/20px 20px 30px 30px;
    backdrop-filter: blur(1.5px);
    overflow: hidden;
    z-index: 2;
  }
  
  /* Jar shine highlight reflection */
  .jar-shine {
    position: absolute;
    top: 10px;
    left: 14px;
    width: 16px;
    height: 180px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 10px;
    pointer-events: none;
  }
  
  /* Firefly Sparkles Inside Jar */
  .jar-firefly {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--gold);
    border-radius: 50%;
    box-shadow: 0 0 16px 5px var(--gold-glow);
    cursor: pointer;
    transition: transform 0.3s ease;
  }
  
  .jar-firefly:hover {
    transform: scale(1.6);
  }
  
  /* Watercolor Form input */
  .watercolor-form {
    width: 100%;
  }
  
  .input-wrapper {
    display: flex;
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: 25px;
    overflow: hidden;
    padding: 3px 3px 3px 16px;
    transition: border-color 0.3s ease;
  }
  
  .input-wrapper.no-btn {
    padding: 3px 16px;
  }
  
  .input-wrapper:focus-within {
    border-color: var(--green-leaf);
    box-shadow: 0 0 10px rgba(123, 142, 115, 0.1);
  }
  
  #wish-input, #wish-from-input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-family: var(--font-text);
    font-size: 0.98rem;
    color: var(--ink-strong);
    background: transparent;
    height: 38px;
  }
  
  .submit-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ink-strong);
    color: var(--paper);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
  
  .submit-btn:hover {
    background: var(--green-leaf);
    transform: scale(1.05);
  }
  
  .submit-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .form-helper {
    display: block;
    font-family: var(--font-hand);
    font-size: 0.72rem;
    color: var(--ink-light);
    margin-top: 6px;
    text-align: right;
  }
  
  /* ==========================================================================
     Parallax Floating Elements
     ========================================================================== */
  
  #parallax-foreground {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
  }
  
  /* Soft floating dandelion seeds */
  .floating-seed {
    position: absolute;
    bottom: -50px;
    left: var(--left);
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.22;
    animation: driftUp var(--speed) linear infinite var(--delay);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23dfb26c' stroke-width='1.2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='2' fill='%23dfb26c'/%3E%3Cpath d='M12 12L4 4M12 12L20 4M12 12L12 2M12 12L4 20M12 12L20 20'/%3E%3C/svg%3E");
  }
  
  .floating-seed.style-2 {
    width: 18px;
    height: 18px;
    opacity: 0.16;
  }
  
  .floating-seed.style-3 {
    width: 30px;
    height: 30px;
    opacity: 0.28;
  }
  
  /* Floating watercolor leaves */
  .floating-leaf {
    position: absolute;
    top: -50px;
    left: var(--left);
    width: 20px;
    height: 20px;
    opacity: 0.18;
    background-size: contain;
    background-repeat: no-repeat;
    animation: swayDown var(--speed) linear infinite var(--delay);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='%237b8e73' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2C6.48 2 2 12 2 12S6.48 22 12 22s10-10 10-10S17.52 2 12 2zm0 18c-4.41 0-8-8-8-8s3.59-8 8-8 8 8 8 8-3.59 8-8 8z'/%3E%3C/svg%3E");
  }
  
  .floating-leaf.style-2 {
    opacity: 0.12;
    fill: var(--rose);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='%23dfa0a5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2C6.48 2 2 12 2 12S6.48 22 12 22s10-10 10-10S17.52 2 12 2zm0 18c-4.41 0-8-8-8-8s3.59-8 8-8 8 8 8 8-3.59 8-8 8z'/%3E%3C/svg%3E");
  }
  
  /* ==========================================================================
     Navigation Controls
     ========================================================================== */
  
  .navigation-controls {
    position: absolute;
    bottom: 4vh;
    left: 0;
    right: 0;
    z-index: 90;
    display: flex;
    justify-content: space-between;
    padding: 0 8vw;
    pointer-events: none;
  }
  
  .nav-arrow {
    width: clamp(45px, 6vh, 60px);
    height: clamp(45px, 6vh, 60px);
    border-radius: 50%;
    background: var(--paper-card);
    border: 1.5px solid var(--border);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(90, 75, 65, 0.08);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: auto;
  }
  
  .nav-arrow:hover:not(:disabled) {
    transform: scale(1.08);
    border-color: var(--green-leaf);
    color: var(--green-leaf);
    box-shadow: 0 6px 22px rgba(90, 75, 65, 0.15);
  }
  
  .nav-arrow:active:not(:disabled) {
    transform: scale(0.96);
  }
  
  .nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
  }
  
  .nav-arrow svg {
    width: 22px;
    height: 22px;
  }
  
  /* ==========================================================================
     Ladybug Twig Progress Bar (Bottom)
     ========================================================================== */
  
  #progress-twig-bar {
    position: absolute;
    bottom: 2.5vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(80vw, 420px);
    z-index: 95;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
  .twig-leaf-container {
    position: relative;
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
  }
  
  /* Twig wood branch line */
  .twig-line {
    width: 100%;
    height: 3px;
    background: var(--ink-light);
    border-radius: 2px;
    opacity: 0.6;
    background-image: linear-gradient(90deg, var(--ink-light) 70%, var(--green-leaf) 100%);
  }
  
  /* Botanical Twig leaves along twig */
  .twig-leaf {
    position: absolute;
    left: var(--pos);
    width: 12px;
    height: 8px;
    background: var(--green-leaf);
    border-radius: 0 100% 0 100%; /* Leaf shape */
    transform: translate(-50%, -8px) rotate(-15deg);
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
  }
  
  .twig-leaf:hover {
    transform: translate(-50%, -10px) scale(1.4) rotate(-5deg);
    opacity: 1;
    background: var(--green-bright);
  }
  
  .twig-leaf.active {
    background: var(--green-bright);
    opacity: 1;
    transform: translate(-50%, -9px) scale(1.2) rotate(-5deg);
  }
  
  /* Alternating leaf rotations for organic rustic look */
  .twig-leaf:nth-child(even) {
    border-radius: 100% 0 100% 0;
    transform: translate(-50%, 4px) rotate(15deg);
  }
  
  .twig-leaf:nth-child(even):hover {
    transform: translate(-50%, 6px) scale(1.4) rotate(5deg);
  }
  
  .twig-leaf:nth-child(even).active {
    transform: translate(-50%, 5px) scale(1.2) rotate(5deg);
  }
  
  /* Cute Crawling Ladybug Indicator */
  #progress-ladybug {
    position: absolute;
    left: 0%;
    transform: translate(-50%, -6px);
    width: 18px;
    height: 13px;
    background: radial-gradient(circle at 35% 35%, #ff4d4d 0%, #c62828 100%);
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.18);
    transition: left 1.6s cubic-bezier(0.25, 1, 0.35, 1);
  }
  
  /* Tiny ladybug face/antennae */
  #progress-ladybug::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -2px;
    transform: translateY(-50%);
    width: 4px;
    height: 6px;
    background: var(--ink-strong);
    border-radius: 0 3px 3px 0;
  }
  
  /* Little black ladybug spots */
  .ladybug-spots {
    position: absolute;
    top: 2px;
    left: 4px;
    width: 2px;
    height: 2px;
    background: var(--ink-strong);
    border-radius: 50%;
    box-shadow: 6px 1px var(--ink-strong), 3px 4px var(--ink-strong), 7px 5px var(--ink-strong);
  }
  
  .progress-labels {
    font-family: var(--font-hand);
    font-size: 0.8rem;
    color: var(--ink-light);
    letter-spacing: 0.05em;
    pointer-events: none;
  }
  
  /* ==========================================================================
     Keyframe Animations
     ========================================================================== */
  
  @keyframes rotateBox {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  @keyframes sparkleNote {
    0% { opacity: 0; transform: translate(0, 0) scale(0.6) rotate(0deg); }
    50% { opacity: 0.9; transform: translate(5px, -12px) scale(1.1) rotate(15deg); }
    100% { opacity: 0; transform: translate(12px, -24px) scale(0.6) rotate(30deg); }
  }
  
  @keyframes floatingPlate {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(0.4deg); }
    100% { transform: translateY(0px) rotate(0deg); }
  }
  
  @keyframes driftUp {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: var(--opacity, 0.22); }
    90% { opacity: var(--opacity, 0.22); }
    100% { transform: translateY(-110vh) translateX(50px) rotate(360deg); opacity: 0; }
  }
  
  @keyframes swayDown {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    8% { opacity: var(--opacity, 0.18); }
    92% { opacity: var(--opacity, 0.18); }
    100% { transform: translateY(110vh) translateX(-60px) rotate(270deg); opacity: 0; }
  }
  
  /* ==========================================================================
     Responsive Media Queries
     ========================================================================== */
  
  @media (max-width: 900px) {
    .keepsake-container {
      grid-template-columns: 1fr;
      overflow-y: auto;
      max-height: 72vh;
      gap: 20px;
      padding-right: 8px; /* Scrollbar space */
    }
  
    .keepsake-container::-webkit-scrollbar {
      width: 4px;
    }
    .keepsake-container::-webkit-scrollbar-thumb {
      background-color: var(--border);
      border-radius: 4px;
    }
  
    #slide-6 {
      padding-top: 8vh;
    }
  
    .family-column, .jar-column {
      padding: 16px 20px;
    }
  
    .jar-area {
      min-height: 200px;
    }
  
    .watercolor-jar-wrapper {
      transform: scale(0.85);
    }
  }
  
  @media (max-width: 768px) {
    .story-slide {
      padding: 12vh 6vw 15vh;
      justify-content: center;
      align-items: flex-start; /* Aligns cards to the top on mobile/tablet */
    }
  
    .story-card {
      max-width: 96vw;
      text-align: center;
      padding: 20px;
      margin-top: 8px; /* Slight top spacer */
    }

    /* Mobile-specific tuck-up overrides since cards are at the top */
    .story-card.minimized {
      transform: translateY(calc(-100% + 42px)) !important; /* Slide upward, leave 42px visible */
      border-radius: 0 0 16px 16px;
      border-top: none;
      border-bottom: 2px solid rgba(142, 122, 110, 0.18);
      box-shadow: 0 4px 15px rgba(90, 75, 65, 0.08);
      padding: 6px 20px 32px !important; /* Generous bottom padding for tab text */
    }

    .story-card.minimized::after {
      top: auto;
      bottom: 8px; /* Beautifully centered text inside the 42px hanging tab */
    }
  
    .cover-panel {
      padding: 30px 20px;
      max-width: 92vw;
    }
  
    #music-toggle {
      top: 16px;
      right: 16px;
      padding: 8px 14px;
    }
  
    .navigation-controls {
      padding: 0 4vw;
      bottom: 4.5vh;
    }
  
    .nav-arrow {
      width: 46px;
      height: 46px;
    }
  
    #progress-twig-bar {
      width: 65vw;
      bottom: 2vh;
    }
  
    .twig-leaf-container {
      height: 16px;
    }
  
    #progress-ladybug {
      width: 14px;
      height: 10px;
    }
  }

  /* Wish Speech Bubble Arrow */
  .wish-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: var(--paper-card) transparent;
    display: block;
    width: 0;
    filter: drop-shadow(0 2px 2px rgba(90, 75, 65, 0.05));
  }

