/* vietnamese */
@font-face {
    font-family: "Quicksand";
    src: url("../fonts/quicksand/6xKtdSZaM9iE8KbpRA_hJFQNcOM.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
    font-family: "Quicksand";
    src: url("../fonts/quicksand/6xKtdSZaM9iE8KbpRA_hJVQNcOM.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
    font-family: "Quicksand";
    src: url("../fonts/quicksand/6xKtdSZaM9iE8KbpRA_hK1QN.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* vietnamese */
@font-face {
    font-family: "Baloo 2";
    src: url("../fonts/baloo2/wXKrE3kTposypRyd51fcANwr.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
    font-family: "Baloo 2";
    src: url("../fonts/baloo2/wXKrE3kTposypRyd51bcANwr.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
    font-family: "Baloo 2";
    src: url("../fonts/baloo2/wXKrE3kTposypRyd51jcAA.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* =============================================
   1. WELCOME/HELP BASE STYLESHEET (Khung sườn)
   ============================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html,
body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: "Quicksand", "Baloo 2", Arial, sans-serif;
}

#welcomeScreen,
#helpScreen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

#helpScreen {
    z-index: 99998;
    display: none;
}

#welcomeScreen.fade-out,
#helpScreen.fade-out {
    pointer-events: none;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Cấu trúc sao/bong bóng nền dùng chung */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* ---- Header / Logo ---- */
.ws-header {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem;
}

.ws-logo-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    margin-left: 15px;
}

.ws-logo {
    max-width: 120px;
    height: auto;
}

/* ---- Main layout ---- */
.ws-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    height: 100%;
}

.ws-content-wrapper {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    text-align: center;
}

.ws-game-title {
    margin: 0;
    font-family: "Baloo 2", "Quicksand", Arial, sans-serif;
    font-size: clamp(2.4rem, 7vw, 5rem);
    line-height: 1.15;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#helpScreen .ws-game-title {
    font-size: clamp(2rem, 6vw, 3rem);
}

.ws-game-subtitle {
    max-width: 740px;
    margin: 0.5rem auto 0;
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 600;
    line-height: 1.6;
}

.ws-button-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
}

.ws-btn-primary-cosmic,
#helpScreen .btn-fullscreen,
#helpScreen .btn-play {
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-height: 56px;
    padding: 1rem 2.5rem;
    font-family: "Quicksand", Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ws-btn-primary-cosmic {
    border-radius: 50px;
    font-size: clamp(1rem, 4vw, 1.5rem);
}

.ws-btn-primary-cosmic span,
#helpScreen .btn-fullscreen span,
#helpScreen .btn-play span {
    position: relative;
    z-index: 2;
    display: inline-block;
    transition: transform 0.2s;
}

.ws-btn-primary-cosmic:hover,
#helpScreen .btn-fullscreen:hover,
#helpScreen .btn-play:hover {
    transform: translateY(-2px);
}

.ws-btn-primary-cosmic:hover span,
#helpScreen .btn-fullscreen:hover span,
#helpScreen .btn-play:hover span {
    transform: scale(1.04);
}

.ws-more-games-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.ws-more-games-link:hover {
    transform: translateY(-1px);
}

.ws-credit {
    position: absolute;
    bottom: 1rem;
    left: 0;
    z-index: 10;
    width: 100%;
    font-size: 0.9rem;
    text-align: center;
}

.ws-credit a {
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 575.98px) {
    .ws-logo-container {
        margin-top: 4px;
        margin-left: 4px;
    }

    .ws-logo {
        max-width: 96px;
    }

    .ws-content-wrapper {
        padding: 1rem;
    }

    .ws-credit {
        font-size: 0.8rem;
    }
}

/* ============================================================
   2. GAME SCREEN STYLES & 5 THEMES (Màu sắc tươi sáng, rực rỡ mầm non)
   ============================================================ */

