body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
    font-family: 'Arial', sans-serif;
}

#game-container {
    width: 1000px;
    height: 600px;
    position: relative;
    background-image: url('background.png');
    background-size: cover;
    border: 10px solid #55aaff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: none; /* Hide default cursor */
}

/* Professor UI */
#professor-ui {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: flex-start;
    z-index: 100;
}

#professor-bubbles {
    width: 80px;
    height: 80px;
    image-rendering: optimizeSpeed; /* For crisp cartoon images */
}

#speech-bubble {
    background-color: white;
    border: 3px solid #333;
    border-radius: 20px;
    padding: 10px 15px;
    margin-left: 10px;
    position: relative;
    max-width: 250px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

#speech-bubble::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 15px solid white;
    left: -15px;
    top: 30px; 
}

#speech-bubble::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    border-right: 18px solid #333;
    left: -18px;
    top: 27px; 
    z-index: -1;
}

#professor-message {
    margin: 0;
    color: #333;
    font-size: 1.1em;
}

/* Magnet Cursor */
#magnet-cursor {
    position: absolute;
    width: 60px;
    height: 60px;
    pointer-events: none; /* Crucial: ensures it doesn't interfere with mouse events for game container */
    transform: translate(-50%, -50%); /* Center magnet image on cursor location */
    z-index: 50;
    transition: transform 0.05s ease-out; /* Smooth movement feel */
}

#magnet-cursor img {
    width: 100%;
    height: 100%;
}

/* Game Objects */
.game-object {
    position: absolute;
    width: 40px; /* Base size for objects */
    height: 40px;
    /* transition: transform 0.1s linear; */ /* Removed transform transition for manual physics movement */
    cursor: default;
    user-select: none;
    z-index: 10;
}

.game-object img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.magnetic {
    /* Magnetic items might pulse or have a slight visual cue */
}

.non-magnetic {
    /* Non-magnetic items */
}

/* New: Visual hint for Level 4 */
.magnetic-field-line {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(circle, rgba(255, 255, 0, 0.6) 0%, rgba(255, 140, 0, 0.2) 50%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.5s;
}

/* Scoreboard */
#score-board {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 1.5em;
    font-weight: bold;
    color: #007bff;
    z-index: 100;
    border: 3px solid #007bff;
}

/* Level UI */
#level-ui {
    position: absolute;
    top: 10px;
    left: 300px; /* Offset from professor UI */
    background-color: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 1.5em;
    font-weight: bold;
    color: #cc44ff;
    z-index: 100;
    border: 3px solid #cc44ff;
    display: flex;
    gap: 15px;
}

/* Overlay Styles (Intermission/Game Over) */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    transition: opacity 0.5s;
}

#overlay.hidden {
    display: none;
}

#overlay-content {
    background-color: #ffe082; /* Warm color */
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    border: 5px solid #ff9800;
    max-width: 80%;
}

#overlay-title {
    color: #e65100;
    font-size: 3em;
    margin-top: 0;
    text-shadow: 2px 2px #fff;
}

#overlay-text {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 20px;
}

#next-button {
    background-color: #4CAF50;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
}

#next-button:hover {
    background-color: #45a049;
}

#star-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.star {
    width: 50px;
    height: 50px;
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}