/* ============================================
   VARIABLES & RESET
   ============================================ */

:root {
    --primary-color: #00d4ff;
    --secondary-color: #6366ff;
    --accent-color: #ec4899;
    --dark-bg: #0a0e27;
    --card-bg: rgba(255, 255, 255, 0.07);
    --card-border: rgba(255, 255, 255, 0.12);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 50%, #0a0e27 100%);
    color: var(--text-primary);
    overflow-x: hidden;
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(99, 102, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   CANVAS & EFFECTS
   ============================================ */

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.mouse-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    filter: blur(40px);
    z-index: 2;
    top: -150px;
    left: -150px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    position: relative;
    z-index: 3;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    animation: slideDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.logo-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid var(--card-border);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 2rem 0;
}

.hero-content {
    width: 100%;
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

.title-word {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInScale 0.8s ease-out backwards;
}

.title-word:nth-child(1) { animation-delay: 0.2s; }
.title-word:nth-child(2) { animation-delay: 0.4s; }
.title-word:nth-child(3) { animation-delay: 0.6s; }

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: var(--text-secondary);
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease-out 0.3s backwards;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.hero-description {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 3rem;
    animation: fadeInUp 1s ease-out 0.4s backwards;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   CTA BUTTON
   ============================================ */

.cta-container {
    margin-bottom: 4rem;
    animation: fadeInUp 1s ease-out 0.5s backwards;
}

.cta-button {
    position: relative;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-bg);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.5px;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.cta-button:hover::before {
    left: 100%;
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 48px rgba(0, 212, 255, 0.5);
}

.cta-button:active {
    transform: translateY(-1px) scale(1.02);
}

.button-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.cta-button:hover .button-icon {
    transform: translateX(4px);
}

.cta-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    animation: fadeIn 1s ease-out 0.6s backwards;
}

/* ============================================
   STATUS GRID
   ============================================ */

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.status-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    animation: fadeInUp 1s ease-out backwards;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.status-card:nth-child(1) { animation-delay: 0.7s; }
.status-card:nth-child(2) { animation-delay: 0.8s; }
.status-card:nth-child(3) { animation-delay: 0.9s; }

.status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0;
    animation: shimmer 2s ease-in-out infinite;
}

.status-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.2);
}

.status-number {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.status-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   FLOATING CARDS
   ============================================ */

.floating-card {
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    animation: float 6s ease-in-out infinite;
    z-index: -1;
}

.card-1 {
    top: 10%;
    left: -10%;
    animation-delay: 0s;
    width: 250px;
    height: 250px;
}

.card-2 {
    top: 50%;
    right: -5%;
    animation-delay: 2s;
    width: 200px;
    height: 200px;
}

.card-3 {
    bottom: 10%;
    left: 5%;
    animation-delay: 4s;
    width: 180px;
    height: 180px;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(30px) rotate(5deg); }
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    animation: fadeInUp 1s ease-out 1s backwards;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.3rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
}

.social-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.2);
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shimmer {
    0% {
        opacity: 0;
        left: -100%;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        left: 100%;
    }
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ============================================
   GAMES BUTTON
   ============================================ */

.games-button {
    position: relative;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.games-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 255, 0.2);
}

.games-button:active {
    transform: translateY(0);
}

.games-icon {
    font-size: 1.2rem;
}

.games-text {
    letter-spacing: 0.5px;
}

/* ============================================
   GAMES MODAL
   ============================================ */

.games-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    overflow-y: auto;
}

.games-modal.show {
    display: flex;
}

.games-container {
    background: linear-gradient(135deg, rgba(26, 26, 62, 0.8) 0%, rgba(10, 14, 39, 0.8) 100%);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 2rem;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 25px 50px rgba(0, 212, 255, 0.1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.games-header h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.games-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.games-close:hover {
    color: var(--accent-color);
    background: rgba(236, 72, 153, 0.1);
}

/* ============================================
   GAMES MENU
   ============================================ */

.games-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(99, 102, 255, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.game-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.15);
}

.game-card:hover::before {
    opacity: 1;
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.game-card:hover .game-icon {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.game-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.difficulty {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ============================================
   GAME CONTENT & TOP BAR
   ============================================ */

.game-content {
    display: none;
}

.game-content.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid var(--card-border);
}

.game-score, .game-combo, .game-lives, .game-moves, .game-current {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.game-score span, .game-combo span, .game-lives span, .game-moves span, .game-current span {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
}

.back-button {
    background: rgba(99, 102, 255, 0.2);
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.9rem;
}

.back-button:hover {
    background: rgba(99, 102, 255, 0.3);
    transform: translateY(-2px);
}

/* ============================================
   PARTICLE CLICKER GAME
   ============================================ */

#clickerCanvas {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(0, 212, 255, 0.05));
    border: 1px solid var(--card-border);
    border-radius: 15px;
    margin-bottom: 1.5rem;
    cursor: crosshair;
    display: block;
}

.game-status {
    text-align: center;
    font-size: 1rem;
    color: var(--text-secondary);
    padding: 1rem;
    min-height: 30px;
}

.game-status.success {
    color: var(--primary-color);
    font-weight: 600;
}

.game-status.danger {
    color: var(--accent-color);
    font-weight: 600;
}

/* ============================================
   MEMORY MATCH GAME
   ============================================ */

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(99, 102, 255, 0.1));
    border: 2px solid var(--card-border);
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
    position: relative;
    transform-style: preserve-3d;
}

.memory-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.2);
    transform: translateY(-3px);
}

.memory-card.flipped {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
}

.memory-card.matched {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--primary-color);
    cursor: default;
    opacity: 0.7;
}

.reset-game-button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: var(--dark-bg);
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.reset-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 212, 255, 0.3);
}

/* ============================================
   REACTION TIME GAME
   ============================================ */

.reaction-box {
    width: 100%;
    aspect-ratio: 1;
    max-height: 500px;
    max-width: 500px;
    margin: 2rem auto;
    background: linear-gradient(135deg, rgba(99, 102, 255, 0.1), rgba(0, 212, 255, 0.05));
    border: 2px solid var(--card-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.reaction-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.reaction-box.green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
    border-color: #22c55e;
    cursor: pointer;
}

.reaction-box.green::before {
    opacity: 1;
}

.reaction-box.success {
    border-color: #22c55e;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
}

.reaction-box.too-early {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.4);
}

.reaction-content {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.reaction-content.green-text {
    color: #22c55e;
    font-weight: 700;
    font-size: 1.3rem;
}

.reaction-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .status-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .social-links {
        width: 100%;
        justify-content: center;
    }

    .cta-button {
        padding: 0.9rem 2rem;
        font-size: 1rem;
    }

    .floating-card {
        opacity: 0.3;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .logo-badge {
        display: none;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .cta-button {
        width: 100%;
        justify-content: center;
    }

    .floating-card {
        display: none;
    }

    .title-word {
        display: block;
    }

    .navbar {
        margin-bottom: 1.5rem;
    }

    .games-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .games-container {
        max-width: 95%;
        padding: 1.5rem;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    #clickerCanvas {
        height: 300px;
    }

    .reaction-box {
        max-height: 300px;
    }
}

/* ============================================
   DARK MODE ENHANCEMENTS (System Preference)
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

.fade-in-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out forwards;
}
