/* Scrapbook UI */
.scrapbook-container {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.intro-card {
    background: #f9f6f0;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.15),
        inset 0 0 40px rgba(139, 126, 102, 0.05); /* tactile edge */
    border: 1px solid #d5c4a6;
    padding: 60px 70px;
    border-radius: 4px;
    text-align: center;
    max-width: 800px;
    z-index: 20;
    transform: rotate(-1.5deg);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.intro-card:hover {
    transform: rotate(0deg) scale(1.02);
}

.intro-card.fade-in {
    animation: paperFadeIn var(--transition-slow) forwards;
}

@keyframes paperFadeIn {
    from { opacity: 0; transform: translateY(10px) rotate(-1.5deg); }
    to { opacity: 1; transform: translateY(0) rotate(-1.5deg); }
}

.intro-card h2 {
    font-size: 3.5rem;
    margin-bottom: 25px;
    color: #4a433a;
}

#intro-message {
    color: #4a433a;
    font-size: 1.15rem;
    margin-bottom: 40px;
}

.bouquet-container {
    position: relative;
    width: 600px;
    height: 600px;
}

.flower-item {
    position: absolute;
    top: 50%; left: 50%;
    transform-origin: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s;
    /* We'll use negative margins to center it based on size via JS */
}

.flower-item:hover {
    filter: brightness(1.05) drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

.flower-item img {
    width: 100%;
    height: auto;
    pointer-events: none;
    mix-blend-mode: multiply;
}

/* Scrapbook Chapter Overlay */
.chapter-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 100;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chapter-overlay.visible {
    pointer-events: auto;
}

.chapter-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(230, 222, 208, 0.95); /* soft warm cream */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.8s ease;
}

.chapter-overlay.visible .chapter-background {
    opacity: 1;
}

.back-to-garden-btn {
    position: absolute;
    top: 30px; left: 40px;
    background: none;
    border: none;
    color: #7b6f61;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.5s ease 0.5s;
    z-index: 110;
}

.back-to-garden-btn:hover {
    color: #4a433a;
}

.chapter-overlay.visible .back-to-garden-btn {
    opacity: 1;
    transform: translateX(0);
}

.chapter-content-container {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 105;
}

.chapter-paper {
    background: #f9f6f0;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.1),
        inset 0 0 40px rgba(139, 126, 102, 0.05); /* tactile edge */
    padding: 50px 70px;
    border-radius: 4px;
    max-width: 850px;
    width: 90%;
    position: absolute;
    opacity: 0;
    transform: translateY(40px) rotate(-3deg) scale(0.95);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chapter-overlay.visible .chapter-paper {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
    transition-delay: 0.2s;
}

.chapter-title {
    font-size: 2.5rem;
    color: #b75c53;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.chapter-intro {
    font-size: 1rem;
    color: #8c8070;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(140, 128, 112, 0.3);
    padding-bottom: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.chapter-body {
    font-size: 1rem;
    line-height: 1.8;
    color: #4a433a;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.chapter-signature {
    margin-top: 40px;
    font-size: 1.4rem;
    color: #7b6f61;
    text-align: right;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.chapter-overlay.visible .chapter-title { opacity: 1; transform: translateY(0); transition-delay: 0.6s; }
.chapter-overlay.visible .chapter-intro { opacity: 1; transform: translateY(0); transition-delay: 0.7s; }
.chapter-overlay.visible .chapter-body { opacity: 1; transform: translateY(0); transition-delay: 0.9s; }
.chapter-overlay.visible .chapter-signature { opacity: 1; transform: translateY(0); transition-delay: 1.2s; }

.chapter-flower-container {
    position: absolute;
    right: -40px;
    bottom: -80px;
    width: 280px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8) rotate(5deg);
    transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    filter: drop-shadow(0 15px 20px rgba(0,0,0,0.15));
}

.chapter-overlay.visible .chapter-flower-container {
    opacity: 1;
    transform: scale(1) rotate(-5deg);
    transition-delay: 0.4s;
}

.chapter-flower-img {
    width: 100%;
    height: auto;
    mix-blend-mode: multiply;
}

.flower-item {
    transition: filter 0.4s ease;
}
.flower-item img {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.flower-item:hover img {
    transform: scale(1.05) translateY(-5px);
}

/* Cassette Player Upgraded UI */
#cassette-player {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: #e3d4bb; /* Outer casing color */
    padding: 20px;
    border-radius: 12px;
    box-shadow: 
        inset 0 2px 5px rgba(255,255,255,0.8),
        0 15px 35px rgba(0,0,0,0.2),
        0 5px 15px rgba(0,0,0,0.1);
    border: 1px solid #d5c4a6;
    transition: transform 0.3s ease, opacity 0.5s ease;
}

#cassette-player:hover {
    transform: translateY(-5px);
}

/* Screws */
.screw {
    position: absolute;
    width: 12px; height: 12px;
    background: #333;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}
.screw::after {
    content: '+';
    color: #111;
    font-size: 10px;
    font-family: sans-serif;
    line-height: 1;
    transform: rotate(45deg);
}
.screw.top-left { top: 12px; left: 12px; }
.screw.top-right { top: 12px; right: 12px; }
.screw.bottom-left { bottom: 12px; left: 12px; }
.screw.bottom-right { bottom: 12px; right: 12px; }

/* Cassette Tape */
.cassette-tape {
    width: 350px;
    height: 220px;
    background: #2c2826; /* Dark border */
    border-radius: 12px;
    padding: 5px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), 0 2px 5px rgba(0,0,0,0.2);
}

.tape-body {
    width: 100%;
    height: 100%;
    background: #d6c8b3;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Label Area */
.tape-label-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    position: relative;
    z-index: 2;
}

.label-red-part {
    background: #b75c53;
    height: 60px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    color: #f0e6d6;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.side-indicator {
    border: 1.5px solid rgba(255,255,255,0.7);
    border-radius: 3px;
    padding: 2px 8px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 1.1rem;
}

.title-artist {
    text-align: center;
}

.tape-title {
    font-size: 1.8rem;
    font-style: italic;
    font-family: var(--font-serif);
    line-height: 1;
}

.tape-artist {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-top: 2px;
}

.tape-duration {
    font-size: 0.8rem;
    font-family: var(--font-sans);
    opacity: 0.9;
}

.label-beige-part {
    background: #e3d4bb;
    flex-grow: 1;
    border-radius: 0 0 6px 6px;
    position: relative;
    padding: 10px;
    /* Horizontal lines pattern */
    background-image: repeating-linear-gradient(to bottom, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 5px);
}

/* Tape Window */
.tape-window-container {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 50px;
    background: #1c1a17;
    border-radius: 25px;
    border: 2px solid rgba(0,0,0,0.5);
    box-shadow: inset 0 3px 10px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.6);
    padding: 2px 10px;
}

.tape-window {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.reel {
    width: 40px; height: 40px;
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #111;
}
.reel::after {
    content: '';
    position: absolute;
    width: 24px; height: 24px;
    background: #fff;
    border-radius: 50%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.tape-roll {
    position: absolute;
    border-radius: 50%;
    background: #3b2c21; 
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
    transition: width 0.1s linear, height 0.1s linear;
}

.reel.left .tape-roll {
    width: 55px; height: 55px;
}
.reel.right .tape-roll {
    width: 38px; height: 38px;
}

.window-center {
    flex-grow: 1;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 10;
}

.tape-strip {
    position: absolute;
    top: 50%;
    left: -10px; right: -10px;
    height: 25px;
    transform: translateY(-50%);
    background: #3b2c21;
    z-index: -1;
}

.tape-markers {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    color: rgba(255,255,255,0.5);
    font-size: 0.6rem;
    font-family: var(--font-sans);
    padding-top: 25px;
    position: relative;
}
.tape-markers::before {
    content: '';
    position: absolute;
    bottom: 12px; left: 0; right: 0;
    height: 1px;
    background: rgba(255,255,255,0.3);
}

/* Bottom trapezoid area */
.tape-bottom {
    height: 35px;
    width: 70%;
    margin: 0 auto;
    background: #d6c8b3;
    position: relative;
    border-top: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.5);
    clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}
.bottom-screw {
    width: 8px; height: 8px;
    background: #333;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}
.hole {
    position: absolute;
    background: #2c2826;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.6);
}
.hole.small { width: 10px; height: 10px; bottom: 12px; }
.hole.large { width: 16px; height: 16px; bottom: 9px; }
.hole-left-1 { left: 10%; }
.hole-left-2 { left: 25%; }
.hole-right-2 { right: 25%; }
.hole-right-1 { right: 10%; }

/* Player Controls */
.player-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.buttons-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.btn-label {
    font-size: 0.55rem;
    color: #8c8070;
    font-weight: 600;
    letter-spacing: 1px;
}

.control-icon-btn {
    width: 45px; height: 45px;
    background: #e3d4bb;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #554e44;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.8),
        0 3px 5px rgba(0,0,0,0.15),
        0 1px 2px rgba(0,0,0,0.1);
    border: 1px solid #d5c4a6;
    transition: all 0.1s;
    cursor: pointer;
}
.control-icon-btn:active {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.control-icon-btn.stuck {
    transform: translateY(2px);
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.25);
    background: #d5c4a6;
}

.main-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}
.main-buttons .control-icon-btn {
    border-radius: 50%;
    width: 50px; height: 50px;
}

.play-btn {
    width: 65px; height: 65px;
    border-radius: 50%;
    background: #b75c53;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.3),
        0 4px 8px rgba(183,92,83,0.4),
        0 2px 4px rgba(0,0,0,0.2);
    border: 1px solid #9c4c44;
    transition: all 0.1s;
    cursor: pointer;
}
.play-btn:active {
    transform: translateY(2px);
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.3);
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.75rem;
    color: #8c8070;
    font-family: var(--font-sans);
    padding: 0 15px;
}

.progress-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

#progress-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #c7bca5; /* Will be updated dynamically by JS */
    border-radius: 2px;
    outline: none;
    position: relative;
    z-index: 5;
}

#progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px; height: 12px;
    background: #b75c53;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 2px solid #e3d4bb;
    cursor: pointer;
}

#progress-slider::-moz-range-thumb {
    width: 12px; height: 12px;
    background: #b75c53;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 2px solid #e3d4bb;
    cursor: pointer;
    border: none;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

#volume-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #c7bca5;
    border-radius: 2px;
    outline: none;
}
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #8c8070;
    cursor: pointer;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}
.playing .reel {
    animation: spin 2.5s linear infinite;
}

/* Letter Scene */
.letter-paper {
    background: #fdfbf7;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.04"/></svg>');
    border: 1px solid #e2d5c3;
    max-width: 1100px;
    width: 95%;
    max-height: 95vh;
    padding: 40px 60px 25px 60px;
    box-shadow: 
        2px 10px 30px rgba(0,0,0,0.1),
        inset 0 0 40px rgba(139, 126, 102, 0.05);
    border-radius: 2px;
    transform: rotate(0.5deg);
    position: relative;
    display: flex;
    flex-direction: column;
}

.tape-top {
    position: absolute;
    top: -15px;
    left: 50%;
    margin-left: -60px;
    width: 120px;
    height: 35px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    transform: rotate(-2deg);
    z-index: 20;
}

.letter-paper h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: var(--color-text-main);
    flex-shrink: 0;
}

