:root {
    --bg-color: #2C3E50;
    --text-color: #ECF0F1;
    --card-bg: #34495E;
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --accent: #FFE66D;
}

body {
    margin: 0;
    font-family: 'Fredoka', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#app {
    text-align: center;
    width: 100%;
    max-width: 800px;
    padding: 10px;
    box-sizing: border-box;
}

h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--secondary);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
}

h2 {
    font-weight: 300;
    margin-bottom: 2rem;
}

.game-settings {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.input-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    /* Wrap on small screens */
}

.input-group label {
    font-size: 1.2rem;
    font-weight: bold;
}

input[type="text"] {
    padding: 0.5rem 1rem;
    font-size: 1.1rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    text-align: center;
    width: 150px;
}

.difficulty-selector {
    display: flex;
    gap: 0.5rem;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.diff-btn.active {
    background: var(--secondary);
    border-color: #fff;
    font-weight: bold;
}

.player-selection {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.player-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 150px;
    border: 4px solid transparent;
}

.player-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: var(--text-color);
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    border: 3px solid #fff;
}

.player-card h3 {
    margin: 0;
    font-size: 1.5rem;
}

.player-card p {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

.leaderboard-mini {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    text-align: left;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.hidden {
    display: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    overflow: hidden;
}

#game-area {
    width: 100%;
    height: 100%;
    position: relative;
}

#back-button {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    color: var(--bg-color);
    z-index: 100;
}

#back-button:hover {
    background: var(--accent);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Kate's Game Styles */
#memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    perspective: 1000px;
}

.memory-card {
    background-color: transparent;
    border-radius: 10px;
    height: 120px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

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

.front-face,
.back-face {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    backface-visibility: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.front-face {
    background: #fff;
    color: #333;
    transform: rotateY(180deg);
}

.back-face {
    background: var(--accent);
    color: white;
    font-size: 2rem;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    #game-container {
        height: 80vh;
        /* Use viewport height for better fit */
        border-radius: 0;
        /* Remove corners for full immersive feel */
    }

    /* Adjust Memory Game Grid */
    #memory-board {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columns for mobile */
        gap: 10px;
        padding: 10px;
    }

    .memory-card {
        height: 90px;
        /* Smaller cards */
    }

    .player-card {
        padding: 1rem;
        width: 120px;
        /* Smaller cards */
    }

    .avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}