/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0d0d1a;
    --bg-panel: #1a1a2e;
    --accent: #ff006e;
    --accent-2: #00f5d4;
    --accent-3: #fee440;
    --text: #e0e0e0;
    --text-dim: #8888aa;
    --border: #2a2a4a;
    --glow: 0 0 10px var(--accent), 0 0 20px var(--accent), 0 0 40px var(--accent);
    --glow-2: 0 0 10px var(--accent-2), 0 0 20px var(--accent-2);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'VT323', monospace;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 18px;
    line-height: 1.6;
}

/* ===== CRT EFFECTS ===== */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}

.crt-flicker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 16, 16, 0.02);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.02; }
    50% { opacity: 0.05; }
    100% { opacity: 0.02; }
}

/* ===== HEADER ===== */
.main-header {
    background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-dark) 100%);
    border-bottom: 3px solid var(--accent);
    padding: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 20px rgba(255, 0, 110, 0.3);
}

.logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 28px;
    color: var(--accent);
    text-shadow: var(--glow);
    letter-spacing: 4px;
    margin-bottom: 10px;
}

.tagline {
    color: var(--accent-2);
    font-size: 20px;
    text-shadow: var(--glow-2);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== NAVIGATION ===== */
.main-nav {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-link {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: var(--text-dim);
    text-decoration: none;
    padding: 10px 20px;
    border: 2px solid var(--border);
    background: var(--bg-dark);
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-3);
    border-color: var(--accent-3);
    box-shadow: 0 0 15px rgba(254, 228, 64, 0.4);
    transform: translateY(-2px);
}

/* ===== HERO SECTION ===== */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 80px 20px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.hero-content {
    text-align: center;
}

.hero-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 42px;
    color: var(--accent-3);
    text-shadow: 0 0 10px var(--accent-3), 0 0 30px var(--accent-3);
    margin-bottom: 20px;
    position: relative;
}

.glitch {
    animation: glitch 2s infinite;
}

@keyframes glitch {
    0%, 90%, 100% { transform: translate(0); }
    92% { transform: translate(-2px, 2px); }
    94% { transform: translate(2px, -2px); }
    96% { transform: translate(-2px, -2px); }
    98% { transform: translate(2px, 2px); }
}

.hero-subtitle {
    font-size: 24px;
    color: var(--text-dim);
    margin-bottom: 40px;
}

.btn-start {
    display: inline-block;
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: var(--bg-dark);
    background: var(--accent-2);
    padding: 20px 40px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 20px var(--accent-2), inset 0 0 10px rgba(0,0,0,0.2);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px var(--accent-2), inset 0 0 10px rgba(0,0,0,0.2);
}

.btn-start::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* ===== ARCADE MACHINE DECORATION ===== */
.hero-arcade-machine {
    position: relative;
    width: 200px;
    height: 280px;
}

.arcade-screen {
    width: 180px;
    height: 140px;
    background: #000;
    border: 8px solid #333;
    border-radius: 10px 10px 0 0;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0,255,0,0.2);
}

.screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: screenPulse 2s infinite;
}

.pixel-character {
    font-size: 48px;
    animation: bounce 1s infinite;
}

.dots {
    color: #0f0;
    font-size: 20px;
    margin-top: 10px;
    animation: dotsBlink 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes dotsBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes screenPulse {
    0%, 100% { box-shadow: inset 0 0 20px rgba(0,255,0,0.2); }
    50% { box-shadow: inset 0 0 40px rgba(0,255,0,0.4); }
}

.arcade-body {
    width: 200px;
    height: 120px;
    background: linear-gradient(180deg, #444 0%, #222 100%);
    border-radius: 0 0 10px 10px;
    margin: 0 auto;
    position: relative;
}

.arcade-body::before {
    content: '♦ ♦ ♦';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent);
    font-size: 14px;
    letter-spacing: 10px;
}

/* ===== SECTION TITLES ===== */
.section-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    color: var(--accent);
    text-align: center;
    margin: 60px 0 40px;
    text-shadow: var(--glow);
    position: relative;
}

.section-title::before,
.section-title::after {
    content: '◆';
    color: var(--accent-3);
    margin: 0 15px;
}

.subsection-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--accent-2);
    text-align: center;
    margin: 40px 0 20px;
}