.letter-paper #letter-body {
    column-width: 400px;
    column-gap: 50px;
    column-rule: 1px solid rgba(139, 126, 102, 0.2);
    font-size: clamp(0.85rem, 1.8vh, 1.05rem);
    line-height: 1.6;
    color: #5a5245;
    text-align: justify;
    overflow-y: hidden;
    flex-grow: 1;
}

#letter-signature {
    margin-top: 15px;
    font-size: 1.8rem;
    text-align: right;
    color: var(--color-text-main);
    flex-shrink: 0;
}

/* Final Scene */
.final-container {
    text-align: center;
}
.final-flower {
    margin-bottom: 30px;
}
.final-peony-img {
    width: 300px;
    height: auto;
    mix-blend-mode: multiply;
}
#final-date {
    font-size: 2.5rem;
    margin-bottom: 10px;
}
#final-greeting {
    font-size: 2rem;
    color: #cc3333; /* A vibrant, beautiful red */
    margin-bottom: 40px;
}

/* Photobooth Button Container */
#photobooth-btn-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 30;
    transition: transform 0.3s ease, opacity 0.5s ease;
}

#read-letter-btn {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%) rotate(2deg);
}

#read-letter-btn:hover {
    transform: translateX(-50%) translateY(-3px) scale(1.05) rotate(0deg);
}

