/**
 * Lucky Wheel Game Styles
 * ABC Website (abcwebsite.com.vn)
 */

:root {
    --primary-color: #ff5722;
    --primary-hover: #f4511e;
    --bg-grad-1: #1e1b4b;
    --bg-grad-2: #0f172a;
    --text-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.95);
    --border-radius: 16px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: var(--font-family);
    background: radial-gradient(circle at center, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
    color: var(--text-color);
}

/* Container chính của game */
.wheel-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px 24px 14px;
    position: relative;
    user-select: none;
    transition: background 0.4s ease;
}

/* Các Theme khác nhau */
.wheel-container.theme-carnival {
    background: radial-gradient(circle at center, #2e1065 0%, #0f172a 100%);
}

.wheel-container.theme-tet {
    background: radial-gradient(circle at center, #7f1d1d 0%, #450a0a 100%);
}

.wheel-container.theme-neon {
    background: radial-gradient(circle at center, #180d38 0%, #050212 100%);
}

.wheel-container.theme-luxury {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

/* Header Game */
.wheel-header {
    text-align: center;
    margin-bottom: 8px;
    z-index: 2;
}

.wheel-title {
    font-size: clamp(20px, 4.5vw, 32px);
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 60%, #fb923c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
    margin-bottom: 4px;
}

.wheel-subtitle {
    font-size: clamp(12px, 2.8vw, 15px);
    color: #cbd5e1;
    font-weight: 500;
    opacity: 0.9;
}

/* Vùng chứa Vòng quay */
.wheel-board-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 520px;
    margin: auto 0;
    padding: 10px 0;
    z-index: 2;
}

#wheel-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: pointer;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.5));
    transition: transform 0.15s ease-out;
}

#wheel-canvas:active {
    transform: scale(0.99);
}

/* Thanh nút điều khiển phía dưới */
.wheel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 420px;
    z-index: 2;
    margin-top: 10px;
}

.btn-spin-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    padding: 0 28px;
    font-size: 17px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    box-shadow: 0 10px 25px -4px rgba(234, 88, 12, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-spin-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -4px rgba(234, 88, 12, 0.65), inset 0 2px 4px rgba(255, 255, 255, 0.5);
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 50%, #9a3412 100%);
}

.btn-spin-action:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 6px 14px -2px rgba(234, 88, 12, 0.5);
}

.btn-spin-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* Nút Cài đặt (Gear Icon) */
.btn-gear-settings {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.btn-gear-settings:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(45deg) scale(1.05);
}

.btn-gear-settings svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
}

/* Nút Bật / Tắt Nhạc nền BGM */
.btn-bgm-toggle {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
    flex-shrink: 0;
    position: relative;
    padding: 0;
}

.btn-bgm-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.btn-bgm-toggle .bgm-icon-on,
.btn-bgm-toggle .bgm-icon-off {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.btn-bgm-toggle svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: none;
    stroke: currentColor;
}

.btn-bgm-toggle.is-playing {
    background: rgba(16, 185, 129, 0.28);
    border-color: rgba(52, 211, 153, 0.7);
    color: #34d399;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
    animation: bgmPulse 2s infinite ease-in-out;
}

.btn-bgm-toggle.is-muted {
    opacity: 0.85;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-bgm-toggle.is-muted:hover {
    opacity: 1;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

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

/* Nền Confetti */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
    display: none;
}

/* Modal Popup Kết quả trúng thưởng */
.wheel-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wheel-modal.is-active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 32px 24px 24px 24px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wheel-modal.is-active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.modal-icon-wrap {
    width: 90px;
    height: 90px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    background: #fff7ed;
    border: 3px solid #ffedd5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    animation: bounce 0.8s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

.modal-title {
    font-size: 22px;
    font-weight: 800;
    color: #ea580c;
    margin-bottom: 8px;
}

.modal-prize-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 12px 16px;
    margin: 14px 0;
}

.modal-prize-name {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.modal-desc {
    font-size: 13.5px;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.5;
}

.btn-modal-action {
    width: 100%;
    height: 46px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-modal-action:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

/* Toast thông báo */
.wheel-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: #0f172a;
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.wheel-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Tối ưu Mobile */
@media (max-width: 480px) {
    .wheel-container {
        padding: 10px 8px 18px 8px;
    }
    .wheel-controls {
        gap: 10px;
    }
    .btn-spin-action {
        height: 48px;
        font-size: 15px;
    }
    .btn-gear-settings,
    .btn-bgm-toggle {
        width: 48px;
        height: 48px;
    }
}
