/* Stroop Test Game Styles */

:root {
    /* Game-specific colors - inherits primary color (#FFD93D) from main.css */
    --color-bg: #FFD93D;
    --color-correct: #4CAF50;
    --color-wrong: #FF6B6B;
    --color-text: #333;
    --color-text-light: rgba(0, 0, 0, 0.6);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.content {
    text-align: center;
    padding: 2rem;
    max-width: 90%;
    width: 100%;
}

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

.instruction {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.timer {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.score {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.best-score {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.color-word {
    font-size: 4rem;
    font-weight: 900;
    margin: 1.5rem 0;
    min-height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Text outline ensures all colors (especially yellow) remain readable on yellow background */
    text-shadow:
        -2px -2px 0 rgba(0, 0, 0, 0.3),
        2px -2px 0 rgba(0, 0, 0, 0.3),
        -2px 2px 0 rgba(0, 0, 0, 0.3),
        2px 2px 0 rgba(0, 0, 0, 0.3),
        0 0 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

/* Feedback animations for correct/incorrect answers */
.color-word.correct {
    animation: pulse-correct 0.2s ease-out;
}

.color-word.wrong {
    animation: shake 0.2s ease-in-out;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.buttons {
    display: none;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.state-playing .buttons,
.state-feedback .buttons {
    display: flex;
}

.game-btn {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s, box-shadow 0.1s;
    min-width: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-btn:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.game-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-btn:focus-visible {
    outline: 3px solid rgba(0, 0, 0, 0.3);
    outline-offset: 2px;
}

.btn-match {
    background: var(--color-correct);
    color: white;
}

.btn-nomatch {
    background: var(--color-wrong);
    color: white;
}

.hint {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-top: 1.5rem;
}

/* Hide controls during gameplay */
.state-playing .controls-inline,
.state-feedback .controls-inline,
.state-gameover .controls-inline {
    display: none;
}

/* Idle state */
.state-idle {
    cursor: pointer;
}

.state-idle .buttons {
    display: none;
}

/* Game over state */
.state-gameover {
    cursor: pointer;
}

.state-gameover .buttons {
    display: none;
}

/* New best score celebration animation */
.state-gameover.new-best {
    animation: celebrate 0.6s ease-out;
}

.state-gameover.new-best .score {
    animation: score-pop 0.4s ease-out;
    color: #E6A700; /* Gold color for new best */
    font-weight: 700;
}

.state-gameover.new-best .instruction {
    color: #E6A700;
}

@keyframes celebrate {
    0% {
        background-color: #FFE566;
        box-shadow: inset 0 0 100px rgba(255, 215, 0, 0.5);
    }
    50% {
        background-color: #FFF0A0;
        box-shadow: inset 0 0 150px rgba(255, 215, 0, 0.3);
    }
    100% {
        background-color: var(--color-bg);
        box-shadow: none;
    }
}

@keyframes score-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Home link */
.home-link {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    transition: background 0.2s;
    z-index: 10;
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.8);
}

.home-link:active {
    transform: translateX(-50%) scale(0.95);
}

.home-link:focus-visible {
    outline: 3px solid rgba(0, 0, 0, 0.3);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 600px) {
    .title {
        font-size: 1.5rem;
    }

    .instruction {
        font-size: 1rem;
    }

    .color-word {
        font-size: 3rem;
        min-height: 4rem;
    }

    .game-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        min-width: 100px;
    }

    .timer {
        font-size: 1.25rem;
    }

    .score {
        font-size: 1rem;
    }
}
