html, body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    overflow: hidden;
    position: relative;
    background-color: black;
    font-family: Calibri, sans-serif;
    touch-action: none; /* Prevent default touch behaviors */
}

#background-overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.c1 {
    position: absolute;
    border-radius: 50%;
    opacity: 0.8;
    cursor: pointer;
    transform: scale(0);
    transition: transform 0.1s ease-in-out;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Desktop sizes */
@media (min-width: 1024px) {
    .c2 { background-color: #2ecc71; width: 275px; height: 275px; } /* Green */
    .c4 { background-color: #3498db; width: 250px; height: 250px; } /* Blue */
    .c8 { background-color: #9b59b6; width: 225px; height: 225px; } /* Purple */
    .c16 { background-color: #f1c40f; width: 200px; height: 200px; } /* Yellow */
    .c32 { background-color: #e67e22; width: 175px; height: 175px; } /* Orange */
    .c64 { background-color: #e74c3c; width: 150px; height: 150px; } /* Red */
}

/* Tablet sizes */
@media (min-width: 768px) and (max-width: 1023px) {
    .c2 { background-color: #2ecc71; width: 220px; height: 220px; }
    .c4 { background-color: #3498db; width: 200px; height: 200px; }
    .c8 { background-color: #9b59b6; width: 180px; height: 180px; }
    .c16 { background-color: #f1c40f; width: 160px; height: 160px; }
    .c32 { background-color: #e67e22; width: 140px; height: 140px; }
    .c64 { background-color: #e74c3c; width: 120px; height: 120px; }
}

/* Mobile sizes */
@media (max-width: 767px) {
    .c2 { background-color: #2ecc71; width: 165px; height: 165px; }
    .c4 { background-color: #3498db; width: 150px; height: 150px; }
    .c8 { background-color: #9b59b6; width: 135px; height: 135px; }
    .c16 { background-color: #f1c40f; width: 120px; height: 120px; }
    .c32 { background-color: #e67e22; width: 105px; height: 105px; }
    .c64 { background-color: #e74c3c; width: 90px; height: 90px; }
}

.score-ui {
    position: fixed;
    top: 2%;
    left: 2%;
    color: white;
    z-index: 100;
    pointer-events: none;
}

/* Desktop sizes */
@media (min-width: 1024px) {
    #score {
        font-size: 4em;
    }
    #level {
        font-size: 2em;
    }
    #cps-counter, #sps-counter {
        font-size: 1.5em;
    }
    .progress-bar-container {
        width: 300px;
    }
}

/* Tablet sizes */
@media (min-width: 768px) and (max-width: 1023px) {
    #score {
        font-size: 3.5em;
    }
    #level {
        font-size: 1.8em;
    }
    #cps-counter, #sps-counter {
        font-size: 1.3em;
    }
    .progress-bar-container {
        width: 250px;
    }
}

/* Mobile sizes */
@media (max-width: 767px) {
    .score-ui {
        top: 1%;
        left: 1%;
    }
    #score {
        font-size: 2.5em;
    }
    #level {
        font-size: 1.4em;
    }
    #cps-counter, #sps-counter {
        font-size: 1.1em;
    }
    .progress-bar-container {
        width: 200px;
    }
}

.progress-bar-container {
    height: 10px;
    background-color: #555;
    border-radius: 5px;
    margin-top: 5px;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: #4caf50;
    border-radius: 5px;
    transition: width 0.2s ease-in-out;
}

#level {
    opacity: 0.7;
    margin-top: 5px;
}

#cps-counter, #sps-counter {
    opacity: 0.7;
    margin-top: 5px;
}

.score-popup {
    position: absolute;
    color: #fff;
    font-size: 4em;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.05s ease-out, opacity 0.2s ease-out, top 0.25s ease-out;
    pointer-events: none;
    z-index: 50;
}

.auto-button {
    position: fixed;
    cursor: pointer;
    z-index: 101;
    pointer-events: auto;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: background-color 0.2s;
    overflow: hidden; /* Important for containing the overlay */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Desktop sizes */
@media (min-width: 1024px) {
    .auto-button {
        bottom: 5%;
        right: 2%;
        padding: 20px;
    }
    .auto-button img {
        width: 40px;
        height: 40px;
    }
}

/* Tablet sizes */
@media (min-width: 768px) and (max-width: 1023px) {
    .auto-button {
        bottom: 4%;
        right: 2%;
        padding: 18px;
    }
    .auto-button img {
        width: 35px;
        height: 35px;
    }
}

/* Mobile sizes */
@media (max-width: 767px) {
    .auto-button {
        bottom: 3%;
        right: 2%;
        padding: 15px;
    }
    .auto-button img {
        width: 30px;
        height: 30px;
    }
}

.auto-button:hover {
    background-color: #f0f0f0;
}

.auto-button:active {
    background-color: #e0e0e0;
}

.auto-button img {
    z-index: 2; /* Ensure icon is above overlay */
}

.auto-button-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.auto-button-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%);
}

.auto-button-overlay.duration {
    background-color: rgba(144, 238, 144, 0.7); /* lightgreen with 0.7 opacity */
    transform-origin: 50% 100%; /* Rotate from bottom center */
    transform: rotate(0deg);
}

.auto-button-overlay.refill {
    background-color: rgba(128, 128, 128, 0.5); /* gray with 0.5 opacity */
    transform-origin: 50% 0%; /* Rotate from top center */
    transform: rotate(0deg);
}


