@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.65rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar h1 {
    font-size: 1rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.95rem;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
}

.nav-user {
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-links a {
    text-decoration: none;
    color: white;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-weight: 600;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    border: none;
}

.btn-primary:hover {
    background: white;
}

.btn-success {
    background: var(--success);
    border: none;
}

.btn-danger {
    background: var(--danger);
    border: none;
}

/* Light Mode Contrast Fixes */
body:not(.dark-mode) .btn {
    background: #f4f6ff;
    color: #1b1f2a;
    border: 1px solid #d0d7ff;
}

body:not(.dark-mode) .btn:hover {
    background: #e9edff;
}

body:not(.dark-mode) .nav-links a {
    background: #f0f2ff;
    color: #1b1f2a;
    border: 1px solid #d0d7ff;
}

body:not(.dark-mode) .nav-links a:hover {
    background: #e6ebff;
}

body:not(.dark-mode) .theme-toggle {
    background: #f0f2ff;
    color: #1b1f2a;
    border: 1px solid #d0d7ff;
}

body:not(.dark-mode) .nav-user {
    color: #1b1f2a;
}

/* Content */
.content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    color: var(--dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Stats */
.stat-box {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

thead {
    background: var(--primary);
}

th {
    padding: 1rem;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: var(--dark);
}

tbody tr:hover {
    background: #f8fafc;
}

/* Leaderboard */
.leaderboard-page .leaderboard-card {
    padding: 2rem;
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 1rem;
}

.leaderboard-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.leaderboard-filter label {
    font-weight: 600;
    color: var(--dark);
}

.leaderboard-filter select {
    width: auto;
    min-width: 220px;
}

.leaderboard-table td {
    vertical-align: middle;
}

.rank {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.medal {
    font-size: 1.1rem;
}

.player-avatar {
    font-size: 1.25rem;
    margin-right: 0.35rem;
}

.current-user {
    background: #fff3cd;
    font-weight: 600;
}

.leaderboard-empty {
    text-align: center;
    color: var(--gray);
    margin: 1.5rem 0;
}

.leaderboard-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Rules Page */
.rules-page .rules-card {
    padding: 2.5rem;
}

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

.rules-header h1 {
    margin: 0;
}

.game-selector {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    border-radius: 14px;
}

.game-btn {
    padding: 0.5rem 0.8rem !important;
    min-width: 150px;
    text-align: center;
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
    white-space: normal;
    word-break: break-word;
}

.game-btn:hover,
.game-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    border-color: transparent;
}

.rule-section {
    display: none;
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.rule-section.active {
    display: block;
}

.rule-section h2 {
    color: var(--dark);
    border-bottom: 2px solid rgba(99, 102, 241, 0.35);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
}

.rule-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.25rem;
    border-radius: 10px;
    margin: 1rem 0;
}

.example {
    background: rgba(255, 255, 255, 0.85);
    padding: 1rem;
    border-left: 4px solid rgba(99, 102, 241, 0.6);
    margin: 0.75rem 0;
    border-radius: 10px;
}

.example h4 {
    margin-top: 0;
    color: var(--primary-dark);
}

.cost-info {
    background: rgba(255, 255, 255, 0.85);
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0.75rem 0;
    text-align: center;
    font-weight: 700;
    color: var(--dark);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.card-display {
    display: inline-block;
    background: white;
    border: 2px solid #333;
    border-radius: 5px;
    padding: 5px 8px;
    margin: 2px;
    font-weight: 700;
}

.card-spade { color: #333; }
.card-coppe { color: #dc3545; }
.card-denari { color: #ffc107; }

.visual-example {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    padding: 1.25rem;
    margin: 1rem 0;
    text-align: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.visual-example h4 {
    color: #2f855a;
    margin-top: 0;
    font-size: 1rem;
}

.game-demo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.choice-display {
    background: #ffffff;
    border: 2px solid #1f2937;
    border-radius: 10px;
    padding: 1.25rem;
    font-size: 2.5rem;
    min-width: 80px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.vs-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #666;
}

.result-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4CAF50;
    margin-top: 0.5rem;
}

.grid-demo {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    gap: 5px;
    justify-content: center;
    margin: 1rem 0;
}

.grid-cell {
    width: 60px;
    height: 60px;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    background: white;
    border-radius: 5px;
}

.memory-demo {
    display: grid;
    grid-template-columns: repeat(4, 50px);
    gap: 5px;
    justify-content: center;
    margin: 1rem 0;
}

.memory-card {
    width: 50px;
    height: 50px;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: white;
    border-radius: 5px;
}

.memory-card.flipped {
    background: #e3f2fd;
}

.card-visual {
    display: inline-flex;
    width: 60px;
    height: 80px;
    border: 2px solid #1f2937;
    border-radius: 8px;
    background: white;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.hand-demo {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.table-demo {
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.4);
    border-radius: 10px;
    padding: 1rem;
    margin: 10px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.arrow {
    font-size: 1.9rem;
    color: #FF5722;
    margin: 0 10px;
}

.step-by-step {
    background: rgba(255, 255, 255, 0.85);
    border-left: 5px solid rgba(245, 158, 11, 0.6);
    padding: 1rem;
    margin: 10px 0;
    border-radius: 10px;
}

.step-by-step h5 {
    color: #b45309;
    margin-top: 0;
}

@media (max-width: 768px) {
    .rules-page .rules-card {
        padding: 1.5rem;
    }

    .rules-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Forms */
input, select, textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    transition: all 0.2s;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .content {
        padding: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .grid, .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }

    .chat-container {
        width: min(92vw, 360px);
        height: 420px;
    }

    .chat-toggle {
        width: 52px;
        height: 52px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .navbar h1 {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .content {
        padding: 0.5rem;
    }

    .nav-links a,
    .btn {
        width: 100%;
        justify-content: center;
    }

    .chat-widget {
        right: 12px;
        bottom: 12px;
    }

    .chat-container {
        width: min(94vw, 340px);
        height: 380px;
    }
}

/* Utilities */
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* Game Specific Styles */
.game-container {
    max-width: 100vw;
    margin: 0 auto;
    padding: 0.25rem;
    max-height: calc(100vh - 50px);
    overflow-y: auto;
}

.game-container h1 {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-weight: 700;
}

.game-info-bar {
    display: flex;
    justify-content: space-around;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stats-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.3rem;
    margin-bottom: 0.35rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0.35rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 0.7rem;
    opacity: 1;
    color: rgba(255,255,255,0.95);
    font-weight: 500;
}

.game-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.game-btn {
    width: 60px;
    height: 60px;
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.35);
}

.game-result {
    text-align: center;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin: 0.35rem 0;
    font-size: 0.85rem;
}

.leaderboard-mini {
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.leaderboard-mini h3 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.leaderboard-mini table {
    background: transparent;
}

.leaderboard-mini thead {
    background: rgba(255, 255, 255, 0.3);
}

.leaderboard-mini th {
    color: white;
    padding: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.leaderboard-mini td {
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.35rem;
    font-size: 0.75rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.leaderboard-mini tr.highlight {
    background: rgba(255, 215, 0, 0.3);
}

.leaderboard-mini tbody tr:hover {
    background: rgba(255, 255, 255, 0.15);
}

.game-board {
    display: grid;
    gap: 0.3rem;
    margin: 0.35rem auto;
    max-width: 300px;
}

.game-board.grid-3x3 {
    grid-template-columns: repeat(3, 1fr);
}

.game-board.grid-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cell:hover:not(:disabled) {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.35);
}

.cell:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.reels {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.35rem 0;
}

.reel {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.multiplier-display {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: bold;
    color: white;
    margin: 0.35rem auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.multiplier-display.crashed {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: shake 0.5s;
}

.multiplier-display.crashed {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    animation: shake 0.5s;
}

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

.message-box {
    text-align: center;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin: 0.35rem 0;
    font-weight: 600;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-box.win {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
}

.message-box.lose {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
}

.message-box.win {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.message-box.lose {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-user {
    font-weight: 600;
}

@media (max-width: 768px) {
    .game-container {
        padding: 1rem;
    }

    .game-container h1 {
        font-size: 2rem;
    }

    .game-actions {
        gap: 1rem;
    }

    .game-btn {
        width: 90px;
        height: 90px;
        font-size: 3rem;
    }

    .stats-display {
        grid-template-columns: repeat(2, 1fr);
    }

    .reels {
        gap: 0.5rem;
    }

    .reel {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .game-btn {
        width: 70px;
        height: 70px;
        font-size: 2.5rem;
    }

    .multiplier-display {
        width: 150px;
        height: 150px;
        font-size: 2.5rem;
    }
}

/* Scroll Position Preservation */
.preserve-scroll {
    scroll-behavior: smooth;
}

/* Prevent scroll jump on refresh */
html {
    scroll-behavior: auto;
}

#game {
    scroll-margin-top: 0;
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
}

body.dark-mode .navbar {
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .game-info-bar,
body.dark-mode .stat-card,
body.dark-mode .message-box,
body.dark-mode .game-btn,
body.dark-mode .cell,
body.dark-mode .reel,
body.dark-mode .leaderboard-mini,
body.dark-mode .card {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .game-btn:hover,
body.dark-mode .cell:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.6);
}

body.dark-mode .leaderboard-mini thead {
    background: rgba(0, 0, 0, 0.6);
}

body.dark-mode .leaderboard-mini td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .card {
    background: rgba(20, 20, 35, 0.95);
    color: #e0e0e0;
}

body.dark-mode table {
    background: rgba(20, 20, 35, 0.95);
}

body.dark-mode td {
    color: #e0e0e0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

body.dark-mode .theme-toggle {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Additional Dark Mode Styles for All Pages */
body.dark-mode .container {
    background: rgba(20, 20, 35, 0.95);
    color: #e0e0e0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5 {
    color: #f0f0f0;
}

body.dark-mode .stat-box {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

body.dark-mode input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .btn {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

body.dark-mode .rank {
    color: #8b9aff;
}

body.dark-mode .current-user {
    background: rgba(255, 193, 7, 0.2);
}

body.dark-mode .game-selector .game-btn {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #8b9aff;
}

body.dark-mode .game-selector .game-btn:hover,
body.dark-mode .game-selector .game-btn.active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
}

body.dark-mode .rule-content,
body.dark-mode .example,
body.dark-mode .visual-example,
body.dark-mode .step-by-step {
    background: rgba(0, 0, 0, 0.55);
    color: #e0e0e0;
}

body.dark-mode .rules-page .rule-section {
    background: rgba(10, 12, 24, 0.9);
}

body.dark-mode .rules-page .game-selector {
    background: transparent;
}

body.dark-mode .rules-page .cost-info {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
}

body.dark-mode .rules-page .rule-section h2 {
    color: #f0f0f0;
    border-bottom-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode .rules-page .example h4,
body.dark-mode .rules-page .visual-example h4,
body.dark-mode .rules-page .step-by-step h5 {
    color: #a5b4fc;
}

body.dark-mode .rules-page .game-btn {
    color: #e0e0e0;
}

body.dark-mode .rules-page .game-btn.active,
body.dark-mode .rules-page .game-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.9);
}

body.dark-mode .rules-page .rule-section,
body.dark-mode .rules-page .rule-content,
body.dark-mode .rules-page .example,
body.dark-mode .rules-page .visual-example,
body.dark-mode .rules-page .step-by-step,
body.dark-mode .rules-page .cost-info,
body.dark-mode .rules-page .choice-display,
body.dark-mode .rules-page .grid-cell,
body.dark-mode .rules-page .memory-card,
body.dark-mode .rules-page .card-visual,
body.dark-mode .rules-page .table-demo {
    background: rgba(20, 20, 35, 0.9);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e0e0e0;
}

body.dark-mode .rules-page .choice-display,
body.dark-mode .rules-page .grid-cell,
body.dark-mode .rules-page .memory-card,
body.dark-mode .rules-page .card-visual {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Rules page: force dark mode to override inline styles */
body.dark-mode.rules-page .rules-card {
    background: rgba(20, 20, 35, 0.95) !important;
    color: #e0e0e0 !important;
}

body.dark-mode.rules-page .rule-section,
body.dark-mode.rules-page .rule-content,
body.dark-mode.rules-page .example,
body.dark-mode.rules-page .visual-example,
body.dark-mode.rules-page .step-by-step,
body.dark-mode.rules-page .cost-info {
    background: rgba(20, 20, 35, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #e0e0e0 !important;
}

body.dark-mode.rules-page .rule-section [style*="background"],
body.dark-mode.rules-page .rule-section [style*="background-color"] {
    background: rgba(20, 20, 35, 0.9) !important;
}

body.dark-mode.rules-page .rule-section [style*="color"] {
    color: #e0e0e0 !important;
}

body.dark-mode .example h4,
body.dark-mode .visual-example h4 {
    color: #8b9aff;
}

body.dark-mode .step-by-step h5 {
    color: #ff9966;
}

body.dark-mode .cost-info {
    background: rgba(255, 193, 7, 0.2);
    color: #ffd54f;
}

body.dark-mode .warning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffd54f;
    border-color: rgba(255, 193, 7, 0.4);
}

body.dark-mode .bank-balance,
body.dark-mode .coins-banner {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.8) 0%, rgba(69, 160, 73, 0.8) 100%);
}

body.dark-mode .control-box {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .control-box h3 {
    color: #f0f0f0;
}

body.dark-mode .form-group label {
    color: #e0e0e0;
}

body.dark-mode .form-group input {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

body.dark-mode .message {
    background: rgba(76, 175, 80, 0.3);
}

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

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

body.dark-mode .legend-item {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode .legend-label {
    color: #e0e0e0;
}

body.dark-mode .time-filter {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(102, 126, 234, 0.5);
    color: #8b9aff;
}

body.dark-mode .time-filter:hover {
    background: rgba(102, 126, 234, 0.3);
    color: white;
}

body.dark-mode .time-filter.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.5) 0%, rgba(118, 75, 162, 0.5) 100%);
}

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

body.dark-mode .stat-card h3 {
    color: #8b9aff;
}

body.dark-mode .stat-card p {
    color: #b0b0b0;
}

body.dark-mode .game-stats h2 {
    color: #f0f0f0;
    border-bottom-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode .choice-display,
body.dark-mode .grid-cell,
body.dark-mode .memory-card,
body.dark-mode .card-visual {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

body.dark-mode .memory-card.flipped {
    background: rgba(33, 150, 243, 0.3);
}

body.dark-mode .table-demo {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

body.dark-mode .result-text {
    color: #4ade80;
}

/* Additional Dark Mode for Buttons and All Elements */
body.dark-mode .btn-home,
body.dark-mode .btn-leaderboard,
body.dark-mode .btn-notifications,
body.dark-mode .back-btn,
body.dark-mode .btn-add,
body.dark-mode .btn-remove,
body.dark-mode .btn-empty {
    background: rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}

body.dark-mode .btn-home:hover,
body.dark-mode .btn-leaderboard:hover,
body.dark-mode .btn-notifications:hover {
    background: rgba(0, 0, 0, 0.6);
}

body.dark-mode .btn-primary {
    background: rgba(102, 126, 234, 0.8);
    color: white;
}

body.dark-mode .btn-primary:hover {
    background: rgba(102, 126, 234, 0.9);
}

body.dark-mode .username,
body.dark-mode .admin-badge {
    color: #8b9aff;
}

body.dark-mode .coins-banner {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.3) 0%, rgba(255, 152, 0, 0.3) 100%);
}

body.dark-mode .notification-badge {
    background: #ff5252;
}

body.dark-mode .game-card,
body.dark-mode .card-btn,
body.dark-mode .mine-cell.revealed,
body.dark-mode .card-btn.revealed {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

body.dark-mode .game-card.back,
body.dark-mode .card-btn.back {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(139, 92, 246, 0.8));
    color: white;
}

body.dark-mode .trump-card,
body.dark-mode .game-card:not(.back) {
    background: white;
    color: #333;
}

body.dark-mode .table-area,
body.dark-mode .table-center {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.4);
}

body.dark-mode .trump-area {
    background: rgba(255, 193, 7, 0.15);
}

body.dark-mode .card-values {
    background: rgba(33, 150, 243, 0.15);
}

body.dark-mode .player-section {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .player-section.active {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.15);
}

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

body.dark-mode .board-label,
body.dark-mode .board-corner {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode .mine-cell {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .mine-cell:hover:not(.revealed):not(.flagged) {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode .mine-cell.flagged {
    background: rgba(255, 193, 7, 0.3);
}

body.dark-mode .rules-btn {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .rules-content {
    background: rgba(20, 20, 35, 0.98);
    border-color: rgba(102, 126, 234, 0.5);
    color: #e0e0e0;
}

body.dark-mode .rules-content h4 {
    color: #8b9aff;
}

body.dark-mode .card-points {
    color: #999;
}

body.dark-mode select {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

body.dark-mode option {
    background: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode .game-selector .game-btn {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #8b9aff;
}

body.dark-mode .game-selector .game-btn:hover,
body.dark-mode .game-selector .game-btn.active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    border-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode label {
    color: #e0e0e0;
}

body.dark-mode .card label {
    color: #333;
}

body.dark-mode .card.dark-mode label {
    color: #e0e0e0;
}

body.dark-mode a {
    color: #8b9aff;
}

body.dark-mode a:hover {
    color: #a5b4ff;
}

body.dark-mode .nav-links a {
    color: white;
}

body.dark-mode .cell-x {
    color: #ff6b6b;
}

body.dark-mode .cell-o {
    color: #4dabf7;
}

body.dark-mode .card-btn.matched {
    background: rgba(76, 175, 80, 0.8);
}

body.dark-mode .hands .card {
    background: white;
    color: #333;
}

body.dark-mode .hands .card.red {
    color: #dc3545;
}

body.dark-mode .hands .card.hidden {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(139, 92, 246, 0.8));
    color: white;
}

/* Profile Page Dark Mode */
body.dark-mode svg {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-mode svg line {
    stroke: rgba(255, 255, 255, 0.1);
}

body.dark-mode svg text {
    fill: #e0e0e0;
}

body.dark-mode .stats-overview .stat-card {
    background: rgba(0, 0, 0, 0.4);
}

body.dark-mode .game-stats table {
    background: rgba(20, 20, 35, 0.95);
}

body.dark-mode .game-stats table tr {
    background: transparent;
}

body.dark-mode .game-stats table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .game-stats table tr[style*="background"] {
    background: rgba(33, 150, 243, 0.2) !important;
}

body.dark-mode .game-stats h2 {
    color: #f0f0f0;
    border-bottom-color: rgba(102, 126, 234, 0.5);
}

/* Hourly Coin Claim Dark Mode */
body.dark-mode div[style*="background: #f5f5f5"] {
    background: rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode div[style*="background: #f5f5f5"] h3 {
    color: #f0f0f0 !important;
}

body.dark-mode div[style*="background: #f5f5f5"] p {
    color: #e0e0e0 !important;
}

body.dark-mode button[style*="background: #4CAF50"],
body.dark-mode button[style*="background: #ccc"] {
    background: rgba(0, 0, 0, 0.5) !important;
    color: #e0e0e0 !important;
}

body.dark-mode button[style*="background: #4CAF50"]:not(:disabled) {
    background: rgba(76, 175, 80, 0.6) !important;
}

body.dark-mode div[style*="background: #4CAF50"],
body.dark-mode div[style*="background: #ff9800"] {
    background: rgba(0, 0, 0, 0.5) !important;
    color: #e0e0e0 !important;
}

/* Game Statistics Table Dark Mode */
body.dark-mode .game-stats table td {
    color: #e0e0e0 !important;
}

body.dark-mode .game-stats table td[style*="color: #4CAF50"] {
    color: #4ade80 !important;
}

body.dark-mode .game-stats table td[style*="color: #f44336"] {
    color: #ff6b6b !important;
}

body.dark-mode .game-stats table td[style*="color: #ff9800"] {
    color: #ffa726 !important;
}

body.dark-mode .game-stats table tr[style*="background: #e3f2fd"] {
    background: rgba(33, 150, 243, 0.2) !important;
}

body.dark-mode .game-stats p[style*="color: #666"] {
    color: #b0b0b0 !important;
}

body.dark-mode .game-stats p[style*="color: #667eea"] {
    color: #8b9aff !important;
}

/* Empty Game Statistics Message Dark Mode */
body.dark-mode .game-stats p[style*="text-align: center"] {
    color: #b0b0b0 !important;
}

body.dark-mode p[style*="color: #666"] {
    color: #b0b0b0 !important;
}

body.dark-mode p[style*="color: #999"] {
    color: #b0b0b0 !important;
}

/* Chart Container and Inline Styled Divs Dark Mode */
body.dark-mode div[style*="background: white"] {
    background: rgba(20, 20, 35, 0.95) !important;
}

body.dark-mode div[style*="background: #f8f9fa"] {
    background: rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .chart-container h2 {
    color: #f0f0f0 !important;
}

body.dark-mode div[style*="color: #333"] {
    color: #e0e0e0 !important;
}

body.dark-mode div[style*="color: #1976d2"] {
    color: #64b5f6 !important;
}

body.dark-mode div[style*="color: #2E7D32"] {
    color: #4ade80 !important;
}

body.dark-mode div[style*="color: #F57C00"] {
    color: #ffa726 !important;
}

/* Dark mode for admin bank button */
body.dark-mode .btn[style*="background: #4CAF50"] {
    background: rgba(76, 175, 80, 0.3) !important;
    border: 1px solid #4CAF50 !important;
}

/* Dark mode for live chat widget */
body.dark-mode .chat-container {
    background: rgba(20, 20, 35, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .chat-messages {
    background: rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .chat-message {
    background: rgba(40, 40, 60, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .chat-text {
    color: #e0e0e0 !important;
}

body.dark-mode .chat-input-container {
    background: rgba(30, 30, 45, 0.9) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode #chatInput {
    background: rgba(40, 40, 60, 0.8) !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode #chatInput::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Dark mode for settings page */
body.dark-mode .settings-section {
    background: rgba(40, 40, 60, 0.6) !important;
}

body.dark-mode .settings-section h2 {
    color: #a5b4fc !important;
    border-bottom-color: #a5b4fc !important;
}

body.dark-mode .form-group label {
    color: #e0e0e0 !important;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .form-group select {
    background: rgba(30, 30, 45, 0.8) !important;
    color: #e0e0e0 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode .avatar-option {
    background: rgba(30, 30, 45, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode .avatar-option.selected {
    border-color: #a5b4fc !important;
    background: rgba(102, 126, 234, 0.3) !important;
}

body.dark-mode .info-box {
    background: rgba(33, 150, 243, 0.2) !important;
    border-left-color: #64b5f6 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .info-box strong {
    color: #64b5f6 !important;
}
/* === Portfolio UI Theme Overrides === */
:root {
    --primary: #1f2a44;
    --primary-dark: #0f172a;
    --secondary: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray: #5b6b82;
    --bg: linear-gradient(120deg, #edf2ff 0%, #fff3df 45%, #eef8ff 100%);
    --bg-soft: rgba(255, 255, 255, 0.6);
    --text: #0f172a;
    --muted: #5b6b82;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(15, 23, 42, 0.08);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(15, 23, 42, 0.1);
    --accent: #f6d365;
    --accent-2: #8fd3f4;
    --accent-3: #22d3ee;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.15);
}

body.dark-mode {
    --primary: #a5b4fc;
    --primary-dark: #6366f1;
    --secondary: #22d3ee;
    --dark: #0b1120;
    --light: #e2e8f0;
    --gray: #94a3b8;
    --bg: radial-gradient(circle at top, rgba(15, 23, 42, 0.95) 0%, rgba(2, 6, 23, 0.98) 60%),
        linear-gradient(120deg, #0b1120 0%, #0f172a 100%);
    --bg-soft: rgba(15, 23, 42, 0.7);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --card-bg: rgba(15, 23, 42, 0.78);
    --card-border: rgba(148, 163, 184, 0.18);
    --glass: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(148, 163, 184, 0.22);
    --accent: #f6d365;
    --accent-2: #67e8f9;
    --accent-3: #38bdf8;
    --shadow: 0 30px 80px rgba(2, 6, 23, 0.5);
}

body {
    font-family: "Space Grotesk", "DM Sans", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background-image:
        radial-gradient(circle at 20% 20%, rgba(246, 211, 101, 0.18) 0 2px, transparent 2px),
        radial-gradient(circle at 80% 30%, rgba(143, 211, 244, 0.2) 0 2px, transparent 2px),
        radial-gradient(circle at 40% 70%, rgba(34, 211, 238, 0.18) 0 2px, transparent 2px),
        radial-gradient(circle at 70% 80%, rgba(246, 211, 101, 0.18) 0 2px, transparent 2px);
    background-size: 220px 220px;
    animation: drift 20s linear infinite;
    opacity: 0.7;
}

body::after {
    background: radial-gradient(circle at 10% 15%, rgba(246, 211, 101, 0.22), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(143, 211, 244, 0.2), transparent 45%),
        radial-gradient(circle at 30% 80%, rgba(34, 211, 238, 0.18), transparent 50%);
    mix-blend-mode: screen;
    opacity: 0.7;
}

@keyframes drift {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-20px, 20px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

.navbar,
.content,
.card,
.chat-widget,
.game-container,
.login-page,
.rules-page,
.leaderboard-page {
    position: relative;
    z-index: 1;
}

.navbar {
    background: var(--glass);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.navbar h1,
.nav-brand,
.nav-user {
    color: var(--text);
}

.nav-links a,
.btn {
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    font-weight: 600;
}

.nav-links a:hover,
.btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
}

body.dark-mode .nav-links a:hover,
body.dark-mode .btn:hover {
    background: rgba(15, 23, 42, 0.9);
}

.btn-primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #111827;
    border: none;
    box-shadow: 0 18px 30px rgba(246, 211, 101, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(120deg, var(--accent-2), var(--accent));
}

.btn-danger {
    background: rgba(239, 68, 68, 0.16);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.theme-toggle {
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--glass-border);
    color: var(--text);
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    box-shadow: var(--shadow);
}

.card p,
.card span,
.card small {
    color: var(--muted);
}

input, select, textarea {
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

input::placeholder {
    color: rgba(88, 105, 131, 0.7);
}

body.dark-mode input::placeholder {
    color: rgba(148, 163, 184, 0.7);
}

table {
    background: var(--card-bg);
}

thead {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

th,
td {
    color: var(--text);
}

tbody tr:hover {
    background: rgba(246, 211, 101, 0.08);
}

body.dark-mode tbody tr:hover {
    background: rgba(148, 163, 184, 0.08);
}

.stat-box,
.stat-card,
.game-info-bar,
.message-box,
.leaderboard-mini,
.rule-section,
.rule-content,
.example,
.visual-example,
.step-by-step {
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

.game-btn,
.cell,
.reel,
.game-result {
    background: var(--bg-soft);
    border: 1px solid var(--glass-border);
    color: var(--text);
}

.game-btn:hover,
.cell:hover:not(:disabled) {
    background: rgba(246, 211, 101, 0.15);
}

body.dark-mode .game-btn:hover,
body.dark-mode .cell:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.15);
}

.leaderboard-mini thead {
    background: rgba(246, 211, 101, 0.22);
}

body.dark-mode .leaderboard-mini thead {
    background: rgba(148, 163, 184, 0.18);
}

.chat-toggle {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #0f172a;
}

.chat-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
}

.chat-header {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #0f172a;
}

.chat-messages {
    background: transparent;
}

.chat-message {
    background: var(--bg-soft);
    border: 1px solid var(--glass-border);
}

.chat-text {
    color: var(--text);
}

.link a {
    color: var(--text) !important;
}

body.dark-mode .link a {
    color: var(--accent-2) !important;
}

@media (max-width: 768px) {
    .navbar {
        gap: 0.5rem;
    }

    .nav-links a,
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .card {
        padding: 1.25rem;
    }
}

.muted { color: var(--muted); }

/* Light mode fixes for game pages */
body:not(.dark-mode) .game-info-bar,
body:not(.dark-mode) .stat-card,
body:not(.dark-mode) .message-box,
body:not(.dark-mode) .game-btn,
body:not(.dark-mode) .cell,
body:not(.dark-mode) .reel,
body:not(.dark-mode) .leaderboard-mini,
body:not(.dark-mode) .game-result,
body:not(.dark-mode) .stat-box {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(15, 23, 42, 0.12);
    color: #0f172a;
}

body:not(.dark-mode) .stat-value,
body:not(.dark-mode) .stat-label,
body:not(.dark-mode) .game-info-bar,
body:not(.dark-mode) .leaderboard-mini td,
body:not(.dark-mode) .leaderboard-mini th,
body:not(.dark-mode) .game-container h1,
body:not(.dark-mode) .game-result,
body:not(.dark-mode) .message-box {
    color: #0f172a;
    text-shadow: none;
}

body:not(.dark-mode) .leaderboard-mini thead {
    background: rgba(15, 23, 42, 0.08);
}

body:not(.dark-mode) .cell-x { color: #dc2626; }
body:not(.dark-mode) .cell-o { color: #2563eb; }

body:not(.dark-mode) .game-btn:hover,
body:not(.dark-mode) .cell:hover:not(:disabled) {
    background: rgba(15, 23, 42, 0.06);
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 600; color: var(--text); }
