/* ========================================
   BIRTHDAY WEBSITE - NGUYÊN HỒNG
   ======================================== */

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a14;
    --bg-card: rgba(255, 255, 255, 0.05);
    --gold: #f0c040;
    --gold-light: #ffe082;
    --pink: #ff6b9d;
    --purple: #9b59b6;
    --cream: #fff8e7;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --flame-orange: #ff6600;
    --flame-yellow: #ffcc00;
    --cake-brown: #8B4513;
    --cake-cream: #F5DEB3;
    --cake-pink: #FF69B4;
    --cake-chocolate: #5C3317;
    --frosting: #fff5ee;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Quicksand', 'Outfit', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* === SCREENS === */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* === INTRO SCREEN === */
#intro-screen {
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a14 70%);
    z-index: 100;
    cursor: pointer;
}

.intro-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.intro-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.intro-emoji {
    font-size: 80px;
    animation: float 3s ease-in-out infinite, glow-pulse 2s ease-in-out infinite;
    margin-bottom: 30px;
    filter: drop-shadow(0 0 30px rgba(240, 192, 64, 0.5));
}

.intro-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    letter-spacing: 1px;
}

.btn-start {
    background: linear-gradient(135deg, var(--gold), var(--pink));
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(240, 192, 64, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(240, 192, 64, 0.6);
}

/* === BIRTHDAY SCREEN === */
#birthday-screen {
    background: radial-gradient(ellipse at 50% 30%, #1e1233 0%, #0a0a14 70%);
    flex-direction: column;
}

.birthday-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    max-width: 450px;
    padding: 20px;
    gap: 10px;
}

/* === HAPPY BIRTHDAY TEXT === */
.hbd-text-container {
    text-align: center;
    animation: fadeInDown 1s ease-out;
}

.hbd-title {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(40px, 10vw, 60px);
    background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 10px rgba(240, 192, 64, 0.4));
    line-height: 1.2;
}

.hbd-name {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(28px, 7vw, 42px);
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 5px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

/* === CAKE === */
.cake-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0;
    animation: fadeInUp 1.2s ease-out;
}

