body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #a18cd1;
    font-family: 'Nunito', sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- Controls (Top Right) --- */
#controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    gap: 15px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #fff;
    font-size: 1.5rem;
    color: #6c5ce7;
    /* Icon color matches theme */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, background 0.2s;
}

.icon-btn:active {
    transform: scale(0.9);
}

.icon-btn:hover {
    background: #fff;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#score-display {
    position: absolute;
    top: 40px;
    font-size: 5rem;
    font-weight: 900;
    color: white;
    opacity: 0.9;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* Popups (Glassmorphism) */
#start-screen,
#game-over-screen,
#pause-screen,
#settings-screen {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px 50px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 4px solid white;
    pointer-events: auto;
    display: none;
    min-width: 250px;
}

#start-screen.active,
#game-over-screen.active,
#pause-screen.active,
#settings-screen.active {
    display: block;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

h1 {
    margin: 0 0 15px 0;
    font-size: 2.5rem;
    color: #6c5ce7;
    text-transform: uppercase;
}

p {
    font-size: 1.2rem;
    color: #636e72;
    font-weight: 700;
}

#final-score {
    font-size: 2rem;
    color: #2d3436;
    font-weight: 900;
}

#high-score {
    font-size: 1.2rem;
    color: #b2bec3;
    margin-bottom: 20px;
    font-weight: 700;
}

.action-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    box-shadow: 0 8px 0 #5849be;
    transition: transform 0.1s, box-shadow 0.1s;
    margin-top: 10px;
}

.action-btn:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #5849be;
}

/* --- Toggle Switch Styles --- */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #2d3436;
    font-weight: 700;
    gap: 20px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #6c5ce7;
}

input:checked+.slider:before {
    transform: translateX(26px);
}
