/* ====== Khung trang xem quà (dùng chung cho mọi mẫu) ====== */
* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; min-height: 100%;
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #12071d; color: #fff; overflow-x: hidden;
}

body.gift-body { display: flex; flex-direction: column; min-height: 100vh; }

.gift-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

/* Nút nhạc nổi */
.gift-music {
    position: fixed; top: 16px; right: 16px; z-index: 60;
    width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.15rem;
    backdrop-filter: blur(8px); display: grid; place-items: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3); transition: transform .2s ease, background .2s ease;
}
.gift-music:hover { transform: scale(1.08); background: rgba(255, 255, 255, .28); }
.gift-music.is-playing span { animation: gift-spin 3.5s linear infinite; display: block; }
@keyframes gift-spin { to { transform: rotate(360deg); } }

/* Watermark + CTA cuối trang */
.gift-brand {
    position: relative; z-index: 40; text-align: center; padding: 14px 16px 22px;
    font-size: .82rem; color: rgba(255, 255, 255, .62);
}
.gift-brand a { color: #fff; font-weight: 700; text-decoration: none; border-bottom: 1px dashed rgba(255, 255, 255, .5); }
.gift-brand a:hover { color: #ffd6e4; }

/* Thanh xem thử trong trình chỉnh sửa */
.gift-preview-flag {
    position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 70;
    background: rgba(0, 0, 0, .55); color: #fff; padding: 5px 16px; border-radius: 999px;
    font-size: .74rem; font-weight: 700; letter-spacing: .04em; backdrop-filter: blur(6px);
    pointer-events: none;
}

/* Màn hình mở quà (chạm để bắt đầu) */
.gift-opener {
    position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; text-align: center;
    background: radial-gradient(circle at 50% 40%, #3a1d4d, #12071d 70%);
    cursor: pointer; transition: opacity .55s ease, visibility .55s ease; padding: 24px;
}
.gift-opener.is-hidden { opacity: 0; visibility: hidden; }
.gift-opener .box { font-size: clamp(4rem, 18vw, 7rem); animation: gift-shake 2.2s ease-in-out infinite; }
.gift-opener p { font-size: 1.05rem; opacity: .85; margin: 14px 0 0; }
.gift-opener h2 { font-size: clamp(1.3rem, 5vw, 1.9rem); margin: 18px 0 0; font-weight: 800; }
@keyframes gift-shake {
    0%, 100% { transform: rotate(0) scale(1); }
    20% { transform: rotate(-8deg) scale(1.05); }
    40% { transform: rotate(8deg) scale(1.05); }
    60% { transform: rotate(-5deg) scale(1.02); }
    80% { transform: rotate(5deg) scale(1.02); }
}

/* Trang lỗi / hết hạn */
.gift-notice { max-width: 480px; margin: auto; text-align: center; padding: 40px 24px; }
.gift-notice .emoji { font-size: 4rem; margin-bottom: 12px; }
.gift-notice h1 { font-size: 1.6rem; margin: 0 0 10px; }
.gift-notice p { opacity: .8; margin-bottom: 22px; }
.gift-notice .btn {
    display: inline-block; padding: 12px 26px; border-radius: 999px; font-weight: 700; text-decoration: none;
    background: linear-gradient(135deg, #ef5f86, #7c4ddb); color: #fff;
}

/* Đồng hồ dùng chung cho các mẫu có đếm ngày.
   Mỗi ô là một <span> chứa cặp số + nhãn để chúng luôn nằm chồng lên nhau. */
.gift-counter { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.gift-counter > span { text-align: center; }
.gift-counter b {
    display: block; font-size: clamp(1.3rem, 5vw, 2rem); line-height: 1; font-weight: 900;
    background: rgba(255, 255, 255, .14); border-radius: 14px; padding: 12px 14px; min-width: 66px;
}
.gift-counter small { display: block; font-size: .66rem; opacity: .75; margin: 6px 0 0; text-transform: uppercase; letter-spacing: .08em; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
