/* 1980s Retro Video Game Aesthetic - Girly Theme */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    --primary-color: #ff66cc; /* Pink */
    --secondary-color: #cc33ff; /* Purple */
    --accent-color: #ffff00; /* Yellow */
    --bg-color: #330033; /* Dark purple background */
    --text-glow: 0 0 2px var(--primary-color);
    --purple-glow: 0 0 2px var(--secondary-color);
    --yellow-glow: 0 0 2px var(--accent-color);
}

/* CRT scanline effect */
@keyframes scanlines {
    0% { background-position: 0 0; }
    100% { background-position: 0 15px; }
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Press Start 2P', cursive;
    background-color: #660066;
    background-image: linear-gradient(45deg, #660066 0%, #ff66cc 100%);
    color: var(--primary-color);
    text-shadow: var(--text-glow);
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(
            transparent 50%, 
            rgba(0, 0, 0, 0.1) 50%
        );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
    animation: scanlines 0.5s linear infinite;
}

.container {
    max-width: 800px;
    width: 95%;
    background-color: rgba(255, 230, 255, 0.95);
    border: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 12px var(--primary-color);
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.title {
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    color: #990099; /* Darker purple for better contrast */
    text-shadow: 2px 2px 0 black;
    font-size: 2em;
    margin-bottom: 20px;
    animation: blink 1s infinite;
    letter-spacing: 1px;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.7; }
}

.info-bar {
    display: flex;
    justify-content: space-between;
    background-color: rgba(255, 180, 255, 0.7);
    padding: 10px 15px;
    border: 2px solid var(--primary-color);
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 0.8em;
    border-radius: 4px;
}

.timer, .score-card {
    color: #990099; /* Darker purple for better contrast */
    text-shadow: 1px 1px 0 #000;
    font-weight: bold;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.card {
    aspect-ratio: 1/1;
    background-color: #ffe6ff;
    border: 3px solid var(--secondary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px var(--secondary-color);
    border-radius: 8px;
}

.card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--secondary-color), 0 0 30px var(--secondary-color);
}

.card.flipped {
    background-color: #ffccff;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
}

/* No match state - red border and shake animation */
.card.no-match {
    background-color: #ffccff;
    border-color: #ff0000;
    box-shadow: 0 0 10px #ff0000, 0 0 20px #ff0000;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.card.matched {
    background-color: #d9ffcc;
    border-color: #33cc33;
    cursor: default;
    animation: bounce 1s;
    box-shadow: 0 0 10px #33cc33, 0 0 20px #33cc33;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.card.matched .card-back::after {
    content: '!';
     font-size: 1.5em;
    color: #33cc33;
    text-shadow: var(--purple-glow);
}

.card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    background-color: #ffccff;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    top: 0;
    left: 0;
}

.card-back::after {
    content: '?';
    font-size: 2em;
    color: #990099; /* Darker purple for better contrast */
    text-shadow: 1px 1px 0 #000;
}

.card-front {
    display: none !important; /* Force hide the front since we're using only question marks */
}

button {
    font-family: 'Press Start 2P', cursive;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.8em;
    display: block;
    margin: 15px auto;
    box-shadow: 5px 5px 0 #993399;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

button:hover {
    background-color: var(--secondary-color);
    box-shadow: 5px 5px 0 #660066;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
    box-shadow: 3px 3px 0 #993399;
}

#start-button {
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 5px 5px 0 #660066;
    font-size: 1em;
    padding: 15px 30px;
    text-shadow: 2px 2px 0 black;
}

#start-button:hover {
    background-color: var(--primary-color);
    box-shadow: 5px 5px 0 #993399;
}

.game-message {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #990099; /* Darker purple for better contrast */
    text-shadow: 1px 1px 0 #000;
    font-weight: bold;
}

.hidden {
    display: none;
}

/* Pixelated edges */
.container,
.card,
button,
.info-bar {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Loading animation */
@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-bar {
    height: 10px;
    background-color: #ffb3ff;
    position: relative;
    margin: 20px auto;
    overflow: hidden;
    box-shadow: 0 0 10px var(--primary-color);
    border-radius: 5px;
}

.loading-progress {
    height: 100%;
    background-color: var(--secondary-color);
    animation: loading 3s forwards;
    box-shadow: 0 0 10px var(--secondary-color);
    border-radius: 5px;
}

/* Stars animation in background */
@keyframes stars {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2000px); }
}

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

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: white;
    border-radius: 50%;
    opacity: 0.5;
    animation: twinkle 1s infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.2; }
    100% { opacity: 0.8; }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    #game-board {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .title {
        font-size: 1.4em;
    }
    
    .info-bar {
        flex-direction: column;
        gap: 10px;
    }
}

/* Win state animation */
@keyframes win-celebration {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--primary-color);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px var(--primary-color), 0 0 60px var(--primary-color);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--primary-color);
    }
}

.win-state {
    animation: win-celebration 2s infinite;
    border: 5px solid var(--primary-color);
    z-index: 100;
}

.win-message {
    background-color: var(--primary-color);
    color: white;
    text-shadow: 2px 2px 0 #660066;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 30px var(--primary-color);
    position: relative;
    animation: win-celebration 2s infinite;
    max-width: 80%;
    margin: 0 auto;
    text-align: center;
    font-size: 1.5em;
    margin-bottom: 20px;
}

/* Listening mode indicator */
.listening-mode .container {
    border-color: #ffff00; /* Yellow border when sound is playing */
}

.listening-mode #game-board {
    pointer-events: none; /* Disable pointer events during sound playback */
    opacity: 0.9;         /* Slight dimming effect */
}

/* Visual cue that can be animated when in listening mode */
.listening-mode::before {
    content: "🎵";
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2em;
    animation: bounce 0.5s infinite alternate;
    z-index: 1000;
    text-shadow: 0 0 5px white;
}

/* Add a cursor style for cards when in listening mode */
.listening-mode .card {
    cursor: not-allowed;
}