:root {
    --bg-color: #1a1a1a;
    --panel-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --accent: #4CAF50;
    --danger: #ff5252;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    height: 100vh;
}

.screen {
    width: 100%;
    max-width: 1000px;
    padding: 20px;
}

.hidden { display: none !important; }

/* Start Screen */
#civ-selection-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.civ-card {
    background: var(--panel-bg);
    padding: 20px;
    border: 1px solid #444;
    cursor: pointer;
    flex: 1;
    transition: 0.2s;
}

.civ-card:hover { border-color: var(--accent); background: #333; }

/* Game Layout */
main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    height: 80vh;
}

.panel {
    background: var(--panel-bg);
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
}

/* Resources */
ul { list-style: none; padding: 0; font-size: 1.2rem; }
li { margin-bottom: 10px; }

/* Buttons */
button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
}
button:hover { opacity: 0.9; }
button:disabled { background: #555; cursor: not-allowed; }

/* Worker Card */
.worker-card {
    background: #383838;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 4px;
    border-left: 4px solid #777;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.worker-stats { font-size: 0.8rem; color: #aaa; }
.prof-high { color: #4CAF50; font-weight: bold; } /* Green for good skills */

.save-indicator {
    color: var(--accent);
    opacity: 0;
    transition: opacity 1s;
    font-size: 0.8rem;
}
.saved { opacity: 1; }

/* Season Indicator in Top Right */
#season-indicator {
    position: absolute;
    top: 20px;
    right: 270px;
    background: #222;
    padding: 10px 15px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    text-align: right;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#season-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    text-transform: uppercase;
}

#season-bonus {
    font-size: 0.9rem;
    color: #bbb;
}

/* Threat Indicator */
#threat-indicator {
    position: absolute;
    top: 20px;
    right: 450px;
    background: #3e2723;
    padding: 10px 15px;
    border: 2px solid #ff5252;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    animation: pulse-red 2s infinite;
}

#threat-msg {
    font-size: 1.0rem;
    font-weight: bold;
    color: #ff5252;
    text-transform: uppercase;
}

#threat-timer {
    font-size: 1.2rem;
    color: #fff;
    font-weight: bold;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 82, 82, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0); }
}

/* Market Layout */
.trade-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #333;
    margin-bottom: 5px;
    padding: 8px;
    border-radius: 4px;
}
.trade-rate { font-size: 0.8rem; color: #888; }

/* Top Right Prestige Button */
#btn-prestige {
    background: #9C27B0; /* Purple for "Epic" feel */
    color: white;
    border: 1px solid #E1BEE7;
    margin-left: 10px;
    display: none; /* Hidden by default */
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(156, 39, 176, 0); }
    100% { box-shadow: 0 0 0 0 rgba(156, 39, 176, 0); }
}

/* Legacy Shop Section on Start Screen */
#legacy-shop {
    margin-top: 30px;
    padding: 20px;
    background: #221a24; /* Dark purple tint */
    border-radius: 8px;
    border: 1px solid #4a2c52;
}

.legacy-card {
    background: #3e2645;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
}

.legacy-cost {
    color: #ffd700; /* Gold */
    font-weight: bold;
}

/* Management Panel container */
.management-panel {
    padding: 0; /* padding handled by inner tabs */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contains the content */
}

/* Tab Navigation Bar */
.tab-nav {
    display: flex;
    background: #222;
    border-bottom: 1px solid #444;
}

.tab-btn {
    flex: 1; /* Stretch to fill width */
    background: transparent;
    border: none;
    padding: 15px;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 0; /* Reset generic button radius */
}

.tab-btn:hover {
    background: #2a2a2a;
    color: #fff;
}

/* Active Tab Style */
.tab-btn.active {
    background: var(--panel-bg); /* Matches the panel body */
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
    font-weight: bold;
}

/* Tab Content Areas */
.tab-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto; /* Scroll ONLY the content, not the tabs */
}

/* Utility to hide inactive tabs */
.tab-content.hidden {
    display: none;
}

.facility-card {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

.facility-card:hover {
    border-color: var(--accent);
    background: #333;
}

.facility-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: #fff;
}

.facility-stats {
    font-size: 0.9rem;
    color: #bbb;
}

.prod-rate {
    color: var(--accent);
    font-weight: bold;
}

.recruit-btn {
    background: #1e88e5; /* Blue for recruiting */
    padding: 8px 15px;
    min-width: 120px;
    text-align: center;
}
.recruit-btn:disabled {
    background: #444;
}

.job-group {
    margin-bottom: 20px;
    background: #222;
    padding: 10px;
    border-radius: 6px;
    border-left: 4px solid #555;
}

.job-header {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.worker-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 4px 0;
    border-bottom: 1px solid #333;
}

.worker-age { color: #bbb; }
.worker-skill { color: var(--accent); }
.skill-low { color: #aaa; }
.skill-high { color: #4CAF50; font-weight: bold; }

/* Distinct style for the Retired group */
.job-group.retired {
    border-left-color: #777;
    background: #1a1a1a;
    opacity: 0.8;
}

.job-group.retired .job-header {
    color: #888;
}

.worker-detail-row.is-retired {
    color: #777;
}

/* FAQ Tab Styles */
.faq-entry {
    background: #2a2a2a;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border-left: 4px solid #888;
}
.faq-entry h4 {
    margin: 0 0 5px 0;
    color: var(--accent);
}
.faq-entry p {
    margin: 0;
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.5;
}

/* World Tab */
.village-card {
    background: #222;
    border: 1px solid #555;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}
.village-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 5px;
}
.village-stats {
    font-size: 0.9rem;
    color: #bbb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}
.raid-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
    background: #2a2a2a;
    padding: 10px;
}
.mission-card {
    background: #3e2723;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid #ff5722;
}
.progress-bar {
    height: 6px;
    background: #111;
    margin-top: 5px;
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #ff5722;
    width: 0%;
    transition: width 0.5s linear;
}

.tab-btn:focus {
    outline: none;
}

/* Sub Tabs (Command Tab) */
.sub-tab-nav {
    display: flex;
    background: #252525;
    margin-bottom: 15px;
    border-radius: 4px;
    padding: 5px;
    gap: 5px;
}

.sub-tab-btn {
    flex: 1;
    background: #333;
    border: none;
    padding: 8px;
    color: #aaa;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
}
.sub-tab-btn.active {
    background: var(--accent);
    color: white;
    font-weight: bold;
}
.sub-tab-btn:hover:not(.active) {
    background: #444;
}

/* Reports */
.report-card {
    background: #222;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid #555;
    font-size: 0.9rem;
}
.report-victory {
    border-left-color: var(--accent);
}
.report-defeat {
    border-left-color: var(--danger);
}
.report-header {
    margin-bottom: 5px;
    border-bottom: 1px solid #333;
    padding-bottom: 3px;
}

/* Modal Popup */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #555;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Achievements */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}
.achievement-square {
    width: 60px;
    height: 60px;
    background: #444;
    border: 2px solid #666;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: help;
    position: relative;
}
.achievement-square.unlocked {
    background: #2e7d32; /* Greenish */
    border-color: #4CAF50;
}
.achievement-square.secret {
    background: #000;
    border-color: #333;
    color: #fff;
}

#global-tooltip {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    width: 200px;
    background-color: #222;
    color: #fff;
    border-radius: 6px;
    padding: 10px;
    border: 1px solid #555;
    font-size: 0.8rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
