/* Memory Match Game Styles */
:root {
    --primary: #bb86fc;
    --primary-light: #c39dff;
    --primary-dark: #9d70d8;
    --secondary: #ff7676;
    --secondary-light: #ff9e9e;
    --secondary-dark: #e45757;
    --text-color: #e0e0e0;
    --text-light: #a0a0a0;
    --text-white: #ffffff;
    --dark: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #2a2a2a;
    --card-back: #424242;
    --success-color: #4caf50;
    --error-color: #f44336;
    --neutral-color: #252525;
    --shadow-light: 0 3px 10px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 5px 15px rgba(0, 0, 0, 0.3);
    --shadow-dark: 0 8px 30px rgba(0, 0, 0, 0.4);
    --border-radius: 12px;
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

body.dark-theme {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Game Page Header */
.game-page-header {
    background-color: #1f1f1f;
    padding: 0.8rem 0;
    border-bottom: 1px solid #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text-color);
}

/* Main Game Content Area */
.game-content {
    padding: 2rem 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-title {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(187, 134, 252, 0.3);
}

/* The Game Container */
#game-container {
    width: 100%;
    max-width: 800px;
    min-height: 500px;
    background-color: var(--bg-card);
    border: 2px solid #444;
    border-radius: 8px;
    margin: 0 auto 2rem auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}

/* Game Instructions Area */
.game-instructions {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 1rem 1.5rem;
    max-width: 700px;
    width: 90%;
    margin: 0 auto;
    text-align: center;
}

.game-instructions h2 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.game-instructions p {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
}

/* Footer Styles */
.site-footer {
    background-color: #1f1f1f;
    color: var(--text-light);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.9rem;
    border-top: 1px solid #333;
    flex-shrink: 0;
}

.site-footer p {
    margin: 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }
    #game-container {
        min-height: 400px;
    }
    .game-instructions {
        width: 95%;
        padding: 0.8rem 1rem;
    }
    .game-instructions h2 {
        font-size: 1.2rem;
    }
    .game-instructions p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.6rem;
    }
    #game-container {
        min-height: 300px;
        border-width: 1px;
    }
    .back-link {
        font-size: 0.9rem;
    }
}

/* ================= Game-specific styles below ================= */

.game-info {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background-color: var(--neutral-color);
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    width: 100%;
    margin-bottom: 20px;
}

.game-info > div {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.1);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.game-info > div:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.15);
}

#game-area {
    padding: 25px;
    position: relative;
    min-height: 400px;
    background: var(--bg-secondary);
    width: 100%;
    border-radius: var(--border-radius);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    max-width: 500px;
    margin: 0 auto 20px;
    perspective: 1000px;
    padding: 10px;
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

.card {
    position: relative;
    aspect-ratio: 1/1;
    cursor: pointer;
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: transform var(--transition-medium);
    border-radius: var(--border-radius);
    overflow: hidden;
    animation: card-appear 0.5s ease-out backwards;
}

.card:hover {
    transform: translateY(-3px) scale(1.02);
    z-index: 1;
}

@keyframes card-appear {
    0% { opacity: 0; transform: scale(0.8) rotateY(90deg); }
    100% { opacity: 1; transform: scale(1) rotateY(0); }
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-front {
    background-color: var(--bg-card);
    transform: rotateY(180deg);
    border: 2px solid var(--primary);
}

.card-back {
    background-color: var(--card-back);
    position: relative;
    overflow: hidden;
}

.card-back::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(30deg);
    animation: shine 3s ease-in-out infinite alternate;
}

@keyframes shine {
    0% { transform: rotate(30deg) translateX(-100%); }
    100% { transform: rotate(30deg) translateX(100%); }
}

.card-back i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.7);
}

.card-shape {
    width: 70%;
    height: 70%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary);
    font-size: 2rem;
    transition: all 0.3s ease;
}

.card:hover .card-shape {
    transform: scale(1.1);
}

.card-shape svg {
    width: 100%;
    height: 100%;
}

.card.matched .card-inner {
    animation: pulse 0.5s ease-in-out;
}

.card.matched .card-front {
    background-color: rgba(76, 175, 80, 0.1);
}

.card.matched .card-shape {
    color: var(--success-color);
}

@keyframes pulse {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
    100% { transform: rotateY(180deg) scale(1); }
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background-color: rgba(18, 18, 18, 0.95);
    z-index: 10;
    border-radius: var(--border-radius);
    padding: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#start-screen h2, #game-over-screen h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
    color: var(--primary);
    text-align: center;
}

#start-screen h2::after, #game-over-screen h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

#start-screen p, #game-over-screen p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 10px;
    text-align: center;
}

.difficulty-selector {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.difficulty-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: var(--text-white);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.difficulty-btn.selected {
    background-color: var(--primary);
    color: var(--text-white);
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(187, 134, 252, 0.3);
}

#start-button, #restart-button {
    padding: 12px 35px;
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#start-button::after, #restart-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s ease;
}

#start-button:hover::after, #restart-button:hover::after {
    left: 100%;
}

#start-button:hover, #restart-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(187, 134, 252, 0.4);
}

#start-button:active, #restart-button:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

#message-display {
    display: none !important; /* Hide the message popup completely */
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 25px;
    background-color: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    animation: slide-down 0.3s ease-out, fade-out 0.3s ease-out 2.7s forwards;
}

@keyframes slide-down {
    0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes fade-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.match-animation {
    animation: match-pulse 0.5s ease-in-out;
}

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

.wrong-animation {
    animation: wrong-shake 0.5s;
}

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

#star-rating {
    display: inline-flex;
    gap: 5px;
    color: #ffc107;
    font-size: 1.4rem;
}

#star-rating i {
    opacity: 0;
    animation: star-appear 0.3s ease-out forwards;
}

@keyframes star-appear {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#game-over-screen p {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    margin: 8px 0;
    width: 80%;
    max-width: 300px;
}

#game-over-screen p:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    #start-screen h2, #game-over-screen h2 {
        font-size: 1.7rem;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .card-shape {
        font-size: 1.5rem;
    }
    
    .difficulty-selector {
        flex-direction: column;
        gap: 8px;
    }
} 