/* 20th Birthday Cheesecake & Candle Scene */
.cake-scene-container {
    width: 90%;
    max-width: 900px;
    height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.cake-header-card {
    background: #f9f6f0;
    box-shadow: 
        0 12px 28px rgba(0,0,0,0.1),
        inset 0 0 30px rgba(139, 126, 102, 0.04);
    border: 1px solid #d5c4a6;
    padding: 18px 45px;
    border-radius: 4px;
    text-align: center;
    z-index: 20;
    transform: rotate(-0.5deg);
    transition: all 0.3s ease;
}

.cake-header-card:hover {
    transform: rotate(0deg) scale(1.01);
}

.cake-title {
    font-size: 2.2rem;
    color: #4a433a;
    line-height: 1.2;
    margin-bottom: 4px;
}

.cake-subtitle {
    font-size: 1.05rem;
    color: #8c8070;
}

/* Ambient glow around the cheesecake */
.cake-ambient-glow {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 620px;
    height: 620px;
    background: radial-gradient(circle, rgba(255, 195, 85, 0.32) 0%, rgba(255, 150, 45, 0.14) 42%, transparent 72%);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    z-index: 2;
}

.cake-ambient-glow.active {
    opacity: 1;
    animation: ambientCandlePulse 2.8s infinite alternate ease-in-out;
}

@keyframes ambientCandlePulse {
    0% { transform: translate(-50%, -50%) scale(0.96); opacity: 0.85; }
    50% { transform: translate(-50%, -50%) scale(1.04); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.98); opacity: 0.9; }
}

/* Cheesecake stage */
.cheesecake-stage {
    position: relative;
    width: 480px;
    max-width: 92vw;
    height: 380px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.cheesecake-wrapper {
    position: relative;
    width: 420px;
    max-width: 86vw;
    margin: 0 auto;
    filter: drop-shadow(0 20px 30px rgba(55, 40, 25, 0.22));
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    animation: cakeFloat 4.5s ease-in-out infinite;
}

@keyframes cakeFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(0.6deg); }
}

.cheesecake-wrapper:hover {
    transform: scale(1.03) translateY(-4px);
}

.cheesecake-img {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    pointer-events: none;
}

/* 20th Birthday Candle Wick Targets */
.candle-wick-target {
    position: absolute;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -100%);
    cursor: pointer;
    z-index: 20;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.candle-wick-target.candle-2 {
    left: 42.6%;
    top: 1.0%;
}

.candle-wick-target.candle-0 {
    left: 58.1%;
    top: 0.7%;
}

/* Flame Assembly */
.flame-wrapper {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 32px;
    height: 48px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.candle-wick-target.lit .flame-wrapper {
    opacity: 1;
    transform: translateX(-50%) scale(1) !important;
    pointer-events: auto;
}

.candle-wick-target.blown .smoke-wisp {
    animation: smokeRise 1.8s ease-out forwards;
}

.flame-body {
    width: 18px;
    height: 34px;
    margin: 0 auto;
    background: radial-gradient(ellipse at bottom, #ffffff 0%, #fffb91 22%, #ff9d00 55%, #d84315 90%);
    border-radius: 50% 50% 35% 35% / 80% 80% 35% 35%;
    box-shadow: 
        0 0 16px 5px rgba(255, 170, 0, 0.75),
        0 0 35px 12px rgba(255, 100, 0, 0.4);
    animation: flameWindFlicker 1.5s infinite ease-in-out;
    position: relative;
    transform-origin: center bottom;
}

.flame-core {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 12px;
    background: radial-gradient(ellipse at bottom, #90caf9 0%, #42a5f5 50%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 50% 50% 35% 35%;
    animation: coreFlicker 0.5s infinite alternate ease-in-out;
}

.flame-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 210, 80, 0.45) 0%, rgba(255, 160, 40, 0.15) 50%, transparent 70%);
    border-radius: 50%;
    animation: flamePulse 1.4s infinite alternate ease-in-out;
    pointer-events: none;
}

