:root {
    --bg-color: #eef2f3;
    --primary-red: #d63031;
    --primary-red-dark: #b71c1c;
    --primary-green: #27ae60;
    --primary-green-dark: #1e8449;
    --accent-gold: #f1c40f;
    --text-dark: #2c3e50;
    --text-light: #ecf0f1;
    --card-bg: rgba(255, 255, 255, 0.95);
    
    --font-heading: 'Mountains of Christmas', cursive;
    --font-body: 'Fredoka', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #83a4d4, #b6fbff); /* Winter gradient */
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Snow Effect */
#snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: white;
    font-size: 1.5rem;
    animation: fall linear infinite;
}

@keyframes fall {
    to { transform: translateY(110vh) rotate(360deg); }
}

/* Menu Layout */
.menu-container {
    position: relative;
    z-index: 10;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.menu-header {
    text-align: center;
    margin-bottom: 1rem;
    width: 100%;
}

.title-animate {
    font-family: var(--font-heading);
    font-size: 5rem;
    color: var(--primary-red);
    text-shadow: 2px 2px 0 white, 4px 4px 0 rgba(0,0,0,0.1);
    animation: bounceIn 1s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    text-align: center;
    width: 100%;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
    .title-animate {
        font-size: 2.5rem; /* Smaller font on mobile */
    }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    display: inline-block;
    margin-top: 0.5rem;
}

.menu-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
}

@media (max-width: 768px) {
    .menu-main {
        grid-template-columns: 1fr;
    }
}

/* Difficulty Cards */
.difficulty-section, .leaderboard-panel {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s;
}

.difficulty-section:hover, .leaderboard-panel:hover {
    transform: translateY(-5px);
}

h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--primary-green-dark);
    border-bottom: 2px dashed #ddd;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.diff-card {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.diff-card:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.diff-card[data-diff="easy"] { border-color: #27ae60; }
.diff-card[data-diff="easy"]:hover { background: #e8f8f5; }

.diff-card[data-diff="medium"] { border-color: #f39c12; }
.diff-card[data-diff="medium"]:hover { background: #fef9e7; }

.diff-card[data-diff="hard"] { border-color: #d35400; }
.diff-card[data-diff="hard"]:hover { background: #fdf2e9; }

.card-icon {
    font-size: 2.5rem;
}

.diff-card h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-dark);
}

.diff-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Leaderboard */
.score-list-wrapper {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
}

#score-list {
    list-style: none;
}

#score-list li {
    background: white;
    margin-bottom: 0.5rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border-left: 5px solid #bdc3c7;
    transition: transform 0.2s;
}

#score-list li:hover {
    transform: translateX(5px);
}

#score-list li.top-1 { border-left-color: #f1c40f; background: #fffcf0; }
#score-list li.top-2 { border-left-color: #95a5a6; background: #f4f6f7; }
#score-list li.top-3 { border-left-color: #cd7f32; background: #fcf3ec; }

.badge {
    background: #eee;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-size: 0.8rem;
    color: #555;
    margin-left: 0.5rem;
}

/* Buttons */
.secondary-btn {
    background: white;
    color: #7f8c8d;
    border: 2px solid #bdc3c7;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn:hover {
    background: #bdc3c7;
    color: white;
}

/* General Game Styles (Keeping essential ones for game.html) */
/* Re-adding necessary styles for game.html that might rely on basic face/game-area classes */


/* --- Re-integration of Game Specific Styles --- */

#game-container {
    position: relative;
    width: 100%;
    height: 100vh; /* Force full viewport height */
    display: flex;
    flex-direction: column;
}

#game-area {
    flex: 1; /* Take remaining space */
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #dceefb; /* Base fallback */
    background-image: radial-gradient(#ffffff 20%, transparent 20%),
                      radial-gradient(#ffffff 20%, transparent 20%);
    background-position: 0 0, 50px 50px;
    background-size: 100px 100px;
}

.face {
    position: absolute;
    width: 60px;
    height: 60px;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    background-size: contain;
    background-repeat: no-repeat;
    /* filter: drop-shadow(0 4px 4px rgba(0,0,0,0.1)); REMOVED FOR PERFORMANCE */
    will-change: transform;
    z-index: 10;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.card {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 5px solid var(--primary-green);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: popIn 0.3s;
}

.hidden { display: none !important; }

/* Game specific header override */
header {
    color: white; /* Keep white text for timer/title */
    background: transparent; /* Let gradient show through or keep distinct */
    position: relative; /* For absolute positioning of children */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
}

/* Ensure the game title looks good */
header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem; /* Larger like menu */
    margin: 0 0 0.5rem 0; /* Add bottom margin for timer spacing */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    text-align: center;
    width: 100%;
}

/* Back button in game header */
#back-menu-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    transition: all 0.2s;
    z-index: 30; /* Ensure clickable */
}

#back-menu-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
        color: var(--primary-red);
    }
    
    #back-menu-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        top: 0.8rem;
        right: 0.8rem;
    }
}

button {
    font-family: var(--font-body);
}

/* Login/Game button styles */
#login-btn, #restart-btn, #save-score-btn, #menu-btn {
    background: var(--primary-red);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 0 #9e1b1d;
    margin: 0.5rem;
}

#login-btn:hover, #restart-btn:hover, #save-score-btn:hover {
    transform: translateY(-2px);
    background: #e82a2c;
}

#login-btn:active, #restart-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #9e1b1d;
}

/* Input styles */
input[type="text"] {
    padding: 1rem;
    font-size: 1.2rem;
    border-radius: 10px;
    border: 2px solid #ccc;
    margin-bottom: 1rem;
    width: 100%;
    text-align: center;
    font-family: var(--font-body);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-green);
}

#timer {
    font-size: 1.2rem;
    font-weight: 600;
    background: rgba(0,0,0,0.2);
    padding: 0.2rem 1rem;
    border-radius: 20px;
}

/* Score Filters */
.score-filters {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 2px solid var(--primary-green);
    color: var(--primary-green-dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(39, 174, 96, 0.1);
}

.filter-btn.active {
    background: var(--primary-green);
    color: white;
}
