:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --background-color: #ecf0f1;
    --card-color: #ffffff;
    --font-color: #34495e;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Removes blue tap highlight on mobile */
}

body {
    font-family: 'Arial Rounded MT Bold', sans-serif;
    background-color: var(--background-color);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 77vh;
    width: 77vw;
    padding: 10px;
}

.app-header {
    text-align: center;
    color: var(--font-color);
}
.app-header h1 { margin: 0; }
.app-header p { margin: 5px 0 15px 0; color: #7f8c8d; }

.theme-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}
.theme-btn {
    padding: 10px 15px;
    border: 2px solid var(--primary-color);
    background-color: #fff;
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.theme-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    flex-grow: 1; /* Takes up available space */
    perspective: 1000px;
}

.card {
    background-color: transparent;
    aspect-ratio: 1 / 1; /* Makes cards square */
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}
.card.flipped { transform: rotateY(180deg); }
.card.matched {
    transform: rotateY(180deg);
    cursor: default;
}
.card.matched .card-back {
    box-shadow: 0 0 15px #2ecc71; /* Glow effect for matched cards */
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(24px, 10vw, 48px); /* Responsive font size */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.card-front {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}
.card-back {
    background: var(--card-color);
    color: var(--font-color);
    transform: rotateY(180deg);
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0 5px 0;
    color: var(--font-color);
    font-size: 1.1em;
}
.game-stats button {
    padding: 10px 15px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
}
.game-stats button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.overlay-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.win-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 350px;
}
.win-box button {
    padding: 12px 25px;
    font-size: 1.2em;
    cursor: pointer;
    border: none;
    background-color: #2ecc71;
    color: white;
    border-radius: 12px;
    margin-top: 10px;
}

.star-rating {
    font-size: 3em;
    color: #bdc3c7; /* Default color for empty stars */
    margin-bottom: 15px;
}
.star-rating .star {
    display: inline-block;
    transition: transform 0.2s, color 0.2s;
    animation: pop-in 0.5s ease-out backwards;
}
.star-rating .star.filled {
    color: #f1c40f; /* Gold color for filled stars */
    transform: scale(1.1);
}
.star:nth-child(2) { animation-delay: 0.1s; }
.star:nth-child(3) { animation-delay: 0.2s; }

@keyframes pop-in {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.hidden { display: none; }