:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(51, 65, 85, 0.8);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #8b5cf6;
    --success: #10b981;
    --error: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-main: 'Cairo', sans-serif;
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
    user-select: none;
    /* Prevent text selection in games */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
}

.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite alternate ease-in-out;
}

.globe-1 {
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: var(--primary);
}

.globe-2 {
    bottom: -10%;
    left: -10%;
    width: 40vw;
    height: 40vw;
    background: var(--accent);
    animation-delay: -5s;
}

.globe-3 {
    top: 40%;
    left: 40%;
    width: 30vw;
    height: 30vw;
    background: var(--success);
    opacity: 0.2;
    animation-delay: -2s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(20px, 40px) scale(1.1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Navbar */
.navbar {
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 20px var(--primary-glow);
    cursor: pointer;
}

.logo i {
    color: var(--primary);
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-btn:hover,
.nav-btn.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.test-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.test-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

.test-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
    transition: var(--transition);
}

.test-card:hover .test-icon {
    transform: scale(1.1) rotate(5deg);
    color: var(--accent);
}

.test-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.test-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Game Container */
.game-container {
    max-width: 1000px;
    margin: 3rem auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.full-height {
    height: 80vh;
    /* Taller for reaction game */
}

/* Game States */
.game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 1rem;
}

.game-subtitle {
    font-size: 1.2rem;
    color: white;
    opacity: 0.9;
}

/* Buttons */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 2rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

/* Reaction Time Colors */
.reaction-wait {
    background-color: #ce2636 !important;
}

.reaction-go {
    background-color: #4bdb6a !important;
}

.reaction-result {
    background-color: #2b87d1 !important;
}

/* Sequence Memory Grid */
.sequence-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 2rem auto;
}

.seq-square {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.seq-square:active {
    transform: scale(0.95);
}

.seq-square.active {
    background: white;
    box-shadow: 0 0 30px white;
}

/* Number Memory Input */
.game-input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    font-size: 2rem;
    color: white;
    border-radius: 12px;
    margin-top: 2rem;
    text-align: center;
    outline: none;
    width: 300px;
}

.game-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Progress Bar */
.progress-bar {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 2rem;
    overflow: hidden;
}

.fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    animation: fillProgress 2s linear forwards;
    /* Matches number display time roughly */
}

@keyframes fillProgress {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

/* Visual Memory Grid */
.visual-grid {
    display: grid;
    gap: 10px;
    margin: 2rem auto;
    width: 100%;
    max-width: 400px;
    justify-content: center;
}

.visual-square {
    width: 100%;
    aspect-ratio: 1;
    /* Keep it square */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.visual-square.active {
    background: white;
    box-shadow: 0 0 15px white;
}

.visual-square.error {
    background: var(--error);
    box-shadow: 0 0 15px var(--error);
}

/* Header with stats */
.game-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.game-stat {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
}