@keyframes flameWindFlicker {
    0%, 100% { transform: scale(1, 1) rotate(0deg) skewX(0deg); }
    10% { transform: scale(0.9, 1.1) rotate(8deg) skewX(6deg) translateX(1px); }
    20% { transform: scale(1.05, 0.95) rotate(-4deg) skewX(-3deg); }
    30% { transform: scale(0.85, 1.2) rotate(18deg) skewX(15deg) translateX(3px) translateY(-2px); } /* Gust of wind */
    40% { transform: scale(1.1, 0.9) rotate(2deg) skewX(1deg); }
    50% { transform: scale(0.95, 1.05) rotate(-8deg) skewX(-6deg) translateX(-1px); }
    60% { transform: scale(0.8, 1.25) rotate(25deg) skewX(20deg) translateX(4px) translateY(-3px); } /* Stronger gust */
    70% { transform: scale(1.05, 0.9) rotate(5deg) skewX(4deg); }
    80% { transform: scale(0.9, 1.1) rotate(-2deg) skewX(-1deg); }
    90% { transform: scale(0.95, 1.15) rotate(12deg) skewX(10deg) translateX(2px) translateY(-1px); }
}

@keyframes coreFlicker {
    0% { transform: translateX(-50%) scale(1, 1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1.1, 0.8); opacity: 0.7; }
}

@keyframes flamePulse {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* Smoke Wisps (after blowing out) */
.smoke-wisp {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 20px;
    opacity: 0;
    pointer-events: none;
}

.candle-item.blown .smoke-wisp {
    animation: smokeRise 1.8s ease-out forwards;
}

@keyframes smokeRise {
    0% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(0) scale(0.6);
        filter: blur(1px);
        background: radial-gradient(circle, rgba(200, 190, 180, 0.8) 0%, transparent 70%);
        border-radius: 50%;
    }
    50% {
        opacity: 0.5;
        transform: translateX(-30%) translateY(-25px) scale(1.5);
        filter: blur(3px);
        background: radial-gradient(circle, rgba(180, 170, 160, 0.6) 0%, transparent 70%);
    }
    100% {
        opacity: 0;
        transform: translateX(-60%) translateY(-50px) scale(2.4);
        filter: blur(6px);
    }
}

/* Matchstick UI */
.matchstick-container {
    position: absolute;
    right: -10px;
    bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    z-index: 30;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.matchstick-container:hover {
    filter: brightness(1.1);
}

.matchstick {
    position: relative;
    width: 14px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: rotate(25deg);
    transform-origin: bottom center;
    transition: transform 0.4s ease;
}

.match-head {
    width: 12px;
    height: 18px;
    background: radial-gradient(circle at 35% 35%, #e53935 0%, #b71c1c 65%, #7f0000 100%);
    border-radius: 6px 6px 4px 4px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.4), 0 2px 4px rgba(0,0,0,0.25);
    position: relative;
    z-index: 2;
}

.match-wood {
    width: 6px;
    height: 85px;
    background: linear-gradient(to right, #dfc69c 0%, #eedbc0 45%, #c8aa7b 100%);
    border-radius: 0 0 2px 2px;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.15);
    margin-top: -2px;
}

.match-flame {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 22px;
    height: 34px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.matchstick.lit .match-flame {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.matchstick.lit .match-head {
    background: radial-gradient(circle at 35% 35%, #ff9800 0%, #ff5722 65%, #212121 100%);
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.8);
}

.match-prompt {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05rem;
    color: #8c8070;
    background: rgba(249, 246, 240, 0.85);
    border: 1px dashed #d5c4a6;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    animation: gentleBounce 2s infinite ease-in-out;
}

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



/* Cake Actions Container */
.cake-actions-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 25;
    min-height: 50px;
}

/* Sparkle particles for celebration */
.sparkle-particle {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    z-index: 40;
    animation: sparkleFall 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes sparkleFall {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx, 0px), var(--ty, 100px)) scale(0.2);
    }
}

/* Make A Wish Popup */
.make-a-wish-popup {
    position: absolute;
    top: 25%;
    left: calc(50% + 180px);
    transform: scale(0.8) rotate(6deg);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-align: center;
}

.make-a-wish-popup.visible {
    opacity: 1;
    transform: scale(1) rotate(6deg);
    pointer-events: auto;
    animation: gentleBounce 2s infinite ease-in-out;
}

.make-a-wish-popup h2 {
    font-size: 2.5rem;
    color: #cc3333; /* Vibrant red */
    margin: 0;
    white-space: nowrap;
    text-shadow: 2px 2px 15px rgba(255,255,255,1), -2px -2px 15px rgba(255,255,255,1);
}

/* Spotify Queue Modal */
#spotify-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#spotify-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.spotify-modal-content {
    background: transparent;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

#spotify-modal.visible .spotify-modal-content {
    transform: translateY(0);
}

#close-spotify-btn {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}