/* Games Page Styles */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&family=Inter:wght@300;500&display=swap');

:root {
    --bg-gradient-light: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --card-bg-light: #ffffff;
    --card-bg-dark: #1f2937;
    --glass-border-light: rgba(255, 255, 255, 0.5);
    --glass-border-dark: rgba(255, 255, 255, 0.1);
    --text-main-light: #1f2937;
    --text-main-dark: #f3f4f6;
    --text-sub-light: #6b7280;
    --text-sub-dark: #9ca3af;
    --font-main: 'Inter', sans-serif;
    --font-arabic: 'Cairo', sans-serif;
    --font-main: 'Inter', sans-serif;
    --font-arabic: 'Cairo', sans-serif;
    --glass-blur: blur(16px);

    /* Fun & Alive Gradients */
    --mesh-gradient-light: radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%), radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%), radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    --mesh-gradient-dark: radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%), radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%), radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);

    /* Spring Physics */
    --spring-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --bounce-easing: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Game Theme Colors */
    --color-grammar: #4f46e5;
    /* Indigo */
    --color-missing: #ea580c;
    /* Orange */
    --color-flashcards: #059669;
    /* Emerald */
    --color-spelling: #db2777;
    /* Pink */
    --color-wheel: #7c3aed;
    /* Violet */
    --color-sentence: #0284c7;
    /* Sky */
    --color-rain: #2563eb;
    /* Blue */
    --color-wordle: #65a30d;
    /* Lime */
    --color-pronunciation: #dc2626;
    /* Red */
}

body {
    background-color: #0f172a;
    /* Fallback */
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-size: 100% 100%;
    background-attachment: fixed;
    height: 100dvh;
    margin: 0;
    font-family: var(--font-main);
    color: var(--text-main-dark);
    /* Default to dark mode text for this dark theme */
    transition: background 0.5s ease;
    overflow: hidden;
}

body.dark-mode {
    background: var(--bg-gradient-dark);
    color: var(--text-main-dark);
}

.games-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Header, Content, Footer/Space */
    gap: 1rem;
    box-sizing: border-box;
}

.game-menu-container {
    overflow-y: auto;
    padding-bottom: 2rem;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

.game-menu-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.games-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.back-btn,
.theme-toggle-btn {
    background: var(--card-bg-light);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, background 0.3s, color 0.3s;
}

#mobileViewToggle {
    background: transparent !important;
    box-shadow: none !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white !important;
}

body.dark-mode .back-btn,
body.dark-mode .theme-toggle-btn {
    background: var(--card-bg-dark);
    color: var(--text-main-dark);
}

.back-btn:hover,
.theme-toggle-btn:hover {
    transform: scale(1.1);
}

.games-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space out title and buttons */
    gap: 1rem;
    margin-bottom: 3rem;
}

.games-header h1 {
    margin: 0;
    font-size: clamp(1.2rem, 4vw, 2.2rem);
    /* Responsive font size */
    white-space: nowrap;
    /* Force single line */
    background: linear-gradient(45deg, #6366f1, #a855f7, #ec4899);
    /* More vibrant gradient */
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation:
        popIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) both,
        gradientFlow 3s ease infinite,
        float 3s ease-in-out infinite 0.8s;
    /* Float starts after popIn */
}

/* Animations */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Game Menu Grid */
.game-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.game-card-item {
    background: var(--card-bg-light);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border-light);
    border-radius: 1.5rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.4s var(--spring-easing), box-shadow 0.4s var(--spring-easing), border-color 0.3s ease;
    /* Very Light Magical Black Glow */
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.05),
        0 0 8px rgba(0, 0, 0, 0.02),
        inset 0 1px 1px rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    animation: slideUpFade 0.6s var(--spring-easing) backwards, cardPulseDay 4s infinite ease-in-out 0.6s;
}

.game-card-item:hover {
    transform: translateY(-5px) scale(1.03);
    /* Day Mode Hover: Slightly deeper but still soft */
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

/* Staggered Entrance */
.game-card-item:nth-child(1) {
    animation-delay: 0.1s;
}

.game-card-item:nth-child(2) {
    animation-delay: 0.15s;
}

.game-card-item:nth-child(3) {
    animation-delay: 0.2s;
}

.game-card-item:nth-child(4) {
    animation-delay: 0.25s;
}

.game-card-item:nth-child(5) {
    animation-delay: 0.3s;
}

.game-card-item:nth-child(6) {
    animation-delay: 0.35s;
}

.game-card-item:nth-child(7) {
    animation-delay: 0.4s;
}

.game-card-item:nth-child(8) {
    animation-delay: 0.45s;
}

.game-card-item:nth-child(9) {
    animation-delay: 0.5s;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Individual Game Colors via nth-child */
.game-card-item:nth-child(1) .game-icon-large {
    color: var(--color-grammar);
    filter: drop-shadow(0 4px 6px rgba(79, 70, 229, 0.3));
}

.game-card-item:nth-child(2) .game-icon-large {
    color: var(--color-missing);
    filter: drop-shadow(0 4px 6px rgba(234, 88, 12, 0.3));
}

.game-card-item:nth-child(3) .game-icon-large {
    color: var(--color-flashcards);
    filter: drop-shadow(0 4px 6px rgba(5, 150, 105, 0.3));
}

.game-card-item:nth-child(4) .game-icon-large {
    color: var(--color-spelling);
    filter: drop-shadow(0 4px 6px rgba(219, 39, 119, 0.3));
}

/* Night Mode Override for Game Cards */
body.dark-mode .game-card-item {
    background: var(--card-bg-dark);
    border-color: var(--glass-border-dark);
    /* Very Light Magical Sky Blue Glow */
    box-shadow:
        0 0 10px rgba(56, 189, 248, 0.1),
        0 0 15px rgba(14, 165, 233, 0.05),
        inset 0 0 5px rgba(56, 189, 248, 0.05);
    animation: cardPulseNight 4s infinite ease-in-out;
}

body.dark-mode .game-card-item:hover {
    box-shadow:
        0 0 15px rgba(56, 189, 248, 0.2),
        0 0 25px rgba(14, 165, 233, 0.1),
        inset 0 0 10px rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-5px) scale(1.03);
}

.game-card-item:nth-child(5) .game-icon-large {
    color: var(--color-wheel);
    filter: drop-shadow(0 4px 6px rgba(124, 58, 237, 0.3));
}

.game-card-item:nth-child(6) .game-icon-large {
    color: var(--color-sentence);
    filter: drop-shadow(0 4px 6px rgba(2, 132, 199, 0.3));
}

.game-card-item:nth-child(7) .game-icon-large {
    color: var(--color-rain);
    filter: drop-shadow(0 4px 6px rgba(37, 99, 235, 0.3));
}

.game-card-item:nth-child(8) .game-icon-large {
    color: var(--color-wordle);
    filter: drop-shadow(0 4px 6px rgba(101, 163, 13, 0.3));
}

.game-card-item:nth-child(9) .game-icon-large {
    color: var(--color-pronunciation);
    filter: drop-shadow(0 4px 6px rgba(220, 38, 38, 0.3));
}

.game-card-item:active {
    transform: scale(0.95);
}

body.dark-mode .game-card-item {
    background: var(--card-bg-dark);
    border-color: var(--glass-border-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Complex Glowing Pulse Animation (20+ Colors) */
@keyframes game-pulse {
    0% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
        transform: scale(1);
        border-color: rgba(99, 102, 241, 0.4);
    }

    /* Indigo */
    5% {
        box-shadow: 0 0 35px rgba(244, 63, 94, 0.6);
        transform: scale(1.02);
        border-color: rgba(244, 63, 94, 0.6);
    }

    /* Rose */
    10% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
        transform: scale(1);
        border-color: rgba(16, 185, 129, 0.4);
    }

    /* Emerald */
    15% {
        box-shadow: 0 0 35px rgba(245, 158, 11, 0.6);
        transform: scale(1.02);
        border-color: rgba(245, 158, 11, 0.6);
    }

    /* Amber */
    20% {
        box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
        transform: scale(1);
        border-color: rgba(14, 165, 233, 0.4);
    }

    /* Sky */
    25% {
        box-shadow: 0 0 35px rgba(139, 92, 246, 0.6);
        transform: scale(1.02);
        border-color: rgba(139, 92, 246, 0.6);
    }

    /* Violet */
    30% {
        box-shadow: 0 0 20px rgba(20, 184, 166, 0.4);
        transform: scale(1);
        border-color: rgba(20, 184, 166, 0.4);
    }

    /* Teal */
    35% {
        box-shadow: 0 0 35px rgba(249, 115, 22, 0.6);
        transform: scale(1.02);
        border-color: rgba(249, 115, 22, 0.6);
    }

    /* Orange */
    40% {
        box-shadow: 0 0 20px rgba(217, 70, 239, 0.4);
        transform: scale(1);
        border-color: rgba(217, 70, 239, 0.4);
    }

    /* Fuchsia */
    45% {
        box-shadow: 0 0 35px rgba(132, 204, 22, 0.6);
        transform: scale(1.02);
        border-color: rgba(132, 204, 22, 0.6);
    }

    /* Lime */
    50% {
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
        transform: scale(1);
        border-color: rgba(6, 182, 212, 0.4);
    }

    /* Cyan */
    55% {
        box-shadow: 0 0 35px rgba(236, 72, 153, 0.6);
        transform: scale(1.02);
        border-color: rgba(236, 72, 153, 0.6);
    }

    /* Pink */
    60% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
        transform: scale(1);
        border-color: rgba(59, 130, 246, 0.4);
    }

    /* Blue */
    65% {
        box-shadow: 0 0 35px rgba(168, 85, 247, 0.6);
        transform: scale(1.02);
        border-color: rgba(168, 85, 247, 0.6);
    }

    /* Purple */
    70% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
        transform: scale(1);
        border-color: rgba(34, 197, 94, 0.4);
    }

    /* Green */
    75% {
        box-shadow: 0 0 35px rgba(234, 179, 8, 0.6);
        transform: scale(1.02);
        border-color: rgba(234, 179, 8, 0.6);
    }

    /* Yellow */
    80% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
        transform: scale(1);
        border-color: rgba(239, 68, 68, 0.4);
    }

    /* Red */
    85% {
        box-shadow: 0 0 35px rgba(99, 102, 241, 0.6);
        transform: scale(1.02);
        border-color: rgba(99, 102, 241, 0.6);
    }

    /* Indigo (Cycle) */
    90% {
        box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
        transform: scale(1);
        border-color: rgba(168, 85, 247, 0.4);
    }

    /* Purple */
    95% {
        box-shadow: 0 0 35px rgba(20, 184, 166, 0.6);
        transform: scale(1.02);
        border-color: rgba(20, 184, 166, 0.6);
    }

    /* Teal */
    100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
        transform: scale(1);
        border-color: rgba(99, 102, 241, 0.4);
    }

    /* Back to Start */
}

