/* Dynamic viewport handling */
:root {
    --viewport-height: 100vh;
}

/* Support for mobile browsers with dynamic viewport */
@supports (height: 100dvh) {
    :root {
        --viewport-height: 100dvh;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #2c3e50;
    color: #ecf0f1;
    overflow: hidden;
    height: var(--viewport-height);
}

#game-container {
    height: var(--viewport-height);
    display: flex;
    flex-direction: column;
}

/* Navigation */
#view-navigation {
    background: #34495e;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    border-bottom: 3px solid #1abc9c;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: #1abc9c;
    box-shadow: 0 4px 15px rgba(26, 188, 156, 0.3);
}

.nav-btn.locked {
    background: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-btn.locked:hover {
    background: #7f8c8d;
    transform: none;
}

/* Game Views */
#game-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for proper flex behavior */
}

.game-view {
    display: none;
    flex: 1;
    padding: 0.5rem;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
    min-height: 0; /* Important for proper flex behavior */
}

.game-view.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Village View */
.village-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    flex-shrink: 0; /* Prevent header from shrinking */
}

.village-header h2 {
    color: #1abc9c;
    font-size: 1.5rem;
}

.resource-panel {
    display: flex;
    gap: 2rem;
    font-weight: bold;
    font-size: 0.9rem;
}

.resource-panel span {
    color: #ecf0f1;
}

/* Scout Report Bar */
.scout-report-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    border: 2px solid rgba(255,255,255,0.1);
}

.scout-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex: 1;
}

.day-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.scout-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 200px;
}

.scout-progress-bar {
    position: relative;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

.scout-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1abc9c, #16a085);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 20%; /* Default to day 1 of 5 */
    position: relative;
}

.scout-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.scout-progress-text {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    margin-top: 2px;
}

.auto-play-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 70px;
    height: 40px;
}

