/* ============================================================
   GAME COMMON STYLES — Shared across all individual game pages
   ============================================================ */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #06b6d4;
    --accent-color: #f59e0b;
    --accent-pink: #ec4899;
    --accent-purple: #a855f7;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-dark: #0f172a;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --gradient-ai: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #06b6d4 100%);
    --gradient-text: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Space Grotesk', 'Inter', sans-serif;
    --font-tech: 'Orbitron', monospace;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-primary);
    background: var(--bg-dark);
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

/* AI Grid Background */
.ai-grid-bg {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; z-index: 0;
    background-image:
        linear-gradient(rgba(99,102,241,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

/* Particle Canvas */
.particle-canvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; z-index: 0;
    opacity: 0.4; pointer-events: none;
}

/* NAVBAR */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(15,23,42,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.nav-brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; }
.nav-brand h2 {
    font-family: var(--font-tech);
    font-size: 1.3rem;
    background: var(--gradient-ai);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-back {
    display: flex; align-items: center; gap: 0.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
}
.nav-back:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-back i { font-size: 0.9rem; }

/* PAGE WRAPPER */
.page-wrapper {
    position: relative; z-index: 1;
    padding-top: 80px; min-height: 100vh;
}

/* GAME PAGE HERO */
.game-page-hero {
    padding: 3rem 1rem 2rem;
    text-align: center;
}
.game-page-hero .hero-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.3);
    color: var(--primary-light);
    font-size: 0.85rem; font-weight: 600;
    margin-bottom: 1rem;
}
.game-page-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    background: var(--gradient-text);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 0.8rem;
}
.game-page-hero p {
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    max-width: 600px; margin: 0 auto;
}

/* LEVEL SELECTOR */
.level-selector-section {
    padding: 1.5rem 1rem 3rem;
    max-width: 1100px; margin: 0 auto;
}
.level-selector-section h2 {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1.5rem; font-weight: 800;
    color: rgba(255,255,255,0.9);
    margin-bottom: 1.5rem;
}
.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}
.level-btn {
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 1.2rem 0.5rem;
    cursor: pointer;
    transition: var(--transition-bounce);
    text-align: center; color: white;
    position: relative; overflow: hidden;
}
.level-btn::before {
    content: ''; position: absolute; inset: 0;
    background: var(--gradient-ai);
    opacity: 0; transition: opacity 0.3s;
}
.level-btn:hover::before, .level-btn.active::before { opacity: 1; }
.level-btn:hover, .level-btn.active {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(99,102,241,0.4);
    border-color: transparent;
}
.level-btn .level-number {
    font-family: var(--font-tech);
    font-size: 1.6rem; font-weight: 900;
    display: block; position: relative; z-index: 1;
}
.level-btn .level-label {
    font-size: 0.72rem; font-weight: 600;
    opacity: 0.8; display: block;
    position: relative; z-index: 1;
    margin-top: 0.3rem; letter-spacing: 0.05em;
    text-transform: uppercase;
}
.level-btn .level-stars {
    position: relative; z-index: 1;
    margin-top: 0.4rem; font-size: 0.65rem; color: #f59e0b;
}

/* GAME ARENA */
.game-arena {
    max-width: 900px; margin: 0 auto 3rem;
    padding: 0 1rem;
}
.glass-panel {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    position: relative; overflow: hidden;
}
.glass-panel::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: var(--gradient-ai);
    border-radius: 24px 24px 0 0;
}

