* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #FAFAFA;
    cursor: url("asset/cursor.png") 0 0, auto;
}


#app-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden; /* Prevent scrollbars from candies at the edge */
}

#onboarding-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 28px;
    color: #DFDFDF;
    letter-spacing: 0.05em;
    pointer-events: none;
    user-select: none;
    z-index: 10;
    opacity: 0;
    animation: 
        fade-in 1s ease forwards,
        pulse 3s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

#onboarding-text.fade-out {
    opacity: 0 !important;
}

@keyframes fade-in {
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.03); }
}

/* Control Panel */
#control-panel {
    position: fixed;
    top: 17px;
    right: 17px;
    background-color: #f8f7f7;
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 30px;
    z-index: 100;
}

.ctrl-btn {
    height: 36px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: url("asset/cursor.png") 0 0, pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.music-btn {
    width: 58px;
    background-color: #fcfcfc;
    border: none;
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.1), 0px 1px 2px 0px rgba(0,0,0,0.1);
}

.music-btn:hover {
    background-color: #f4f4f4;
    box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.12), 0px 2px 3px 0px rgba(0,0,0,0.12);
}

.restart-btn {
    padding: 0 16px;
    min-width: 87px;
    background-color: transparent;
    border: 1px solid #dfdfdf;
    gap: 4px;
}

.restart-btn:hover {
    background-color: #f0f0f0;
}

.ctrl-btn img {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.restart-btn span {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: #6a6a6a;
    letter-spacing: -0.15px;
    pointer-events: none;
}

.candy {
    --rotation: 0deg;
    position: absolute;
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1);
    user-select: none;
    pointer-events: none;
    max-width: 120px; /* Prevent oversized images */
    height: auto; /* Maintain aspect ratio */
    animation: pop-in 0.25s ease-out;
    transition: filter 0.4s ease;
}

.candy.carrying {
    filter: drop-shadow(0px 6px 10px rgba(0, 0, 0, 0.22));
}

.candy.sliding {
    transition: left 0.35s ease-out, top 0.35s ease-out, transform 0.35s ease-out;
}

.ant {
    position: absolute;
    z-index: 1; /* Below the candy */
    pointer-events: none;
    user-select: none;
    /* transition properties are managed in JavaScript for 2-phase movement */
}

@keyframes pop-in {
    0% { transform: translate(-50%, -50%) rotate(var(--rotation)) scale(0.8); }
    50% { transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1.1); }
    100% { transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1.0); }
}