.cake {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cake-top {
    width: 160px;
    height: 50px;
    background: linear-gradient(180deg, var(--frosting) 0%, #ffe8d6 100%);
    border-radius: 10px 10px 0 0;
    position: relative;
    z-index: 2;
    box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.2);
}

.cake-drip {
    position: absolute;
    bottom: -12px;
    width: 14px;
    height: 18px;
    background: var(--frosting);
    border-radius: 0 0 50% 50%;
    z-index: 3;
}

.drip-1 { left: 15px; height: 20px; }
.drip-2 { left: 45px; height: 14px; }
.drip-3 { left: 80px; height: 22px; }
.drip-4 { right: 40px; height: 16px; }
.drip-5 { right: 15px; height: 18px; }

.cake-middle {
    width: 170px;
    height: 55px;
    background: linear-gradient(180deg, var(--cake-chocolate) 0%, #3e1f0e 100%);
    position: relative;
    z-index: 1;
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.3);
}

.cake-bottom {
    width: 190px;
    height: 60px;
    background: linear-gradient(180deg, #d4956a 0%, var(--cake-brown) 100%);
    border-radius: 0 0 15px 15px;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.cake-plate {
    width: 220px;
    height: 15px;
    background: linear-gradient(180deg, #ddd 0%, #aaa 100%);
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
    margin-top: -2px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Cake decorations */
.cake-deco {
    position: absolute;
    font-size: 18px;
    z-index: 4;
    animation: wiggle 3s ease-in-out infinite;
}

.deco-1 { top: -5px; left: 20px; }
.deco-2 { top: -5px; right: 20px; animation-delay: 0.5s; }
.deco-3 { top: -5px; left: 70px; animation-delay: 1s; }
.deco-4 { top: 55px; left: 10px; animation-delay: 0.3s; }
.deco-5 { top: 55px; right: 10px; animation-delay: 0.7s; }

/* Sprinkles */
.sprinkle {
    position: absolute;
    width: 4px;
    height: 10px;
    border-radius: 3px;
    z-index: 4;
}

.s1 { background: #ff6b9d; top: 60px; left: 30px; transform: rotate(30deg); }
.s2 { background: #4ecdc4; top: 70px; left: 55px; transform: rotate(-20deg); }
.s3 { background: var(--gold); top: 65px; right: 35px; transform: rotate(45deg); }
.s4 { background: #ff6b9d; top: 75px; right: 55px; transform: rotate(-30deg); }
.s5 { background: #4ecdc4; top: 110px; left: 25px; transform: rotate(60deg); }
.s6 { background: var(--gold); top: 115px; left: 60px; transform: rotate(-15deg); }
.s7 { background: #ff6b9d; top: 105px; right: 30px; transform: rotate(25deg); }
.s8 { background: #4ecdc4; top: 120px; right: 60px; transform: rotate(-45deg); }

/* === CANDLE === */
.candle-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    margin-bottom: -5px;
}

.candle {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.candle-body {
    width: 14px;
    height: 50px;
    background: linear-gradient(90deg, #ff9aa2, #ff6b81, #ff9aa2);
    border-radius: 0 0 3px 3px;
    position: relative;
    box-shadow: 0 0 8px rgba(255, 107, 129, 0.3);
}

.candle-body::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 2px;
    right: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
}

.candle-body::after {
    content: '';
    position: absolute;
    top: 25px;
    left: 2px;
    right: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
}

.candle-wick {
    width: 2px;
    height: 10px;
    background: #333;
    border-radius: 1px;
    margin-top: -2px;
    margin-bottom: -2px;
}

/* === FLAME === */
.flame-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: -5px;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.flame-container.blown-out {
    opacity: 0;
    transform: scale(0) translateY(-10px);
}

.flame {
    width: 16px;
    height: 30px;
    background: radial-gradient(ellipse at 50% 90%, var(--flame-yellow) 0%, var(--flame-orange) 50%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 0.15s ease-in-out infinite alternate;
    position: relative;
    filter: blur(0.5px);
}

.flame-inner {
    position: absolute;
    width: 8px;
    height: 16px;
    background: radial-gradient(ellipse, #fff 0%, var(--flame-yellow) 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    top: 8px;
    left: 4px;
    animation: flicker-inner 0.2s ease-in-out infinite alternate;
}

.flame-glow {
    position: absolute;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 200, 0, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    top: -15px;
    left: -22px;
    animation: glow-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

/* Smoke particles (shown after blowing) */
.smoke {
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(200, 200, 200, 0.6);
    border-radius: 50%;
    animation: smokeRise 1.5s ease-out forwards;
    pointer-events: none;
}

/* === MIC INSTRUCTION === */
.mic-instruction {
    text-align: center;
    animation: fadeInUp 1.5s ease-out;
    padding: 15px 20px;
}

.mic-icon {
    font-size: 36px;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.mic-instruction p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.mic-note {
    font-size: 14px !important;
    color: var(--gold) !important;
    font-weight: 600;
    margin-top: 5px !important;
    animation: pulse 2s ease-in-out infinite;
}

.blow-meter-container {
    width: 250px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 12px auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.blow-meter {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--pink));
    border-radius: 10px;
    transition: width 0.3s ease;
}

.blow-timer {
    text-align: center;
    font-size: 14px;
    color: var(--gold-light);
    margin-top: 6px;
    font-weight: 600;
    letter-spacing: 1px;
}

.mic-hint {
    font-size: 13px !important;
    opacity: 0.5;
    margin-top: 5px !important;
}

.btn-tap-blow {
    background: linear-gradient(135deg, var(--gold), var(--pink));
    border: none;
    padding: 14px 35px;
    border-radius: 50px;
    font-size: 16px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    margin-top: 15px;
    box-shadow: 0 4px 20px rgba(240, 192, 64, 0.4);
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.btn-tap-blow:hover {
    transform: scale(1.05);
}

/* === CELEBRATION OVERLAY === */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a14 70%);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.celebration-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.hidden {
    display: none !important;
}

.celebration-content {
    text-align: center;
    padding: 50px 20px 60px;
    animation: celebrationEntry 1s ease-out;
    max-width: 500px;
    width: 100%;
}

.celebration-title {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(32px, 8vw, 50px);
    background: linear-gradient(135deg, var(--gold-light), var(--pink), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: shimmer 3s ease-in-out infinite;
    background-size: 200% auto;
}

.celebration-name {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(24px, 6vw, 36px);
    color: var(--text-primary);
    margin-bottom: 30px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    letter-spacing: 3px;
}

.wishes-container {
    margin: 20px 0;
}

.wish-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 25px;
    margin: 15px 0;
    animation: fadeInUp 1.5s ease-out;
    text-align: center;
}

.wish-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.wish-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.wish-author {
    margin-top: 15px;
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
}

/* === AVATAR === */
.avatar-section {
    margin: 15px 0;
}

.celebration-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
    box-shadow: 0 0 25px rgba(240, 192, 64, 0.4);
    animation: float 3s ease-in-out infinite;
}

/* === WISH IMAGE === */
.wish-image {
    margin-top: 15px;
}

.wish-img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* === GIF === */
.celebration-gif {
    margin: 20px 0;
}

.gif-img {
    max-width: 250px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* === CREDIT === */
.credit-line {
    margin-top: 25px;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
    letter-spacing: 1px;
    opacity: 0.7;
}

.credit-line strong {
    color: var(--gold);
    font-style: normal;
}

.celebration-emojis {
    font-size: 32px;
    letter-spacing: 10px;
    margin-top: 25px;
    animation: bounce 1s ease-in-out infinite;
}

/* === CONFETTI === */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confettiFall linear forwards;
}

.confetti-piece.circle {
    border-radius: 50%;
}

.confetti-piece.square {
    border-radius: 2px;
}

.confetti-piece.rect {
    width: 5px;
    height: 14px;
    border-radius: 2px;
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

@keyframes flicker {
    0% { transform: scale(1, 1) rotate(-1deg); }
    25% { transform: scale(1.02, 0.96) rotate(1deg); }
    50% { transform: scale(0.98, 1.04) rotate(-0.5deg); }
    75% { transform: scale(1.01, 0.97) rotate(0.5deg); }
    100% { transform: scale(0.99, 1.02) rotate(-1deg); }
}

@keyframes flicker-inner {
    0% { transform: scale(1, 1); opacity: 1; }
    50% { transform: scale(0.9, 1.1); opacity: 0.9; }
    100% { transform: scale(1.05, 0.95); opacity: 1; }
}

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

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

@keyframes smokeRise {
    0% { 
        opacity: 0.6; 
        transform: translateY(0) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-60px) scale(2.5) translateX(var(--smoke-x, 10px)); 
    }
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(var(--confetti-rotation, 720deg)) scale(0.5);
        opacity: 0;
    }
}

@keyframes celebrationEntry {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

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

/* Stars for intro */
@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* === RESPONSIVE === */
@media (max-height: 650px) {
    .hbd-title { font-size: 35px; }
    .hbd-name { font-size: 24px; }
    .cake-top { width: 130px; height: 40px; }
    .cake-middle { width: 140px; height: 45px; }
    .cake-bottom { width: 155px; height: 50px; }
    .cake-plate { width: 180px; }
    .candle-body { height: 40px; }
    .birthday-container { gap: 5px; }
}

@media (max-width: 375px) {
    .hbd-title { font-size: 36px; }
    .hbd-name { font-size: 24px; }
    .celebration-title { font-size: 28px; }
}

/* Floating stars background */
.star {
    position: fixed;
    background: white;
    border-radius: 50%;
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
    pointer-events: none;
    z-index: 0;
}
