/* ============================================
   Play ServerBay - Modern Mini Games Platform
   ============================================ */

/* CSS Variables */
:root {
    /* Light Theme (default) */
    --bg-primary: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f8;
    --text-primary: #1a1d29;
    --text-secondary: #5c6370;
    --text-muted: #9ca3af;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #252532;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #27272a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

input {
    font-family: inherit;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent-primary);
}

.logo-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--accent-primary);
    transform: rotate(15deg);
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
}

.user-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.user-avatar {
    font-size: 1.25rem;
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: var(--transition);
}

.user-menu.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.user-dropdown input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.user-dropdown input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.signup-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

.user-greeting {
    font-weight: 600;
    margin-bottom: 1rem;
}

.user-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
    background: transparent;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ============================================
   Main Content & Pages
   ============================================ */
main {
    padding-top: 70px;
    min-height: calc(100vh - 70px);
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-games {
    position: relative;
    width: 250px;
    height: 250px;
}

.float-game {
    position: absolute;
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
    animation-delay: var(--delay);
}

.float-game:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%); }
.float-game:nth-child(2) { top: 30%; right: 0; }
.float-game:nth-child(3) { bottom: 20%; left: 10%; }
.float-game:nth-child(4) { bottom: 0; right: 20%; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Sections */
.featured-section,
.games-section,
.categories-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-new {
    background: var(--success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.view-all {
    color: var(--accent-primary);
    font-weight: 500;
    transition: var(--transition);
}

.view-all:hover {
    text-decoration: underline;
}

/* Featured Card */
.featured-card {
    display: grid;
    grid-template-columns: 300px 1fr;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.featured-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.featured-preview {
    aspect-ratio: 4/3;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    font-size: 4rem;
    opacity: 0.8;
}

.featured-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.featured-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.featured-meta {
    display: flex;
    gap: 1rem;
}

.meta-item {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.game-card-image {
    aspect-ratio: 16/10;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.game-icon {
    font-size: 3rem;
    transition: var(--transition);
}

.game-card:hover .game-icon {
    transform: scale(1.2) rotate(5deg);
}

.game-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.game-card:hover .game-play-overlay {
    opacity: 1;
}

.play-icon {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-primary);
    animation: pulse 1.5s infinite;
}

.game-card-content {
    padding: 1rem;
}

.game-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.game-card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-card-category {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    color: var(--text-muted);
}

.game-card-rating {
    font-size: 0.875rem;
    color: var(--warning);
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.category-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.category-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.category-card h3 {
    margin-bottom: 0.25rem;
}

.category-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Page Header */
.page-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    text-align: center;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* Filters */
.filters {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ============================================
   Game Player
   ============================================ */
#gamePlayer {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 2000;
    padding-top: 70px;
    overflow: auto;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.back-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--error);
    color: white;
}

.game-header h2 {
    font-size: 1.25rem;
}

.game-score {
    font-weight: 600;
    color: var(--accent-primary);
}

.game-score span:last-child {
    font-size: 1.25rem;
}

.game-area {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    aspect-ratio: 16/10;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.game-controls {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Game Over Modal */
.game-over-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.score-display {
    margin-bottom: 1rem;
}

.score-display p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.score-display span {
    font-size: 3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.high-score-msg {
    color: var(--success);
    font-weight: 600;
    margin-bottom: 1rem;
    animation: pulse 1s infinite;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ============================================
   Leaderboard
   ============================================ */
.leaderboard-tabs {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.tab-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.leaderboard-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.leaderboard-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px;
    padding: 1rem 1.5rem;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row.header {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.leaderboard-rank {
    font-weight: 700;
    font-size: 1.25rem;
}

.leaderboard-rank.gold { color: #ffd700; }
.leaderboard-rank.silver { color: #c0c0c0; }
.leaderboard-rank.bronze { color: #cd7f32; }

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.leaderboard-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.leaderboard-name {
    font-weight: 500;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--accent-primary);
    text-align: right;
}

.leaderboard-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.footer p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--accent-primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content p {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-visual {
        display: none;
    }
    
    .featured-card {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .navbar.open .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .hero-content h1 {
        font-size: 2.25rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .leaderboard-row {
        grid-template-columns: 40px 1fr 80px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .leaderboard-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.5rem 1rem;
    }
    
    .logo-text {
        display: none;
    }
    
    .user-name {
        display: none;
    }
    
    .hero {
        padding: 2rem 1rem;
    }
    
    .featured-section,
    .games-section,
    .categories-section {
        padding: 1.5rem 1rem;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .modal-actions .btn-primary,
    .modal-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Game-Specific Styles
   ============================================ */

/* Tic Tac Toe */
.tictactoe-grid {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    gap: 8px;
}

.tictactoe-cell {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.tictactoe-cell:hover:not(.taken) {
    background: var(--accent-primary);
    color: white;
}

.tictactoe-cell.x { color: var(--accent-primary); }
.tictactoe-cell.o { color: var(--error); }

.tictactoe-status {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Memory Match */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 70px);
    gap: 8px;
}

.memory-card {
    width: 70px;
    height: 70px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    transform-style: preserve-3d;
}

.memory-card.flipped {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
}

.memory-card.matched {
    background: var(--success);
    opacity: 0.7;
}

.memory-card:not(.flipped):not(.matched):hover {
    transform: scale(1.05);
}

/* Flappy Bird */
.flappy-game {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB, #E0F6FF);
}

.flappy-bird {
    position: absolute;
    font-size: 2rem;
    transition: transform 0.1s;
}

.flappy-pipe {
    position: absolute;
    width: 50px;
    background: linear-gradient(to right, #2ECC71, #27AE60);
    border-radius: 4px;
}

.flappy-pipe.top {
    top: 0;
}

.flappy-pipe.bottom {
    bottom: 0;
}

.flappy-score {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Dice */
.dice-container {
    text-align: center;
}

.dice {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    margin: 0 auto 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.dice:hover {
    transform: scale(1.05);
}

.dice.rolling {
    animation: diceRoll 0.5s ease-in-out;
}

@keyframes diceRoll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.dice-result {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dice-history {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.history-dice {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Quiz */
.quiz-container {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
}

.quiz-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.quiz-question {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-answer {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: left;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
}

.quiz-answer:hover:not(.disabled) {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.quiz-answer.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.quiz-answer.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.quiz-answer.disabled {
    cursor: default;
}

.quiz-score {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
}

/* Spin Wheel */
.wheel-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    overflow: hidden;
}

.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    z-index: 10;
}

.spin-btn {
    display: block;
    margin: 1.5rem auto 0;
}

/* Number Guessing */
.guess-game {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    text-align: center;
}

.guess-number {
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 1rem 0;
}

.guess-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.guess-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.guess-hint {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 500;
}

.guess-hint.higher {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.guess-hint.lower {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.guess-hint.correct {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Rock Paper Scissors */
.rps-container {
    text-align: center;
}

.rps-choices {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.rps-choice {
    width: 100px;
    height: 100px;
    background: var(--bg-secondary);
    border: 3px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 3rem;
    cursor: pointer;
    transition: var(--transition);
}

.rps-choice:hover {
    border-color: var(--accent-primary);
    transform: translateY(-8px);
}

.rps-result {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.rps-score {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.rps-score-item {
    text-align: center;
}

.rps-score-value {
    font-size: 2rem;
    font-weight: 700;
}

.rps-score-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}
