/* General Styles */
body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #e8f0f3; /* Slightly different background for challenge version */
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    background-color: #0277BD; /* Blue header */
    color: white;
    padding: 1rem;
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    color: #fff; /* Ensure title is white */
}

/* Game Instructions Box */
.instructions-box {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px 25px;
    margin-bottom: 20px;
    max-width: 860px;
    width: 90%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.instructions-box h2 {
    margin-top: 0;
    color: #01579B; /* Darker blue for instruction title */
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.instructions-box h3 {
    margin-top: 15px;
    margin-bottom: 5px;
    color: #555;
}

.instructions-box ul,
.instructions-box ol {
    padding-left: 20px;
}
.instructions-box ul ul {
    padding-left: 15px;
    list-style-type: disc;
}

.instructions-box li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.instructions-box strong {
    color: #0277BD; /* Blue highlight */
}

/* Highlight target thresholds */
#goal-min-threshold, .goal-fail-threshold {
    color: #E65100; /* Orange for the 70 threshold */
    font-weight: bold;
}
#fail-min-water, #fail-min-ecology, #fail-min-satisfaction {
    color: #C62828; /* Red for hard fail conditions */
    font-weight: bold;
}

/* Hide Instructions Button */
.instructions-box button {
    display: block;
    margin: 15px auto 0;
    padding: 8px 15px;
    cursor: pointer;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
}
.instructions-box button:hover {
    background-color: #5a6268;
}

/* Hide instructions class */
.instructions-box.hidden {
    display: none;
}

/* Main Game Area */
main {
    flex: 1;
    max-width: 900px;
    width: 95%;
    margin: 0 auto 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Sections within Main */
#game-stats, #actions, #message-log-container, #game-controls {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#game-stats {
    background-color: #e3f2fd; /* Light blue background for stats */
    border: 1px solid #bbdefb;
}

#actions {
     background-color: #e8f5e9; /* Light green background for actions */
     border: 1px solid #c8e6c9;
}


#game-stats p, #actions p, #message-log p {
    margin-bottom: 0.8em;
}

h2 {
    color: #0277BD; /* Blue section titles */
    border-bottom: 2px solid #039BE5;
    padding-bottom: 5px;
    margin-top: 0;
}

.icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Action Buttons */
#action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Reduced gap slightly */
}

.action-btn, #end-turn-button, #start-button {
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: left;
    display: flex;
    align-items: center;
    font-size: 0.88em; /* Slightly smaller font for more text */
    line-height: 1.3; /* Adjust line height */
}

.action-btn img {
    margin-right: 8px;
    min-width: 16px; /* Prevent text shift if image fails */
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.action-btn {
     background-color: #66BB6A; /* Default action green */
}
.action-btn:hover:not(:disabled) {
    background-color: #4CAF50;
}

/* --- Specific Button Colors --- */
button[data-action="develop_tourism"] {
    background-color: #FFCA28; /* Amber */
    color: #424242; /* Darker text for readability */
}
button[data-action="develop_tourism"]:hover:not(:disabled) {
    background-color: #FFB300;
}

/* ===== NEW Button Colors ===== */
button[data-action="improve_social"] {
    background-color: #26A69A; /* Teal */
}
button[data-action="improve_social"]:hover:not(:disabled) {
    background-color: #00897B; /* Darker Teal */
}

button[data-action="expand_infra"] {
    background-color: #78909C; /* Blue Grey */
}
button[data-action="expand_infra"]:hover:not(:disabled) {
    background-color: #546E7A; /* Darker Blue Grey */
}
/* --- End Specific Button Colors --- */


.action-btn:disabled, #end-turn-button:disabled, #start-button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Control Buttons */
#start-button {
    background-color: #4CAF50; /* Green */
}
#end-turn-button {
    background-color: #039BE5; /* Blue */
    justify-content: center; /* Center text for end turn */
}

#start-button:hover:not(:disabled) {
     background-color: #388E3C;
}
#end-turn-button:hover:not(:disabled) {
     background-color: #0277BD;
}


/* Message Log */
#message-log-container {
     grid-column: 1 / -1;
}

#message-log {
    height: 200px; /* Slightly taller log */
    overflow-y: scroll;
    border: 1px solid #eee;
    background-color: #fff;
    padding: 10px;
    margin-top: 10px;
}

#message-log p {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    border-bottom: 1px dashed #eee;
    padding-bottom: 3px;
}

#message-log p:last-child {
    border-bottom: none;
}

/* Log Message Types */
.log-info { color: #333; }
.log-warning { color: #E65100; font-weight: bold;}
.log-error { color: #D32F2F; font-weight: bold;}
.log-win { color: #2E7D32; font-weight: bold; font-size: 1.1em;}
.log-year-end { color: #0277BD; font-style: italic;}
.log-final-score { color: #1A237E; font-weight: bold; font-size: 1.1em;} /* Dark blue for score */

/* Game Controls Section */
#game-controls {
    grid-column: 1 / -1;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Final Score Display */
#final-score {
    font-weight: bold;
    color: #1A237E; /* Dark blue */
    font-size: 1.1em;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    margin-top: 20px;
    background-color: #dcedf6; /* Light blue footer background */
    color: #444;
    font-size: 0.9em;
    width: 100%;
}

/* Responsive Adjustments */
@media (max-width: 700px) {
    main {
        grid-template-columns: 1fr;
        margin: 10px;
        padding: 10px;
        width: 90%;
    }
    #action-buttons {
        flex-direction: column;
    }
     h1 {
        font-size: 1.5em;
    }
    .instructions-box{
        width: 85%;
        padding: 10px 15px;
    }
    .action-btn, #end-turn-button, #start-button {
         font-size: 0.9em; /* Slightly larger on small screens */
    }
    #game-controls {
        flex-direction: column;
        gap: 10px;
    }
}