.game-card-item {
    /* ... existing styles ... */
    animation: game-pulse 30s infinite linear;
    /* Very slow, continuous cycle */
}

.game-card-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .game-card-item:hover {
    box-shadow: 0 25px 50px rgba(99, 102, 241, 0.3);
    border-color: #818cf8;
    background: rgba(31, 41, 55, 0.8);
}

.game-icon-large {
    font-size: 4rem;
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.game-card-item:hover .game-icon-large {
    transform: scale(1.2) rotate(10deg);
}

.game-card-item h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-main-light);
    font-size: 1.3rem;
}

body.dark-mode .game-card-item h3 {
    color: var(--text-main-dark);
}

.game-card-item p {
    margin: 0 0 1rem 0;
    color: var(--text-sub-light);
    font-family: var(--font-arabic);
    font-weight: 700;
    font-size: 1.1rem;
    /* Increased size */
    line-height: 1.6;
    /* Better spacing for Arabic glyphs */
}

body.dark-mode .game-card-item p {
    color: var(--text-sub-dark);
}

.high-score {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    display: inline-block;
}

body.dark-mode .high-score {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* ========================================
   PREMIUM BUTTON SYSTEM
   ======================================== */

/* Base Button Style */
.game-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.4s var(--spring-easing);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.game-btn:active {
    transform: translateY(0) scale(0.98);
}

.game-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none !important;
}

/* Next Button - Primary Success */
.next-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    border-radius: 1rem;
    font-weight: 700;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s var(--spring-easing);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.next-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.next-btn:active {
    transform: translateY(0) scale(0.98);
}

body.dark-mode .next-btn {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.4);
}

/* Check Button - Primary Action */
.check-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    color: white;
    border-radius: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s var(--spring-easing);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.check-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.check-btn:active {
    transform: translateY(0) scale(0.98);
}

.check-btn:disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

body.dark-mode .check-btn:disabled {
    background: #4b5563;
    color: #d1d5db;
    opacity: 0.8;
    border: 1px solid #6b7280;
}

/* Show Answer Button - Warning/Caution */
.show-answer-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: white;
    border-radius: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s var(--spring-easing);
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.show-answer-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.show-answer-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Start Button - Energetic Purple */
.start-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
    border: none;
    color: white;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.4s var(--spring-easing);
    box-shadow: 0 4px 6px rgba(168, 85, 247, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.start-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 16px rgba(168, 85, 247, 0.4);
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
}

.start-btn:active {
    transform: translateY(0) scale(0.98);
}

body.dark-mode .start-btn {
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
    box-shadow: 0 4px 6px rgba(147, 51, 234, 0.4);
}

/* Active Game Container */
.active-game-container {
    background: var(--card-bg-light);
    border-radius: 2rem;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    animation: slideUpFade 0.6s var(--spring-easing) backwards;
    flex: 1;
}

/* Timer Bar */
.wc-timer {
    width: 100%;
    height: 20px;
    /* Increased height for text */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 0.5rem;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-timer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: rgba(251, 191, 36, 0.3);
    /* Gold transparent */
    animation: countdown 5s linear forwards;
    transform-origin: left;
    z-index: 1;
}

#wcTimerText {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fbbf24;
    z-index: 2;
    position: relative;
}

/* Skeleton Loader for Empty States */
.skeleton-loader {
    width: 100%;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub-light);
    font-weight: 500;
    animation: pulse 1.5s infinite ease-in-out;
}

body.dark-mode .skeleton-loader {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-sub-dark);
}

body.dark-mode .active-game-container {
    background: var(--card-bg-dark);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.game-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    gap: 1rem;
}

.game-header-inner h3 {
    margin: 0;
    font-size: 1.5rem;
    white-space: nowrap;
    background: linear-gradient(to right, #6366f1, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation:
        popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) both,
        gradientFlow 3s linear infinite;
    text-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.game-back-btn {
    background: transparent;
    border: none;
    color: var(--text-sub-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-back-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main-light);
    transform: translateX(-3px);
}

body.dark-mode .game-back-btn {
    color: var(--text-sub-dark);
}

body.dark-mode .game-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main-dark);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness & iPhone View Simulation */
@media (max-width: 600px) {
    .games-container {
        padding: 1rem;
    }
}

/* Apply mobile styles when screen is small OR when simulation is active */
@media (max-width: 600px),
screen and (min-width: 0px) {
    /* 
       HACK: We want these styles to apply if body has .iphone-view class 
       BUT CSS doesn't support "OR" between media query and selector nesting easily without duplication.
       So we will use a separate block for .iphone-view below.
    */
}

/* iPhone View Simulation - Ported from style.css */
body.iphone-view {
    max-width: 393px;
    margin: 2rem auto;
    border: 12px solid #333;
    border-radius: 50px;
    min-height: calc(100vh - 4rem);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    overflow-x: hidden;
    position: relative;
}

