/* Global Styles */
:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --text-color: #2d3436;
    --light-color: #f5f5f5;
    --dark-color: #2d3436;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --game-bg-1: linear-gradient(135deg, #a29bfe, #6c5ce7);
    --game-bg-2: linear-gradient(135deg, #74b9ff, #0984e3);
    --game-bg-3: linear-gradient(135deg, #55efc4, #00b894);
    --game-bg-4: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    --game-bg-5: linear-gradient(135deg, #ff7675, #d63031);
    --game-bg-6: linear-gradient(135deg, #fd79a8, #e84393);
    --game-bg-7: linear-gradient(135deg, #81ecec, #00cec9);
    --game-bg-8: linear-gradient(135deg, #fab1a0, #e17055);
    --game-bg-9: linear-gradient(135deg, #74b9ff, #0984e3);
    --game-bg-10: linear-gradient(135deg, #a29bfe, #6c5ce7);
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Screen Styles */
.screen {
    display: none;
    position: relative;
    min-height: 80vh;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease forwards;
}

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

/* Hub Screen Styles */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 3rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.8;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.game-card {
    background-color: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.game-icon {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.game-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.game-card p {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* Game icons */
.circle-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--game-bg-1);
    position: relative;
}

.circle-icon::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.color-icon {
    display: flex;
    width: 70px;
    height: 40px;
}

.color-icon::before, .color-icon::after {
    content: '';
    flex: 1;
    height: 100%;
}

.color-icon::before {
    background-color: #fd79a8;
    border-radius: 10px 0 0 10px;
}

.color-icon::after {
    background-color: #0984e3;
    border-radius: 0 10px 10px 0;
}

.dodge-icon {
    width: 50px;
    height: 50px;
    position: relative;
}

.dodge-icon::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: var(--dark-color);
    border-radius: 15px 15px 0 0;
}

.dodge-icon::after {
    content: '1';
    position: absolute;
    top: 0;
    left: 30%;
    font-size: 20px;
    font-weight: bold;
    color: var(--danger-color);
}

.jump-icon {
    width: 60px;
    height: 40px;
    position: relative;
}

.jump-icon::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    width: 15px;
    height: 25px;
    background: var(--primary-color);
    border-radius: 7px 7px 0 0;
}

.jump-icon::after {
    content: '';
    position: absolute;
    right: 10px;
    bottom: 0;
    width: 10px;
    height: 15px;
    background: var(--danger-color);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 50% 50%);
}

.memory-icon {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5px;
    width: 50px;
    height: 50px;
}

.memory-icon::before {
    content: '😀';
    grid-column: 1;
    grid-row: 1;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f1f1;
    border-radius: 5px;
}

.memory-icon::after {
    content: '🎮';
    grid-column: 2;
    grid-row: 2;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f1f1;
    border-radius: 5px;
}

.math-icon {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.math-icon::before {
    content: '42';
    font-size: 24px;
    font-weight: bold;
    color: var(--dark-color);
}

.reflex-icon {
    width: 60px;
    height: 60px;
    position: relative;
}

.reflex-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    border-radius: 5px;
    opacity: 0.7;
}

.reflex-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.word-icon {
    display: flex;
    width: 70px;
    justify-content: center;
    align-items: center;
}

.word-icon::before {
    content: 'A⟲Z';
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
}

.line-icon {
    width: 60px;
    height: 40px;
    position: relative;
}

.line-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 3px;
    background: var(--dark-color);
    border-radius: 3px;
}

.line-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 50%;
}

.quiz-icon {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-icon::before {
    content: '?';
    font-size: 30px;
    font-weight: bold;
    color: var(--primary-color);
}

footer {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Game Screen Styles */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.back-button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.back-button:hover {
    background: rgba(108, 92, 231, 0.1);
}

.score-display, .timer-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-color);
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 5px;
    box-shadow: var(--shadow);
}

.game-play-area {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 2rem;
    min-height: 50vh;
    position: relative;
}

.game-instructions {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.game-instructions h2 {
    font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.game-instructions p {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.start-button, .restart-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
}

.start-button:hover, .restart-button:hover {
    background: #5b4bd4;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.5);
}

.start-button:active, .restart-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.4);
}

.game-over {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    z-index: 10;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 2rem;
}

.game-over h2 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.game-over p {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.final-score {
    font-weight: 700;
    color: var(--primary-color);
}

/* Game Specific Styles */

/* Tap Circle Game */
#tap-circle-area {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.tap-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    cursor: pointer;
    transform: scale(0);
    animation: popIn 0.3s forwards;
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes popOut {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1.5); opacity: 0; }
}

/* Color Match Game */
.color-match-game {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

#color-word {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    transition: var(--transition);
}

.color-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.color-button {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.color-button:hover {
    transform: scale(1.1);
}

.color-button[data-color="red"] { background-color: #ff0000; }
.color-button[data-color="blue"] { background-color: #0000ff; }
.color-button[data-color="green"] { background-color: #00ff00; }
.color-button[data-color="yellow"] { background-color: #ffff00; }
.color-button[data-color="purple"] { background-color: #800080; }

/* Number Dodger Game */
.number-dodger-game {
    display: none;
    position: relative;
    height: 400px;
    overflow: hidden;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px solid #eee;
}

#player {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 5px;
    z-index: 2;
}

.falling-number {
    position: absolute;
    top: -30px;
    width: 30px;
    height: 30px;
    background: var(--dark-color);
    color: white;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 1;
}

/* Media Queries */
@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .score-display, .timer-display {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 1rem;
    }
    
    .game-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .color-buttons {
        gap: 0.5rem;
    }
    
    .color-button {
        width: 60px;
        height: 60px;
    }
}