:root {
    /* Color Palette */
    --bg-color: #1a1a1a;
    --panel-color: #242424;
    --text-color: #e0e0e0;
    --accent-color: #3b82f6;    
    --secondary-color: #4ade80; 
    --highlight-color: #facc15; 
    --danger-color: #ef4444;
    --border-color: #3f3f46;

    /* Map Configuration */
    --map-grid-cols: 20;
    --tile-size: 20px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', 'Courier New', monospace;
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* --- Layout --- */

.game-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
}

.panel {
    padding: 1.5rem;
    box-sizing: border-box;
    background-color: var(--panel-color);
    overflow-y: auto;
    scrollbar-width: thin;
}

.left-panel {
    width: 380px;
    min-width: 300px;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.right-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    gap: 2rem;
    padding: 2rem;
    background: #111111;
    position: relative;
}

/* --- Typography and Components --- */

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.title {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin: 0;
    text-shadow: 0 0 5px rgba(74, 222, 128, 0.3);
}

h3, h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    border-bottom: 1px dashed #333;
    padding-bottom: 4px;
}

.section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.small-text {
    font-size: 0.8rem;
    color: #a0a0a0;
}

#resource-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

#resource-list li {
    padding: 3px 0;
    font-size: 1rem;
}

/* --- Controls & Buttons --- */

.job-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 4px 0;
    border-radius: 4px;
    background-color: #2c2c2c;
}

.job-control span:first-child {
    flex-grow: 1;
    padding-left: 10px;
}

button {
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

button:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

/* Time Control Button */
.time-control {
    width: 80px;
    background-color: var(--secondary-color);
    color: #1a1a1a; /* Dark text for contrast */
}

.time-control.paused {
    background-color: var(--highlight-color); /* Yellow for paused/waiting */
    animation: pulse-button 2s infinite;
}

@keyframes pulse-button {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

.action-button {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
}

/* --- Event Log --- */

#event-log {
    margin-top: 10px;
    height: 120px;
    overflow-y: scroll;
    font-size: 0.75rem;
    padding: 5px;
    background-color: #111111;
    border: 1px solid #333;
    border-radius: 4px;
}

#event-log div {
    padding: 2px 0;
    border-bottom: 1px dotted #2b2b2b;
}

/* --- Map Grid --- */

#map-grid {
    display: grid;
    grid-template-columns: repeat(var(--map-grid-cols), var(--tile-size));
    grid-template-rows: repeat(var(--map-grid-cols), var(--tile-size));
    gap: 1px;
    background-color: #000;
    border: 3px solid var(--border-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 1);
}

.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    background-color: #000;
    box-sizing: border-box; 
    position: relative;
    cursor: pointer;
}

.tile:hover {
    z-index: 20;
    outline: 1px solid rgba(255, 255, 255, 0.5);
}

/* Biome Colors */
.tile.revealed.plains { background-color: #d2b48c; }
.tile.revealed.taiga { background-color: #2e8b57; }
.tile.revealed.marsh { background-color: #4682b4; }

/* Selection Styles */
.tile.player-loc { 
    box-shadow: inset 0 0 0 2px #ffffff; 
    z-index: 10;
}

.tile.selected {
    box-shadow: inset 0 0 0 2px var(--highlight-color);
    animation: pulse-selection 1.5s infinite ease-in-out;
    z-index: 15;
}

.tile.player-loc.selected {
    box-shadow: inset 0 0 0 2px #ffffff, inset 0 0 0 4px var(--highlight-color);
}

@keyframes pulse-selection {
    0% { box-shadow: inset 0 0 0 2px var(--highlight-color); }
    50% { box-shadow: inset 0 0 0 4px var(--highlight-color); }
    100% { box-shadow: inset 0 0 0 2px var(--highlight-color); }
}

/* --- Tile Info Panel --- */

#tile-info {
    width: 100%;
    max-width: 420px;
    /* Fixed height prevents layout jumps */
    height: 160px; 
    flex-shrink: 0;
    padding: 1rem;
    background-color: #111;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-y: auto;
}

#tile-details {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #b0b0b0;
}