body.iphone-view::before {
    /* Notch / Dynamic Island Simulation */
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 35px;
    background-color: #000;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 1000;
    pointer-events: none;
}

/* Shared Mobile Styles (Applied to small screens AND .iphone-view) */
@media (max-width: 600px) {
    .game-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .game-card-item {
        padding: 1rem 0.5rem;
        border-radius: 1rem;
        background: var(--surface);
        box-shadow: var(--shadow);
        border: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        /* Changed from center to space-between */
        align-items: center;
        text-align: center;
        gap: 0.5rem;
        min-height: 180px;
        /* Increased min-height */
        height: auto;
        /* Allow growth */
        aspect-ratio: auto;
        /* Remove square constraint */
    }

    .game-icon-large {
        font-size: 2.5rem;
        margin-bottom: 0;
        flex-shrink: 0;
        filter: none;
    }

    .game-card-item h3 {
        font-size: 0.95rem;
        margin: 0;
        line-height: 1.4;
        font-weight: 600;
        color: var(--text-main);
        /* Remove line clamp to avoid cutting text */
        display: block;
        height: auto;
    }

    .game-card-item p {
        font-size: 0.8rem;
        margin: 0;
        color: var(--text-secondary);
        white-space: normal;
        /* Allow wrapping */
        line-height: 1.3;
        opacity: 1;
    }

    .high-score {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
        margin-top: 0.25rem;
        background: var(--background);
        color: var(--primary);
        border-radius: 1rem;
        font-weight: 600;
        border: 1px solid var(--border);
    }
}

/* Force Mobile Styles for Simulation */
body.iphone-view .game-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
}

body.iphone-view .game-card-item {
    padding: 1rem 0.5rem;
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    min-height: 180px;
    height: auto;
    aspect-ratio: auto;
}

body.iphone-view .game-icon-large {
    font-size: 2.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
    filter: none;
}

body.iphone-view .game-card-item h3 {
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.4;
    font-weight: 600;
    color: var(--text-main);
    display: block;
    height: auto;
}

body.iphone-view .game-card-item p {
    font-size: 1rem;
    /* Larger for mobile view too */
    margin: 0;
    color: var(--text-secondary);
    white-space: normal;
    line-height: 1.5;
    opacity: 1;
}

