:root {
    --primary: #ff6b6b;
    --secondary: #4ecdc4;
    --dark: #1a1a2e;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--dark);
    background: radial-gradient(circle at center, #16213e 0%, #1a1a2e 100%);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Default cursor restored */
    cursor: auto;
}

body.gaming {
    /* Hide default cursor only during gameplay */
    cursor: none;
}

#custom-cursor {
    display: none;
    /* Hidden by default */
    position: fixed;
    width: 80px;
    height: 80px;
    background-image: url('pie.png');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.05s ease-out;
    /* No blending, original opaque image */
}

body.gaming #custom-cursor {
    display: block;
    /* Shown only during gameplay */
}

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

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
    z-index: 2000;
}

#permanent-leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 250px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    z-index: 2000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.gaming #permanent-leaderboard {
    opacity: 0;
    pointer-events: none;
}

.stat-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 8px 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: 2px;
}

.value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text);
}

#play-area {
    width: 100%;
    height: 100%;
}

.avatar {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-image: url('avatar.png');
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), 0 0 10px var(--primary);
    cursor: inherit;
    transition: transform 0.1s ease;
    user-select: none;
}

.avatar:active {
    transform: scale(0.9);
}

.stat-card .value {
    font-size: 1.5rem;
    /* Smaller size to fit more cards */
}

/* Input Styles */
input[type="text"] {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border);
    padding: 15px 25px;
    border-radius: 15px;
    color: white;
    font-size: 1.2rem;
    margin-bottom: 30px;
    width: 100%;
    outline: none;
    text-align: center;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: var(--secondary);
}

/* Leaderboard Styles */
.leaderboard-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--secondary);
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 2px;
}

#leaderboard-list {
    list-style: none;
}

#leaderboard-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
}

#leaderboard-list li:last-child {
    border-bottom: none;
}

#leaderboard-list .rank {
    color: var(--primary);
    margin-right: 10px;
}

#leaderboard-list .player-name {
    flex-grow: 1;
    color: white;
    /* Name in white as requested */
}

#leaderboard-list .player-score {
    color: var(--secondary);
}

/* Modals */
#overlay,
#start-screen,
#name-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: var(--glass);
    border: 2px solid var(--glass-border);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 500px;
    color: white;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
    color: #ccc;
}

button {
    background: linear-gradient(45deg, var(--primary), #ff8e8e);
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    color: white;
    font-weight: 900;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

button:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.5);
}

/* Splash effect */
.splat {
    position: absolute;
    pointer-events: none;
    font-size: 2rem;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 0 #000;
    animation: splatAnim 0.6s ease-out forwards;
    z-index: 50;
}

@keyframes splatAnim {
    0% {
        transform: scale(0.5) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(2) rotate(20deg);
        opacity: 0;
    }
}