/* ==================== X-O ONLINE GAME - ENHANCED DESIGN ==================== */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --accent: #f59e0b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #0a0a1a;
    --bg-light: #121225;
    --card: #16162a;
    --card-hover: #1e1e3a;
    --text: #ffffff;
    --text-muted: #8b8ba3;
    --border: #2a2a4a;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ==================== NAVIGATION - ENHANCED ==================== */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(180deg, var(--card) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    transition: var(--transition);
}

.nav-logo:hover { transform: scale(1.02); }
.logo-icon { font-size: 1.6rem; -webkit-text-fill-color: initial; }

.nav-links { display: flex; gap: 0.5rem; }

.nav-btn {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 600;
}

.nav-btn:hover { 
    background: var(--card-hover); 
    color: var(--text);
    border-color: var(--border);
}

.nav-btn.active { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ==================== SCREENS ==================== */
.app-container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.screen { display: none; animation: fadeIn 0.4s ease; }
.screen.active { display: block; }

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

/* ==================== HERO - ENHANCED ==================== */
.hero-section { 
    text-align: center; 
    padding: 3rem 1rem 2rem; 
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 60px rgba(99, 102, 241, 0.3);
}

.tagline { 
    color: var(--text-muted); 
    font-size: 1.2rem;
    font-weight: 500;
}

/* ==================== CARDS - ENHANCED ==================== */
.card {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.card h2 { 
    margin-bottom: 1.5rem; 
    font-size: 1.6rem; 
    text-align: center;
    font-weight: 700;
}

.main-card { max-width: 500px; margin: 0 auto 1.5rem; }

/* ==================== COUNTRY SELECTOR - ENHANCED ==================== */
.country-selector { position: relative; margin-bottom: 1.5rem; }

.country-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.country-display:hover { 
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.country-flag { width: 32px; height: 22px; border-radius: 4px; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.country-flag-small { width: 28px; height: 20px; border-radius: 3px; object-fit: cover; }

#selected-country-name { flex: 1; color: var(--text-muted); font-weight: 500; }
.dropdown-arrow { color: var(--text-muted); font-size: 0.8rem; transition: var(--transition); }
.country-display:hover .dropdown-arrow { color: var(--primary); }

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    margin-top: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow);
}

.country-search {
    width: 100%;
    padding: 1rem 1.25rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.country-search::placeholder { color: var(--text-muted); }

.country-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.country-option:hover { 
    background: var(--bg);
    padding-right: 1.5rem;
}

/* ==================== INPUTS - ENHANCED ==================== */
.name-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: inherit;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    transition: var(--transition);
    font-weight: 500;
}

.name-input:focus { 
    outline: none; 
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.name-input::placeholder { color: var(--text-muted); }

/* ==================== GAME MODES - ENHANCED ==================== */
.game-modes { display: flex; flex-direction: column; gap: 1rem; }
.game-modes h3 { 
    text-align: center; 
    margin-bottom: 0.75rem; 
    color: var(--text-muted); 
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-mode-btn {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.game-mode-btn:hover {
    border-color: var(--primary);
    background: linear-gradient(145deg, var(--bg) 0%, var(--card-hover) 100%);
    transform: translateX(-8px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2);
}

.mode-icon { 
    font-size: 2.25rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.mode-info { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.mode-title { font-weight: 700; font-size: 1.1rem; }
.mode-desc { font-size: 0.9rem; color: var(--text-muted); }
.mode-arrow { 
    color: var(--primary); 
    font-size: 1.3rem;
    transition: var(--transition);
}

.game-mode-btn:hover .mode-arrow { transform: translateX(-5px); }

/* ==================== DIFFICULTY - ENHANCED ==================== */
.difficulty-selector { 
    display: flex; 
    gap: 0.75rem; 
    margin-bottom: 0.75rem; 
}

.difficulty-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.difficulty-btn:hover { 
    border-color: var(--primary); 
    color: var(--text);
    background: var(--card-hover);
}

.difficulty-btn.active { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ==================== BUTTONS - ENHANCED ==================== */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-success { 
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-danger { 
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-secondary { 
    background: var(--card-hover); 
    color: var(--text); 
    border: 2px solid var(--border);
}

.btn-small { padding: 0.6rem 1.25rem; font-size: 0.9rem; }

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

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

.btn-link {
    background: none;
    border: none;
    color: var(--primary-light);
    font-family: inherit;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-link:hover { color: var(--primary); text-decoration: underline; }

/* ==================== JOIN SECTION ==================== */
.join-section { text-align: center; margin-top: 1.5rem; }
.join-box { display: flex; gap: 0.75rem; margin-top: 1rem; }
.join-box input {
    flex: 1;
    padding: 1rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    text-align: center;
    text-transform: uppercase;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    transition: var(--transition);
}

.join-box input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== QUICK STATS - ENHANCED ==================== */
.quick-stats { 
    display: flex; 
    justify-content: center; 
    gap: 3rem; 
    margin: 2rem 0; 
}

.stat-box { 
    text-align: center;
    padding: 1rem 2rem;
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label { 
    font-size: 0.95rem; 
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ==================== WEATHER & JOKE - ENHANCED ==================== */
.weather-widget, .daily-joke {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem auto;
    max-width: 380px;
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
}

.weather-widget:hover, .daily-joke:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.weather-location { font-size: 1rem; color: var(--text-muted); font-weight: 500; }
.weather-refresh { 
    background: var(--bg); 
    border: 1px solid var(--border);
    cursor: pointer; 
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}
.weather-refresh:hover { background: var(--primary); border-color: var(--primary); }

.weather-icon { font-size: 4rem; margin: 1rem 0; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3)); }
.weather-temp { font-size: 2.5rem; font-weight: 800; }
.weather-condition { color: var(--text-muted); font-size: 1rem; margin-bottom: 1rem; font-weight: 500; }
.weather-details { display: flex; justify-content: center; gap: 1.5rem; font-size: 0.95rem; color: var(--text-muted); }

.joke-header { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
    margin-bottom: 1rem; 
    color: var(--secondary); 
    font-weight: 700;
    font-size: 1.1rem;
}

.joke-text { 
    color: var(--text); 
    line-height: 1.7;
    font-size: 1.05rem;
}

.joke-refresh { 
    background: var(--bg); 
    border: 1px solid var(--border);
    color: var(--primary-light); 
    cursor: pointer; 
    font-size: 0.9rem; 
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}

.joke-refresh:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ==================== GAME SCREEN - ENHANCED ==================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.game-info-bar { display: flex; align-items: center; gap: 1.5rem; font-weight: 700; font-size: 1.1rem; }
.vs-badge { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-icon {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    transition: var(--transition);
    border: 2px solid var(--border);
}

.btn-icon:hover { 
    background: var(--primary); 
    border-color: var(--primary);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ==================== SCORE DISPLAY - ENHANCED ==================== */
.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
}

.score-item { display: flex; align-items: center; gap: 0.75rem; }
.score-player { font-size: 1rem; color: var(--text-muted); font-weight: 600; }
.score-symbol { font-size: 1.5rem; font-weight: 800; }
.score-symbol.x { color: var(--primary); text-shadow: 0 0 20px rgba(99, 102, 241, 0.5); }
.score-symbol.o { color: var(--secondary); text-shadow: 0 0 20px rgba(236, 72, 153, 0.5); }
.score-value { font-size: 2rem; font-weight: 800; min-width: 40px; text-align: center; }
.score-divider { color: var(--text-muted); font-size: 1.5rem; font-weight: 700; }

/* ==================== TURN & TIMER - ENHANCED ==================== */
.turn-display { 
    text-align: center; 
    padding: 1rem; 
    background: var(--bg); 
    border-radius: var(--radius-md); 
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
    font-size: 1.2rem;
    font-weight: 700;
}

.turn-display .highlight { margin-right: 0.5rem; }
.turn-display .highlight.x-turn { 
    color: var(--primary); 
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}
.turn-display .highlight.o-turn { 
    color: var(--secondary); 
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
}

.timer-display { 
    text-align: center; 
    padding: 0.75rem; 
    background: var(--bg); 
    border-radius: var(--radius-md); 
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    border: 2px solid var(--border);
}

.timer-display.urgent { 
    background: rgba(239, 68, 68, 0.15); 
    border-color: var(--danger); 
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse { 
    0%, 100% { opacity: 1; transform: scale(1); } 
    50% { opacity: 0.8; transform: scale(1.02); } 
}

/* ==================== GAME BOARD - ENHANCED ==================== */
.game-area { max-width: 420px; margin: 0 auto; }

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
}

.cell {
    aspect-ratio: 1;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.cell::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.03) 100%);
    pointer-events: none;
}

.cell:hover { 
    border-color: var(--primary);
    background: var(--card-hover);
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2);
}

.cell.x { 
    color: var(--primary); 
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.cell.o { 
    color: var(--secondary); 
    text-shadow: 0 0 30px rgba(236, 72, 153, 0.6);
    border-color: var(--secondary);
    background: rgba(236, 72, 153, 0.1);
}

.cell.winner { 
    background: rgba(34, 197, 94, 0.2); 
    border-color: var(--success);
    animation: winnerPulse 0.6s ease;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
}

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

.cell.clicked { animation: placePiece 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes placePiece {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ==================== RESULT - ENHANCED ==================== */
.result { 
    text-align: center; 
    padding: 1.5rem; 
    border-radius: var(--radius-md); 
    margin-bottom: 1.5rem;
    animation: resultIn 0.5s ease;
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.result.win { 
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
    border: 2px solid var(--success);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
}

.result.lose { 
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 2px solid var(--danger);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.result.draw { 
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 2px solid var(--warning);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.result-content { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.result-emoji { font-size: 2rem; }
.result-text { font-size: 1.4rem; font-weight: 800; }

/* ==================== POST-GAME ACTIONS - ENHANCED ==================== */
.post-game-actions { 
    display: flex; 
    justify-content: center; 
    gap: 1.25rem; 
    margin-bottom: 1.5rem; 
}

.action-btn {
    width: 55px;
    height: 55px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover { 
    transform: scale(1.15) rotate(5deg);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.action-btn.danger:hover { 
    border-color: var(--danger);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* ==================== GAME CONTROLS - ENHANCED ==================== */
.game-controls { 
    display: flex; 
    justify-content: center; 
    gap: 1rem; 
    margin-bottom: 1.5rem; 
    flex-wrap: wrap; 
}

.new-game-btn {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.new-game-btn:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover { 
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.control-btn.recording { 
    background: var(--danger);
    border-color: var(--danger);
    animation: recordingPulse 1.5s infinite;
}

@keyframes recordingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}

/* ==================== CHAT - ENHANCED ==================== */
.chat-container { 
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border);
}

.chat-messages { 
    max-height: 220px; 
    overflow-y: auto; 
    padding: 1.25rem; 
}

.chat-message { 
    margin-bottom: 0.75rem; 
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    border-right: 3px solid var(--primary);
}

.chat-message .player-name { 
    font-weight: 700; 
    color: var(--primary-light);
    margin-left: 0.5rem;
}

.chat-input { 
    display: flex; 
    padding: 1rem; 
    gap: 0.75rem; 
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.chat-input input:focus { 
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.typing-indicator { 
    padding: 0.75rem 1rem; 
    color: var(--text-muted); 
    font-size: 0.9rem;
    font-style: italic;
}

/* Voice Recording */
.voice-recording-ui { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 1rem; 
    background: rgba(239, 68, 68, 0.1);
    border-top: 1px solid var(--border);
}

.recording-indicator { display: flex; align-items: center; gap: 0.75rem; }
.recording-dot { 
    width: 14px; 
    height: 14px; 
    background: var(--danger); 
    border-radius: 50%; 
    animation: blink 1s infinite;
    box-shadow: 0 0 10px var(--danger);
}

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Voice Messages */
.voice-message {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    border-right: 3px solid var(--secondary);
}

.voice-message.sent {
    background: rgba(99, 102, 241, 0.1);
    border-right-color: var(--primary);
}

.voice-message .player-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}

.voice-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.voice-player .play-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.voice-player .play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

.voice-player audio {
    flex: 1;
    height: 36px;
    max-width: 200px;
}

.voice-player .duration {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ==================== LOBBY & MATCHMAKING - ENHANCED ==================== */
.lobby-card { 
    max-width: 450px; 
    margin: 2rem auto; 
    text-align: center; 
}

.lobby-header { margin-bottom: 2rem; }
.lobby-header h2 { 
    margin-bottom: 1rem; 
    font-size: 1.8rem;
}

.game-code-large {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 5px;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    border: 2px solid var(--border);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.lobby-info { margin-bottom: 2rem; }
.lobby-info p { 
    color: var(--text-muted); 
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.share-code { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 0.75rem; 
}

.share-code span { 
    padding: 0.75rem 1.5rem; 
    background: var(--bg); 
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    border: 2px solid var(--border);
}

.waiting-area { padding: 2.5rem; }
.waiting-area p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 1.5rem;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.searching-dots { display: flex; justify-content: center; gap: 0.75rem; }
.searching-dots span {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.searching-dots span:nth-child(1) { animation-delay: -0.32s; }
.searching-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ==================== LEADERBOARD & STATS - ENHANCED ==================== */
.screen-header { 
    display: flex; 
    align-items: center; 
    gap: 1.25rem; 
    margin-bottom: 2rem; 
}

.screen-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.back-btn {
    padding: 0.6rem 1.25rem;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-btn:hover { 
    background: var(--primary); 
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.loading { 
    text-align: center; 
    padding: 3rem; 
    color: var(--text-muted);
    font-size: 1.1rem;
}

.leaderboard-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 1rem;
}

.leaderboard-table th, .leaderboard-table td { 
    padding: 1rem; 
    text-align: center; 
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th { 
    color: var(--text-muted); 
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-table tr:hover { 
    background: var(--card-hover);
}

.leaderboard-table tr.current-player { 
    background: rgba(99, 102, 241, 0.15);
    font-weight: 700;
}

.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 1.25rem; 
    margin-bottom: 2rem; 
}

.stat-card { 
    background: linear-gradient(145deg, var(--bg) 0%, var(--card-hover) 100%);
    padding: 1.5rem; 
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2);
}

.stat-card .stat-value { 
    font-size: 2rem; 
    font-weight: 800; 
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label { 
    font-size: 0.95rem; 
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ==================== MODALS - ENHANCED ==================== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    padding: 1rem;
}

.modal-content {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    border: 2px solid var(--border);
    box-shadow: var(--shadow), var(--shadow-glow);
    animation: modalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.8) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content h2 { 
    margin-bottom: 1.25rem; 
    font-size: 1.8rem;
    font-weight: 800;
}

.modal-content p { 
    color: var(--text-muted); 
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.modal-actions { 
    display: flex; 
    gap: 1rem; 
    justify-content: center; 
    flex-wrap: wrap; 
}

.emoji-large { 
    font-size: 5rem; 
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

/* Joke Modal */
.joke-content { max-width: 480px; }
.joke-display { 
    background: var(--bg); 
    padding: 2rem; 
    border-radius: var(--radius-md); 
    margin-bottom: 2rem;
    border: 2px solid var(--border);
}

.joke-setup { 
    font-size: 1.2rem; 
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.joke-punchline { 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: var(--secondary);
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

/* ==================== ERROR & TOAST - ENHANCED ==================== */
.error-message {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    z-index: 1000;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-30px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#toast-container { 
    position: fixed; 
    bottom: 25px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 1000; 
}

.toast {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    color: var(--text);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
    border: 2px solid var(--border);
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
    box-shadow: var(--shadow);
}

.toast.show { 
    opacity: 1; 
    transform: translateY(0); 
}

/* ==================== UTILITY ==================== */
.hidden { display: none !important; }

.disconnect-message {
    text-align: center;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid var(--warning);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    color: var(--warning);
    font-weight: 600;
}

/* ==================== RESPONSIVE - ENHANCED ==================== */
@media (max-width: 768px) {
    .main-nav { 
        flex-direction: column; 
        gap: 1rem; 
        padding: 1rem;
    }
    
    .hero-section h1 { font-size: 2.5rem; }
    .hero-section { padding: 2rem 1rem 1.5rem; }
    
    .board { max-width: 320px; gap: 8px; padding: 8px; }
    .cell { font-size: 2.5rem; }
    
    .quick-stats { gap: 1.5rem; }
    .stat-box { padding: 0.75rem 1.5rem; min-width: 100px; }
    .stat-value { font-size: 2rem; }
    
    .modal-actions { flex-direction: column; }
    .modal-content { padding: 2rem; }
    
    .game-controls { gap: 0.75rem; }
    
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media (max-width: 480px) {
    .game-header { flex-wrap: wrap; gap: 0.75rem; }
    .game-info-bar { order: 3; width: 100%; justify-content: center; font-size: 1rem; }
    
    .score-display { flex-wrap: wrap; gap: 1.5rem; padding: 1rem; }
    .score-value { font-size: 1.75rem; }
    
    .hero-section h1 { font-size: 2rem; }
    
    .card { padding: 1.5rem; }
    
    .game-mode-btn { padding: 1rem; }
    .mode-icon { font-size: 1.75rem; }
    
    .game-code-large { font-size: 1.5rem; padding: 0.75rem 1.5rem; }
}

/* ==================== SCROLLBAR - ENHANCED ==================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { 
    background: var(--bg); 
    border-radius: 5px; 
}
::-webkit-scrollbar-thumb { 
    background: var(--border); 
    border-radius: 5px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { 
    background: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* ==================== AI CHAT MESSAGE ==================== */
.chat-message.ai-message {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.1) 100%);
    border-right-color: var(--secondary);
}

.chat-message .ai-name {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* ==================== CALL BUTTON ACTIVE ==================== */
.control-btn.calling {
    background: var(--success);
    border-color: var(--success);
    animation: callPulse 1.5s infinite;
}

@keyframes callPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 0 15px rgba(34, 197, 94, 0); }
}

/* ==================== CONNECTION STATUS ==================== */
.connection-status {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 999;
    transition: var(--transition);
}

.connection-status.connected {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* ==================== MATCHMAKING MODAL ==================== */
.matchmaking-status-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.matchmaking-status-info {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
}

.status-message {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.players-count, .rooms-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.players-count:last-child, .rooms-count:last-child {
    border-bottom: none;
}

.count-label {
    color: var(--text-muted);
    font-weight: 600;
}

.count-value {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timeout-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ==================== MATCHMAKING MODAL - ENHANCED ==================== */
.matchmaking-status-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.matchmaking-status-info {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
}

.status-message {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.players-count, .rooms-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.players-count:last-child, .rooms-count:last-child {
    border-bottom: none;
}

.count-label {
    color: var(--text-muted);
    font-weight: 600;
}

.count-value {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timeout-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Matchmaking Screen Status */
#matchmaking-screen .card {
    position: relative;
}

.search-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-muted);
}

.search-status-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    animation: blink 1s infinite;
}

/* Quick Stats Enhancement */
.quick-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.stat-box {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid var(--border);
    min-width: 120px;
    transition: var(--transition);
}

.stat-box:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.2);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.5rem;
}


/* ==================== COUNTRY SELECTOR ==================== */
.country-selector {
    margin-bottom: 1rem;
    position: relative;
}

.country-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.country-display:hover {
    border-color: var(--primary);
}

.country-flag {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    object-fit: cover;
}

.country-flag-small {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
}

.dropdown-arrow {
    margin-right: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.country-search {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

.country-search:focus {
    outline: none;
}

.country-list {
    max-height: 200px;
    overflow-y: auto;
}

.country-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.country-option:hover {
    background: var(--bg);
}

/* ==================== DIFFICULTY SELECTOR ==================== */
.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
    justify-content: center;
}

.difficulty-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.difficulty-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-color: transparent;
    color: white;
}

/* ==================== WEATHER WIDGET ==================== */
.weather-widget {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin: 1rem 0;
    text-align: center;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.weather-location {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.weather-refresh {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    transition: transform 0.3s;
}

.weather-refresh:hover {
    transform: rotate(180deg);
}

.weather-icon {
    font-size: 3rem;
    margin: 0.5rem 0;
}

.weather-temp {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.weather-condition {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.weather-details {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.weather-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.weather-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
}

.weather-spinner {
    animation: spin 2s linear infinite;
}

.weather-error {
    padding: 1rem;
    text-align: center;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== DAILY JOKE ==================== */
.daily-joke {
    background: linear-gradient(145deg, var(--card) 0%, var(--bg-light) 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin: 1rem 0;
    cursor: pointer;
    transition: var(--transition);
}

.daily-joke:hover {
    border-color: var(--secondary);
    transform: translateY(-2px);
}

.joke-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--secondary);
    font-weight: 700;
}

.joke-icon {
    font-size: 1.2rem;
}

.joke-text {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
}

.joke-reveal {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.joke-reveal:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.joke-refresh {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.joke-refresh:hover {
    border-color: var(--primary);
    color: var(--text);
}

.joke-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
}

.joke-spinner {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Joke Modal */
.joke-modal-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.joke-setup {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.joke-punchline {
    font-size: 1.1rem;
    color: var(--secondary);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ==================== MOBILE IMPROVEMENTS ==================== */
@media (max-width: 600px) {
    /* Better touch targets */
    .cell {
        min-height: 80px !important;
        font-size: 2.5rem !important;
    }
    
    /* Larger buttons for touch */
    .game-mode-btn, .btn, .nav-btn {
        padding: 12px 20px !important;
        min-height: 48px !important;
        font-size: 1rem !important;
    }
    
    /* Full width on mobile */
    .card, .game-card, .lobby-card {
        margin: 10px !important;
        padding: 15px !important;
        width: calc(100% - 20px) !important;
    }
    
    /* Chat improvements */
    .chat-container {
        max-height: 200px !important;
    }
    
    .chat-messages {
        max-height: 150px !important;
    }
    
    /* Game board */
    .board {
        gap: 5px !important;
    }
    
    /* Navigation */
    .main-nav {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .nav-links {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    
    /* Quick stats */
    .quick-stats {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .stat-box {
        width: 100% !important;
    }
    
    /* Game controls */
    .game-controls {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    
    .game-header {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    /* Score display */
    .score-display {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    /* Settings panel */
    .settings-panel {
        width: 95% !important;
        padding: 15px !important;
    }
    
    /* Leaderboard */
    .leaderboard-item {
        flex-direction: column !important;
        gap: 5px !important;
    }
    
    /* Ad containers */
    .ad-banner-home, .ad-sidebar, #ad-after-game {
        max-width: 100% !important;
        margin: 10px 5px !important;
    }
}

/* Even smaller screens */
@media (max-width: 400px) {
    .cell {
        min-height: 60px !important;
        font-size: 2rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    .hero-section h1 {
        font-size: 1.8rem !important;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .board {
        max-width: 300px !important;
    }
    
    .cell {
        min-height: 60px !important;
    }
    
    .hero-section {
        padding: 10px !important;
    }
}

/* Sound toggle button */
.sound-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--primary-color, #6C5CE7);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle.muted {
    opacity: 0.5;
}