body.iphone-view .high-score {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    margin-top: 0.25rem;
    background: var(--background);
    color: var(--primary);
    border-radius: 1rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

/* Dark Mode Overrides for Simulation */
body.iphone-view.dark-mode .game-card-item {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body.iphone-view.dark-mode .game-card-item h3 {
    color: #f3f4f6;
}

body.iphone-view.dark-mode .game-card-item p {
    color: #9ca3af;
}

body.iphone-view.dark-mode .high-score {
    background: rgba(129, 140, 248, 0.2);
    color: #818cf8;
}

/* Continue with existing media query... */
@media (max-width: 600px) {

    /* Fullscreen Active Game */
    /* Force Mobile Styles for Simulation */
    body.iphone-view .active-game-container {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 38px;
        /* Match phone radius minus border */
        z-index: 100;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .active-game-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        border-radius: 0;
        padding: 1rem;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .game-header-inner {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }

    .game-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .game-card-item {
        padding: 0.75rem;
        /* Slightly less padding to give more room */
        border-radius: 1rem;
    }

    .game-icon-large {
        font-size: 2.5rem;
        /* Smaller icon to fit text */
        margin-bottom: 0;
        /* Remove margin, let justify-content handle it */
        flex-shrink: 0;
    }

    .game-card-item h3 {
        font-size: 0.95rem;
        margin: 0;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        /* Limit to 2 lines */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .game-card-item p {
        font-size: 0.8rem;
        margin: 0;
        color: var(--text-sub-light);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .high-score {
        font-size: 0.7rem;
        padding: 0.1rem 0.4rem;
        margin-top: auto;
        /* Push to bottom if needed, though justify-between handles it */
    }

    /* Flashcard Mobile Tweaks */
    .flashcard-container {
        height: 50vh;
        /* Use viewport height */
        max-height: 400px;
        margin-bottom: 1rem;
    }

    .flashcard h2 {
        font-size: 2.5rem;
    }

    .flashcard-controls {
        gap: 1rem;
    }

    .fc-btn {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }

    /* General Game Options Mobile */
    .game-options {
        grid-template-columns: 1fr;
        /* Stack options */
    }

    /* Grammar Game Mobile Tweaks */
    .grammar-sentence-area {
        font-size: 1.5rem;
        line-height: 2;
        padding: 1rem;
        background: var(--card-bg-light);
        border-radius: 1rem;
        margin-bottom: 1.5rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }

    body.dark-mode .grammar-sentence-area {
        background: var(--card-bg-dark);
    }

    .word-drop-zone {
        min-width: 80px;
        height: 2.5rem;
        margin: 0 0.25rem;
        border-bottom-width: 3px;
    }

    .word-bank {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 1rem;
        margin-top: auto;
        /* Push to bottom */
    }

    body.dark-mode .word-bank {
        background: rgba(0, 0, 0, 0.2);
    }

    .draggable-word {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
        border-radius: 2rem;
        /* Pill shape */
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        touch-action: none;
        /* Important for drag on mobile */
    }

    body.dark-mode .draggable-word {
        background: #374151;
        color: white;
    }
}

/* Flashcard Visual Overhaul */
.flashcard-container {
    perspective: 1000px;
    width: 100%;
    max-width: 500px;
    /* Wider card */
    height: 350px;
    /* Taller card */
    margin: 0 auto 2rem;
}

.flashcard {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-sizing: border-box;
    box-sizing: border-box;
    /* Ensure padding doesn't overflow */
    transition: z-index 0s 0.4s;
    /* Delay z-index change until halfway through flip */
}

.flashcard-front {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(243, 244, 246, 0.9) 100%);
    z-index: 2;
}

.flashcard-back {
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
    transform: rotateY(180deg);
    border: 3px solid #fb7185;
    box-shadow: 0 0 30px rgba(251, 113, 133, 0.3);
    z-index: 1;
}

.flashcard.flipped .flashcard-front {
    z-index: 1;
}

.flashcard.flipped .flashcard-back {
    z-index: 2;
}

body.dark-mode .flashcard-front {
    background: linear-gradient(135deg, rgba(55, 65, 81, 0.95) 0%, rgba(31, 41, 55, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .flashcard-back {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #818cf8;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

.flashcard h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    /* Responsive font size */
    margin: 0 0 1.5rem 0;
    font-weight: 800;
    background: linear-gradient(45deg, #1f2937, #4b5563);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 100%;
}

body.dark-mode .flashcard h2 {
    background: linear-gradient(45deg, #f3f4f6, #d1d5db);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.flashcard-back h2 {
    font-family: 'Noto Sans Arabic', sans-serif;
    color: #be123c;
    background: none;
    -webkit-text-fill-color: #be123c;
    background-clip: border-box;
    -webkit-background-clip: border-box;
}

body.dark-mode .flashcard-back h2 {
    color: #818cf8;
    -webkit-text-fill-color: #818cf8;
}

.tap-hint {
    font-size: 1rem;
    color: var(--text-sub-light);
    opacity: 0.8;
    animation: pulse 2s infinite;
    font-weight: 500;
    margin-top: auto;
    /* Push to bottom */
}

body.dark-mode .tap-hint {
    color: var(--text-sub-dark);
}

@keyframes pulse {
    0% {
        opacity: 0.5;
        transform: scale(0.95);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}

/* Flashcard Controls */
.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.wc-level-btn {
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.wc-level-btn.unlocked {
    background: #1e3a8a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wc-level-btn.unlocked:hover {
    transform: scale(1.05);
    background: #2563eb;
}

.wc-level-btn.locked {
    background: #374151;
    color: #9ca3af;
    border: 1px solid #4b5563;
    cursor: not-allowed;
    opacity: 0.8;
}

.wc-level-btn.unlocked:active {
    transform: scale(0.95);
}

.fc-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 1rem;
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fc-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.fc-btn.wrong {
    background: #fee2e2;
    color: #ef4444;
}

.fc-btn.correct {
    background: #d1fae5;
    color: #10b981;
}

body.dark-mode .fc-btn.wrong {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

body.dark-mode .fc-btn.correct {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

/* Missing Word Game Visuals */
.game-question-area {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

.game-sentence {
    font-size: 1.8rem;
    line-height: 1.6;
    color: var(--text-main-light);
    margin-bottom: 1rem;
    font-weight: 500;
}

body.dark-mode .game-sentence {
    color: var(--text-main-dark);
}

.missing-word-slot {
    display: inline-block;
    width: 100px;
    height: 1.5em;
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 3px solid #6366f1;
    vertical-align: bottom;
    margin: 0 5px;
    border-radius: 4px;
    animation: pulse-border 2s infinite;
}

body.dark-mode .missing-word-slot {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

@keyframes pulse-border {
    0% {
        border-color: #6366f1;
    }

    50% {
        border-color: #a5b4fc;
    }

    100% {
        border-color: #6366f1;
    }
}

.game-hint {
    font-size: 1.4rem;
    color: var(--text-sub-light);
    font-family: 'Noto Sans Arabic', sans-serif;
    margin-top: 0.5rem;
}

body.dark-mode .game-hint {
    color: var(--text-sub-dark);
}

.game-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 1.2rem;
    font-size: 1.2rem;
    border-radius: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    color: var(--text-main-light);
    font-weight: 700;
    position: relative;
    overflow: hidden;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.8), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

body.dark-mode .option-btn {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: var(--text-main-dark);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 2px 4px -1px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

/* Staggered animation delays for options */
.option-btn:nth-child(1) {
    animation-delay: 0.1s;
}

.option-btn:nth-child(2) {
    animation-delay: 0.2s;
}

.option-btn:nth-child(3) {
    animation-delay: 0.3s;
}

.option-btn:nth-child(4) {
    animation-delay: 0.4s;
}

.option-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #6366f1;
    z-index: 1;
}

.option-btn:hover::before {
    opacity: 1;
}

.option-btn.correct {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3) !important;
    animation: pulse-green 0.6s cubic-bezier(0.4, 0, 0.6, 1);
    opacity: 1 !important;
    /* Force opacity */
}

.option-btn.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
    color: white !important;
    border-color: #f87171 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3) !important;
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    opacity: 1 !important;
    /* Force opacity */
}

.option-btn:disabled {
    cursor: default;
    transform: none !important;
    box-shadow: none;
}

/* Ensure disabled state doesn't override colors for unselected buttons if needed, 
   but we want them to look disabled unless they are the correct answer */
.option-btn:disabled:not(.correct):not(.wrong) {
    opacity: 0.6;
    background: var(--surface);
    /* Keep neutral */
}



@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Grammar Rule Explanation - Premium Style */
.grammar-explanation {
    font-size: 1.1rem;
    color: var(--text-main-light);
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
    line-height: 1.6;
    text-align: center;
    font-weight: 500;
    animation: slideUpFade 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.dark-mode .grammar-explanation {
    background: rgba(31, 41, 55, 0.8);
    color: var(--text-main-dark);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.grammar-explanation strong {
    color: #6366f1;
    font-weight: 700;
}

body.dark-mode .grammar-explanation strong {
    color: #818cf8;
}

/* Spelling Game Styles */
.spelling-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 800px;
    /* Increased max-width */
    margin: 2rem auto;
}

.spelling-option-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    color: var(--text-main-light);
    font-weight: 700;
    position: relative;
    overflow: hidden;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
    flex: 1 1 auto;
    /* Allow growing */
    min-width: 120px;
    /* Minimum width */
    max-width: 100%;
    /* Prevent overflow */
    word-break: break-word;
    /* Safety net */
}

.spelling-option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.8), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

body.dark-mode .spelling-option-btn {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: var(--text-main-dark);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 2px 4px -1px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.spelling-option-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #db2777;
    /* Pink for spelling */
    z-index: 1;
}

.spelling-option-btn:hover::before {
    opacity: 1;
}

.spelling-option-btn.correct {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3) !important;
    animation: pulse-green 0.6s cubic-bezier(0.4, 0, 0.6, 1);
    opacity: 1 !important;
}

.spelling-option-btn.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
    color: white !important;
    border-color: #f87171 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3) !important;
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    opacity: 1 !important;
}

.spelling-option-btn:disabled {
    cursor: default;
    transform: none !important;
    box-shadow: none;
}

.spelling-option-btn:disabled:not(.correct):not(.wrong) {
    opacity: 0.6;
    background: var(--surface);
}

/* Word Wheel Styles */
.word-wheel-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-answer-box {
    min-height: 60px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 1rem;
    padding: 1rem 2rem;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.2rem;
    margin-bottom: 1rem;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    min-height: 50px;
    /* Ensure height */
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #4f46e5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode .wheel-answer-box {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.wheel-answer-box.correct {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    border: none;
}

.wheel-answer-box.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
    color: white !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    border: none;
}

.game-hint {
    font-size: 1.2rem;
    color: var(--text-secondary-light);
    margin-bottom: 1rem;
    font-style: italic;
    direction: rtl;
    /* Ensure Arabic is RTL */
    font-family: 'Noto Sans Arabic', sans-serif;
    /* Use Arabic font */
    line-height: 1.6;
}

.wheel-hint {
    font-size: 1.2rem;
    color: var(--text-sub-light);
    margin-bottom: 2rem;
    font-family: 'Noto Sans Arabic', sans-serif;
    min-height: 1.5em;
    /* Prevent layout shift */
}

body.dark-mode .wheel-hint {
    color: var(--text-sub-dark);
}

.wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 2rem auto;
    /* Ensure it has space */
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.wheel-center-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #6366f1;
    color: white;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wheel-center-btn:hover {
    transform: scale(1.1);
    background: #4f46e5;
}

.wheel-letter {
    position: absolute;
    width: 60px;
    /* Increased from 50px */
    height: 60px;
    /* Increased from 50px */
    border-radius: 50%;
    background: var(--card-bg-light);
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    /* Increased from 1.5rem */
    font-weight: 700;
    color: var(--text-main-light);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 5;
    text-transform: uppercase;
}

body.dark-mode .wheel-letter {
    background: var(--card-bg-dark);
    border-color: #4b5563;
    color: var(--text-main-dark);
}

.wheel-letter:hover {
    transform: scale(1.1);
    border-color: #6366f1;
    color: #6366f1;
    z-index: 20;
}

.wheel-letter.selected {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

body.dark-mode .wheel-letter.selected {
    background: rgba(99, 102, 241, 0.2);
}

.game-controls-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

.fixed-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 equal columns */
    gap: 0.5rem;
    width: 100%;
    max-width: 600px;
    margin: 2rem auto 0;
    align-items: center;
}

.fixed-controls button {
    /* width: 100%; Removed to allow circular shape */
    margin: 0 auto;
    /* Center in grid cell */
}

#undoWheelBtn {
    padding: 0;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white !important;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(100, 116, 139, 0.3);
    height: 60px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode #undoWheelBtn {
    background: linear-gradient(135deg, #475569 0%, #334155 100%) !important;
}

#skipWheelBtn {
    padding: 0;
    /* Remove padding for circle */
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    /* Thicker border */
    color: white !important;
    border-radius: 50%;
    /* Circular */
    font-weight: 800;
    font-size: 1.8rem;
    /* Larger emoji */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
    height: 60px;
    /* Fixed height */
    width: 60px;
    /* Fixed width */
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode #skipWheelBtn {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
    border-color: rgba(255, 255, 255, 0.2);
    color: white !important;
    box-shadow: 0 4px 6px rgba(249, 115, 22, 0.4);
}

#skipWheelBtn:hover {
    transform: translateY(-2px) scale(1.1);
    /* Slightly larger scale */
    box-shadow: 0 8px 15px rgba(245, 158, 11, 0.4);
}

#skipWheelBtn:active {
    transform: translateY(0) scale(0.95);
}

/* --- Sentence Builder Styles --- */
.sentence-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    width: 100%;
    max-width: 800px;
}

.sentence-drop-zone {
    min-height: 80px;
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

body.dark-mode .sentence-drop-zone {
    background: rgba(255, 255, 255, 0.05);
    border-color: #4b5563;
}

.sentence-drop-zone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.sentence-word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

#wheelShowAnswerBtn {
    padding: 0;
    /* Remove padding for circle */
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    /* Thicker border */
    color: white !important;
    border-radius: 50%;
    /* Circular */
    font-weight: 800;
    font-size: 1.8rem;
    /* Larger emoji */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
    height: 60px;
    /* Fixed height */
    width: 60px;
    /* Fixed width */
    display: flex;
    align-items: center;
    justify-content: center;
}

#wheelShowAnswerBtn:hover {
    transform: translateY(-2px) scale(1.1);
    /* Slightly larger scale */
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.4);
}

#wheelShowAnswerBtn:disabled {
    background: #d1d5db !important;
    color: #6b7280 !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
    border: 2px solid transparent;
}

body.dark-mode #wheelShowAnswerBtn:disabled {
    background: #4b5563 !important;
    color: #d1d5db !important;
    opacity: 0.8;
    border: 1px solid #6b7280;
}

