/* Global Reset & Anti-Scrolling */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Absolutely no scrolling */
    font-family: 'Nunito', sans-serif;
    background-color: #f0f2f5; /* Light, clean background */
    color: #333;
}

:root {
    --control-panel-width: 220px;
    --panel-padding: 20px;
    --gap: 20px;
}

/* Main Game Container */
.maze-game-container {
    display: flex;
    width: 100vw;
    height: 100dvh;
    padding: var(--panel-padding);
    box-sizing: border-box;
}

#circle-maze-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    gap: var(--gap);
}

/* Side Panels */
#circle-character-selection,
#circle-controls-panel {
    flex: 0 0 var(--control-panel-width);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--panel-padding);
    box-sizing: border-box;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

#circle-character-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-content: center;
    gap: 15px;
}

#circle-controls-panel {
    justify-content: flex-start;
    gap: 15px;
}

.panel-heading {
    width: 100%;
    text-align: center;
    font-size: 1.4em;
    font-weight: 800;
    color: #4a4e69;
    margin: 0 0 10px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

#circle-layer-selection {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

/* Maze Wrapper */
.maze-wrapper {
    position: relative; /* Crucial for overlay positioning */
    height: 100%;
    max-width: calc(100vw - (2 * var(--control-panel-width)) - (4 * var(--panel-padding)) - (2 * var(--gap)));
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

maze-circle {
    width: 100%;
    height: 100%;
}

/* Buttons */
.character-btn {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    cursor: pointer;
    border: 5px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.character-btn:hover {
    transform: scale(1.05);
}

.character-btn.selected {
    border-color: #fca311;
    box-shadow: 0 0 10px #fca311;
}

.control-button {
    width: 100%;
    padding: 12px 15px;
    font-weight: 700;
    font-size: 1em;
    cursor: pointer;
    border-radius: 8px;
    border: 2px solid #4a4e69;
    background-color: transparent;
    color: #4a4e69;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.control-button:hover {
    background-color: #dcdcde;
}

.control-button.active {
    background-color: #4a4e69;
    color: white;
}

.back-button {
    margin-top: auto;
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* --- Win Overlay --- */
#win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%; /* Match the maze shape */
    pointer-events: none; /* Let clicks pass through if needed */
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s;
}

#win-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#win-message-box {
    text-align: center;
    position: relative;
}

#win-text {
    font-size: 5vw; /* Responsive font size */
    font-weight: 800;
    color: transparent;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    animation: rainbow-text-animation 4s ease infinite;
}

@keyframes rainbow-text-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Falling Stars --- */
.stars-container {
    position: absolute;
    top: -100px; /* Start above the text */
    left: 50%;
    width: 200%; /* Wider to feel more random */
    height: 200%;
    transform: translateX(-50%);
    pointer-events: none;
}

.star {
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px white;
    animation: fall linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(150vh) rotate(360deg); /* Fall a long way */
        opacity: 0;
    }
}

/* Responsive Layout */
@media (max-width: 800px), (orientation: portrait) {
    /* ... existing responsive styles ... */
     #win-text {
        font-size: 12vw;
    }
}
