/* ============================================
   style.css — Birthday Surprise App
   ============================================ */

/* ---------- Global & Reset ---------- */
body {
    font-family: 'Itim', cursive;
    overscroll-behavior: none;
    touch-action: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ป้องกันการ highlight ทั้งหมด */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* ป้องกันการ drag รูปภาพ */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    pointer-events: none;
}

/* ป้องกันการ highlight ข้อความทั้งหมด */
p, h1, h2, h3, h4, h5, h6, span, div, button, a {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ---------- Responsive Container ---------- */
#app-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100dvh;
    background-color: #111;
    overflow: hidden;
}

#app-container {
    width: 375px;
    height: 667px;
    background-color: #A7C7E7;
    position: relative;
    transform-origin: center center;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    background-size: cover;
    background-position: center;
}

/* ---------- Utilities ---------- */
.prevent-select {
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* ---------- Flame ---------- */
.flame {
    width: 9px;
    height: 15px;
    background: radial-gradient(
        ellipse at bottom,
        #fff 10%,
        #ffd000 40%,
        #ff5e00 80%,
        transparent
    );
    border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
    position: absolute;
    transform-origin: bottom center;
    animation: flicker 0.1s ease-in-out alternate infinite;
    filter: drop-shadow(0 0 10px #ff5e00);
    transition: opacity 0.5s, transform 0.5s;
}

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

.flame.blowing {
    animation: blow-flicker 0.1s ease-in-out alternate infinite;
}

@keyframes blow-flicker {
    0%   { transform: scaleY(0.8) scaleX(1.2) rotate(-30deg); opacity: 0.7; }
    100% { transform: scaleY(0.9) scaleX(1.1) rotate(-25deg); opacity: 0.9; }
}

/* ---------- Fan ---------- */
.spin {
    animation: spin-blade 0.2s linear infinite;
}

@keyframes spin-blade {
    100% { transform: rotate(360deg); }
}

/* ---------- Transition Helpers ---------- */
.fade-in  { opacity: 1 !important; pointer-events: auto  !important; }
.fade-out { opacity: 0 !important; pointer-events: none  !important; }

.scale-in { transform: translate(-50%, -50%) scale(1) !important; opacity: 1 !important; }
.pop-in   { transform: scale(1) !important;                         opacity: 1 !important; }

/* ---------- Gravity Drop (Fan release) ---------- */
.gravity-drop {
    transition: top 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53) !important;
}

/* ---------- Dialog Box ---------- */
.dialog-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
    background: white;
    padding: 12px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 50;
    width: 80%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ---------- Down Arrow Animation ---------- */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* ---------- Toast ---------- */
.toast {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 60;
    white-space: nowrap;
}

/* ---------- Dark Overlay ---------- */
#dark-overlay {
    position: absolute;
    inset: 0;
    background: #000000f0;
    z-index: 100;
    transition: opacity 1.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}