#nextWheelBtn {
    padding: 0;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white !important;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
    height: 60px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode #nextWheelBtn {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

.sentence-word {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    /* Make it clear these are clickable */
    user-select: none;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: var(--text-main-light);
}

body.dark-mode .sentence-word {
    background: #374151;
    border-color: #4b5563;
    color: var(--text-main-dark);
}

.sentence-word:hover {
    transform: translateY(-2px);
    border-color: #6366f1;
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.2);
}

.sentence-word.used {
    opacity: 0.5;
    pointer-events: none;
    background: #f3f4f6;
}

/* --- Word Rain Styles --- */
/* --- Word Rain Styles --- */
.rain-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

#rainCanvas {
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    border-radius: 1.5rem;
    width: 100%;
    height: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.rain-input-container {
    width: 100%;
    max-width: 500px;
    position: relative;
}

#rainInput {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    color: var(--text-primary);
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    outline: none;
}

#rainInput:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

#rainInput.correct-flash {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 1.5rem;
    z-index: 20;
    animation: fadeIn 0.3s ease-out;
}

.game-over-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    width: 400px;
}

.game-over-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #ef4444, #f87171);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.final-score {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.final-score span {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 1.8rem;
}

.restart-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.start-btn {
    padding: 1rem 4rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.start-btn:hover {
    transform: translate(-50%, -52%) scale(1.05);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

/* --- Wordle Styles --- */
.wordle-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    padding-bottom: 2rem;
    /* Ensure padding at bottom for scrolling */
    overflow: auto;
}

.wordle-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
}

.wordle-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.wordle-tile {
    width: 50px;
    height: 50px;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    transition: all 0.3s;
}

body.dark-mode .wordle-tile {
    border-color: #4b5563;
    color: white;
}

.wordle-tile.filled {
    border-color: #6b7280;
    animation: popIn 0.1s;
}

.wordle-tile.correct {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.wordle-tile.present {
    background: #eab308;
    border-color: #eab308;
    color: white;
}

.wordle-tile.absent {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
}

.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 500px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key-btn {
    padding: 15px 10px;
    background: #e5e7eb;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    flex: 1;
    max-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .key-btn {
    background: #4b5563;
    color: white;
}

.key-btn.wide {
    max-width: 65px;
    font-size: 0.8rem;
}

.key-btn.correct {
    background: #10b981;
    color: white;
}

.key-btn.present {
    background: #eab308;
    color: white;
}

.key-btn.absent {
    background: #374151;
    color: white;
    opacity: 0.5;
}

/* --- Spelling Game Enhancements --- */
#spellingHint {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

body.dark-mode #spellingHint {
    color: #f3f4f6;
}

.game-example {
    font-size: 1.2rem;
    color: #4b5563;
    margin-top: 0.5rem;
    font-style: italic;
    min-height: 1.5rem;
    transition: color 0.3s;
}

body.dark-mode .game-example {
    color: #d1d5db;
}

/* ========================================
   DASHBOARD LAYOUT (Single Screen - iPhone 16 Pro)
   ======================================== */

.dashboard-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    /* Dynamic Viewport Height */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: 2000;
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Header, Main, Footer */
    overflow: hidden;
    /* ZERO SCROLLING */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark-mode .dashboard-game-container {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #f3f4f6;
}

/* --- Header --- */
.dashboard-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
}

