/* ==========================================================================
   J2pon.world Stylesheet - Optimized Version
   ========================================================================== */

/* CSS Custom Properties (Variables) */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white: #ffffff;
    --black: #000000;
    
    --font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;
    
    --border-radius-sm: 5px;
    --border-radius-md: 10px;
    --border-radius-lg: 15px;
    --border-radius-xl: 25px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.25);
    
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--dark-color);
    overflow-x: hidden;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Header Styles */
.header {
    background: var(--glass-bg);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    margin-bottom: 30px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    animation: headerShine 3s linear infinite;
}

@keyframes headerShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header h1 {
    color: var(--secondary-color);
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

.header-subtitle {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 25px;
    font-weight: 300;
}

/* Theme Selector */
.theme-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-xl);
    backdrop-filter: blur(5px);
}

.theme-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.theme-option:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.theme-option.active {
    border-color: var(--white);
    transform: scale(1.2);
    box-shadow: var(--shadow-lg);
}

.theme-option::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all var(--transition-base);
    transform: translate(-50%, -50%);
}

.theme-option:hover::after {
    width: 100%;
    height: 100%;
}

.theme-purple { background: linear-gradient(45deg, #667eea, #764ba2); }
.theme-ocean { background: linear-gradient(45deg, #00d2d3, #54a0ff); }
.theme-sunset { background: linear-gradient(45deg, #feca57, #ff9ff3); }
.theme-forest { background: linear-gradient(45deg, #55a3ff, #003d82); }

/* Navigation */
.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(118, 75, 162, 0.1);
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 12px 24px;
    border-radius: var(--border-radius-xl);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all var(--transition-base);
}

.nav-btn:hover::before {
    left: 100%;
}

.nav-btn.active,
.nav-btn:hover {
    background: var(--secondary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-btn i {
    margin-right: 8px;
}

/* ==========================================================================
   Authentication Panels
   ========================================================================== */

.auth-panel,
.user-panel {
    background: var(--glass-bg);
    padding: 25px;
    border-radius: var(--border-radius-md);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.auth-info h3,
.user-details .user-name {
    color: var(--secondary-color);
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-info p {
    color: #666;
    font-size: 1em;
    line-height: 1.5;
}

.auth-buttons,
.user-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 1.5em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow-md);
    position: relative;
}

.avatar::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    z-index: -1;
    filter: blur(5px);
    opacity: 0.7;
}

.user-score {
    color: #666;
    font-size: 1em;
    margin-bottom: 5px;
}

.user-level {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 1.1em;
}

/* ==========================================================================
   Button Components
   ========================================================================== */

.btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-xl);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all var(--transition-base);
    transform: translate(-50%, -50%);
}

.btn:hover::before {
    width: 200%;
    height: 200%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
}

.btn-danger {
    background: linear-gradient(45deg, #dc3545, #e83e8c);
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #6f42c1);
}

.btn-secondary {
    background: linear-gradient(45deg, #6c757d, #495057);
}

.btn-admin {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    animation: adminPulse 2s infinite;
}

@keyframes adminPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* ==========================================================================
   Section and Content Layouts
   ========================================================================== */

.section {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.section.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-card {
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.content-card h2 {
    color: var(--secondary-color);
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 700;
    text-align: center;
    position: relative;
}

.content-card h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.content-card h2 i {
    margin-right: 10px;
}

/* ==========================================================================
   Games Section
   ========================================================================== */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.game-card {
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.game-card:hover::before {
    animation: cardShine 0.6s ease-in-out;
}

@keyframes cardShine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); opacity: 0; }
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.game-icon {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.game-card h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: 700;
    text-align: center;
}

.game-card p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: center;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    font-size: 0.9em;
    color: #666;
    background: rgba(118, 75, 162, 0.1);
    padding: 10px;
    border-radius: var(--border-radius-md);
}

.game-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.game-play-btn {
    width: 100%;
    margin-top: 15px;
    background: linear-gradient(45deg, var(--success-color), #20c997);
    border: none;
    padding: 12px;
    color: var(--white);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Game Area */
.game-area {
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-top: 30px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    text-align: center;
}

.game-controls {
    margin-bottom: 25px;
}

.score-board {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.1em;
    background: rgba(118, 75, 162, 0.1);
    padding: 15px;
    border-radius: var(--border-radius-md);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.score-item span {
    color: var(--secondary-color);
    font-size: 1.2em;
    font-weight: 700;
}

.game-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

#gameCanvas {
    border: 3px solid var(--secondary-color);
    border-radius: var(--border-radius-md);
    display: block;
    margin: 20px auto;
    background: var(--light-color);
    box-shadow: var(--shadow-md);
    max-width: 100%;
    height: auto;
}

.game-instructions {
    margin-top: 20px;
    padding: 15px;
    background: rgba(118, 75, 162, 0.1);
    border-radius: var(--border-radius-md);
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Leaderboard
   ========================================================================== */

.leaderboard-content {
    max-height: 600px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: rgba(118, 75, 162, 0.1);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.leaderboard-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    transform: scaleY(0);
    transition: all var(--transition-base);
}

.leaderboard-item:hover::before {
    transform: scaleY(1);
}

.leaderboard-item:hover {
    background: rgba(118, 75, 162, 0.2);
    transform: translateX(10px);
    box-shadow: var(--shadow-md);
}

.leaderboard-rank {
    font-weight: 700;
    font-size: 1.5em;
    color: var(--secondary-color);
    min-width: 40px;
    text-align: center;
}

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.leaderboard-score {
    text-align: right;
}

.leaderboard-score .score {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--secondary-color);
}

.leaderboard-score .date {
    color: #666;
    font-size: 0.9em;
}

/* ==========================================================================
   Achievements
   ========================================================================== */

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.achievement {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 25px;
    border-radius: var(--border-radius-md);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.achievement::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all var(--transition-slow);
}

.achievement:hover::before {
    left: 100%;
}

.achievement:hover {
    transform: scale(1.05) rotateY(5deg);
    box-shadow: var(--shadow-xl);
}

.achievement.locked {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

.achievement.locked:hover {
    transform: none;
    box-shadow: none;
}

.achievement-icon {
    font-size: 3em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.achievement h4 {
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: 700;
}

.achievement p {
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.4;
}

.achievement-status {
    margin-top: 15px;
    font-weight: 600;
    font-size: 0.9em;
}

/* ==========================================================================
   Blog Section
   ========================================================================== */

.blog-posts {
    max-height: 600px;
    overflow-y: auto;
}

.blog-post {
    border-bottom: 2px solid #eee;
    padding: 25px 0;
    margin-bottom: 25px;
    transition: all var(--transition-base);
    position: relative;
}

.blog-post:last-child {
    border-bottom: none;
}

.blog-post:hover {
    transform: translateY(-3px);
    background: rgba(118, 75, 162, 0.05);
    padding: 30px 20px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}

.blog-title {
    color: var(--secondary-color);
    font-size: 1.5em;
    margin-bottom: 12px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.3;
}

.blog-title:hover {
    text-decoration: underline;
}

.blog-meta {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.blog-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.blog-content {
    line-height: 1.7;
    color: #444;
    font-size: 1em;
}

.blog-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.like-btn {
    background: none;
    border: 2px solid var(--info-color);
    color: var(--info-color);
    padding: 8px 16px;
    border-radius: var(--border-radius-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
}

.like-btn:hover {
    background: var(--info-color);
    color: var(--white);
    transform: scale(1.05);
}

/* ==========================================================================
   Profile Section
   ========================================================================== */

.profile-content {
    display: grid;
    gap: 25px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.profile-stat-card {
    background: rgba(118, 75, 162, 0.1);
    padding: 25px;
    border-radius: var(--border-radius-md);
    text-align: center;
    border-left: 4px solid var(--secondary-color);
}

.profile-stat-card h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.profile-stat-card .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(118, 75, 162, 0.2);
}

.profile-stat-card .stat-item:last-child {
    border-bottom: none;
}

.profile-posts {
    margin-top: 30px;
}

.profile-posts h3 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    font-size: 1.4em;
}

.profile-post {
    background: rgba(255, 255, 255, 0.5);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
}

.profile-post:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(5px);
}

.profile-post h4 {
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-size: 1.1em;
}

.profile-post .post-meta {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.profile-post .post-excerpt {
    color: #555;
    line-height: 1.6;
}

/* ==========================================================================
   Admin Panel
   ========================================================================== */

.admin-panel {
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-top: 30px;
    border: 3px solid var(--danger-color);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    animation: adminGlow 2s infinite alternate;
}

@keyframes adminGlow {
    0% { box-shadow: 0 0 20px rgba(220, 53, 69, 0.3); }
    100% { box-shadow: 0 0 40px rgba(220, 53, 69, 0.6); }
}

.admin-card h2 {
    color: var(--danger-color);
    margin-bottom: 25px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 25px;
    border-radius: var(--border-radius-md);
    text-align: center;
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.stat-card p {
    font-size: 1em;
    opacity: 0.9;
    font-weight: 600;
}

.users-list {
    max-height: 250px;
    overflow-y: auto;
    border: 2px solid #ddd;
    padding: 15px;
    border-radius: var(--border-radius-md);
    background: var(--white);
    margin-bottom: 25px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: all var(--transition-fast);
}

.user-item:last-child {
    border-bottom: none;
}

.user-item:hover {
    background: rgba(118, 75, 162, 0.1);
    border-radius: var(--border-radius-sm);
}

.admin-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   Modal System
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.7) translateY(-50px);
    transition: all var(--transition-base);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 25px;
}

.modal-header h2 {
    color: var(--secondary-color);
    font-size: 1.6em;
    font-weight: 700;
    margin: 0 0 20px 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: #f0f0f0;
    color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-form {
    padding: 0 30px 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1em;
}

.form-group label i {
    margin-right: 8px;
    color: var(--secondary-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-family: inherit;
    transition: all var(--transition-base);
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
    transform: translateY(-2px);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

/* ==========================================================================
   Notification System
   ========================================================================== */

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    max-width: 350px;
}

.notification {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 15px 25px;
    margin-bottom: 10px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    opacity: 0;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--white);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    background: linear-gradient(45deg, var(--success-color), #20c997);
}

.notification.warning {
    background: linear-gradient(45deg, var(--warning-color), #fd7e14);
}

.notification.error {
    background: linear-gradient(45deg, var(--danger-color), #e83e8c);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 1.2em;
}

.notification-text {
    flex: 1;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    opacity: 0.8;
    transition: all var(--transition-fast);
}

.notification-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* ==========================================================================
   Loading System
   ========================================================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.loading-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    text-align: center;
    color: var(--white);
}

.loading-spinner i {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
    display: none !important;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2.5em;
    }
    
    .theme-selector {
        gap: 10px;
    }
    
    .theme-option {
        width: 30px;
        height: 30px;
    }
    
    .nav-buttons {
        gap: 10px;
    }
    
    .nav-btn {
        font-size: 0.85em;
        padding: 10px 16px;
    }
    
    .auth-panel,
    .user-panel {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .score-board {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-buttons {
        flex-direction: column;
    }
    
    .btn {
        min-width: auto;
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 20px 20px 0;
    }
    
    .modal-form {
        padding: 0 20px 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .leaderboard-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification {
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .nav-btn {
        font-size: 0.8em;
        padding: 8px 12px;
    }
    
    .game-card {
        padding: 20px;
    }
    
    .content-card {
        padding: 20px;
    }
    
    .modal-header {
        padding: 15px 15px 0;
    }
    
    .modal-form {
        padding: 0 15px 15px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card h3 {
        font-size: 2em;
    }
}

/* ==========================================================================
   Dark Mode Support (Optional Enhancement)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #2c2c2c;
        --dark-color: #f8f9fa;
        --glass-bg: rgba(40, 40, 40, 0.95);
    }
    
    body {
        color: var(--dark-color);
    }
    
    .form-group input,
    .form-group textarea {
        background: #3c3c3c;
        color: var(--white);
        border-color: #555;
    }
    
    .users-list {
        background: #3c3c3c;
        border-color: #555;
        color: var(--white);
    }
    
    .user-item:hover {
        background: rgba(118, 75, 162, 0.2);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .header,
    .auth-panel,
    .user-panel,
    .game-area,
    .admin-panel,
    .notification-container,
    .loading-overlay {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .content-card {
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }
    
    .btn {
        display: none;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #000080;
        --glass-bg: rgba(255, 255, 255, 1);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .nav-btn {
        border-width: 3px;
    }
    
    .game-card {
        border: 2px solid var(--secondary-color);
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .pulse,
    .loading-spinner i {
        animation: none;
    }
}

/* ==========================================================================
   Focus Management for Accessibility
   ========================================================================== */

.btn:focus,
.nav-btn:focus,
.theme-option:focus,
input:focus,
textarea:focus,
.game-card:focus {
    outline: 3px solid var(--warning-color);
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--dark-color);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

/* ==========================================================================
   Custom Scrollbar Styling
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
}

/* ==========================================================================
   Selection Styling
   ========================================================================== */

::selection {
    background: var(--secondary-color);
    color: var(--white);
}

::-moz-selection {
    background: var(--secondary-color);
    color: var(--white);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state i {
    display: block;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.admin-badge {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    margin-left: 8px;
}

.rank-1 .leaderboard-rank {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    font-weight: bold;
}

.rank-2 .leaderboard-rank {
    background: linear-gradient(45deg, #C0C0C0, #A8A8A8);
    color: #333;
    font-weight: bold;
}

.rank-3 .leaderboard-rank {
    background: linear-gradient(45deg, #CD7F32, #B8860B);
    color: #fff;
    font-weight: bold;
}

.leaderboard-rank {
    min-width: 60px;
    padding: 10px;
    border-radius: var(--border-radius-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.leaderboard-user .user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.leaderboard-user .user-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

.leaderboard-user .user-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.leaderboard-score .total-score {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--secondary-color);
}

.leaderboard-score .score-label {
    font-size: 0.8em;
    color: #666;
}

.game-leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.game-leaderboard-header h3 {
    color: var(--secondary-color);
    margin: 0;
}

.leaderboard-item.game-specific {
    background: rgba(102, 126, 234, 0.05);
    border-left: 4px solid var(--primary-color);
}

/* Canvas Animasyonları */
@keyframes canvasGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 0 30px rgba(118, 75, 162, 0.5); }
}

#gameCanvas:hover {
    animation: canvasGlow 2s infinite;
}

#gameCanvas.game-active {
    border-color: #28a745;
    box-shadow: 0 0 20px rgba(40, 167, 69, 0.3);
}

/* Oyun Kontrolleri İyileştirmeleri */
.game-controls {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.score-board {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.score-item {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
}

.score-item span {
    display: block;
    font-size: 1.4em;
    font-weight: bold;
    color: var(--secondary-color);
    margin-top: 5px;
}

/* Oyun Talimatları */
.game-instructions {
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(118, 75, 162, 0.2);
    border-radius: var(--border-radius-md);
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}

.game-instructions p {
    margin: 0;
    font-style: italic;
    color: #555;
    line-height: 1.5;
}

/* Mobil Oyun Kontrolleri */
@media (max-width: 768px) {
    .game-controls {
        padding: 15px;
    }
    
    .score-board {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .score-item {
        padding: 10px;
        font-size: 0.9em;
    }
    
    .score-item span {
        font-size: 1.2em;
    }
    
    #gameCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .game-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .game-instructions {
        font-size: 0.9em;
        padding: 12px;
    }
}

/* Oyun Kartları Hover Efektleri */
.game-card {
    position: relative;
    overflow: hidden;
}

.game-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.6s ease;
    pointer-events: none;
}

.game-card:hover::after {
    left: 100%;
}

.game-play-btn {
    position: relative;
    overflow: hidden;
}

.game-play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.game-play-btn:hover::before {
    width: 300%;
    height: 300%;
}

/* Başarım Badge'leri */
.achievement-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #FFD700;
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
}

/* Puan Animasyonları */
@keyframes scoreUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px) scale(1.2);
        opacity: 0;
    }
}

.score-animation {
    animation: scoreUp 1s ease-out forwards;
}

/* Game Over Overlay */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 100;
}

.game-over-title {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 20px;
    color: #FFD700;
}

.game-over-stats {
    text-align: center;
    margin-bottom: 30px;
}

.game-over-stats div {
    margin: 8px 0;
    font-size: 1.1em;
}

/* Responsive Canvas */
#gameCanvas {
    max-width: 100%;
    height: auto;
    touch-action: manipulation; /* Mobil dokunma optimizasyonu */
}

/* Loading States */
.game-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    font-size: 1.2em;
    color: #666;
}

.game-loading i {
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

/* Game Stats Cards */
.game-stats-expanded {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius-md);
}

.game-stat-item {
    text-align: center;
    padding: 10px;
}

.game-stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--secondary-color);
    display: block;
}

.game-stat-label {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

/* Performance Indicators */
.performance-excellent { color: #FFD700 !important; }
.performance-good { color: #28a745 !important; }
.performance-average { color: #ffc107 !important; }
.performance-poor { color: #dc3545 !important; }

/* Game Instructions Enhancements */
.game-instructions.active {
    background: linear-gradient(45deg, rgba(40, 167, 69, 0.1), rgba(32, 201, 151, 0.1));
    border-color: rgba(40, 167, 69, 0.3);
    animation: instructionGlow 2s infinite alternate;
}

@keyframes instructionGlow {
    0% { box-shadow: 0 0 10px rgba(40, 167, 69, 0.2); }
    100% { box-shadow: 0 0 20px rgba(40, 167, 69, 0.4); }
}