:root {
    --bg-gradient-1: #e6ccb2;
    --bg-gradient-2: #ffe8d6;
    --text-dark: #4a3728;
    --primary: #9c6644;
    --coffee-dark: #3e2723;
    --cup-color: #fdfdfd;
}

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

body,
html {
    width: 100%;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    min-height: 100vh;
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    touch-action: none;
}

.title-section {
    text-align: center;
    margin-top: 5vh;
    z-index: 10;
}

h1 {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: var(--primary);
    text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    display: inline-block;
    backdrop-filter: blur(5px);
}

/* Coffee Cup Styling */
.cup-wrapper {
    position: relative;
    margin-top: 4vh;
    /* Đẩy ly cafe lên cao hơn một chút */
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cup-handle {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 120px;
    border: 15px solid var(--cup-color);
    border-radius: 40px;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.gift-container {
    position: relative;
    width: clamp(250px, 75vw, 320px);
    /* Tự động co küch thước ly trên màn nhỏ */
    height: clamp(250px, 75vw, 320px);
    border-radius: 50%;
    background: var(--cup-color);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 0 20px rgba(0, 0, 0, 0.05),
        inset 0 0 0 15px var(--cup-color),
        /* Vành ly */
        inset 0 0 0 16px rgba(0, 0, 0, 0.1);
    /* Bóng nắp vành */
    overflow: hidden;
    z-index: 2;
    /* Đảm bảo nội dung bên trong cũng bo tròn */
    mask-image: radial-gradient(white, black);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

#hidden-gift {
    position: absolute;
    top: 15px;
    left: 15px;
    width: calc(100% - 30px);
    height: calc(100% - 30px);
    border-radius: 50%;
    object-fit: cover;
    display: block;
    user-select: none;
    pointer-events: none;
    transition: transform 3s ease;
}

.gift-container.revealed #hidden-gift {
    transform: scale(1.1);
}

#coffee-liquid {
    position: absolute;
    top: 15px;
    left: 15px;
    width: calc(100% - 30px);
    height: calc(100% - 30px);
    border-radius: 50%;
    transition: opacity 2s ease-out;
    cursor: grab;
}

#coffee-liquid:active {
    cursor: grabbing;
}

/* Smoke bubbles */
.smoke {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 20px;
    height: 60px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0;
    pointer-events: none;
}

.smoke-1 {
    animation: rise 3s infinite ease-in;
    transform: translateX(-40px);
}

.smoke-2 {
    animation: rise 4s infinite ease-in 1s;
    transform: translateX(10px);
}

.smoke-3 {
    animation: rise 3.5s infinite ease-in 2s;
    transform: translateX(30px);
}

@keyframes rise {
    0% {
        bottom: 40%;
        opacity: 0;
        transform: scale(1) translateX(var(--tx));
    }

    50% {
        opacity: 0.6;
    }

    100% {
        bottom: 120%;
        opacity: 0;
        transform: scale(3) translateX(calc(var(--tx) + 20px));
    }
}

#physics-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: none;
}

#success-message {
    position: absolute;
    bottom: 2vh;
    bottom: 2dvh;
    /* Hạ thấp sát đáy để chừa chỗ */
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    /* Tăng độ rõ nền */
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    /* Thu gọn padding */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 30;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.8s ease;
    width: 95%;
    /* Trải rộng ra hai bên màn hình hơn */
    max-width: 450px;
}

#success-message.show {
    transform: translateY(0);
    opacity: 1;
}

#success-message h2 {
    font-family: 'Dancing Script', cursive;
    color: var(--primary);
    font-size: 2rem;
    /* Giảm size tiêu đề chúc mừng */
    margin-bottom: 0.25rem;
}

.fade-in {
    animation: fadeIn 1s ease forwards;
}

.fade-in-up {
    animation: fadeInUp 1s ease 0.3s forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}