:root {
    --bg-color: #fce4ec;
    --text-primary: #333;
    --text-secondary: #666;
    --primary-color: #f06292;
    --primary-hover: #e91e63;
    --secondary-color: #fff;
    --card-bg: rgba(255, 255, 255, 0.85);
    --dark-bg: #121212;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --bulb-off: #333;
    --bulb-on: #fffacd;
    --accent: #ffeb3b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 1s ease;
}

.font-caveat {
    font-family: 'Caveat', cursive;
}

.font-outfit {
    font-family: 'Outfit', sans-serif;
}

#container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    position: relative;
}

.step {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transform: translateY(20px);
}

.step.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Common Components */
.btn {
    padding: 12px 32px;
    border-radius: 50px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    outline: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(240, 98, 146, 0.4);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #f5f5f5;
}

.btn-light {
    background-color: #444;
    color: #eee;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.btn-light:hover {
    background-color: #555;
}

.btn-float {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}
.btn-float:active {
    transform: translateX(-50%) scale(0.95);
}

.hidden {
    display: none !important;
}

.title-text {
    font-size: 3rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.big-text {
    font-size: 3.5rem;
    color: var(--primary-hover);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.sub-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Step 1: Envelope */
.envelope-wrapper {
    position: relative;
    width: 280px;
    height: 200px;
    margin-bottom: 3rem;
    cursor: pointer;
    perspective: 1000px;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.envelope:hover {
    transform: translateY(-10px);
}

.env-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #e91e63;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.env-front {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 140px solid #f06292;
    border-right: 140px solid #f06292;
    border-bottom: 100px solid #ec407a;
    border-top: 100px solid transparent;
    border-radius: 0 0 10px 10px;
    bottom: 0;
    z-index: 3;
}

.env-flap {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 140px solid transparent;
    border-right: 140px solid transparent;
    border-top: 100px solid #f48fb1;
    border-bottom: 100px solid transparent;
    top: 0;
    transform-origin: top;
    transition: transform 0.5s 0.3s;
    z-index: 4;
}

.env-heart {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 5;
    transition: opacity 0.3s;
}

.env-letter {
    position: absolute;
    width: 90%;
    height: 90%;
    background: white;
    left: 5%;
    bottom: 5%;
    border-radius: 8px;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.6s ease;
}

.env-letter-content {
    font-family: 'Caveat', cursive;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.step.opening .env-flap {
    transform: rotateX(180deg);
}

.step.opening .env-heart {
    opacity: 0;
}

.step.opening .env-letter {
    transform: translateY(-80px);
}

.btn-group {
    display: flex;
    gap: 15px;
}

/* Step 2: Dark Room */
.dark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--dark-bg);
    z-index: -1;
}

.single-bulb {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 4rem;
}

.wire {
    width: 2px;
    height: 100px;
    background-color: #555;
}

.bulb-glass {
    width: 50px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50% 50% 25px 25px;
    border: 2px solid #555;
    position: relative;
}

/* Step 3: Lights On */
.hanging-bulbs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 0 20px;
    pointer-events: none;
}

.hanging-bulb {
    position: relative;
    width: 2px;
    height: 80px;
    background-color: #ccc;
    transform-origin: top center;
    animation: swing 3s infinite ease-in-out alternate;
}

.hanging-bulb::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    transition: all 0.5s ease;
}

.hanging-bulb.on::after {
    background-color: var(--accent);
    box-shadow: 0 0 30px var(--accent), 0 0 50px var(--accent);
}

.hanging-bulb.c1 { height: 120px; animation-delay: 0.1s; }
.hanging-bulb.c2 { height: 80px; animation-delay: 0.5s; }
.hanging-bulb.c3 { height: 140px; animation-delay: 0.2s; }
.hanging-bulb.c4 { height: 90px; animation-delay: 0.7s; }
.hanging-bulb.c5 { height: 110px; animation-delay: 0.4s; }

@keyframes swing {
    0% { transform: rotate(5deg); }
    100% { transform: rotate(-5deg); }
}

/* Step 4: Music Notes */
.music-notes {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.note {
    position: absolute;
    font-size: 2rem;
    opacity: 0;
    color: var(--primary-color);
}

.note.n1 { bottom: 20%; left: 20%; animation: floatUp 4s infinite 0s linear; }
.note.n2 { bottom: 10%; left: 50%; animation: floatUp 3s infinite 1s linear; }
.note.n3 { bottom: 15%; left: 80%; animation: floatUp 3.5s infinite 0.5s linear; }

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(-200px) scale(1.5); opacity: 0; }
}

