/* Enhanced Game Styles with Glassmorphism */

/* Game Container */
.game-container {
    min-height: 100vh;
    background: var(--bg-primary);
    padding-top: 80px;
}

/* Game Hero Section */
.game-hero {
    position: relative;
    padding: 4rem 0;
    text-align: center;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.neural-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(0, 122, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(88, 86, 214, 0.1) 0%, transparent 50%),
        linear-gradient(rgba(0, 122, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 122, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 30px 30px, 30px 30px;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.floating-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.floating-particles::before,
.floating-particles::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.floating-particles::before {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.floating-particles::after {
    top: 60%;
    right: 30%;
    animation-delay: 4s;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.game-icon {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    box-shadow: var(--shadow-xl);
}

.icon-pulse {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 2px solid var(--primary-color);
    border-radius: 35px;
    opacity: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(1.2);
    }
}

.game-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.title-neural {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: slideInLeft 0.8s ease forwards;
}

.title-spark {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-color), #FF6B35);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: slideInUp 0.8s ease 0.2s forwards;
    opacity: 0;
}

.title-catcher {
    display: inline-block;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: slideInRight 0.8s ease 0.4s forwards;
    opacity: 0;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.game-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.6s forwards;
}

.game-stats-preview {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.8s forwards;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    color: var(--text-primary);
    font-weight: 500;
}

.stat-item i {
    color: var(--primary-color);
}

/* Game Area */
.game-area {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 2rem;
}

/* Game HUD */
.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.hud-left {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.stat-display:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.hud-right {
    display: flex;
    gap: 1rem;
}

.game-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.game-btn:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    padding: 1rem;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
}

.grid-cell {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-size: 2.5rem;
    user-select: none;
}

.grid-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grid-cell:hover::before {
    opacity: 1;
}

.grid-cell:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.grid-cell:active {
    transform: translateY(-2px) scale(0.95);
}

/* Game Items */
.game-item {
    font-size: 2.5rem;
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: itemSpawn 0.4s ease forwards;
}

@keyframes itemSpawn {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(90deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.game-item.spark {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.game-item.bomb {
    color: #FF4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.game-item.hit {
    animation: itemHit 0.4s ease forwards;
}

@keyframes itemHit {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Game Effects */
.game-effects {
    position: relative;
    height: 0;
    pointer-events: none;
}

.score-popup {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    opacity: 0;
    z-index: 100;
    text-shadow: 0 0 10px rgba(255, 149, 0, 0.5);
}

.score-popup.show {
    animation: scorePopup 1s ease forwards;
}

@keyframes scorePopup {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-60px) scale(1);
    }
}

.combo-display {
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    opacity: 0;
    z-index: 100;
}

.combo-display.show {
    animation: comboShow 2s ease forwards;
}

@keyframes comboShow {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translateX(-50%) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }
}

/* Game Modal */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: var(--blur-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    padding: 2.5rem;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.game-modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-color), #FF6B35);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: white;
    font-size: 2rem;
    animation: modalIconPulse 2s ease-in-out infinite;
}

@keyframes modalIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.modal-body {
    margin-bottom: 2rem;
}

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

.final-stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.final-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.final-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.performance-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-style: italic;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Game Instructions */
.game-instructions {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
}

.game-instructions h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

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

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.instruction-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.instruction-icon {
    font-size: 2rem;
    min-width: 60px;
    text-align: center;
}

.instruction-text h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.instruction-text p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding-top: 70px;
    }
    
    .game-hero {
        padding: 2rem 0;
    }
    
    .hero-content {
        padding: 0 1rem;
    }
    
    .game-title {
        font-size: 2.5rem;
    }
    
    .game-stats-preview {
        gap: 1rem;
    }
    
    .stat-item {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .game-area {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .game-hud {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .hud-left {
        justify-content: center;
        gap: 1rem;
    }
    
    .stat-display {
        flex: 1;
        min-width: 0;
        padding: 0.75rem 1rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .hud-right {
        justify-content: center;
    }
    
    .game-btn {
        flex: 1;
        padding: 0.75rem 1.5rem;
    }
    
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .grid-cell {
        font-size: 2rem;
    }
    
    .game-item {
        font-size: 2rem;
    }
    
    .modal-content {
        padding: 2rem;
    }
    
    .final-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .instruction-item {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .game-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .game-description {
        font-size: 1rem;
    }
    
    .game-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .grid-cell {
        font-size: 1.5rem;
    }
    
    .game-item {
        font-size: 1.5rem;
    }
    
    .stat-display {
        padding: 0.5rem 0.75rem;
    }
    
    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
}

/* Dark Mode Adjustments */
.dark .grid-cell {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.dark .grid-cell:hover {
    border-color: var(--primary-color);
}

.dark .game-item.spark {
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
}

.dark .game-item.bomb {
    text-shadow: 0 0 15px rgba(255, 68, 68, 0.7);
}

/* Performance Optimizations */
.game-grid,
.grid-cell,
.game-item {
    will-change: transform;
}

.game-item {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .game-item,
    .score-popup,
    .combo-display,
    .modal-icon {
        animation: none !important;
    }
    
    .grid-cell {
        transition: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .grid-cell {
        border-width: 3px;
    }
    
    .game-item.spark {
        color: #FFFF00;
    }
    
    .game-item.bomb {
        color: #FF0000;
    }
}

