/* ==========================================================================
   STYLE SYSTEM CHO GAME ĐỐ VUI FLOWERDANCE v2.0
   Tông màu: Hồng cánh sen (#ff4fa8), Tím huyền bí (#7b2cbf), Dark Violet (#0a051b)
   Cải tiến: Confetti canvas, Share buttons, Mute toggle, Responsive 320px+
   Tác giả: Antigravity AI
   ========================================================================== */

:root {
    --primary: #ff4fa8;
    --primary-hover: #ec407a;
    --primary-light: #f8bbd0;
    --primary-glow: rgba(255, 79, 168, 0.4);
    --secondary: #7b2cbf;
    --secondary-light: #e0aaff;
    --secondary-glow: rgba(123, 44, 191, 0.4);
    --dark-bg: #0a051b;
    --card-bg: rgba(25, 12, 50, 0.55);
    --border-glow: rgba(255, 79, 168, 0.2);
    --text-light: #f3effa;
    --text-muted: #a69cb8;
    --accent-green: #38b000;
}

/* Reset cơ bản */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at 15% 20%, rgba(123, 44, 191, 0.25) 0%, transparent 40%),
                      radial-gradient(circle at 85% 80%, rgba(255, 79, 168, 0.25) 0%, transparent 40%);
    background-attachment: fixed;
    line-height: 1.6;
}

/* Container game chính */
.game-container {
    width: 92%;
    max-width: 650px;
    margin: 2rem auto;
    position: relative;
    z-index: 10;
}

/* Card Glassmorphism cao cấp */
.game-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glow);
    border-radius: 28px;
    padding: 2.5rem 2rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* Các Screen chuyển tiếp */
.game-screen {
    display: none;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.game-screen.active {
    display: block;
}

/* ============ TYPOGRAPHY ============ */
h1.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, var(--primary-light) 50%, #d8b4fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.brand-subtitle i {
    color: var(--primary);
}

.screen-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.screen-desc {
    color: var(--text-muted);
    text-align: center;
    font-size: 1rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

/* ============ BADGE LƯỢT CHƠI ============ */
.play-count-badge {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-green);
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: rgba(56, 176, 0, 0.08);
    border: 1px solid rgba(56, 176, 0, 0.2);
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
}

/* ============ NÚT TẮT/BẬT ÂM THANH ============ */
.mute-toggle-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 100;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(25, 12, 50, 0.7);
    border: 1px solid rgba(255, 79, 168, 0.3);
    color: var(--primary-light);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.mute-toggle-btn:hover {
    background: rgba(255, 79, 168, 0.15);
    transform: scale(1.1);
}

/* ============ BUTTON ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 2.2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    cursor: pointer;
    gap: 10px;
    box-shadow: 0 4px 20px var(--primary-glow);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 79, 168, 0.6);
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary));
}

.btn:active {
    transform: translateY(-1px);
}

.btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* ============ QUIZ ============ */
.quiz-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.4s ease;
}

.quiz-question-box {
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: white;
    margin-bottom: 1.5rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    text-align: left;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: rgba(255, 79, 168, 0.08);
    border-color: var(--primary);
    padding-left: 1.8rem;
}

.option-btn.selected {
    background: linear-gradient(135deg, rgba(255, 79, 168, 0.25), rgba(123, 44, 191, 0.25));
    border-color: var(--primary);
    color: white;
    font-weight: 500;
    box-shadow: inset 0 0 10px rgba(255, 79, 168, 0.1);
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 2rem;
}

.btn-prev {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: none;
}

.btn-prev:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* ============ VÒNG QUAY MAY MẮN ============ */
.wheel-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 2rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-outer-glow {
    position: absolute;
    width: 334px;
    height: 334px;
    border-radius: 50%;
    border: 3px solid rgba(255, 79, 168, 0.4);
    box-shadow: 0 0 30px rgba(255, 79, 168, 0.25),
                inset 0 0 15px rgba(123, 44, 191, 0.3);
    pointer-events: none;
    z-index: 2;
    animation: rotateSlow 20s linear infinite;
}

.wheel-canvas {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1;
    /* Transition được set động trong JS */
}

.wheel-pointer {
    position: absolute;
    top: -12px;
    left: calc(50% - 15px);
    width: 30px;
    height: 35px;
    background-color: var(--primary);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 5;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.5));
}

.wheel-center-btn {
    position: absolute;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 0%, var(--primary-light) 60%, var(--primary) 100%);
    border: 4px solid white;
    z-index: 6;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 79, 168, 0.6),
                inset 0 2px 2px rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    color: var(--secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.wheel-center-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(255, 79, 168, 0.8);
}

