/* ===== CSS Variables ===== */
:root {
    --primary: #FFB5C5;
    --primary-dark: #ff9bb0;
    --secondary: #B5EAD7;
    --accent: #C7CEEA;
    --warm: #FFDAC1;
    --bg: #FFF5F5;
    --bg-gradient: linear-gradient(135deg, #FFF5F5 0%, #FFE4EC 50%, #E8F5F0 100%);
    --text: #5a5a5a;
    --text-dark: #3a3a3a;
    --shadow: 0 8px 32px rgba(255, 181, 197, 0.3);
    --shadow-lg: 0 16px 48px rgba(255, 181, 197, 0.4);
    --radius: 20px;
    --radius-sm: 12px;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* ===== Password Screen ===== */
.password-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.password-box {
    background: white;
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 360px;
    width: 90%;
    animation: floatIn 0.6s ease-out;
}

.password-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.password-box h2 {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.password-box input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.password-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 181, 197, 0.2);
}

.password-box button {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.password-box button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.error-text {
    color: #e74c3c;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}

/* ===== Main Content ===== */
.main-content {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

header {
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0 white;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text);
}

/* ===== Microphone Status ===== */
.mic-status {
    background: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.mic-status.listening {
    background: var(--secondary);
}

.mic-status.listening #mic-icon {
    animation: pulse 1s infinite;
}

/* ===== Cake ===== */
.cake-container {
    display: flex;
    justify-content: center;
    margin: 6rem 0 2rem 0;
}

.cake {
    position: relative;
    width: 280px;
}

.cake-top {
    width: 200px;
    height: 50px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 20px 20px 0 0;
    margin: 0 auto;
    position: relative;
}

.cake-top::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 15px;
    right: 15px;
    height: 12px;
    background: white;
    border-radius: 6px;
    opacity: 0.5;
}

.cake-middle {
    width: 240px;
    height: 60px;
    background: linear-gradient(180deg, var(--warm) 0%, #ffc9a1 100%);
    margin: 0 auto;
    position: relative;
}

.cake-middle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 15px;
    background: var(--secondary);
    border-radius: 0 0 50% 50%;
}

.cake-bottom {
    width: 260px;
    height: 55px;
    background: linear-gradient(180deg, var(--accent) 0%, #b3b9d9 100%);
    margin: 0 auto;
    border-radius: 0 0 20px 20px;
    position: relative;
}

.cake-bottom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: var(--primary);
    border-radius: 0 0 50% 50%;
}

.cake-plate {
    width: 300px;
    height: 20px;
    background: linear-gradient(180deg, #f0f0f0 0%, #d0d0d0 100%);
    margin: 0 auto;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* ===== Candles ===== */
.candles {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 25px;
}

.candle {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.candle:hover {
    transform: scale(1.1);
}

.candle.blown-out {
    cursor: default;
}

.candle.blown-out:hover {
    transform: none;
}

.candle-body {
    width: 14px;
    height: 45px;
    background: linear-gradient(90deg, var(--accent) 0%, #a8b0db 50%, var(--accent) 100%);
    border-radius: 3px 3px 2px 2px;
    position: relative;
}

.candle-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 8px;
    background: #333;
    border-radius: 1px;
}

/* ===== Flame ===== */
.flame-container {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.flame {
    width: 12px;
    height: 24px;
    background: linear-gradient(180deg, #fff7e6 0%, #ffdb4d 30%, #ff9500 70%, #ff5500 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 0.3s infinite alternate;
    position: relative;
}

.flame::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    top: 4px;
    left: 3px;
}

.flame-glow {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(255, 200, 100, 0.4) 0%, transparent 70%);
    top: -5px;
    left: -9px;
    animation: glow 0.5s infinite alternate;
}

.blown-out .flame-container {
    display: none;
}

/* ===== Smoke ===== */
.smoke {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: rgba(150, 150, 150, 0.6);
    border-radius: 50%;
    animation: smokeRise 1.5s ease-out forwards;
}

.blown-out .smoke {
    display: block;
}

/* ===== Gift Progress ===== */
.gift-progress {
    margin-top: 2rem;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 0.8rem;
}

.dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    transition: all 0.3s;
}

.dot.opened {
    background: var(--secondary);
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--secondary);
}

.progress-text {
    font-size: 1rem;
    color: var(--text);
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: popIn 0.4s ease-out;
}

/* ===== Slot Machine ===== */
.slot-modal-content h2 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.slot-machine {
    background: linear-gradient(135deg, var(--warm) 0%, var(--primary) 100%);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.slot-window {
    display: flex;
    gap: 10px;
    justify-content: center;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.1);
}

.slot-reel {
    width: 70px;
    height: 80px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.slot-symbol {
    font-size: 3rem;
    transition: transform 0.1s;
}

.slot-reel.spinning .slot-symbol {
    animation: slotSpin 0.1s linear infinite;
}

.gift-reveal {
    animation: fadeIn 0.5s;
}

.gift-reveal h3 {
    color: var(--text-dark);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.gift-reveal p {
    color: var(--text);
    font-size: 1rem;
}

.btn-primary {
    background: var(--secondary);
    color: var(--text-dark);
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ===== Finale ===== */
.finale-modal-content {
    padding: 3rem;
}

.finale-modal-content h1 {
    font-size: 2.2rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.finale-text {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.finale-subtext {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.finale-hearts {
    font-size: 3rem;
    animation: heartbeat 1s infinite;
}

/* ===== Confetti Canvas ===== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes flicker {
    0% {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }
    50% {
        transform: scaleY(1.1) scaleX(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scaleY(0.95) scaleX(1.05);
        opacity: 1;
    }
}

@keyframes glow {
    from { opacity: 0.3; }
    to { opacity: 0.6; }
}

@keyframes smokeRise {
    0% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-40px) scale(2);
    }
}

@keyframes slotSpin {
    from { transform: translateY(-100%); }
    to { transform: translateY(100%); }
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1); }
    75% { transform: scale(1.15); }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .cake {
        transform: scale(0.85);
    }

    .candles {
        gap: 18px;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .slot-reel {
        width: 55px;
        height: 65px;
    }

    .slot-symbol {
        font-size: 2.2rem;
    }
}