:root,
[data-theme="cosmic"] {
    --theme-name: "cosmic";
    --primary-glow: #818cf8;
    --primary-gradient: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%);
    --gold-glow: #fde047;
    --gold-gradient: linear-gradient(135deg, #fef08a 0%, #facc15 50%, #f59e0b 100%);
    --bg-screen: radial-gradient(circle at 50% 20%, #4338ca 0%, #312e81 45%, #1e1b4b 100%);
    --bg-mesh-1: rgba(236, 72, 153, 0.35);
    --bg-mesh-2: rgba(99, 102, 241, 0.35);
    --bg-mesh-3: rgba(168, 85, 247, 0.25);
    --card-glass: rgba(30, 27, 75, 0.9);
    --card-winner-bg: linear-gradient(165deg, rgba(49, 46, 129, 0.96) 0%, rgba(30, 27, 75, 0.98) 100%);
    --header-bg: rgba(49, 46, 129, 0.85);
    --border-glass: rgba(216, 180, 254, 0.3);
    --ball-bg: radial-gradient(circle at 35% 30%, #a855f7 0%, #7c3aed 50%, #4338ca 100%);
    --ball-border: rgba(216, 180, 254, 0.7);
    --ball-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(236, 72, 153, 0.6);
    --ball-initial-bg: linear-gradient(135deg, #f472b6 0%, #c084fc 50%, #818cf8 100%);
    --spin-btn-bg: radial-gradient(circle at 35% 30%, #ff2d87 0%, #ec4899 50%, #8b5cf6 100%);
    --spin-glow: rgba(236, 72, 153, 0.75);
    --winner-glow: rgba(253, 224, 71, 1), 0 0 100px rgba(236, 72, 153, 0.9);
    --accent-btn-bg: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    --font-heading: 'Baloo 2', 'Quicksand', system-ui, -apple-system, sans-serif;
    --font-body: 'Quicksand', system-ui, -apple-system, sans-serif;
}

[data-theme="ocean"] {
    --theme-name: "ocean";
    --primary-glow: #38bdf8;
    --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 50%, #0369a1 100%);
    --gold-glow: #fde047;
    --gold-gradient: linear-gradient(135deg, #fef08a 0%, #fde047 50%, #f59e0b 100%);
    --bg-screen: radial-gradient(circle at 50% 20%, #0284c7 0%, #0369a1 45%, #075985 100%);
    --bg-mesh-1: rgba(56, 189, 248, 0.4);
    --bg-mesh-2: rgba(6, 182, 212, 0.35);
    --bg-mesh-3: rgba(14, 165, 233, 0.3);
    --card-glass: rgba(8, 47, 73, 0.92);
    --card-winner-bg: linear-gradient(165deg, rgba(3, 105, 161, 0.96) 0%, rgba(8, 47, 73, 0.98) 100%);
    --header-bg: rgba(3, 105, 161, 0.85);
    --border-glass: rgba(186, 230, 253, 0.35);
    --ball-bg: radial-gradient(circle at 35% 30%, #38bdf8 0%, #0284c7 50%, #0369a1 100%);
    --ball-border: rgba(186, 230, 253, 0.8);
    --ball-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(56, 189, 248, 0.7);
    --ball-initial-bg: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 50%, #0284c7 100%);
    --spin-btn-bg: radial-gradient(circle at 35% 30%, #fde047 0%, #f59e0b 50%, #ea580c 100%);
    --spin-glow: rgba(56, 189, 248, 0.8);
    --winner-glow: rgba(253, 224, 71, 1), 0 0 100px rgba(56, 189, 248, 0.9);
    --accent-btn-bg: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
}

[data-theme="forest"] {
    --theme-name: "forest";
    --primary-glow: #4ade80;
    --primary-gradient: linear-gradient(135deg, #4ade80 0%, #16a34a 50%, #059669 100%);
    --gold-glow: #fde047;
    --gold-gradient: linear-gradient(135deg, #fef08a 0%, #facc15 50%, #f59e0b 100%);
    --bg-screen: radial-gradient(circle at 50% 20%, #059669 0%, #047857 45%, #064e3b 100%);
    --bg-mesh-1: rgba(74, 222, 128, 0.4);
    --bg-mesh-2: rgba(163, 230, 53, 0.35);
    --bg-mesh-3: rgba(16, 185, 129, 0.3);
    --card-glass: rgba(6, 78, 59, 0.92);
    --card-winner-bg: linear-gradient(165deg, rgba(5, 150, 105, 0.96) 0%, rgba(6, 78, 59, 0.98) 100%);
    --header-bg: rgba(4, 120, 87, 0.85);
    --border-glass: rgba(187, 247, 208, 0.35);
    --ball-bg: radial-gradient(circle at 35% 30%, #4ade80 0%, #16a34a 50%, #15803d 100%);
    --ball-border: rgba(187, 247, 208, 0.8);
    --ball-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(74, 222, 128, 0.7);
    --ball-initial-bg: linear-gradient(135deg, #86efac 0%, #4ade80 50%, #16a34a 100%);
    --spin-btn-bg: radial-gradient(circle at 35% 30%, #fb7185 0%, #f43f5e 50%, #e11d48 100%);
    --spin-glow: rgba(74, 222, 128, 0.8);
    --winner-glow: rgba(253, 224, 71, 1), 0 0 100px rgba(74, 222, 128, 0.9);
    --accent-btn-bg: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
}

[data-theme="candy"] {
    --theme-name: "candy";
    --primary-glow: #fb7185;
    --primary-gradient: linear-gradient(135deg, #fb7185 0%, #f43f5e 50%, #c026d3 100%);
    --gold-glow: #fef08a;
    --gold-gradient: linear-gradient(135deg, #fef08a 0%, #fde047 50%, #f59e0b 100%);
    --bg-screen: radial-gradient(circle at 50% 20%, #db2777 0%, #be185d 45%, #831843 100%);
    --bg-mesh-1: rgba(251, 113, 133, 0.45);
    --bg-mesh-2: rgba(244, 114, 182, 0.4);
    --bg-mesh-3: rgba(253, 224, 71, 0.35);
    --card-glass: rgba(131, 24, 67, 0.92);
    --card-winner-bg: linear-gradient(165deg, rgba(190, 24, 93, 0.96) 0%, rgba(131, 24, 67, 0.98) 100%);
    --header-bg: rgba(190, 24, 93, 0.85);
    --border-glass: rgba(252, 231, 243, 0.4);
    --ball-bg: radial-gradient(circle at 35% 30%, #f472b6 0%, #ec4899 50%, #be185d 100%);
    --ball-border: rgba(252, 231, 243, 0.85);
    --ball-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(251, 113, 133, 0.7);
    --ball-initial-bg: linear-gradient(135deg, #fbcfe8 0%, #f472b6 50%, #db2777 100%);
    --spin-btn-bg: radial-gradient(circle at 35% 30%, #fef08a 0%, #fde047 50%, #f59e0b 100%);
    --spin-glow: rgba(251, 113, 133, 0.8);
    --winner-glow: rgba(254, 240, 138, 1), 0 0 100px rgba(244, 63, 94, 0.9);
    --accent-btn-bg: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
}

[data-theme="sunset"] {
    --theme-name: "sunset";
    --primary-glow: #fb923c;
    --primary-gradient: linear-gradient(135deg, #fb923c 0%, #ea580c 50%, #e11d48 100%);
    --gold-glow: #fef08a;
    --gold-gradient: linear-gradient(135deg, #fef08a 0%, #fde047 50%, #f59e0b 100%);
    --bg-screen: radial-gradient(circle at 50% 20%, #ea580c 0%, #c2410c 45%, #9a3412 100%);
    --bg-mesh-1: rgba(253, 224, 71, 0.45);
    --bg-mesh-2: rgba(251, 146, 60, 0.4);
    --bg-mesh-3: rgba(245, 158, 11, 0.35);
    --card-glass: rgba(154, 52, 18, 0.92);
    --card-winner-bg: linear-gradient(165deg, rgba(194, 65, 12, 0.96) 0%, rgba(154, 52, 18, 0.98) 100%);
    --header-bg: rgba(194, 65, 12, 0.85);
    --border-glass: rgba(254, 240, 138, 0.4);
    --ball-bg: radial-gradient(circle at 35% 30%, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    --ball-border: rgba(254, 240, 138, 0.85);
    --ball-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(253, 224, 71, 0.7);
    --ball-initial-bg: linear-gradient(135deg, #fef08a 0%, #fde047 50%, #ea580c 100%);
    --spin-btn-bg: radial-gradient(circle at 35% 30%, #ff4b72 0%, #f43f5e 50%, #e11d48 100%);
    --spin-glow: rgba(251, 146, 60, 0.8);
    --winner-glow: rgba(254, 240, 138, 1), 0 0 100px rgba(234, 88, 12, 0.9);
    --accent-btn-bg: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
}

/* ============================================================
   LỚP MÀU CẦU VỒNG ĐA SẮC CHO TỪNG QUẢ BÓNG HỌC SINH (MẦM NON)
   ============================================================ */
.student-ball.color-variant-0 {
    background: radial-gradient(circle at 35% 30%, #ff5286 0%, #e11d48 60%, #9f1239 100%);
    border-color: #fecdd3;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(255, 82, 134, 0.6);
}
.student-ball.color-variant-0 .ball-initial {
    background: linear-gradient(135deg, #fda4af 0%, #f43f5e 100%);
}

.student-ball.color-variant-1 {
    background: radial-gradient(circle at 35% 30%, #38bdf8 0%, #0284c7 60%, #0369a1 100%);
    border-color: #bae6fd;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(56, 189, 248, 0.6);
}
.student-ball.color-variant-1 .ball-initial {
    background: linear-gradient(135deg, #7dd3fc 0%, #0284c7 100%);
}

.student-ball.color-variant-2 {
    background: radial-gradient(circle at 35% 30%, #4ade80 0%, #16a34a 60%, #15803d 100%);
    border-color: #bbf7d0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(74, 222, 128, 0.6);
}
.student-ball.color-variant-2 .ball-initial {
    background: linear-gradient(135deg, #86efac 0%, #16a34a 100%);
}

.student-ball.color-variant-3 {
    background: radial-gradient(circle at 35% 30%, #fde047 0%, #f59e0b 60%, #b45309 100%);
    border-color: #fef08a;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(253, 224, 71, 0.6);
}
.student-ball.color-variant-3 .ball-initial {
    background: linear-gradient(135deg, #fef08a 0%, #d97706 100%);
}

.student-ball.color-variant-4 {
    background: radial-gradient(circle at 35% 30%, #c084fc 0%, #9333ea 60%, #6b21a8 100%);
    border-color: #e9d5ff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(192, 132, 252, 0.6);
}
.student-ball.color-variant-4 .ball-initial {
    background: linear-gradient(135deg, #d8b4fe 0%, #9333ea 100%);
}

.student-ball.color-variant-5 {
    background: radial-gradient(circle at 35% 30%, #fb923c 0%, #ea580c 60%, #9a3412 100%);
    border-color: #fed7aa;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(251, 146, 60, 0.6);
}
.student-ball.color-variant-5 .ball-initial {
    background: linear-gradient(135deg, #fed7aa 0%, #ea580c 100%);
}

.game-screen-root {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-screen);
    display: flex;
    flex-direction: column;
    transition: background 0.4s ease;
}

.bg-space-mesh {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 20%, var(--bg-mesh-1) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, var(--bg-mesh-2) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, var(--bg-mesh-3) 0%, transparent 55%);
    pointer-events: none;
    z-index: 1;
    transition: all 0.4s ease;
}

.bg-grid-glow {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   3. HEADER BAR
   ============================================================ */
.game-header-bar {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    height: 70px;
    transition: background 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 0 20px var(--primary-glow);
    transition: all 0.3s ease;
}

.brand-title {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-heading);
    color: #fff;
    line-height: 1.2;
    margin: 0;
}

.brand-sub {
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.header-stats-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-pill {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-head-icon {
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-head-icon:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    color: #fff;
}

.btn-gear {
    width: 42px;
    padding: 0;
    font-size: 18px;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.btn-gear:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(245, 158, 11, 0.6);
    color: #fff;
}

/* ============================================================
   4. PHYSICS STAGE & STUDENT BALLS
   ============================================================ */
.physics-stage {
    position: absolute;
    inset: 70px 0 0 0;
    z-index: 10;
    overflow: hidden;
    pointer-events: auto;
}

.student-ball {
    position: absolute;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ball-bg);
    border: 1px solid var(--ball-border);
    box-shadow: var(--ball-shadow);
    cursor: pointer;
    will-change: transform, left, top;
    transition: box-shadow 0.2s, border-color 0.2s, background 0.3s;
    user-select: none;
    overflow: hidden;
}

.student-ball:hover {
    border-color: var(--gold-glow);
    box-shadow: 0 0 30px var(--gold-glow), inset 0 0 20px rgba(251, 191, 36, 0.4);
    z-index: 25;
}

/* Trường hợp có Avatar: Ảnh full 100% toàn bộ quả bóng */
.student-ball img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
    z-index: 1;
}

.student-ball.has-avatar .ball-name {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 86%;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 1px 6px;
    font-size: 11px;
    line-height: 1.3;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* Trường hợp không có Avatar: Dùng vòng tròn chữ cái viết tắt */
.ball-initial {
    width: 52%;
    height: 52%;
    border-radius: 50%;
    background: var(--ball-initial-bg);
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

.ball-name {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 800;
    font-family: var(--font-body);
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.8);
    max-width: 92%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    letter-spacing: 0.2px;
}

/* Winner ball highlight during revealing */
.student-ball.winner-spotlight {
    border: 4px solid var(--gold-glow) !important;
    box-shadow: 0 0 50px var(--winner-glow) !important;
    z-index: 100 !important;
}

/* ============================================================
   5. IDLE SPIN LAYER (Chuyển nút quay xuống dưới màn hình)
   ============================================================ */
.idle-spin-layer {
    position: absolute;
    inset: 70px 0 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 32px;
    pointer-events: none;
    gap: 12px;
}

.spin-btn-wrap {
    position: relative;
    pointer-events: auto;
}

.spin-glow-ring {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: var(--primary-gradient);
    filter: blur(22px);
    opacity: 0.65;
    animation: ringPulse 2.5s infinite;
    transition: background 0.3s ease;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.12); opacity: 0.95; }
}

.btn-spin-huge {
    position: relative;
    width: 145px;
    height: 145px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.35);
    background: var(--spin-btn-bg);
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 40px var(--spin-glow), inset 0 0 25px rgba(255, 255, 255, 0.4);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-spin-huge:hover {
    transform: scale(1.06) translateY(-4px);
    box-shadow: 0 20px 50px var(--spin-glow), inset 0 0 35px rgba(255, 255, 255, 0.6);
    border-color: #fff;
}

.btn-spin-huge:active {
    transform: scale(0.95);
}

.spin-sub {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.9;
}

.spin-main {
    font-size: 34px;
    font-weight: 900;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    line-height: 1;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   6. RESULT OVERLAY & WINNER CARD
   ============================================================ */
.result-backdrop-layer {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(5, 7, 17, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.result-box-container {
    max-width: 500px;
    width: 100%;
    animation: zoomWinner 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomWinner {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes zoomModalCenter {
    0% {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.winner-card-body {
    background: var(--card-winner-bg);
    border: 2px solid var(--gold-glow);
    border-radius: 28px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px var(--primary-glow);
    transition: all 0.3s ease;
}

.winner-top-crown {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    color: var(--gold-glow);
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.winner-avatar-container {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 16px auto;
}

.winner-glow-back {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: var(--gold-gradient);
    filter: blur(20px);
    opacity: 0.7;
    animation: ringPulse 2s infinite;
}

.winner-avatar-circle {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: 4px solid var(--gold-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    transition: background 0.3s ease;
}

.winner-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.winner-avatar-circle .avatar-char {
    font-size: 54px;
    font-weight: 900;
    font-family: var(--font-heading);
    color: #fff;
}

.winner-trophy-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 40px;
    height: 40px;
    background: var(--gold-gradient);
    border-radius: 50%;
    border: 3px solid rgba(15, 17, 35, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.winner-greeting {
    font-size: 15px;
    color: #cbd5e1;
    font-weight: 600;
    margin-bottom: 6px;
}

.winner-student-name {
    font-size: 32px;
    font-weight: 900;
    font-family: var(--font-heading);
    color: #fff;
    margin-bottom: 24px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.winner-btn-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-cosmic-primary {
    padding: 12px 24px;
    border-radius: 16px;
    background: var(--accent-btn-bg);
    border: none;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-cosmic-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px var(--primary-glow);
    color: #fff;
}

.btn-cosmic-glass {
    padding: 12px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-cosmic-glass:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-2px);
}

/* ============================================================
   7. MODAL CÂU HỎI OVERLAY (Chuẩn ddkt1 & Đồng bộ Dynamic Game Styles)
   ============================================================ */
#questionOverlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 17, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9998;
    transition: all 0.3s ease;
}

#questionArea {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92vw;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-winner-bg);
    border: 2px solid var(--border-glass);
    border-radius: 28px;
    padding: 32px 28px;
    z-index: 9999;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 50px var(--primary-glow);
    display: flex;
    flex-direction: column;
    color: #fff;
    font-family: var(--font-body);
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    animation: zoomModalCenter 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.q-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.q-badge {
    padding: 8px 18px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.badge-mc { background: rgba(99, 102, 241, 0.3); border: 1px solid #818cf8; color: #e0e7ff; }
.badge-tf { background: rgba(16, 185, 129, 0.3); border: 1px solid #34d399; color: #d1fae5; }
.badge-sa { background: rgba(245, 158, 11, 0.3); border: 1px solid #fbbf24; color: #fef3c7; }
.badge-fb { background: rgba(14, 165, 233, 0.3); border: 1px solid #38bdf8; color: #e0f2fe; }
.badge-ma { background: rgba(236, 72, 153, 0.3); border: 1px solid #f472b6; color: #fce7f3; }
.badge-es { background: rgba(168, 85, 247, 0.3); border: 1px solid #c084fc; color: #f3e8ff; }

.q-progress-badge {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--border-glass);
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.q-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(245, 158, 11, 0.25);
    border: 1px solid #fbbf24;
    color: #fef3c7;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.q-timer-badge.timer-warning {
    background: rgba(239, 68, 68, 0.35) !important;
    border-color: #f87171 !important;
    color: #fee2e2 !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.6) !important;
    animation: timerPulse 0.6s infinite alternate ease-in-out;
}

@keyframes timerPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

.q-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.45;
    margin-bottom: 24px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.q-content-with-img {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.q-img img {
    max-width: 250px;
    max-height: 180px;
    border-radius: 16px;
    border: 2px solid var(--border-glass);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.q-body {
    flex: 1;
    margin-bottom: 24px;
}

.q-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .q-opts {
        grid-template-columns: 1fr;
    }
}

.optBtn {
    padding: 16px 22px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--border-glass);
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.optBtn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--gold-glow);
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 20px var(--primary-glow);
}

.opt-letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 17px;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.optBtn.opt-correct {
    background: rgba(16, 185, 129, 0.35) !important;
    border-color: #34d399 !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.6) !important;
}

.optBtn.opt-correct .opt-letter {
    background: #10b981;
    border-color: #a7f3d0;
    color: #fff;
}

.optBtn.opt-wrong {
    background: rgba(239, 68, 68, 0.35) !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.6) !important;
}

.optBtn.opt-wrong .opt-letter {
    background: #ef4444;
    border-color: #fecdd3;
    color: #fff;
}

/* True / False styles */
.tf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    border: 1px solid var(--border-glass);
    transition: all 0.2s ease;
}

.tf-text {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
}

.tf-btns {
    display: flex;
    gap: 10px;
}

.tf-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 2px solid transparent;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tf-true { background: rgba(16, 185, 129, 0.25); color: #34d399; border-color: rgba(52, 211, 153, 0.5); }
.tf-false { background: rgba(239, 68, 68, 0.25); color: #f87171; border-color: rgba(248, 113, 113, 0.5); }

.tf-btn.selected { transform: scale(1.12); }
.tf-true.selected { background: #10b981; color: #fff; border-color: #a7f3d0; box-shadow: 0 0 15px rgba(16, 185, 129, 0.7); }
.tf-false.selected { background: #ef4444; color: #fff; border-color: #fecdd3; box-shadow: 0 0 15px rgba(239, 68, 68, 0.7); }

.tf-row.tf-correct { border-color: #34d399; background: rgba(16, 185, 129, 0.2); }
.tf-row.tf-wrong { border-color: #f87171; background: rgba(239, 68, 68, 0.2); }

/* Matching styles */
.ma-container {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 12px 0 20px 0;
    user-select: none;
}

@media (max-width: 640px) {
    .ma-container {
        gap: 20px;
    }
}

.match-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.ma-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
}

.match-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid var(--border-glass);
    border-radius: 18px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-height: 56px;
}

.match-item:hover:not(.locked) {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--primary-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 15px var(--primary-glow);
}

.match-item.selected {
    border-color: var(--gold-glow) !important;
    background: rgba(251, 191, 36, 0.25) !important;
    box-shadow: 0 0 25px var(--gold-glow) !important;
    transform: scale(1.02);
}

.match-item.paired {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.18);
}

.match-item.match-correct {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.25) !important;
    color: #d1fae5 !important;
}

.match-item.match-wrong {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.25) !important;
    color: #fee2e2 !important;
}

.match-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
}

.match-l .match-letter {
    margin-right: 12px;
}

.match-r .match-letter {
    margin-left: 12px;
}

.match-text {
    flex: 1;
    line-height: 1.4;
}

.match-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid #ffffff;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.match-dot-r {
    right: -7px;
}

.match-dot-l {
    left: -7px;
}

.match-item.selected .match-dot {
    background: #fbbf24;
    border-color: #ffffff;
    box-shadow: 0 0 12px #fbbf24;
    transform: translateY(-50%) scale(1.3);
}

.match-item.paired .match-dot {
    background: #60a5fa;
    border-color: #ffffff;
    box-shadow: 0 0 10px #60a5fa;
}

.match-item.match-correct .match-dot {
    background: #10b981;
    border-color: #ffffff;
    box-shadow: 0 0 12px #10b981;
}

.match-item.match-wrong .match-dot {
    background: #ef4444;
    border-color: #ffffff;
    box-shadow: 0 0 12px #ef4444;
}

/* Essay container */
.q-ans-container {
    padding: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px dashed var(--border-glass);
    border-radius: 20px;
    margin-top: 14px;
}

.q-ans-box {
    font-size: 17px;
    color: #f1f5f9;
    font-weight: 700;
    line-height: 1.6;
}

/* Question bottom navigation */
.q-bottom-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--border-glass);
    padding-top: 20px;
}

.q-nav-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn_boqua {
    padding: 12px 24px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-glass);
    color: #f1f5f9;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn_boqua:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: translateY(-2px);
}

.q-btn-next, .q-btn-confirm {
    padding: 12px 28px;
    border-radius: 16px;
    background: var(--accent-btn-bg);
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 25px var(--primary-glow);
    transition: all 0.2s ease;
}

.q-btn-next:hover, .q-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px var(--primary-glow);
}

.q-btn-show {
    padding: 12px 24px;
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.25);
    border: 1px solid #f59e0b;
    color: #fef08a;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.q-btn-show:hover {
    background: rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.q-btn-correct {
    padding: 12px 24px;
    border-radius: 16px;
    background: #10b981;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transition: all 0.2s ease;
}

.q-btn-wrong {
    padding: 12px 24px;
    border-radius: 16px;
    background: #ef4444;
    border: none;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    transition: all 0.2s ease;
}

/* ============================================================
   8. MODAL LAYERS (SUMMARY, SETTINGS, NOTICES)
   ============================================================ */
.modal-layer-custom {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(5, 7, 17, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: all 0.3s ease;
}

.modal-box-card {
    max-width: 480px;
    width: 100%;
    background: var(--card-winner-bg);
    border: 2px solid var(--border-glass);
    border-radius: 28px;
    padding: 32px 26px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--primary-glow);
    animation: zoomWinner 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #fff;
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.modal-settings-box {
    max-width: 560px;
}

.modal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-card-header h3 {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-heading);
    margin: 0;
    color: #fff;
}

.btn-close-custom {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #cbd5e1;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-custom:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.form-label-custom {
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 6px;
    display: block;
}

.form-select-custom {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    outline: none;
}

.form-select-custom option {
    background: #0f1123;
    color: #fff;
}

.toggle-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
}

.switch-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 34px;
    transition: .3s;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}

.switch-toggle input:checked + .slider-toggle {
    background-color: #6366f1;
}

.switch-toggle input:checked + .slider-toggle:before {
    transform: translateX(22px);
}

.modal-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
}

/* Summary Modal Elements */
.summary-icon-wrap {
    font-size: 60px;
    color: #f59e0b;
    margin-bottom: 12px;
}

.summary-trophy-anim {
    animation: bounceTrophy 1s infinite alternate;
}

@keyframes bounceTrophy {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

.summary-title {
    font-size: 24px;
    font-weight: 900;
    font-family: var(--font-heading);
    margin-bottom: 10px;
}

.summary-stars-row {
    font-size: 48px;
    font-weight: 900;
    color: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 16px 0;
}

.star-glow {
    filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.8));
}

.summary-desc {
    font-size: 15px;
    color: #cbd5e1;
}

/* ============================================================
   9. HISTORY SIDE DRAWER
   ============================================================ */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.history-side-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 380px;
    height: 100vh;
    background: #0f1123;
    border-left: 1px solid var(--border-glass);
    z-index: 10020;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
}

.history-side-drawer.open {
    right: 0;
}

.drawer-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-glass);
}

.drawer-header-bar h3 {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-heading);
    margin: 0;
    color: #fff;
}

.drawer-body-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.hist-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-glow);
}

.hist-avatar-initial {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.hist-info {
    flex: 1;
}

.hist-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.hist-time {
    font-size: 12px;
    color: #94a3b8;
}

.hist-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    color: #fbbf24;
    font-size: 13px;
    font-weight: 800;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    font-size: 14px;
}

/* Toast */
.app-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-glass);
    color: #fff;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10050;
    pointer-events: none;
}

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