body.dark-mode .dashboard-header {
    background: rgba(31, 41, 55, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.dashboard-title .subtitle {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    font-family: 'Noto Sans Arabic', sans-serif;
}

body.dark-mode .dashboard-title h3 {
    color: #f3f4f6;
}

body.dark-mode .dashboard-title .subtitle {
    color: #9ca3af;
}

.dashboard-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #9ca3af;
    font-weight: 600;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #6366f1;
}

/* --- Main Content (Canvas) --- */
.dashboard-main {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#rainCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    z-index: 5;
}

body.dark-mode .start-overlay {
    background: rgba(0, 0, 0, 0.3);
}

/* Premium Start Button */
.premium-start-btn {
    position: relative;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border: none;
    border-radius: 2rem;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s;
}

.premium-start-btn:active {
    transform: scale(0.95);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: rotate(45deg);
    animation: glowRotate 3s infinite linear;
}

@keyframes glowRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Footer Controls --- */
.dashboard-footer {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    /* Safe Area */
}

body.dark-mode .dashboard-footer {
    background: rgba(31, 41, 55, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.rain-controls-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 Options side-by-side */
    gap: 1rem;
}

.rain-option-btn {
    padding: 1rem 0.5rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
    /* Large touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Noto Sans Arabic', sans-serif;
}

body.dark-mode .rain-option-btn {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

.rain-option-btn:active {
    transform: scale(0.96);
    background: #f3f4f6;
}

/* ========================================
   DASHBOARD LAYOUT (Single Screen - iPhone 16 Pro)
   ======================================== */

.dashboard-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    /* Dynamic Viewport Height */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: 2000;
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Header, Main, Footer */
    overflow: hidden;
    /* ZERO SCROLLING */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark-mode .dashboard-game-container {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #f3f4f6;
}

/* --- Header --- */
.dashboard-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
}

body.dark-mode .dashboard-header {
    background: rgba(31, 41, 55, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.dashboard-title .subtitle {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    font-family: 'Noto Sans Arabic', sans-serif;
}

body.dark-mode .dashboard-title h3 {
    color: #f3f4f6;
}

body.dark-mode .dashboard-title .subtitle {
    color: #9ca3af;
}

.dashboard-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #9ca3af;
    font-weight: 600;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #6366f1;
}

/* --- Main Content (Canvas) --- */
.dashboard-main {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#rainCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    z-index: 50;
    /* Increased to be above canvas */
}

body.dark-mode .start-overlay {
    background: rgba(0, 0, 0, 0.3);
}

/* Premium Start Button */
.premium-start-btn {
    position: relative;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border: none;
    border-radius: 2rem;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s;
}

.premium-start-btn:active {
    transform: scale(0.95);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: rotate(45deg);
    animation: glowRotate 3s infinite linear;
}

@keyframes glowRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Footer Controls --- */
.dashboard-footer {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    /* Safe Area */
}

body.dark-mode .dashboard-footer {
    background: rgba(31, 41, 55, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.rain-controls-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 Options side-by-side */
    gap: 1rem;
}

.rain-option-btn {
    padding: 1rem 0.5rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
    /* Large touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Noto Sans Arabic', sans-serif;
}

body.dark-mode .rain-option-btn {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

.rain-option-btn:active {
    transform: scale(0.96);
    background: #f3f4f6;
}

/* ========================================
   DASHBOARD LAYOUT (Single Screen - iPhone 16 Pro)
   ======================================== */

.dashboard-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    /* Dynamic Viewport Height */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: 2000;
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Header, Main, Footer */
    overflow: hidden;
    /* ZERO SCROLLING */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark-mode .dashboard-game-container {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #f3f4f6;
}

/* --- Header --- */
.dashboard-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
}

body.dark-mode .dashboard-header {
    background: rgba(31, 41, 55, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.dashboard-title .subtitle {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    font-family: 'Noto Sans Arabic', sans-serif;
}

body.dark-mode .dashboard-title h3 {
    color: #f3f4f6;
}

body.dark-mode .dashboard-title .subtitle {
    color: #9ca3af;
}

.dashboard-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #9ca3af;
    font-weight: 600;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #6366f1;
}

/* --- Main Content (Canvas) --- */
.dashboard-main {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#rainCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    z-index: 50;
    /* Increased to be above canvas */
    flex-direction: column;
}

.game-over-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

body.dark-mode .start-overlay {
    background: rgba(0, 0, 0, 0.3);
}

/* Premium Start Button */
.premium-start-btn {
    position: relative;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border: none;
    border-radius: 2rem;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s;
}

.premium-start-btn:active {
    transform: scale(0.95);
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: rotate(45deg);
    animation: glowRotate 3s infinite linear;
}

@keyframes glowRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Footer Controls --- */
.dashboard-footer {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    /* Safe Area */
}

body.dark-mode .dashboard-footer {
    background: rgba(31, 41, 55, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.rain-controls-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 Options side-by-side */
    gap: 1rem;
}

.rain-option-btn {
    padding: 1rem 0.5rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
    /* Large touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Noto Sans Arabic', sans-serif;
}

body.dark-mode .rain-option-btn {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

.rain-option-btn:active {
    transform: scale(0.96);
    background: #f3f4f6;
}

/* =========================================
   ORD-REGN (WORD RAIN) REFACTOR
   Target: iPhone 16 Pro, OLED, Zero-Scroll
   ========================================= */

:root {
    /* Core Palette - OLED Optimized */
    --rain-bg: #121212;
    /* Dark Grey for OLED (prevents smearing) */
    --rain-text: #F8FAFC;

    /* Bilingual Identity */
    --rain-sv-color: #60A5FA;
    /* Soft Blue for Swedish */
    --rain-ar-color: #FBBF24;
    /* Amber/Gold for Arabic */

    /* Glassmorphism */
    --rain-glass-bg: rgba(255, 255, 255, 0.08);
    --rain-glass-border: rgba(255, 255, 255, 0.1);
    --rain-glass-blur: 20px;

    /* Functional */
    --rain-danger: #EF4444;
    --rain-success: #10B981;
}

@media (prefers-color-scheme: light) {
    :root {
        --rain-bg: #F3F4F6;
        --rain-text: #1F2937;
        --rain-glass-bg: rgba(255, 255, 255, 0.6);
        --rain-glass-border: rgba(0, 0, 0, 0.05);
        --rain-sv-color: #2563EB;
        --rain-ar-color: #D97706;
    }
}

/* Main Container - The "Zero-Scroll" Wrapper */
#rainGame.modern-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    /* Dynamic Viewport Height for mobile browsers */
    background-color: var(--rain-bg);
    z-index: 2000;
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Header, Canvas, Controls */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    overflow: hidden;
    /* No scrolling allowed */
    box-sizing: border-box;
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
}

/* 1. Header Area */
.rain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    z-index: 10;
}

.glass-btn {
    background: var(--rain-glass-bg);
    backdrop-filter: blur(var(--rain-glass-blur));
    -webkit-backdrop-filter: blur(var(--rain-glass-blur));
    border: 1px solid var(--rain-glass-border);
    color: var(--rain-text);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.score-board {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    background: var(--rain-glass-bg);
    backdrop-filter: blur(var(--rain-glass-blur));
    -webkit-backdrop-filter: blur(var(--rain-glass-blur));
    border: 1px solid var(--rain-glass-border);
    font-weight: 700;
    color: var(--rain-text);
}

/* 2. Canvas Area */
.rain-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#rainCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Overlay for Start Button */
.glass-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 20;
}

.neon-btn {
    background: linear-gradient(135deg, var(--rain-sv-color), var(--rain-ar-color));
    border: none;
    padding: 1.5rem 3rem;
    border-radius: 2rem;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.5);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.neon-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.lang-sv {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.lang-ar {
    font-size: 1.8rem;
    font-family: 'Noto Sans Arabic', sans-serif;
    line-height: 1;
}

/* 3. Controls Area */
.rain-controls {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 Options */
    gap: 1rem;
    z-index: 10;
    background: linear-gradient(to top, var(--rain-bg) 20%, transparent);
}

.rain-option-btn {
    background: var(--rain-glass-bg);
    backdrop-filter: blur(var(--rain-glass-blur));
    -webkit-backdrop-filter: blur(var(--rain-glass-blur));
    border: 1px solid var(--rain-glass-border);
    color: var(--rain-ar-color);
    /* Arabic Text Color */
    font-family: 'Noto Sans Arabic', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    padding: 1rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
    /* Touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.rain-option-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.98);
}

/* Typography Hierarchy */
.rain-word-sv {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    /* Regular/Light */
    color: var(--rain-sv-color);
}

.rain-word-ar {
    font-family: 'Noto Sans Arabic', sans-serif;
    font-weight: 700;
    /* Bold */
    color: var(--rain-ar-color);
}

/* Grammar Game Controls - Premium Redesign */
.game-controls-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: space-between;
}

.score-badge {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 2rem;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.game-filter-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--card-bg-light);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding: 0.75rem 2.5rem 0.75rem 1.25rem;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main-light);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    font-family: var(--font-main);
}

.game-filter-select:hover {
    border-color: #6366f1;
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.game-filter-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

body.dark-mode .game-filter-select {
    background-color: var(--card-bg-dark);
    color: var(--text-main-dark);
    border-color: rgba(99, 102, 241, 0.4);
}

body.dark-mode .game-filter-select:hover {
    border-color: #818cf8;
}


/* Creative Word Wheel Controls */
.word-wheel-controls {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 1px 1px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    /* Limit width for better look */
    margin: 0 auto 1.5rem auto !important;
    /* Center and add spacing */
}

body.dark-mode .word-wheel-controls {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.word-wheel-controls .game-filter-select {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0.5rem 2rem 0.5rem 1rem;
    /* Adjust padding */
    margin: 0;
    width: auto;
    font-weight: 700;
    color: var(--text-main-light);
}

body.dark-mode .word-wheel-controls .game-filter-select {
    color: var(--text-main-dark);
}

.word-wheel-controls .score-badge {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    box-shadow: 0 2px 5px rgba(139, 92, 246, 0.3);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.game-example {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: var(--text-main-light);
    text-align: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid #6366f1;
}

body.dark-mode .game-example {
    color: var(--text-main-dark);
    background: rgba(99, 102, 241, 0.2);
}

/* Sentence Builder Visual Feedback */
.sentence-drop-zone.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
}

.sentence-drop-zone.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* Sentence Builder Title Refinement */
#sentenceGame .game-header-inner h3 {
    font-size: 1.4rem;
    /* Smaller to fit on one line */
    white-space: nowrap;
    background: linear-gradient(to right, #6366f1, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 3s infinite linear;
    background-size: 200% auto;
    margin: 0;
    padding: 0;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

/* Word Rain Title Refinement */
#rainGame .game-header-inner h3 {
    font-size: 1.5rem;
    white-space: nowrap;
    background: linear-gradient(to right, #3b82f6, #06b6d4, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 3s infinite linear;
    background-size: 200% auto;
    margin: 0;
    padding: 0;
}

.rain-controls-header {
    justify-content: center;
    margin-bottom: 1.5rem !important;
}

/* ========================================
   WORD CONNECT MODULE STYLES
   ======================================== */

#word-game-module {
    display: flex;
    /* Hidden by default via JS, but when shown needs flex */
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    padding: 0;
    box-shadow: none;
    overflow-y: auto;
    /* Enabled scrolling for mobile support */
    /* Standard Game Background */
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-size: 100% 100%;
    background-color: #0f172a;
    transition: background 0.5s ease;
}

.wc-example-text {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    margin-top: 0.3rem;
    font-weight: 400;
}

/* Themes removed per user request to restore original background */

.wc-header {
    /* Layout handled inline/HTML for specific structure */
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 1.5rem 1.5rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.wc-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.wc-back-btn:active {
    transform: scale(0.9);
}

.wc-text-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.wc-text-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- COMPACT HEADER REDESIGN --- */
.wc-header-compact {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 1.5rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.wc-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    position: relative;
}

.wc-back-icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.wc-back-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.wc-game-title {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.2);
    white-space: nowrap;
    text-align: center;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wc-level-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(79, 70, 229, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #a5b4fc;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.wc-level-badge:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.wc-header-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.wc-stats-capsule {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 2rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex: 1;
    min-width: 0;
    /* Allow shrinking */
    justify-content: space-around;
}

.wc-stat-item {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #e2e8f0;
    white-space: nowrap;
}

.wc-stat-divider {
    width: 1px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.3rem;
}

.wc-action-group {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.wc-mini-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.wc-mini-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Mobile Optimization */
@media (max-width: 480px) {
    .wc-header-compact {
        padding: 0.6rem 0.8rem;
        gap: 0.6rem;
    }

    .wc-game-title {
        font-size: 1rem;
    }

    .wc-level-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    .wc-stats-capsule {
        padding: 0.2rem 0.4rem;
    }

    .wc-stat-item {
        font-size: 0.75rem;
    }

    .wc-mini-btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* FORCE MOBILE MODE FOR WORD CONNECT */
#word-game-module {
    max-width: 480px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Apply mobile header styles to Word Connect regardless of screen size */
#word-game-module .wc-header-compact {
    padding: 0.6rem 0.8rem;
    gap: 0.6rem;
}

#word-game-module .wc-game-title {
    font-size: 1rem;
}

#word-game-module .wc-level-badge {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

#word-game-module .wc-stats-capsule {
    padding: 0.2rem 0.4rem;
}

#word-game-module .wc-stat-item {
    font-size: 0.75rem;
}

#word-game-module .wc-mini-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
}



.wc-translation-display {
    font-size: 1.5rem;
    color: #fbbf24;
    height: 2rem;
    margin: 1rem 0;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s;
    width: 100%;
}

.wc-translation-display.pop-in {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wc-coin-counter {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    color: #fbbf24;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wc-game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Changed from space-between to center to control gap */
    gap: 0.25rem;
    /* Explicit gap, reduced from previous implicit spacing */
    padding-bottom: 2rem;
    overflow: visible;
    /* Allow content to flow for scrolling */
}

/* Grid Area */
.wc-grid-container {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    /* Reduced padding */
    margin-bottom: 0;
    /* Ensure no extra margin */
    margin-top: 4rem;
    /* Increased space above grid per user request */
}

.wc-word-row {
    display: flex;
    gap: 0.5rem;
}

.wc-letter-box {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: transparent;
    /* Hidden by default */
    transition: all 0.3s ease;
}

.wc-word-row.solved .wc-letter-box {
    background: white;
    color: #4f46e5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.wc-letter-box.reveal {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Wheel Area */
.wc-wheel-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.wc-preview-text {
    height: 40px;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.wc-wheel {
    position: relative;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 50%;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 200, 255, 0.3);
    box-shadow:
        0 0 20px rgba(0, 200, 255, 0.2),
        0 0 40px rgba(0, 200, 255, 0.1),
        inset 0 0 15px rgba(0, 200, 255, 0.1);
    animation: magicalWheelPulse 4s infinite ease-in-out;
    transition: box-shadow 0.5s ease, border-color 0.5s ease, background 0.5s ease;
}

@keyframes magicalWheelPulse {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(0, 200, 255, 0.2),
            0 0 40px rgba(0, 200, 255, 0.1),
            inset 0 0 15px rgba(0, 200, 255, 0.1);
        border-color: rgba(0, 200, 255, 0.3);
    }

    50% {
        box-shadow:
            0 0 30px rgba(0, 200, 255, 0.4),
            0 0 60px rgba(0, 200, 255, 0.2),
            inset 0 0 25px rgba(0, 200, 255, 0.2);
        border-color: rgba(0, 200, 255, 0.6);
    }
}

@keyframes neonPulseGreen {

    0%,
    100% {
        box-shadow:
            0 0 30px #22c55e,
            0 0 60px #22c55e,
            inset 0 0 30px rgba(34, 197, 94, 0.6);
        border-color: #4ade80;
        background: rgba(34, 197, 94, 0.1);
    }

    50% {
        box-shadow:
            0 0 50px #4ade80,
            0 0 100px #22c55e,
            0 0 150px #22c55e,
            inset 0 0 60px rgba(74, 222, 128, 0.8);
        border-color: #86efac;
        background: rgba(34, 197, 94, 0.2);
    }
}

@keyframes neonPulseYellow {

    0%,
    100% {
        box-shadow:
            0 0 30px #eab308,
            0 0 60px #eab308,
            inset 0 0 30px rgba(234, 179, 8, 0.6);
        border-color: #facc15;
        background: rgba(234, 179, 8, 0.1);
    }

    50% {
        box-shadow:
            0 0 50px #facc15,
            0 0 100px #eab308,
            0 0 150px #eab308,
            inset 0 0 60px rgba(250, 204, 21, 0.8);
        border-color: #fde047;
        background: rgba(234, 179, 8, 0.2);
    }
}

@keyframes neonPulseRed {

    0%,
    100% {
        box-shadow:
            0 0 30px #ef4444,
            0 0 60px #ef4444,
            inset 0 0 30px rgba(239, 68, 68, 0.6);
        border-color: #f87171;
        background: rgba(239, 68, 68, 0.1);
    }

    50% {
        box-shadow:
            0 0 50px #f87171,
            0 0 100px #ef4444,
            0 0 150px #ef4444,
            inset 0 0 60px rgba(248, 113, 113, 0.8);
        border-color: #fca5a5;
        background: rgba(239, 68, 68, 0.2);
    }
}

/* Utility Classes for JS Triggering */
.wc-wheel.pulse-green {
    animation: neonPulseGreen 0.8s infinite ease-in-out !important;
}

.wc-wheel.pulse-yellow {
    animation: neonPulseYellow 0.8s infinite ease-in-out !important;
}

.wc-wheel.pulse-red {
    animation: neonPulseRed 0.8s infinite ease-in-out !important;
}

.wc-connector-lines {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.wc-wheel-letter {
    position: absolute;
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #4f46e5;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    user-select: none;
    z-index: 2;
    transition: transform 0.2s, background 0.2s;
}

.wc-wheel-letter.active {
    background: #fbbf24;
    color: #78350f;
    transform: scale(1.2);
}

.wc-countdown {
    height: 30px;
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.wc-countdown.visible {
    opacity: 1;
    animation: pulse 1s infinite;
}

/* Modal */
.wc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.wc-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    text-align: center;
    width: 80%;
    max-width: 300px;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wc-modal-content h2 {
    color: #4f46e5;
    margin-top: 0;
    font-size: 0.9rem;
    white-space: nowrap;
}

.wc-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.wc-btn-primary {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.wc-btn-secondary {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 0.8rem;
    border-radius: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.wc-hint-btn {
    position: absolute;
    /* Changed to absolute for centering */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    color: #fbbf24;
    transition: transform 0.2s;
    z-index: 5;
    /* Above wheel background, below letters if needed, but letters are z-index 2 */
    flex-shrink: 0;
}

.wc-hint-btn.active-hint {
    animation: hintPulse 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes hintPulse {
    0% {
        background-color: white;
        transform: translate(-50%, -50%) scale(1);
    }

    30% {
        background-color: #ef4444;
        /* Red */
        color: white;
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    }

    100% {
        background-color: white;
        color: #fbbf24;
        transform: translate(-50%, -50%) scale(1);
    }
}

.wc-hint-btn:active {
    transform: translate(-50%, -50%) scale(0.9);
    /* Preserve centering */
}

.wc-hint-cost {
    font-size: 0.7rem;
    font-weight: 700;
    color: #374151;
    margin-top: -2px;
}

.wc-hint-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    /* Preserve centering */
}

.wc-next-level-btn {
    /* Positioned in flow above grid */
    margin: 0.5rem auto;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    z-index: 20;
    white-space: nowrap;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: none;
    /* Hidden by default */
}

.wc-next-level-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* Level Select Grid */
.wc-chapter-header {
    width: 100%;
    font-weight: 700;
    color: #4f46e5;
    margin: 1rem 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.wc-chapter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.wc-level-btn {
    aspect-ratio: 1;
    border: none;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.wc-level-btn.unlocked {
    background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
    color: white;
    /* Day Mode: Soft, Magical Black Glow */
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: levelPulseDay 4s infinite ease-in-out;
    position: relative;
    overflow: hidden;
}



.wc-level-btn.locked {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.wc-level-btn.unlocked:active {
    transform: scale(0.95);
}

/* Reward Message (Combo/Bonus) - Removed per user request */
.wc-reward-message {
    display: none;
}

.wc-reward-message.error {
    background: #ef4444;
    color: white;
    border: none;
    font-size: 1rem;
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* Ensure wheel container has relative positioning for absolute child */
.wc-wheel-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    /* Reduced gap */
    width: 100%;
}

.wc-wheel-row {
    position: relative;
    /* Anchor for absolute centering */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    /* Constrain width */
}

/* Rich Reward Message Styles */
.wc-reward-message {
    /* Existing styles override */
    white-space: normal;
    /* Allow wrapping */
    max-width: 280px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    line-height: 1.4;
}

.wc-combo-badge {
    background: #f59e0b;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wc-reward-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wc-reward-word {
    font-size: 1.4rem;
    font-weight: 800;
    color: #4f46e5;
}

.wc-reward-sentence {
    font-style: italic;
    color: #555;
    font-size: 0.95rem;
    margin-top: 0.2rem;
}

.wc-reward-translation {
    color: #888;
    font-size: 0.85rem;
    font-family: 'Noto Sans Arabic', sans-serif;
}

/* Dark mode adjustments */
body.dark-mode .wc-reward-message {
    background: rgba(31, 41, 55, 0.95);
    border-color: #818cf8;
}

body.dark-mode .wc-reward-word {
    color: #818cf8;
}

body.dark-mode .wc-reward-sentence {
    color: #d1d5db;
}

body.dark-mode .wc-reward-translation {
    color: #9ca3af;
}

/* Level Status Message */
.wc-level-status {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #10b981;
    /* Success green */
    min-height: 1.5rem;
    transition: all 0.3s ease;
    margin-top: 0.25rem;
    opacity: 0;
    transform: translateY(-5px);
}

.wc-level-status.visible {
    opacity: 1;
    transform: translateY(0);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.8) translateY(-5px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Circular Countdown */
.wc-countdown-container {
    position: relative;
    width: 60px;
    /* Double size (was implicitly small) */
    height: 60px;
    margin: 0.5rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wc-countdown-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    /* Start from top */
}

.wc-countdown-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 4;
}

.wc-countdown-circle-progress {
    fill: none;
    stroke: #10b981;
    /* Success Green */
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 176;
    /* 2 * PI * r (r=28) */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.wc-countdown-text {
    font-size: 1.5rem;
    /* Double size */
    font-weight: 700;
    color: #fbbf24;
    /* Gold */
    z-index: 1;
}

/* Bomb Mode Styles */
.wc-bomb-overlay {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    /* Red */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    z-index: 10;
    animation: bomb-pulse 1s infinite;
}

.wc-bomb-icon {
    font-size: 14px;
}

.wc-bomb-timer {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: 700;
    color: #ef4444;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

@keyframes bomb-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.2);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes explosion-shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.wc-explosion-effect {
    animation: explosion-shake 0.5s;
    border: 2px solid #ef4444 !important;
}

/* Proverb UI Styles */
.wc-proverb-progress-container {
    margin: 0.5rem 0;
    text-align: center;
}

.wc-proverb-progress-bar {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    max-width: 90%;
    margin: 0 auto;
}

.wc-proverb-word-slot {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    color: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.wc-proverb-word-slot.revealed {
    background: #fbbf24;
    color: #1f2937;
    border-style: solid;
    border-color: #fbbf24;
    font-weight: 700;
    animation: popIn 0.5s;
}

.wc-proverb-modal-content {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border: 2px solid #fbbf24;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.3);
}

.wc-proverb-title {
    color: #fbbf24;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wc-proverb-text {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 0.5rem;
    font-weight: 700;
}



/* --- Premium Library Styles --- */
#wcLibraryModal .wc-modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #f8fafc;
}

#wcLibraryModal h2 {
    background: linear-gradient(to right, #fbbf24, #d97706);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.8rem;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.2);
}

.wc-library-section {
    margin-bottom: 2rem;
}

.wc-library-header {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.wc-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.wc-library-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.25rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wc-library-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.wc-lib-word {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fbbf24;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.wc-lib-trans {
    font-family: 'Noto Sans Arabic', sans-serif;
    color: #e2e8f0;
    font-size: 1.1rem;
    font-weight: 500;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.wc-lib-sentence-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.wc-lib-sentence-sv {
    font-style: italic;
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.4;
    flex: 1;
}

.wc-lib-sentence-ar {
    font-family: 'Noto Sans Arabic', sans-serif;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 0.25rem;
}

/* Speaker Buttons */
.wc-lib-speak-main {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.wc-lib-speak-main:hover {
    background: #fbbf24;
    color: #1e293b;
    transform: scale(1.1);
}

.wc-lib-speak-sm {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    opacity: 0.6;
    transition: all 0.2s;
    font-size: 1rem;
}

.wc-lib-speak-sm:hover {
    color: #fbbf24;
    opacity: 1;
    transform: scale(1.1);
}

/* Delete Buttons */
.wc-lib-delete {
    position: absolute;
    top: 1rem;
    right: 3.5rem;
    /* Left of speaker */
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.wc-lib-delete:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

.wc-lib-clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-weight: 600;
}

.wc-lib-clear-btn:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Scrollbar for modal */
.wc-modal-content::-webkit-scrollbar {
    width: 8px;
}

.wc-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.wc-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.wc-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Premium Level Select Modal --- */
#wcLevelSelectModal .wc-modal-content {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(251, 191, 36, 0.2);
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(251, 191, 36, 0.05);
    color: #e2e8f0;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

#wcLevelSelectModal h2 {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.2);
    animation: none;
}

#wcLevelSelectModal .wc-chapter-header {
    color: #fbbf24;
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}

#wcLevelSelectModal button[onclick="closeLevelSelect()"] {
    color: #fbbf24;
    transition: all 0.3s;
}

#wcLevelSelectModal button[onclick="closeLevelSelect()"]:hover {
    color: #fff;
    transform: scale(1.1) rotate(90deg);
    text-shadow: 0 0 10px #fbbf24;
}

/* Modal Close Button */
.wc-modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.wc-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    /* Red tint on hover */
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    transform: rotate(90deg);
}