/* Memory Sequence Game Styles */

:root {
    /* Use dark background for better color visibility */
    --color-bg: #2C3E50;
    --color-text: #ECF0F1;
    --color-text-light: rgba(255, 255, 255, 0.7);
    --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.5rem;
    margin-bottom: 0.5rem;
}

.level {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

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

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
}

/* Color buttons - main game interaction elements */
.color-btn {
    aspect-ratio: 1;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, background-color 0.1s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-btn:active {
    transform: scale(0.95);
}

/* Lit state - when showing sequence or player taps */
.color-btn.lit {
    box-shadow: 0 0 30px currentColor, 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

/* Disable button interactions when not in input state */
.state-showing .color-btn {
    pointer-events: none;
}

.state-idle .color-btn,
.state-gameover .color-btn {
    pointer-events: none;
    opacity: 0.7;
}

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

/* Hide initial controls during gameplay */
.state-showing .controls-inline,
.state-input .controls-inline,
.state-gameover .controls-inline {
    display: none;
}

/* Clickable background states */
.state-idle,
.state-gameover {
    cursor: pointer;
}

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

.state-gameover.new-best .level {
    animation: score-pop 0.4s ease-out;
    color: #FFD93D; /* YFW primary yellow */
}

.state-gameover.new-best .instruction {
    color: #FFD93D; /* YFW primary yellow */
}

@keyframes celebrate {
    0% {
        background-color: #3D566E;
        box-shadow: inset 0 0 100px rgba(255, 217, 61, 0.2);
    }
    50% {
        background-color: #4A6785;
        box-shadow: inset 0 0 150px rgba(255, 217, 61, 0.15);
    }
    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.15);
    border-radius: 20px;
    transition: background 0.2s;
    z-index: 10;
}

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

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

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

    .instruction {
        font-size: 1.25rem;
    }

    .level {
        font-size: 1rem;
    }

    .grid {
        max-width: 220px;
        gap: 10px;
    }

    .color-btn {
        border-radius: 12px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) {
    .content {
        padding: 1rem;
    }

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

    .instruction {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .level, .best-level {
        margin-bottom: 0.5rem;
    }

    .grid {
        max-width: 180px;
        gap: 8px;
    }

    .hint {
        margin-top: 1rem;
    }
}

/* Prevent text selection during gameplay */
.game-container * {
    user-select: none;
    -webkit-user-select: none;
}

/* How-to-play section styles for dark background */
.how-to-play {
    background: rgba(255, 255, 255, 0.05);
}

.how-to-play h2,
.how-to-play h3 {
    color: var(--color-text);
}

.how-to-play p,
.how-to-play li {
    color: var(--color-text-light);
}

.how-to-play .fun-fact {
    background: rgba(255, 217, 61, 0.1);
    border-left-color: #FFD93D;
}

/* Related games section */
.related-games {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.related-games h3 {
    color: var(--color-text-light);
}

.related-game-link {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
}
