* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    overflow-x: hidden;
}

#game-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto 1fr;
    gap: 10px;
    padding: 10px;
    min-height: 100vh;
}

/* Header */
#game-header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    color: white;
    font-size: 28px;
    margin-bottom: 5px;
}

#city-name {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
}

.header-resources {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.resource {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.resource-icon {
    font-size: 20px;
}

/* Navigation */
#main-nav {
    grid-column: 1 / -1;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Main Content */
#main-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 24px;
}

/* Buildings Grid */
.buildings-grid,
.workers-grid,
.military-grid,
.defense-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.building-card,
.worker-card,
.military-card,
.defense-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.building-card:hover,
.worker-card:hover,
.military-card:hover,
.defense-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.card-icon {
    font-size: 36px;
}

.card-title {
    flex: 1;
}

.card-title h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 5px;
}

.card-level {
    color: #667eea;
    font-size: 14px;
    font-weight: bold;
}

.card-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.card-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: bold;
    color: #333;
}

.card-cost {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #666;
}

.cost-item.insufficient {
    color: #e74c3c;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.btn-build,
.btn-upgrade,
.btn-train,
.btn-assign,
.btn-remove {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-build,
.btn-upgrade,
.btn-train {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-build:hover,
.btn-upgrade:hover,
.btn-train:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.btn-build:disabled,
.btn-upgrade:disabled,
.btn-train:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-assign {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
}

.btn-remove {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

/* Queue Panel */
#queue-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: calc(100vh - 250px);
}

#queue-panel h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.queue-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.queue-item-name {
    font-weight: bold;
    color: #333;
}

.queue-item-cancel {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.queue-progress {
    background: #ddd;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.queue-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.queue-time {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* World Map */
#world-map {
    width: 100%;
    height: 500px;
    background: #1a1a2e;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    margin: 20px 0;
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    grid-template-rows: repeat(20, 1fr);
    width: 100%;
    height: 100%;
    gap: 1px;
}

.map-cell {
    background: #16213e;
    border: 1px solid #0f3460;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.map-cell:hover {
    background: #1f4068;
    transform: scale(1.1);
    z-index: 10;
}

.map-cell.player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.map-cell.my-city {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 0 10px rgba(245, 87, 108, 0.8);
}

.map-cell.empty {
    background: #0f3460;
}

.map-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.map-controls button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.map-controls button:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

#map-info {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

#map-info h3 {
    color: #667eea;
    margin-bottom: 10px;
}

#sector-details {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

/* Workers Stats */
.workers-stats,
.military-stats,
.defense-stats {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.workers-stats p,
.military-stats p,
.defense-stats p {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.workers-stats span,
.military-stats span,
.defense-stats span {
    font-weight: bold;
    color: #667eea;
}

/* Responsive */
@media (max-width: 1024px) {
    #game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }

    #queue-panel {
        grid-column: 1;
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .header-resources {
        gap: 10px;
    }

    .resource {
        padding: 6px 10px;
        font-size: 12px;
    }

    .buildings-grid,
    .workers-grid,
    .military-grid,
    .defense-grid {
        grid-template-columns: 1fr;
    }

    .nav-btn {
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.building-card,
.worker-card,
.military-card,
.defense-card {
    animation: slideIn 0.3s ease;
}
