/* Modern CSS Reset & Variables */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-light: rgba(255, 255, 255, 0.9);
    
    --surface-glass: rgba(255, 255, 255, 0.12);
    --surface-glass-border: rgba(255, 255, 255, 0.2);
    --surface-dark: rgba(0, 0, 0, 0.05);
    
    --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 20px 60px rgba(0, 0, 0, 0.12);
    --shadow-hard: 0 30px 80px rgba(0, 0, 0, 0.16);
    
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Body & Background */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.7;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background elements */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 70% 70%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 30% 30%, rgba(245, 87, 108, 0.1) 0%, transparent 50%);
    animation: backgroundFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes backgroundFloat {
    0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    position: relative;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.3)); }
    to { filter: drop-shadow(0 0 40px rgba(102, 126, 234, 0.6)); }
}

/* Main Layout */
main {
    max-width: 1200px;
    margin: auto;
    display: grid;
    gap: 40px;
    position: relative;
}

/* Section Styles with Glassmorphism */
section {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    transform: translateY(0);
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

section:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
    border-color: rgba(255, 255, 255, 0.3);
}

h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 25px;
    position: relative;
    color: var(--text-primary);
}

h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
    animation: underlineGrow 0.6s ease-out;
}

@keyframes underlineGrow {
    from { width: 0; }
    to { width: 60px; }
}

/* Enhanced Tab Styles */
.code-tabs {
    display: flex;
    margin-bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 4px;
    overflow-x: auto;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-bounce);
    position: relative;
    white-space: nowrap;
    min-width: fit-content;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    border-radius: 12px;
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.tab-button:hover::before {
    opacity: 0.1;
}

.tab-button.active {
    color: white;
    transform: scale(1.05);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tab-button.active::before {
    opacity: 1;
}

/* Modern Code Block Styles */
.code-block {
    display: none;
    background: linear-gradient(145deg, #1e1e2e, #2a2a3a);
    color: #e4e4e7;
    padding: 32px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.6), transparent);
}

.code-block.active {
    display: block;
    animation: codeSlideIn 0.4s ease-out;
}

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

/* Scrollbar Styling */
.code-block::-webkit-scrollbar {
    height: 8px;
}

.code-block::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

/* Game Gallery Enhancements */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.game-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-glass-border);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-bounce);
    position: relative;
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow-soft);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.game-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: var(--shadow-hard);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-card:hover::before {
    opacity: 0.05;
}

.game-card-thumbnail {
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.game-card-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
}

.game-card-body {
    padding: 28px;
    position: relative;
}

.game-card-title {
    margin: 0 0 12px 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.game-card-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* Breadcrumb Enhancement */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto 30px auto;
    font-size: 0.9rem;
    padding: 12px 20px;
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid var(--surface-glass-border);
    display: inline-block;
}

.breadcrumb a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.breadcrumb a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: var(--transition);
}

.breadcrumb a:hover::after {
    width: 100%;
}

.breadcrumb a:hover {
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    section {
        padding: 24px;
    }
    
    .game-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .code-tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .code-block {
        padding: 20px;
        font-size: 13px;
    }
}

/* Loading animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeInUp 0.6s ease-out;
}

section:nth-child(2) { animation-delay: 0.1s; }
section:nth-child(3) { animation-delay: 0.2s; }
section:nth-child(4) { animation-delay: 0.3s; }

/* Interactive elements */
.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Focus states for accessibility */
.tab-button:focus,
.game-card:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    section {
        background: white;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}