/* ===== GAMES GRID (Homepage) ===== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.game-card {
    background: var(--bg-panel);
    border: 2px solid var(--border);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,0,110,0.1), transparent);
    transition: left 0.5s;
}

.game-card:hover::before {
    left: 100%;
}

.game-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 0, 110, 0.3);
}

.game-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.game-card h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--accent-2);
    margin-bottom: 10px;
}

.game-card p {
    color: var(--text-dim);
    margin-bottom: 20px;
    font-size: 16px;
}

.play-btn {
    display: inline-block;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--accent-3);
    border: 2px solid var(--accent-3);
    padding: 8px 16px;
    transition: all 0.2s;
}

.game-card:hover .play-btn {
    background: var(--accent-3);
    color: var(--bg-dark);
}

/* ===== STATS BAR ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 60px 20px;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: 'Press Start 2P', cursive;
    font-size: 36px;
    color: var(--accent-3);
    text-shadow: 0 0 10px var(--accent-3);
}

.stat-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 10px;
}

/* ===== GAMES PAGE ===== */
.games-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.game-section {
    margin-bottom: 60px;
    background: var(--bg-panel);
    border: 2px solid var(--border);
    padding: 30px;
}

.game-info {
    margin-bottom: 20px;
}

.game-info h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: var(--accent-2);
    margin-bottom: 10px;
}

.game-info p {
    color: var(--text-dim);
    margin-bottom: 15px;
}

.controls-info {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    font-size: 16px;
    color: var(--accent-3);
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    background: #000;
    border: 4px solid var(--border);
    padding: 10px;
}

.game-container canvas {
    display: block;
    background: #000;
    image-rendering: pixelated;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.game-overlay p {
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    color: var(--accent-3);
    text-shadow: 0 0 20px var(--accent-3);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
}

.game-overlay.hidden {
    display: none;
}

/* ===== MEMORY GAME BOARD ===== */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-panel);
}

.memory-card {
    aspect-ratio: 1;
    background: var(--border);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.memory-card:hover {
    border-color: var(--accent-2);
    box-shadow: 0 0 15px var(--accent-2);
}

.memory-card.flipped {
    background: var(--bg-dark);
    border-color: var(--accent-3);
}

.memory-card.matched {
    background: rgba(0, 245, 212, 0.2);
    border-color: var(--accent-2);
    animation: matchPulse 0.5s;
}

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

/* ===== ABOUT PAGE ===== */
.about-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.about-card {
    background: var(--bg-panel);
    border: 2px solid var(--border);
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.about-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}

.about-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.about-card h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    color: var(--accent-2);
    margin-bottom: 15px;
}

.about-card p {
    color: var(--text-dim);
    font-size: 18px;
}

/* ===== TECH STACK ===== */
.tech-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.tech-item {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--bg-dark);
    background: var(--accent-3);
    padding: 10px 20px;
    border-radius: 4px;
}

/* ===== CREDITS ===== */
.credits {
    text-align: center;
    color: var(--text-dim);
}

.credits p {
    margin-bottom: 10px;
}

.copyright {
    font-size: 14px;
    color: var(--text-dim);
    opacity: 0.7;
}

/* ===== FOOTER ===== */
.main-footer {
    background: var(--bg-panel);
    border-top: 3px solid var(--accent);
    padding: 30px;
    text-align: center;
    margin-top: 60px;
}

.main-footer p {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.footer-blink {
    color: var(--accent-3) !important;
    animation: blink 1s infinite;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .logo {
        font-size: 18px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero {
        padding: 40px 20px;
    }

    .hero-arcade-machine {
        display: none;
    }

    .section-title {
        font-size: 14px;
    }

    .stats-bar {
        gap: 30px;
    }

    .stat-number {
        font-size: 24px;
    }

    .game-container canvas {
        max-width: 100%;
        height: auto;
    }

    .memory-board {
        grid-template-columns: repeat(4, 1fr);
        max-width: 300px;
    }

    .memory-card {
        font-size: 24px;
    }

    .controls-info {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .nav-link {
        font-size: 10px;
        padding: 8px 12px;
    }

    .btn-start {
        font-size: 12px;
        padding: 15px 30px;
    }

    .game-section {
        padding: 15px;
    }

    .memory-board {
        max-width: 250px;
        gap: 5px;
        padding: 10px;
    }

    .memory-card {
        font-size: 20px;
    }
}
