body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Align to top */
    min-height: 100vh;
    margin: 0;
    padding-top: 20px; /* Add some space at the top */
    background-color: #f0f2f5; /* Slightly cooler light gray */
    color: #333;
    text-align: center;
}

header {
    margin-bottom: 20px;
    color: #2c3e50; /* Darker blue-gray for header */
}

.simulator-container {
    border: 3px solid #4a4a4a; /* Darker border */
    border-radius: 10px; /* Slightly more rounded */
    display: inline-block; 
    position: relative;
    background-color: #E0C0B0; 
    box-shadow: 0 8px 20px rgba(0,0,0,0.25); /* Deeper shadow */
    width: 400px; 
    height: 500px;
    overflow: hidden; 
}

#fadeCanvas {
    display: block;
    background-color: transparent; 
    /* cursor will be 'none' when powered on, managed by JS */
}

.controls-container {
    margin-top: 25px; /* More spacing */
    padding: 20px; /* More padding */
    background-color: #ffffff; /* White background for controls */
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px; /* Increased gap */
    width: 85%;
    max-width: 450px; 
}

.controls-container button {
    padding: 12px 20px; /* Larger buttons */
    font-size: 1.05em; /* Slightly larger font */
    border: none;
    border-radius: 6px;
    background-color: #007bff; /* Standard blue */
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease; /* Added transform */
}

.controls-container button:hover {
    background-color: #0069d9;
    transform: translateY(-1px); /* Slight lift on hover */
}
.controls-container button:active {
    transform: translateY(0px); /* Press down effect */
}

#powerButton.powered-on {
    background-color: #dc3545; /* Standard red */
}
#powerButton.powered-on:hover {
    background-color: #c82333; 
}

.controls-container button:disabled,
.controls-container button:disabled:hover {
    background-color: #adb5bd; /* More distinct disabled color */
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
    transform: translateY(0); /* No hover transform for disabled */
}

.guard-select {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    justify-content: center; /* Center wrapped buttons */
    align-items: center;
    gap: 8px; /* Smaller gap between guard buttons specifically */
}

.guard-select span {
    font-weight: bold;
    margin-bottom: 5px; /* Add margin if wraps */
    width: 100%; /* Make span take full width for alignment */
    text-align: center;
}

.guard-button {
    background-color: #e9ecef; /* Lighter gray for guards */
    color: #212529; /* Darker text for guards */
    padding: 8px 12px; /* Slightly smaller guard buttons */
    font-size: 0.9em;
}
.guard-button:hover {
    background-color: #ced4da;
}
.guard-button.active {
    background-color: #007bff;
    color: white;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.6); /* Enhanced active shadow */
}

.guard-button:disabled,
.guard-button:disabled:hover {
    background-color: #ced4da;
    color: #6c757d;
}

.guard-button.active:disabled,
.guard-button.active:disabled:hover { 
    background-color: #80bdff; 
    color: #f8f9fa;
    box-shadow: none;
}

.instructions {
    margin-top: 25px;
    font-size: 1em; /* Slightly larger instructions */
    color: #495057; /* Softer black */
    line-height: 1.6;
}

footer {
    margin-top: 30px; /* More space before footer */
    font-size: 0.9em;
    color: #6c757d;
}

#secretEndingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Darker overlay */
    color: white;
    display: none; /* Initially hidden */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1000; /* Ensure it's on top */
    padding: 20px;
    box-sizing: border-box;
}

#secretEndingScreen img {
    max-width: 80%;
    max-height: 70vh; /* Max height relative to viewport height */
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#secretEndingScreen p {
    font-size: 2em; /* Larger text */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}