/* ============ FORM NHẬN QUÀ ============ */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 79, 168, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

/* ============ NÚT CHIA SẺ MXH ============ */
.share-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    color: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-share:hover {
    transform: translateY(-2px);
}

.btn-share-fb {
    background: linear-gradient(135deg, #1877f2, #0d6efd);
    box-shadow: 0 4px 15px rgba(24, 119, 242, 0.4);
}

.btn-share-fb:hover {
    box-shadow: 0 8px 25px rgba(24, 119, 242, 0.6);
}

.btn-share-zalo {
    background: linear-gradient(135deg, #0068ff, #0099ff);
    box-shadow: 0 4px 15px rgba(0, 104, 255, 0.4);
}

.btn-share-zalo:hover {
    box-shadow: 0 8px 25px rgba(0, 104, 255, 0.6);
}

/* ============ BẢNG VINH DANH ============ */
.winners-card {
    background: rgba(25, 12, 50, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 1.8rem;
    margin-top: 2rem;
    backdrop-filter: blur(10px);
}

.winners-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.winners-title i {
    color: #ffb703;
}

.winners-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.winner-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 8px;
}

.winner-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.winner-name {
    font-weight: 500;
    color: white;
}

.winner-prize {
    color: var(--primary-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-align: right;
    max-width: 50%;
}

.winner-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============ CONFETTI CANVAS ============ */
.confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    display: none;
}

/* ============ CÁNH HOA HỒNG RƠI ============ */
.petal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.petal {
    position: absolute;
    background-color: #ff4fa8;
    border-radius: 150% 0 150% 150%;
    opacity: 0.7;
    pointer-events: none;
    transform-style: preserve-3d;
}

/* ============ HIỆU ỨNG QUÀ TẶNG ============ */
.prize-box-reveal {
    background: rgba(255, 79, 168, 0.08);
    border: 2px dashed rgba(255, 79, 168, 0.3);
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    margin: 1.5rem 0 2rem;
    animation: pulseGlow 2s ease-in-out infinite;
}

.prize-name-highlight {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 10px var(--primary-glow);
    margin-bottom: 8px;
}

.success-icon {
    font-size: 4rem;
    color: var(--accent-green);
    text-align: center;
    display: block;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(56, 176, 0, 0.3));
    animation: bounceIn 0.8s ease;
}

.floating-logo {
    animation: float 4s ease-in-out infinite;
    display: block;
    margin: 0 auto 1.5rem;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    object-fit: cover;
}

/* ============ ANIMATIONS ============ */
@keyframes rotateSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes pulseGlow {
    0%, 100% { 
        border-color: rgba(255, 79, 168, 0.3);
        box-shadow: 0 0 0 rgba(255, 79, 168, 0);
    }
    50% { 
        border-color: rgba(255, 79, 168, 0.6);
        box-shadow: 0 0 20px rgba(255, 79, 168, 0.15);
    }
}

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

/* ============ RESPONSIVE MOBILE ============ */

/* Màn hình nhỏ 320px - 380px (iPhone SE, iPhone 12 Mini) */
@media (max-width: 380px) {
    .game-container {
        width: 96%;
        margin: 1rem auto;
    }

    .game-card {
        padding: 1.8rem 1.2rem;
        border-radius: 22px;
    }

    h1.brand-title {
        font-size: 1.7rem;
    }

    .brand-subtitle {
        font-size: 0.8rem;
    }

    .screen-title {
        font-size: 1.4rem;
    }

    .screen-desc {
        font-size: 0.9rem;
    }

    .question-text {
        font-size: 1.05rem;
    }

    .option-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }

    .wheel-container {
        width: 280px;
        height: 280px;
    }

    .wheel-canvas {
        width: 280px;
        height: 280px;
    }

    .wheel-outer-glow {
        width: 294px;
        height: 294px;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .share-buttons {
        flex-direction: column;
    }

    .btn-share {
        width: 100%;
        justify-content: center;
    }
}

/* Màn hình trung bình 381px - 430px (iPhone 14/15/16 Pro Max) */
@media (min-width: 381px) and (max-width: 430px) {
    .game-container {
        width: 94%;
    }

    .game-card {
        padding: 2rem 1.5rem;
    }
}

/* Tablet 768px+ */
@media (min-width: 768px) {
    .game-container {
        margin: 3rem auto;
    }

    .game-card {
        padding: 3rem 2.5rem;
    }
}