/* GAME HEADER */
.game-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap; gap: 1rem;
}
.game-header-title {
    display: flex; align-items: center; gap: 0.8rem;
}
.game-header-title h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem; font-weight: 800;
}
.level-badge {
    background: var(--gradient-ai);
    padding: 0.25rem 0.8rem;
    border-radius: 50px;
    font-size: 0.75rem; font-weight: 700;
    font-family: var(--font-tech);
}
.game-stats-bar {
    display: flex; gap: 1.5rem; flex-wrap: wrap;
}
.stat-chip {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 0.4rem 1rem;
    font-size: 0.9rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.4rem;
    color: rgba(255,255,255,0.9);
}
.stat-chip i { font-size: 0.8rem; }
.stat-chip.timer-chip i { color: var(--accent-color); }
.stat-chip.score-chip i { color: #10b981; }
.stat-chip.level-chip i { color: var(--primary-light); }
.stat-chip.lives-chip i { color: #ef4444; }

/* PROGRESS BAR */
.progress-track {
    width: 100%; height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px; overflow: hidden;
    margin-bottom: 2rem;
}
.progress-fill {
    height: 100%; border-radius: 10px;
    background: var(--gradient-ai);
    transition: width 0.4s ease;
}

/* BUTTONS */
.btn-primary {
    background: var(--gradient-ai);
    color: white; border: none;
    padding: 0.9rem 2rem;
    border-radius: 12px;
    font-weight: 700; font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex; align-items: center; gap: 0.6rem;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99,102,241,0.5);
}
.btn-secondary {
    background: rgba(255,255,255,0.07);
    color: white; border: 1.5px solid rgba(255,255,255,0.15);
    padding: 0.9rem 2rem;
    border-radius: 12px;
    font-weight: 700; font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex; align-items: center; gap: 0.6rem;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
}
.btn-danger {
    background: rgba(239,68,68,0.15);
    color: #ef4444; border: 1.5px solid rgba(239,68,68,0.3);
    padding: 0.9rem 2rem;
    border-radius: 12px;
    font-weight: 700; font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-normal);
    display: inline-flex; align-items: center; gap: 0.6rem;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* GAME OVER / WIN OVERLAY */
.game-result-overlay {
    position: absolute; inset: 0;
    background: rgba(15,23,42,0.96);
    border-radius: 24px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 50; text-align: center; padding: 2rem;
    animation: fadeIn 0.4s ease;
}
.result-emoji { font-size: 5rem; margin-bottom: 1rem; animation: bounce 1s infinite; }
.result-title {
    font-family: var(--font-heading);
    font-size: 2.5rem; font-weight: 900;
    background: var(--gradient-ai);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}
.result-subtitle { color: rgba(255,255,255,0.6); margin-bottom: 2rem; font-size: 1.1rem; }
.result-stats {
    display: flex; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; justify-content: center;
}
.result-stat {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px; padding: 1rem 1.5rem; text-align: center;
}
.result-stat .val {
    font-family: var(--font-tech);
    font-size: 2rem; font-weight: 900;
    background: var(--gradient-ai);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.result-stat .lbl { font-size: 0.8rem; color: rgba(255,255,255,0.5); margin-top: 0.2rem; }
.result-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* START SCREEN */
.start-screen {
    text-align: center; padding: 3rem 1rem;
}
.start-screen .start-icon {
    width: 120px; height: 120px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem;
}
.start-screen h2 {
    font-family: var(--font-heading);
    font-size: 2rem; font-weight: 900;
    margin-bottom: 0.8rem;
}
.start-screen p { color: rgba(255,255,255,0.6); margin-bottom: 1.5rem; font-size: 1.05rem; }
.level-info-chips {
    display: flex; gap: 0.8rem; justify-content: center;
    margin-bottom: 2rem; flex-wrap: wrap;
}
.info-chip {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 0.4rem 0.9rem;
    font-size: 0.85rem; color: rgba(255,255,255,0.7);
    display: flex; align-items: center; gap: 0.4rem;
}
.info-chip i { font-size: 0.75rem; }

/* FOOTER */
.game-footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    position: relative; z-index: 1;
}
.game-footer a { color: rgba(255,255,255,0.5); text-decoration: none; }
.game-footer a:hover { color: var(--primary-light); }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes correctPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.animate-slide { animation: slideIn 0.4s ease; }

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed; top: 90px; right: 1rem;
    z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
    background: rgba(15,23,42,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white; font-weight: 600;
    display: flex; align-items: center; gap: 0.7rem;
    animation: slideIn 0.3s ease;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.toast.success { border-color: #10b981; }
.toast.error   { border-color: #ef4444; }
.toast.info    { border-color: var(--primary-light); }
.toast i.success { color: #10b981; }
.toast i.error   { color: #ef4444; }
.toast i.info    { color: var(--primary-light); }

/* RESPONSIVE */
@media (max-width: 640px) {
    .level-grid { grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
    .level-btn { padding: 0.8rem 0.3rem; }
    .level-btn .level-number { font-size: 1.1rem; }
    .level-btn .level-label { font-size: 0.6rem; }
    .level-btn .level-stars { display: none; }
    .glass-panel { padding: 1.5rem 1rem; }
    .game-header { flex-direction: column; }
    .result-stats { gap: 1rem; }
}