.auto-play-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.auto-play-btn.active {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.auto-play-btn.active:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.day-counter {
    font-weight: bold;
    font-size: 1rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.scout-status {
    font-size: 0.9rem;
    color: #f8f9fa;
    font-style: italic;
}

.end-day-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 0.9rem;
}

.end-day-btn:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.end-day-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.village-content {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 0 1rem 1rem 1rem;
    min-height: 0;
    overflow: hidden;
}

/* Four-column layout with ratios: 0.6:5:0.6:0.8 (Production:Grid:Manager:Buildings) */
.production-planner {
    flex: 0.6;
    min-width: 150px;
}

.village-grid {
    flex: 5;
    min-width: 600px;
}

.village-manager {
    flex: 0.6;
    min-width: 150px;
}

.building-menu {
    flex: 0.8;
    min-width: 160px;
}

.village-grid {
    background: linear-gradient(135deg, #4a4a4a, #5a5a5a);
    border-radius: 8px;
    position: relative;
    min-height: 400px;
    cursor: grab;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
    overflow: hidden; /* This creates the viewport effect */
    user-select: none;
}

.village-grid:active {
    cursor: grabbing;
}

.village-grid.dragging {
    cursor: grabbing;
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
}

.village-grid-content {
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    position: absolute;
    width: 200%;
    height: 200%;
    top: 0;
    left: 0;
}

.village-grid.build-mode {
    cursor: crosshair;
    box-shadow: inset 0 0 20px rgba(255,255,255,0.2);
}

/* Terrain Tiles */
.terrain-tile {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.1);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 1;
    transition: all 0.2s ease;
    user-select: none;
}

.terrain-tile:hover {
    border-color: rgba(255,255,255,0.3);
    transform: scale(1.05);
    z-index: 2;
}

.terrain-tile.grass {
    background-color: #4a7c59;
}

.terrain-tile.forest {
    background-color: #2d5a27;
}

.terrain-tile.hills {
    background-color: #8b7355;
}

.terrain-tile.water {
    background-color: #4a90e2;
    animation: water-flow 3s ease-in-out infinite;
}

.terrain-tile.fertile {
    background-color: #6b8e23;
}

.terrain-tile.rocky {
    background-color: #696969;
}

@keyframes water-flow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Building placement on terrain */
.building {
    z-index: 10;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.building:hover {
    transform: scale(1.1);
    border-color: rgba(255,255,255,0.6);
    background: rgba(0,0,0,0.4);
}

.village-sidebar {
    width: 300px;
    min-width: 300px;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 100%;
}

.building-menu h3,
.village-info h3 {
    margin: 0 0 0.75rem 0;
    color: #1abc9c;
    font-size: 1rem;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.4rem;
    text-align: center;
    font-weight: 600;
}

.build-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.4rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.build-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.build-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

.build-btn.selected {
    background: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.village-info {
    margin-top: 2rem;
}

.village-info p {
    margin-bottom: 0.5rem;
    color: #bdc3c7;
}

/* Building Styles */
.building {
    position: absolute;
    width: 45px;
    height: 45px;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.building:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.building.house { 
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.building.farm { 
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.building.townCenter { 
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.building.barracks { 
    background: linear-gradient(135deg, #34495e, #2c3e50);
}

/* Battle View */
.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #8b4513, #a0522d);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.battle-header h2 {
    color: #fff;
    font-size: 1.5rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.battle-content {
    display: flex;
    height: calc(100% - 100px);
    gap: 1rem;
}

#battle-field {
    flex: 1;
    background: linear-gradient(135deg, #8b4513, #a0522d);
    border-radius: 8px;
    position: relative;
    min-height: 400px;
    padding: 2rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

.battle-info {
    color: #fff;
    text-align: center;
}

.battle-info p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

#battle-log {
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1rem;
    min-height: 200px;
    color: #ecf0f1;
    font-family: monospace;
    font-size: 0.9rem;
}

.army-panel {
    width: 250px;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.army-panel h3 {
    color: #1abc9c;
    margin-bottom: 1rem;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.5rem;
}

/* Monarch View */
.monarch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.monarch-header h2 {
    color: #fff;
    font-size: 1.5rem;
}

.gold-display {
    font-size: 1.3rem;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.monarch-content {
    height: calc(100% - 100px);
    overflow-y: auto;
}

.investment-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.investment-category {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.investment-category h3 {
    color: #1abc9c;
    margin-bottom: 1rem;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.5rem;
}

.investment-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    text-align: left;
}

.investment-btn:hover {
    background: #e67e22;
    transform: translateX(5px);
}

.investment-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

/* Throne View */
.throne-header {
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.throne-header h2 {
    color: #f1c40f;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.throne-header p {
    color: #bdc3c7;
}

.throne-content {
    display: flex;
    height: calc(100% - 100px);
    gap: 2rem;
}

.merge-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

.merge-slot {
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    border: 2px dashed rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.merge-slot:hover {
    background: rgba(255,255,255,0.2);
    border-color: #1abc9c;
}

.merge-info {
    width: 300px;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.merge-info h3 {
    color: #1abc9c;
    margin-bottom: 1rem;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.5rem;
}

#active-bonuses p {
    color: #bdc3c7;
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .village-content,
    .battle-content,
    .throne-content {
        flex-direction: column;
    }
    
    .village-sidebar,
    .army-panel,
    .merge-info {
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .investment-categories {
        grid-template-columns: 1fr;
    }
    
    .resource-panel {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.building.producing {
    animation: pulse 2s infinite;
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.battle-log-entry {
    animation: slideIn 0.5s ease;
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    border-left: 3px solid #1abc9c;
    padding-left: 0.5rem;
}

/* Quest/Expedition View Styles */
.quest-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-bottom: 2px solid #1abc9c;
}

.quest-header h2 {
    margin-bottom: 0.5rem;
    color: #1abc9c;
}

.expedition-container {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.expedition-card {
    background: #34495e;
    border-radius: 10px;
    padding: 1.5rem;
    border: 2px solid #3498db;
    transition: all 0.3s ease;
}

.expedition-card:hover {
    border-color: #1abc9c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 188, 156, 0.2);
}

.expedition-card h3 {
    color: #1abc9c;
    margin-bottom: 0.5rem;
}

.expedition-details {
    margin: 1rem 0;
}

.travel-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.travel-info span {
    font-size: 0.9rem;
    color: #bdc3c7;
}

.rewards-preview {
    background: #2c3e50;
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.rewards-preview strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #f39c12;
}

.rewards-preview span {
    display: block;
    font-size: 0.85rem;
    color: #ecf0f1;
}

.expedition-btn {
    width: 100%;
    padding: 0.75rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.expedition-btn:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-1px);
}

.expedition-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

/* Travel Screen Styles */
.travel-screen {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.travel-progress {
    background: #34495e;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #2c3e50;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1abc9c, #3498db);
    transition: width 0.5s ease;
}

.army-status {
    background: #34495e;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.status-grid div {
    background: #2c3e50;
    padding: 0.75rem;
    border-radius: 5px;
    text-align: center;
}

.travel-events {
    background: #34495e;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.event-log {
    max-height: 200px;
    overflow-y: auto;
    background: #2c3e50;
    padding: 1rem;
    border-radius: 5px;
}

.travel-event {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-left: 3px solid #3498db;
    padding-left: 1rem;
}

.travel-event.positive {
    border-left-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.travel-event.negative {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.event-time {
    color: #95a5a6;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.travel-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.travel-actions button {
    padding: 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.travel-actions button:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.return-journey {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.return-journey .travel-progress {
    background: rgba(255, 255, 255, 0.1);
}

/* Modal System Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 35, 50, 0.9));
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Achievement Modal - Position at top */
.modal-overlay .achievement-modal {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        backdrop-filter: blur(0px);
    }
    to { 
        opacity: 1; 
        backdrop-filter: blur(8px);
    }
}

.modal-content {
    background: linear-gradient(145deg, #1a252f, #2c3e50);
    border: 3px solid #3498db;
    border-radius: 25px;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.9),
        0 0 60px rgba(52, 152, 219, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        inset 0 -2px 0 rgba(0, 0, 0, 0.3);
    max-width: 750px;
    width: 92%;
    max-height: 85vh;
    overflow: hidden;
    color: #ecf0f1;
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-80px) rotateX(15deg);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
    }
}

.modal-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    padding: 25px 30px;
    margin: -3px -3px 0 -3px;
    border-bottom: 2px solid #34495e;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.modal-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-body {
    padding: 30px;
    line-height: 1.7;
    font-size: 16px;
    background: linear-gradient(180deg, #2c3e50, #34495e);
}

.modal-body h3 {
    color: #3498db;
    font-size: 22px;
    margin: 25px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.modal-body ul {
    margin: 20px 0;
    padding-left: 0;
}

.modal-body li {
    margin: 12px 0;
    padding: 12px 20px;
    background: rgba(52, 152, 219, 0.1);
    border-left: 4px solid #3498db;
    border-radius: 8px;
    list-style: none;
    transition: all 0.3s ease;
}

.modal-body li:hover {
    background: rgba(52, 152, 219, 0.2);
    transform: translateX(5px);
}

.modal-body strong {
    color: #3498db;
    font-weight: 600;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.modal-close:hover {
    background: #e74c3c;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.6);
}

/* Construction Modal Styles */
.construction-info {
    text-align: center;
}

.construction-icon {
    font-size: 4rem;
    margin: 20px 0;
}

.resource-spent, .construction-time {
    margin: 25px 0;
    padding: 20px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 12px;
    border-left: 4px solid #3498db;
}

.resource-spent h4, .construction-time h4 {
    color: #3498db;
    margin-bottom: 10px;
}

#resource-spent-list {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.resource-item {
    background: rgba(231, 76, 60, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e74c3c;
    font-weight: bold;
}

/* Building Site Styles */
.building-site {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(255, 193, 7, 0.3);
    border: 2px dashed #ffc107;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: buildingPulse 2s infinite;
}

.building-site:hover {
    background: rgba(255, 193, 7, 0.5);
    transform: scale(1.1);
}

.building-site::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, transparent, #ffc107, transparent);
    border-radius: 2px;
}

@keyframes buildingPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
}

.building-site .progress-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: conic-gradient(#28a745 var(--progress, 0%), transparent 0%);
    padding: 2px;
    transition: background 0.5s ease;
}

.building-site .progress-inner {
    width: 100%;
    height: 100%;
    background: rgba(255, 193, 7, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

/* Completed Building Styles */
.building {
    position: absolute;
    transition: all 0.3s ease;
    z-index: 10;
}

.building:hover {
    z-index: 20;
}

/* Message Modal Styles */
.message-modal {
    text-align: center;
    padding: 1rem;
}

.message-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.message-text {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    color: #ecf0f1;
}

.message-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.message-modal-warning .message-text {
    color: #f39c12;
}

.message-modal-error .message-text {
    color: #e74c3c;
}

.message-modal-success .message-text {
    color: #27ae60;
}

.modal-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #1abc9c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    color: #1abc9c;
    font-size: 1.4rem;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #bdc3c7;
    font-size: 2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.1s, color 0.1s;
}

.modal-close-btn:hover {
    background: rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.12);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    color: #ecf0f1;
}

/* Quest Menu Modal Specific Styles */
.quest-menu-modal .modal-body {
    padding: 1rem;
}

.expedition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.expedition-card {
    background: #2c3e50;
    border-radius: 10px;
    padding: 1.5rem;
    border: 2px solid #3498db;
    transition: all 0.3s ease;
}

.expedition-card:hover {
    border-color: #1abc9c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 188, 156, 0.2);
}

.expedition-card h4 {
    color: #1abc9c;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.expedition-description {
    color: #bdc3c7;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.expedition-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.stat-icon {
    width: 20px;
    text-align: center;
}

.expedition-rewards {
    background: rgba(52, 73, 94, 0.5);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.expedition-rewards strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #f39c12;
}

.rewards-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rewards-list span {
    font-size: 0.85rem;
    color: #ecf0f1;
}

.expedition-start-btn {
    width: 100%;
    padding: 1rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.expedition-start-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Active Expedition Styles */
.active-expedition {
    padding: 1rem;
}

.expedition-progress {
    background: #2c3e50;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.expedition-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.army-status, .recent-events {
    background: #2c3e50;
    padding: 1.5rem;
    border-radius: 10px;
}

.army-status h5, .recent-events h5 {
    color: #1abc9c;
    margin-bottom: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #34495e;
    border-radius: 5px;
}

.status-icon {
    width: 20px;
    text-align: center;
}

.events-list {
    max-height: 150px;
    overflow-y: auto;
}

.event-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #3498db;
    padding-left: 1rem;
    background: #34495e;
    border-radius: 0 5px 5px 0;
}

.event-item.positive {
    border-left-color: #27ae60;
}

.event-item.negative {
    border-left-color: #e74c3c;
}

.expedition-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    padding: 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Toast Notification System */
#notification-container {
    position: fixed;
    top: 80px; /* Below the top-right icons */
    right: 20px;
    z-index: 1100;
    pointer-events: none;
    display: flex !important; /* Override inline style */
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.toast-notification {
    pointer-events: auto;
    font-family: inherit;
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.3;
}

/* Legacy notification styles (keeping for compatibility) */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    pointer-events: none;
}

.notification {
    background: #34495e;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 350px;
}

.notification.notification-enter {
    transform: translateX(0);
    opacity: 1;
}

.notification.notification-exit {
    transform: translateX(100%);
    opacity: 0;
}

.notification-content {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-message {
    flex: 1;
    color: #ecf0f1;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: #bdc3c7;
    font-size: 1.5rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.1s, color 0.1s;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.12);
}

/* Notification Types */
.notification-success {
    border-left: 4px solid #27ae60;
}

.notification-error {
    border-left: 4px solid #e74c3c;
}

.notification-warning {
    border-left: 4px solid #f39c12;
}

.notification-info {
    border-left: 4px solid #3498db;
}

/* Confirmation Dialog */
.confirmation-dialog {
    text-align: center;
    padding: 1rem;
}

.confirmation-message {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.5;
    color: #ecf0f1;
}

.confirmation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #e74c3c;
    color: white;
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

    .btn-secondary:hover {
        background: #7f8c8d;
        transform: translateY(-1px);
    }

/* Building Button Styles */
.building-btn {
    padding: 12px 16px;
    margin: 4px;
    background: linear-gradient(145deg, #34495e, #2c3e50);
    color: #ecf0f1;
    border: 2px solid #3498db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.building-btn:hover {
    background: linear-gradient(145deg, #3498db, #2980b9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.building-btn.selected {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    border-color: #e74c3c;
    animation: selectedPulse 1.5s infinite;
}

@keyframes selectedPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(231, 76, 60, 0);
    }
}

.building-btn:disabled {
    background: linear-gradient(145deg, #7f8c8d, #95a5a6);
    border-color: #95a5a6;
    color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* Small Notification Modal */
.notification-modal {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(145deg, #27ae60, #2ecc71);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 350px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.notification-modal.show {
    transform: translateX(0);
}

.notification-modal.error {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}

.notification-modal.warning {
    background: linear-gradient(145deg, #f39c12, #e67e22);
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.3;
}

    /* Tutorial Modal Styles */
    .tutorial-modal .tutorial-content {
        padding: 1rem;
    }

    /* Story-driven tutorial styles */
    .story-panel {
        background: linear-gradient(135deg, rgba(44, 62, 80, 0.95), rgba(52, 73, 94, 0.95));
        border: 2px solid #3498db;
        border-radius: 12px;
        padding: 1.5rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .story-panel p {
        margin-bottom: 1rem;
        line-height: 1.6;
        font-size: 1.05em;
    }

    .story-panel em {
        color: #f39c12;
        font-style: italic;
        font-weight: 500;
    }

    .story-panel .highlight {
        background: rgba(241, 196, 15, 0.3);
        padding: 2px 6px;
        border-radius: 4px;
        color: #f1c40f;
        font-weight: bold;
    }

    .tutorial-instruction {
        background: rgba(46, 204, 113, 0.2);
        border: 1px solid #2ecc71;
        border-radius: 8px;
        padding: 1rem;
        margin-top: 1rem;
        text-align: center;
    }

    .tutorial-instruction strong {
        color: #2ecc71;
        font-size: 1.1em;
    }

    .tutorial-complete-stats {
        background: rgba(230, 126, 34, 0.2);
        border: 1px solid #e67e22;
        border-radius: 8px;
        padding: 1rem;
        margin-top: 1rem;
        text-align: center;
    }

    .tutorial-complete-stats h4 {
        color: #e67e22;
        margin-bottom: 0.5rem;
    }

    /* Enhanced highlight animation */
    @keyframes tutorial-pulse {
        0% {
            box-shadow: 0 0 0 0 rgba(241, 196, 15, 0.7);
            transform: scale(1);
        }
        50% {
            box-shadow: 0 0 0 10px rgba(241, 196, 15, 0.3);
            transform: scale(1.05);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(241, 196, 15, 0);
            transform: scale(1);
        }
    }

    .tutorial-highlight {
        border: 3px solid #f1c40f !important;
        background: rgba(241, 196, 15, 0.2) !important;
        position: relative;
        z-index: 1000;
        animation: tutorial-pulse 2s infinite;
        box-shadow: 0 0 20px rgba(241, 196, 15, 0.6) !important;
    }

    @keyframes tutorial-pulse {
        0% { 
            box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
        }
        50% { 
            box-shadow: 0 0 30px rgba(241, 196, 15, 0.9);
            transform: scale(1.02);
        }
        100% { 
            box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
        }
    }

    .tutorial-section {
        margin-bottom: 1.5rem;
        padding: 1rem;
        background: rgba(52, 73, 94, 0.8);
        border-radius: 8px;
        border-left: 4px solid #3498db;
    }

    .tutorial-section h4 {
        color: #1abc9c;
        margin-bottom: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .tutorial-section h5 {
        color: #e74c3c;
        margin-bottom: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .tutorial-section ul {
        list-style: none;
        padding-left: 1rem;
    }

    .tutorial-section li {
        margin-bottom: 0.5rem;
        padding-left: 1rem;
        position: relative;
    }

    .tutorial-section li:before {
        content: "▶";
        position: absolute;
        left: 0;
        color: #3498db;
    }

    .tutorial-actions {
        text-align: center;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Settings Modal Styles */
.settings-modal {
    background: linear-gradient(145deg, #1a252f, #2c3e50);
    border: 3px solid #3498db;
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.7), 0 0 40px rgba(52,152,219,0.2);
    max-width: 600px;
    width: 95vw;
    max-height: 80vh;
    color: #ecf0f1;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    padding: 0;
    overflow: hidden;
}
.settings-modal .settings-content {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px 32px 24px 32px;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #3498db #2c3e50;
}
.settings-modal .settings-content::-webkit-scrollbar {
    width: 8px;
}
.settings-modal .settings-content::-webkit-scrollbar-track {
    background: #2c3e50;
    border-radius: 4px;
}
.settings-modal .settings-content::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}
.settings-modal .settings-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(90deg, #1a252f 80%, #3498db 100%);
    z-index: 2;
    padding: 20px 32px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #34495e;
    box-shadow: 0 -2px 8px rgba(52,152,219,0.08);
}
.settings-modal .settings-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1abc9c;
    margin-bottom: 12px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 32px 0 32px;
}
.settings-modal .settings-section {
    background: rgba(52, 73, 94, 0.7);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 8px;
}
.settings-modal .settings-section h4 {
    color: #1abc9c;
    margin-bottom: 8px;
    font-size: 1.1rem;
}
.settings-modal .settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.settings-modal .settings-label {
    font-weight: 500;
    color: #ecf0f1;
}
.settings-modal .settings-input {
    background: #34495e;
    border: 1px solid #3498db;
    border-radius: 6px;
    color: #ecf0f1;
    padding: 6px 12px;
    font-size: 1rem;
}
.settings-modal .settings-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.settings-modal .settings-btn:hover {
    background: #2980b9;
}
@media (max-width: 600px) {
    .settings-modal {
        width: 98vw !important;
        max-height: 98vh !important;
        border-radius: 8px !important;
    }
    .settings-modal .settings-content {
        padding: 12px !important;
        gap: 12px !important;
        max-height: 70vh;
    }
    .settings-modal .settings-actions {
        padding: 12px !important;
    }
    .settings-modal .settings-title {
        padding: 12px 12px 0 12px !important;
    }
}
    .setting-group {
        margin-bottom: 2rem;
        padding: 1rem;
        background: rgba(52, 73, 94, 0.8);
        border-radius: 8px;
        border-left: 4px solid #e74c3c;
    }

    .setting-group h5 {
        color: #1abc9c;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .setting-item {
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .setting-item label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        cursor: pointer;
        flex: 1;
    }

    .setting-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
        accent-color: #1abc9c;
    }

    .setting-item.info-item {
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .setting-item.info-item:last-child {
        border-bottom: none;
    }

    .info-label {
        color: #bdc3c7;
        font-weight: 500;
    }

    .info-value {
        color: #1abc9c;
        font-weight: bold;
        font-family: 'Courier New', monospace;
    }

    .settings-actions {
        text-align: center;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Progression Modal Styles */
    .progression-modal .progression-content {
        padding: 1rem;
    }

    .progression-header {
        text-align: center;
        margin-bottom: 2rem;
        padding: 1rem;
        background: rgba(52, 73, 94, 0.8);
        border-radius: 8px;
        border-left: 4px solid #f39c12;
    }

    .progression-header h4 {
        color: #1abc9c;
        margin-bottom: 0.5rem;
    }

    .progression-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .progression-item {
        padding: 1rem;
        border-radius: 8px;
        display: flex;
        align-items: center;
        gap: 1rem;
        transition: all 0.3s ease;
    }

    .progression-item.unlocked {
        background: rgba(46, 204, 113, 0.2);
        border: 2px solid #2ecc71;
    }

    .progression-item.locked {
        background: rgba(149, 165, 166, 0.2);
        border: 2px solid #95a5a6;
        opacity: 0.7;
    }

    .progression-icon {
        font-size: 2rem;
        min-width: 50px;
        text-align: center;
    }

    .progression-info h5 {
        color: #ecf0f1;
        margin-bottom: 0.5rem;
    }

    .progression-info p {
        color: #bdc3c7;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .progression-status {
        font-size: 0.8rem;
        font-weight: bold;
    }

    .progression-stats {
        padding: 1rem;
        background: rgba(52, 73, 94, 0.8);
        border-radius: 8px;
        border-left: 4px solid #9b59b6;
        margin-bottom: 2rem;
    }

    .progression-stats h5 {
        color: #1abc9c;
        margin-bottom: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .stat-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }

    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        background: rgba(44, 62, 80, 0.6);
        border-radius: 4px;
    }

    .stat-label {
        color: #bdc3c7;
    }

    .stat-value {
        color: #1abc9c;
        font-weight: bold;
    }

    .progression-actions {
        text-align: center;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .btn-danger {
        background: #e74c3c;
        color: white;
    }

    .btn-danger:hover {
        background: #c0392b;
        transform: translateY(-1px);
    }

    /* Unlock Requirement Modal Styles */
    .unlock-requirement-modal .unlock-requirement-content {
        text-align: center;
        padding: 2rem;
    }

    .unlock-requirement-content .unlock-icon {
        font-size: 4rem;
        margin-bottom: 1rem;
    }

    .unlock-requirement-content .unlock-message h4 {
        color: #e74c3c;
        margin-bottom: 1rem;
        font-size: 1.2rem;
    }

    .unlock-requirement-content .requirement-text {
        color: #1abc9c;
        font-size: 1rem;
        margin-bottom: 2rem;
        font-weight: bold;
    }

    .unlock-requirement-content .unlock-actions {
        margin-top: 1.5rem;
    }

    /* Construction Queued Modal Styles */
    .construction-queued-modal .construction-queued-content {
        text-align: center;
        padding: 2rem;
    }

    .construction-queued-content .construction-icon {
        font-size: 4rem;
        margin-bottom: 1rem;
    }

    .construction-queued-content .construction-message h4 {
        color: #2ecc71;
        margin-bottom: 1rem;
        font-size: 1.3rem;
    }

    .construction-queued-content .building-name {
        color: #1abc9c;
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
        font-weight: bold;
    }

    .construction-details {
        background: rgba(52, 73, 94, 0.6);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 2rem;
        text-align: left;
    }

    .detail-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
        padding: 0.5rem;
        background: rgba(44, 62, 80, 0.4);
        border-radius: 4px;
    }

    .detail-item:last-child {
        margin-bottom: 0;
    }

    .detail-icon {
        font-size: 1.2rem;
        min-width: 20px;
        text-align: center;
    }

    .detail-text {
        color: #ecf0f1;
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .construction-queued-content .construction-actions {
        margin-top: 1.5rem;
    }

    /* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        height: 95vh;
        margin: 2.5vh 2.5vw;
    }
    
    .expedition-grid {
        grid-template-columns: 1fr;
    }
    
    .expedition-status {
        grid-template-columns: 1fr;
    }
    
    .expedition-actions {
        grid-template-columns: 1fr;
    }
    
    .notification {
        max-width: calc(100vw - 40px);
    }
}

/* Achievement Toast Modal Styles */
.achievement-toast-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    background: linear-gradient(145deg, #2c3e50, #34495e) !important;
    border: 3px solid #f39c12 !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 30px rgba(243,156,18,0.3) !important;
    animation: achievementToastIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
    max-width: 90vw !important;
    z-index: 10000 !important;
}

.achievement-toast-modal .modal-header {
    display: none !important; /* Hide the header completely for toast style */
}

.achievement-toast-modal .modal-body {
    padding: 0 !important;
}

.achievement-toast-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    text-align: left;
    position: relative;
}

.achievement-icon {
    font-size: 48px;
    flex-shrink: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.achievement-text {
    flex: 1;
    min-width: 0;
}

.achievement-text h3 {
    color: #f39c12;
    margin: 0 0 4px 0;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.achievement-title {
    color: #ecf0f1;
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: bold;
}

.achievement-description {
    color: #95a5a6;
    font-style: italic;
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    line-height: 1.3;
}

.achievement-rewards {
    background: rgba(46, 204, 113, 0.15);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #2ecc71;
    font-size: 0.9rem;
    color: #ecf0f1;
}

.achievement-rewards strong {
    color: #2ecc71;
}

.achievement-ok-btn {
    background: linear-gradient(145deg, #f39c12, #e67e22);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(243,156,18,0.3);
    flex-shrink: 0;
    align-self: flex-end;
}

.achievement-ok-btn:hover {
    background: linear-gradient(145deg, #e67e22, #d35400);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(243,156,18,0.4);
}

@keyframes achievementToastIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateY(-15deg);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.05) rotateY(0deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateY(0deg);
    }
}

/* Responsive adjustment for smaller screens */
@media (max-width: 500px) {
    .achievement-toast-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px;
    }
    
    .achievement-icon {
        font-size: 40px;
    }
    
    .achievement-ok-btn {
        align-self: center;
        width: 100%;
    }
}

/* Mini Modal Animations */
@keyframes miniModalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes miniModalSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* Mini Modal Styles */
.mini-modal {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mini-modal-header {
    user-select: none;
}

.mini-modal-close:hover {
    background: rgba(231, 76, 60, 0.25) !important;
    color: #e74c3c !important;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.12) !important;
}

.mini-modal-body {
    scrollbar-width: thin;
    scrollbar-color: #3498db #2c3e50;
}

.mini-modal-body::-webkit-scrollbar {
    width: 6px;
}

.mini-modal-body::-webkit-scrollbar-track {
    background: #2c3e50;
}

.mini-modal-body::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 3px;
}

/* Village Content Layout */
.village-content {
    display: flex;
    gap: 1rem;
    height: calc(100% - 200px); /* Adjust for header and scout bar */
}

.village-grid {
    flex: 1;
    background: rgba(52, 73, 94, 0.3);
    border-radius: 8px;
    padding: 1rem;
    min-height: 400px;
}

.village-sidebar {
    width: 300px;
    background: rgba(52, 73, 94, 0.5);
    border-radius: 8px;
    padding: 1rem;
}

.village-info h3 {
    color: #1abc9c;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.building-menu {
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    border-radius: 6px;
    padding: 0.6rem;
    border: 1px solid rgba(74, 74, 74, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.building-menu h3 {
    margin: 0 0 0.5rem 0;
    color: #e0e0e0;
    font-size: 0.9rem;
    border-bottom: 2px solid rgba(224, 224, 224, 0.2);
    padding-bottom: 0.3rem;
    text-align: center;
    font-weight: 600;
}

.building-list-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    min-height: 100px;
}

.building-list-container::-webkit-scrollbar {
    width: 5px;
}

.building-list-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.building-list-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.4);
    border-radius: 3px;
}

.building-list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.6);
}

.building-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.building-btn {
    padding: 0.4rem 0.6rem;
    background: linear-gradient(135deg, #555555, #666666);
    color: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    text-align: left;
    font-weight: 500;
}

.building-btn:hover {
    background: linear-gradient(135deg, #666666, #777777);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.building-btn:disabled {
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    cursor: not-allowed;
    opacity: 0.5;
    color: #999999;
}

.building-btn:disabled:hover {
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    transform: none;
    box-shadow: none;
}

.building-btn.selected {
    background: linear-gradient(135deg, #888888, #999999);
    box-shadow: 0 0 10px rgba(136, 136, 136, 0.5);
    color: #ffffff;
}

/* End Day Button */
.end-day-btn {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 0.9rem;
}

.end-day-btn:hover {
    background: linear-gradient(135deg, #d35400, #c0392b);
    transform: translateY(-2px);
}

/* Production Planner Styles */
.production-planner {
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    border-radius: 6px;
    padding: 0.6rem;
    border: 1px solid rgba(74, 74, 74, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 100%;
}

.production-planner h3 {
    color: #e0e0e0;
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 2px solid rgba(224, 224, 224, 0.2);
    padding-bottom: 0.3rem;
    text-align: center;
    font-weight: 600;
}

.planner-section {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    padding: 0.4rem;
    margin-bottom: 0.4rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.planner-section:last-child {
    margin-bottom: 0;
}

.planner-section h4 {
    color: #d0d0d0;
    margin: 0 0 0.3rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.production-goals, .efficiency-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.goal-item, .efficiency-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: #e0e0e0;
    font-size: 0.75rem;
}

.goal-icon {
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.goal-text {
    flex: 1;
}

.efficiency-item span {
    flex: 1;
}

/* Production Efficiency Bars */
.goal-input {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    padding: 0.2rem 0.4rem;
    color: white;
    font-size: 0.75rem;
    width: 50px;
    text-align: center;
}

.goal-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.efficiency-bar-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    height: 14px;
    margin-left: 0.5rem;
    overflow: hidden;
    flex: 1;
    position: relative;
}

.efficiency-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.efficiency-bar.excellent {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.efficiency-bar.good {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.efficiency-bar.fair {
    background: linear-gradient(90deg, #f1c40f, #f39c12);
}

.efficiency-bar.poor {
    background: linear-gradient(90deg, #e67e22, #d35400);
}

.efficiency-bar.critical {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.efficiency-text {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Village Manager Styles */
.village-manager {
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    border-radius: 6px;
    padding: 0.6rem;
    border: 1px solid rgba(74, 74, 74, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 100%;
}

.village-manager h3 {
    color: #e0e0e0;
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 2px solid rgba(224, 224, 224, 0.2);
    padding-bottom: 0.3rem;
    text-align: center;
    font-weight: 600;
}

.manager-section {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    padding: 0.4rem;
    margin-bottom: 0.4rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.manager-section:last-child {
    margin-bottom: 0;
}

.manager-section h4 {
    color: #d0d0d0;
    margin: 0 0 0.3rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.production-info, .population-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.production-item, .population-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.production-icon {
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.production-text {
    flex: 1;
}

.time-controls {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.current-day {
    background: rgba(0,0,0,0.2);
    padding: 0.4rem;
    border-radius: 4px;
    text-align: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

.end-day-button, .auto-play-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.end-day-button:hover, .auto-play-button:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.auto-play-button.active {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.auto-play-button.active:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
}

#auto-play-icon {
    font-size: 0.7rem;
}

#auto-play-text {
    font-size: 0.8rem;
}

/* Population View Button */
.population-view-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.population-view-button:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.population-view-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Army Drafting Modal Styles */
.army-drafting-modal .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.army-drafting-modal .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.army-drafting-modal .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.army-drafting-modal .btn-secondary {
    background: #95a5a6;
    color: white;
}

.army-drafting-modal .btn-secondary:hover {
    background: #7f8c8d;
}

.army-drafting-modal .btn-primary {
    background: #27ae60;
    color: white;
}

.army-drafting-modal .btn-primary:hover {
    background: #2ecc71;
}

/* Responsive Design */
@media (max-height: 700px) {
    .village-header {
        padding: 0.5rem 1rem;
        margin-bottom: 0.5rem;
    }
    
    .village-sidebar {
        gap: 0.5rem;
    }
    
    .manager-section {
        padding: 0.4rem;
        margin-bottom: 0.4rem;
    }
    
    .building-list-container {
        max-height: 200px;
    }
}

@media (max-width: 1200px) {
    .village-sidebar {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 1000px) {
    .village-content {
        flex-direction: column;
    }
    
    .village-sidebar {
        width: 100%;
        min-width: auto;
        max-height: 300px;
        flex-direction: row;
        gap: 1rem;
    }
    
    .village-manager,
    .building-menu {
        flex: 1;
    }
}

/* World Map Styles */
.world-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #2c3e50;
}

.world-header {
    background: #34495e;
    padding: 1rem;
    border-bottom: 2px solid #1abc9c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.world-header h2 {
    margin: 0;
    color: #1abc9c;
    font-size: 1.5rem;
}

.world-info {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.world-info span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.world-main {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
}

.world-map-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: #34495e;
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    min-height: 0;
}

#hex-canvas {
    background: #2c3e50;
    border: 2px solid #1abc9c;
    border-radius: 5px;
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 600px;
    margin: 0 auto;
    cursor: pointer;
}

.hex-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    pointer-events: none;
    border-radius: 5px;
}

.world-sidebar {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.parties-management {
    background: #34495e;
    border-radius: 8px;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.parties-management h3 {
    margin: 0 0 1rem 0;
    color: #1abc9c;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.5rem;
}

.party-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.party-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    background: #2c3e50;
    color: #bdc3c7;
    border: 1px solid #34495e;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.party-tab:hover {
    background: #3498db;
    color: white;
}

.party-tab.active {
    background: #1abc9c;
    color: white;
    border-color: #1abc9c;
}

.party-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.party-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
}

.party-panel.active {
    display: block;
}

.expedition-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.expedition-item {
    background: #2c3e50;
    padding: 1rem;
    border-radius: 5px;
    border-left: 4px solid #f39c12;
}

.expedition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.expedition-title {
    font-weight: bold;
    color: #f39c12;
}

.expedition-status {
    font-size: 0.8rem;
    color: #95a5a6;
}

.expedition-details {
    font-size: 0.9rem;
    color: #bdc3c7;
    line-height: 1.4;
}

.hex-info-panel {
    background: #34495e;
    border-radius: 8px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.hex-info-panel h4 {
    margin: 0 0 1rem 0;
    color: #1abc9c;
    border-bottom: 2px solid #1abc9c;
    padding-bottom: 0.5rem;
}

.hex-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.hex-action-btn {
    padding: 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.hex-action-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.hex-action-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

.hex-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.hex-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #2c3e50;
    border-radius: 3px;
    font-size: 0.9rem;
}

.hex-detail-label {
    color: #95a5a6;
}

.hex-detail-value {
    color: #ecf0f1;
    font-weight: bold;
}

/* Responsive adjustments for world map */
@media (max-width: 768px) {
    .world-main {
        flex-direction: column;
    }
    
    .world-sidebar {
        min-width: 0;
        max-width: none;
        order: -1;
    }
    
    .parties-management {
        max-height: 300px;
    }
    
    .world-info {
        gap: 1rem;
        font-size: 0.8rem;
    }
    
    .party-tabs {
        flex-wrap: wrap;
    }
    
    .party-tab {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Population Modal Styles */
.population-modal .modal-content {
    max-width: 900px;
    width: 90vw;
    max-height: 80vh;
}

.population-overview {
    background: rgba(52, 73, 94, 0.3);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.population-overview h3 {
    color: #3498db;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.population-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: rgba(41, 128, 185, 0.2);
    border-radius: 6px;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.stat-label {
    color: #bdc3c7;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.stat-value {
    color: #3498db;
    font-size: 1.3rem;
    font-weight: bold;
}

.villagers-list h4 {
    color: #2ecc71;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.villagers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.villagers-grid::-webkit-scrollbar {
    width: 8px;
}

.villagers-grid::-webkit-scrollbar-track {
    background: rgba(44, 62, 80, 0.3);
    border-radius: 4px;
}

.villagers-grid::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.6);
    border-radius: 4px;
}

.villagers-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.8);
}

.villager-card {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(39, 174, 96, 0.1));
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.villager-card:hover {
    border-color: rgba(46, 204, 113, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.2);
}

.villager-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
}

.villager-icon {
    font-size: 1.8rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(46, 204, 113, 0.2);
    border-radius: 50%;
}

.villager-info {
    flex: 1;
}

.villager-name {
    font-weight: bold;
    color: #2ecc71;
    font-size: 1.1rem;
}

.villager-role {
    color: #95a5a6;
    font-size: 0.9rem;
    text-transform: capitalize;
}

.villager-status {
    font-size: 1.2rem;
}

.villager-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}

.detail-label {
    color: #bdc3c7;
    font-size: 0.9rem;
}

.detail-value {
    color: #ecf0f1;
    font-weight: 500;
    text-align: right;
}

.no-villagers {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #95a5a6;
}

.no-villagers-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-villagers-text {
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Responsive adjustments for population modal */
@media (max-width: 768px) {
    .population-modal .modal-content {
        width: 95vw;
        max-height: 85vh;
    }
    
    .population-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .villagers-grid {
        grid-template-columns: 1fr;
        max-height: 350px;
    }
    
    .villager-card {
        padding: 0.75rem;
    }
}

/* Population Groups Styling (Stellaris-style) */
.population-groups {
    margin-top: 20px;
}

.groups-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.population-group {
    background: rgba(52, 73, 94, 0.8);
    border: 1px solid #3d566e;
    border-radius: 8px;
    overflow: hidden;
    transition: background-color 0.2s ease;
}

.population-group:hover {
    background: rgba(52, 73, 94, 1);
}

.group-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    gap: 12px;
}

.group-icon {
    font-size: 1.5em;
    width: 40px;
    text-align: center;
}

.group-info {
    flex: 1;
}

.group-name {
    font-weight: bold;
    color: #ecf0f1;
    font-size: 1.1em;
}

.group-description {
    font-size: 0.9em;
    color: #bdc3c7;
    margin-top: 2px;
}

.group-count {
    font-weight: bold;
    color: #3498db;
    font-size: 1.2em;
    min-width: 40px;
    text-align: right;
}

.group-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.3s ease;
}

.population-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #3d566e;
    text-align: center;
}

.population-actions .action-btn {
    margin: 0 10px;
}

/* Enhanced population stats for groups view */
.population-groups .population-stats {
    background: rgba(41, 128, 185, 0.1);
    border: 1px solid rgba(41, 128, 185, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.population-groups .population-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.population-groups .population-stats .stat-item:last-child {
    border-bottom: none;
}

.population-groups .population-stats .stat-label {
    color: #ecf0f1;
    font-weight: 500;
}

.population-groups .population-stats .stat-value {
    color: #3498db;
    font-weight: bold;
    font-size: 1.1em;
}

/* Death notification styling */
.toast.warning .toast-icon {
    color: #e74c3c;
}

.toast.warning {
    border-left: 4px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* Responsive design for population groups */
@media (max-width: 768px) {
    .group-header {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .group-icon {
        font-size: 1.3em;
        width: 35px;
    }
    
    .group-name {
        font-size: 1em;
    }
    
    .group-description {
        font-size: 0.8em;
    }
    
    .group-count {
        font-size: 1.1em;
        min-width: 35px;
    }
}

/* Enhanced Population UI Styles */
.modern-modal .modal-content {
    padding: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid #3a3a3a;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.population-overview {
    padding: 24px;
    background: linear-gradient(135deg, #2a4d3a 0%, #1e3d2f 100%);
    border-radius: 16px 16px 0 0;
    margin-bottom: 0;
}

.overview-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.5em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 1.2em;
    background: rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 8px;
}

.overview-subtitle {
    color: #b8d4c2;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.population-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.stat-icon {
    font-size: 1.5em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffffff;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8em;
    color: #b8d4c2;
    margin-top: 2px;
}

.population-sections {
    padding: 24px;
}

.population-section {
    margin-bottom: 32px;
}

.population-section:last-child {
    margin-bottom: 0;
}

.section-header {
    margin-bottom: 16px;
}

.section-header h4 {
    margin: 0 0 4px 0;
    font-size: 1.2em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    background: #3a3a3a;
    padding: 6px;
    border-radius: 6px;
}

.section-subtitle {
    color: #888;
    font-size: 0.85em;
}

.modern-group {
    background: #2a2a2a;
    border: 1px solid #404040;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.modern-group:hover {
    background: #333333;
    border-color: #555555;
    transform: translateX(4px);
}

.modern-group .group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.group-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modern-group .group-icon {
    font-size: 1.2em;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #404040;
    border-radius: 8px;
}

.modern-group .group-name {
    font-weight: bold;
    color: #ffffff;
    font-size: 0.95em;
}

.modern-group .group-description {
    color: #aaa;
    font-size: 0.8em;
    margin-top: 2px;
}

.group-stats {
    text-align: right;
}

.group-count {
    font-size: 1.1em;
    font-weight: bold;
    color: #4CAF50;
}

.group-percentage {
    font-size: 0.8em;
    color: #888;
}

.progress-bg {
    background: #1a1a1a;
    border-radius: 8px;
    height: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid #333;
}

.progress-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-label {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    font-size: 0.75em;
    color: #ffffff;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    z-index: 1;
}

/* Age group colors */
.age-children { background: linear-gradient(90deg, #FFB74D, #FFA726); }
.age-youngAdults { background: linear-gradient(90deg, #66BB6A, #4CAF50); }
.age-adults { background: linear-gradient(90deg, #42A5F5, #2196F3); }
.age-middleAged { background: linear-gradient(90deg, #AB47BC, #9C27B0); }
.age-elderly { background: linear-gradient(90deg, #8D6E63, #6D4C41); }

/* Job group colors */
.job-unemployed { background: linear-gradient(90deg, #90A4AE, #78909C); }
.job-farmers { background: linear-gradient(90deg, #8BC34A, #689F38); }
.job-woodcutters { background: linear-gradient(90deg, #8D6E63, #5D4037); }
.job-miners { background: linear-gradient(90deg, #607D8B, #455A64); }
.job-builders { background: linear-gradient(90deg, #FFA726, #F57C00); }
.job-guards { background: linear-gradient(90deg, #EF5350, #D32F2F); }
.job-merchants { background: linear-gradient(90deg, #FFCA28, #FFA000); }
.job-drafted { background: linear-gradient(90deg, #F44336, #C62828); }
.job-other { background: linear-gradient(90deg, #9E9E9E, #616161); }

.population-actions {
    padding: 20px 24px 24px;
    background: #1a1a1a;
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.action-btn.primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.action-btn.secondary {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
}

.action-btn.secondary:hover {
    background: #444;
    color: #fff;
    border-color: #666;
}

.btn-icon {
    font-size: 1em;
}

.no-villagers {
    padding: 48px 24px;
    text-align: center;
}

.no-villagers-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-villagers-icon {
    font-size: 4em;
    margin-bottom: 16px;
    opacity: 0.7;
}

.no-villagers h3 {
    color: #ffffff;
    margin: 0 0 16px 0;
    font-size: 1.3em;
}

.no-villagers p {
    color: #aaa;
    line-height: 1.5;
    margin-bottom: 24px;
}

.empty-state-tips {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2a2a2a;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.tip-icon {
    font-size: 1.2em;
}

.tip-text {
    color: #ccc;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .population-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .population-actions {
        flex-direction: column;
    }
    
    .modern-group .group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .group-stats {
        text-align: left;
    }
}
