/* Basic Reset & Body Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e; /* Dark space blue */
    color: #e0e0e0; /* Light grey text */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Prevent scrollbars */
}

#game-container {
    width: 100%;
    max-width: 1200px; /* Max width of the game area */
    height: 90vh; /* Adjust as needed */
    max-height: 800px;
    border: 2px solid #4a4a6a; /* Darker border */
    background-color: #2a2a4e; /* Slightly lighter background */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    position: relative; /* For positioning modals */
}

/* Top Information Bar */
#top-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background-color: #1e1e3e; /* Darker panel color */
    border-bottom: 1px solid #4a4a6a;
    border-radius: 8px 8px 0 0;
}

#top-bar div {
    font-size: 1.1em;
    font-weight: bold;
    color: #aaccff; /* Light blue text */
}

/* Main Game View */
#world-window {
    flex-grow: 1; /* Takes remaining vertical space */
    position: relative; /* For positioning elements inside if needed */
    overflow: hidden; /* Ensure canvas fits */
    background-color: #000; /* Default background if canvas isn't full size */
}

#game-canvas {
    display: block; /* Removes baseline spacing */
    width: 100%;
    height: 100%;
    /* Background image will be drawn by the rendering engine */
}

/* Control Panel Styling */
#control-panel {
    display: flex;
    justify-content: space-around; /* Distribute sections */
    align-items: center; /* Align items vertically */
    padding: 15px;
    background-color: #1e1e3e; /* Darker panel color */
    border-top: 1px solid #4a4a6a;
    border-radius: 0 0 8px 8px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens if needed */
}

.panel-section {
    display: flex;
    align-items: center;
    gap: 10px; /* Spacing between elements in a section */
    margin: 5px 10px; /* Spacing around sections */
}

/* Skeuomorphic Button Styling (Example) */
button {
    padding: 8px 15px;
    font-size: 0.95em;
    border: 1px solid #6a6a8a; /* Slightly lighter border */
    background: linear-gradient(to bottom, #4a4a6a, #3a3a5a); /* Gradient */
    color: #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s ease, transform 0.1s ease;
    min-width: 100px; /* Ensure buttons have some width */
    text-align: center;
}

button:hover {
    background: linear-gradient(to bottom, #5a5a7a, #4a4a6a);
    border-color: #8a8aac;
}

button:active, button.active {
    background: linear-gradient(to top, #4a4a6a, #3a3a5a); /* Inverted gradient */
    transform: translateY(1px);
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
    color: #ffffcc; /* Highlight active/pressed state */
}

button:disabled {
    background: #333;
    color: #777;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    border-color: #555;
}

/* Save/Load Text Area */
#save-load textarea {
    padding: 5px;
    font-size: 0.8em;
    background-color: #2a2a4e;
    border: 1px solid #4a4a6a;
    color: #e0e0e0;
    border-radius: 4px;
    width: 150px; /* Adjust as needed */
    height: 40px; /* Roughly button height */
    resize: none; /* Prevent resizing */
}

/* Modal Styling */
.modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(30, 30, 62, 0.95); /* Semi-transparent dark background */
    border: 2px solid #6a6a8a;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
    z-index: 100; /* Ensure modals are on top */
    min-width: 300px;
    max-width: 80%;
    color: #e0e0e0;
}

.modal h2 {
    margin-bottom: 15px;
    color: #aaccff;
    border-bottom: 1px solid #4a4a6a;
    padding-bottom: 5px;
}

.modal .close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #cc4444; /* Reddish close button */
    border: 1px solid #aa2222;
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    line-height: 23px; /* Center the 'X' */
    text-align: center;
    cursor: pointer;
    box-shadow: none;
    padding: 0;
    min-width: unset;
}
.modal .close-modal:hover {
    background: #dd5555;
}

#viewfinder-canvas {
     display: block;
     width: 100%;
     max-width: 500px; /* Limit viewfinder size */
     height: auto;
     aspect-ratio: 1 / 1; /* Example aspect ratio */
     background-color: #111;
     border: 1px solid #4a4a6a;
     margin: 10px auto; /* Center */
}

#save-confirm-modal textarea {
    width: 100%;
    min-height: 80px;
    margin-top: 10px;
    margin-bottom: 15px;
    background-color: #1a1a2e;
    border: 1px solid #4a4a6a;
    color: #ccffcc; /* Greenish text for code */
    font-family: monospace;
    resize: vertical;
}