/* Step 5: Banners and Confetti */
.banners {
    position: absolute;
    top: 60px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.banner {
    width: 120px;
    height: 40px;
    background: repeating-linear-gradient(
        45deg,
        #ffeb3b,
        #ffeb3b 10px,
        #f06292 10px,
        #f06292 20px
    );
    clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
    animation: dropIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: top;
    opacity: 0;
}

@keyframes dropIn {
    0% { transform: translateY(-50px) scale(0.5); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    animation: fall 5s infinite linear;
}

@keyframes fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1;}
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0;}
}

/* Step 6: Balloons */
.floating-balloons {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.balloon {
    position: absolute;
    bottom: -100px;
    width: 60px;
    height: 70px;
    background-color: var(--primary-color);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    animation: floatBalloon 6s infinite ease-in;
    box-shadow: inset -10px -10px 15px rgba(0,0,0,0.1);
}

.balloon::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid var(--primary-color);
}

.balloon::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 50%;
    width: 1px;
    height: 50px;
    background-color: rgba(255,255,255,0.5);
}

@keyframes floatBalloon {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-120vh) rotate(15deg); }
}

/* Step 7: Cut Cake */
.cake-area {
    position: relative;
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cake-wrapper {
    position: relative;
    width: 200px;
    height: 150px;
    margin-top: 50px;
}

.cake-base {
    position: absolute;
    bottom: 0;
    width: 200px;
    height: 100px;
}

.cake-layer {
    position: absolute;
    width: 100%;
    height: 40px;
    background-color: #ffd54f; /* Yellow cake */
    border-radius: 10px;
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.1);
}

.cake-layer.bottom { bottom: 0; }
.cake-layer.top { bottom: 40px; background-color: #ffca28; }

.cake-icing {
    position: absolute;
    top: 10px;
    width: 210px;
    left: -5px;
    height: 30px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.05);
}

.cake-candles {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 40px;
    background: repeating-linear-gradient(45deg, #fff, #fff 5px, #f44336 5px, #f44336 10px);
    border-radius: 3px;
}

.flame {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 20px;
    background-color: #ff9800;
    border-radius: 50% 50% 20% 20%;
    box-shadow: 0 0 10px #ffeb3b, 0 0 20px #ffeb3b;
    animation: flicker 0.1s infinite alternate;
}

@keyframes flicker {
    0% { transform: translateX(-50%) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1.1) rotate(5deg); opacity: 0.9; }
}

.cut-path-container {
    position: absolute;
    width: 300px;
    height: 150px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.cut-dotted-line {
    position: absolute;
    top: 60px;
    left: 20px;
    width: 260px;
    height: 0;
    border-top: 4px dashed rgba(240, 98, 146, 0.6);
    transform: rotate(10deg);
    pointer-events: none;
}

.knife {
    position: absolute;
    top: 20px;
    left: 0;
    font-size: 3rem;
    cursor: grab;
    user-select: none;
    display: flex;
    transform: rotate(-35deg);
    transition: transform 0.1s;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.2));
}

.knife:active {
    cursor: grabbing;
}

.knife-handle {
    width: 20px;
    height: 60px;
    background: #333;
    border-radius: 5px;
}

.knife-blade {
    width: 20px;
    height: 80px;
    background: linear-gradient(to right, #ddd, #eee);
    border-radius: 2px 2px 50% 2px;
    margin-top: -20px;
}

/* Mask to reveal cut cake */
.cake-cut-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color); /* Hide the cake partially when cut */
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
.cake-cut-active .cake-cut-mask {
    opacity: 0;
}
.cake-cut-active .cake-wrapper {
    transform: scale(1.05);
    transition: transform 0.5s;
}
.cake-cut-active .cake-base {
    clip-path: polygon(0 0, 45% 0, 55% 100%, 0 100%);
    transition: clip-path 0.5s;
}

.hint-text {
    position: absolute;
    bottom: 100px;
    font-size: 1.2rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
}

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

/* Step 9: Cards */
.cards-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 500px;
}

.wish-card {
    width: 120px;
    height: 160px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.wish-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.card-front {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    font-size: 2.5rem;
}

.card-back {
    background-color: white;
    color: var(--primary-color);
    transform: rotateY(180deg);
    font-size: 1.2rem;
    padding: 10px;
}

/* Step 10: Final */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    max-width: 90%;
}

.main-greeting {
    font-size: 3rem;
    color: var(--primary-hover);
    margin: 10px 0;
}

.recipient-name {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.final-wish {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.signature {
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* Transitions for Steps */
body.lights-off {
    background-color: var(--dark-bg);
}

body.lights-on {
    background-color: #fff9c4; /* Bright yellow */
}

body.mood-set {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
}
