/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 50%, #00b894 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Delete mode styles */
body.delete-mode {
    cursor: crosshair;
}

body.delete-mode .grid-cell:hover {
    background-color: rgba(255, 0, 0, 0.3) !important;
    border: 2px solid #ff4757 !important;
}

body.delete-mode .grid-cell.occupied:hover {
    background-color: rgba(255, 0, 0, 0.5) !important;
}

#trash-btn.delete-mode-active {
    background-color: #ff4757 !important;
    color: white !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Suggestions blur toggle styles */
.suggested-actions-container {
    position: relative;
}

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

.blur-toggle-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.blur-toggle-btn:hover {
    background-color: #f0f0f0;
    border-color: #999;
}

.suggested-actions.blurred {
    filter: blur(4px);
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
}

.suggested-actions:not(.blurred) {
    filter: none;
    opacity: 1;
    transition: all 0.3s ease;
}

/* Enhanced building selection for merging */
.grid-cell.occupied {
    cursor: grab;
}

.grid-cell.occupied:active {
    cursor: grabbing;
}

.grid-cell.occupied .building-in-grid {
    pointer-events: none; /* Allow entire cell to be draggable */
}

.grid-cell.occupied .building-label {
    pointer-events: none; /* Allow entire cell to be draggable */
}

/* Bonus indicators */
.bonus-indicator {
    position: absolute;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.bonus-indicator.happiness-bonus {
    top: 2px;
    right: 2px;
    background: rgba(76, 175, 80, 0.9);
}

.bonus-indicator.adjacency-bonus {
    top: 2px;
    left: 2px;
    background: rgba(33, 150, 243, 0.9);
}

.bonus-indicator.amplified-bonus {
    bottom: 2px;
    right: 2px;
    background: rgba(255, 152, 0, 0.9);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 5px rgba(255, 152, 0, 0.5); }
    to { box-shadow: 0 0 10px rgba(255, 152, 0, 0.8); }
}

/* Game container */
#game-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header styles */
#game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

#game-title h1 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Resource bar */
#resource-bar {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.resource-item:hover {
    transform: translateY(-2px);
}

.resource-icon {
    font-size: 1.2rem;
}

.resource-item span:last-child {
    font-weight: 600;
    color: #2c3e50;
    min-width: 60px;
    text-align: center;
}

.resource-rate {
    font-size: 0.8rem;
    opacity: 0.8;
    color: #4ade80;
    font-weight: 500;
    margin-left: 0.25rem;
}

/* Happiness bonus visual indicators */
.resource-item.extremely-happy {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    animation: pulse-gold 2s infinite;
}

.resource-item.very-happy {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.resource-item.happy {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.resource-item.unhappy {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.resource-item.very-unhappy {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

@keyframes pulse-gold {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

/* Game controls */
#game-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.control-btn.paused {
    background: rgba(241, 196, 15, 0.8);
    border-color: #f1c40f;
}


.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.trash-btn {
    background: rgba(220, 38, 38, 0.2);
    border: 2px solid rgba(220, 38, 38, 0.4);
}

.trash-btn:hover {
    background: rgba(220, 38, 38, 0.3);
    transform: translateY(-2px);
}

.trash-btn.drag-over {
    background: rgba(220, 38, 38, 0.5);
    border: 2px solid #dc2626;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
}

/* Main game area */
#game-main {
    flex: 1;
    display: flex;
    gap: 2rem;
    padding: 2rem;
    min-height: 0;
}

/* City grid container */
#city-grid-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* City grid */
#city-grid {
    display: grid;
    grid-template-columns: repeat(6, 80px);
    grid-template-rows: repeat(6, 80px);
    gap: 4px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.grid-cell {
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    padding: 4px;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.grid-cell.occupied {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.building-label {
    font-size: 10px;
    color: #000;
    background: none;
    padding: 2px 0;
    text-align: center;
    margin-top: 2px;
    white-space: nowrap;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.grid-cell.drag-over {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
    transform: scale(1.1);
}

.grid-cell.merge-target {
    background: rgba(255, 193, 7, 0.3);
    border-color: #ffc107;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Building in grid */
.building-in-grid {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: transform 0.2s ease;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.building-in-grid, .building-icon, .building-name, .building-cost {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input, textarea, .selectable-text {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.building-in-grid * {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

/* Re-enable pointer events for the container */
.building-in-grid {
    pointer-events: auto;
}

/* Specifically target building labels to prevent selection */
.building-in-grid .building-name,
.building-in-grid .building-icon {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    pointer-events: none !important;
    -webkit-touch-callout: none !important;
}

.building-in-grid:active {
    cursor: grabbing;
}

.building-in-grid.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1000;
}

/* Building types */
.building-residential {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

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

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

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

.building-icon-large {
    font-size: 2rem;
    margin-bottom: 0.2rem;
}

.building-level {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 2px;
}

.building-stats {
    font-size: 0.5rem;
    font-weight: 500;
    opacity: 0.8;
    line-height: 1.1;
    text-align: center;
}

/* Bonus Indicators */
.bonus-indicator {
    position: absolute;
    width: 18px;
    height: 18px;
    z-index: 10;
    pointer-events: none;
    animation: glow 2s ease-in-out infinite alternate;
}

.adjacency-indicator {
    top: 2px;
    right: 2px;
    color: #ffd700;
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.8);
}

.happiness-indicator {
    top: 2px;
    left: 2px;
    color: #ff69b4;
    text-shadow: 0 0 4px rgba(255, 105, 180, 0.8);
}

.amplified-indicator {
    bottom: 2px;
    right: 2px;
    color: #ff4500;
    text-shadow: 0 0 4px rgba(255, 69, 0, 0.8);
}

@keyframes glow {
    from {
        text-shadow: 0 0 4px currentColor;
    }
    to {
        text-shadow: 0 0 8px currentColor, 0 0 12px currentColor;
    }
}

/* Pulsating trash indicator */
.pulsating {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Building Info Panel */
#building-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1200px;
    height: 85%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    z-index: 1000;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
}

.info-panel-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.info-panel-content {
    padding: 1.5rem;
    height: calc(100% - 80px);
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .info-panel-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.building-progression {
    margin-bottom: 2rem;
}

.building-progression h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #74b9ff;
    padding-bottom: 0.5rem;
}

.progression-chain {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.progression-item {
    flex: 1;
    min-width: 150px;
    background: rgba(116, 185, 255, 0.1);
    border: 2px solid rgba(116, 185, 255, 0.3);
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    position: relative;
}

.progression-item:not(:last-child)::after {
    content: '→';
    position: absolute;
    right: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #74b9ff;
    font-weight: bold;
}

.progression-item .building-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.progression-item .building-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.progression-item .building-stats-detailed {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.progression-item .building-stats {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.merge-arrow {
    font-size: 1.5rem;
    color: #74b9ff;
    font-weight: bold;
    margin: 0 0.5rem;
    align-self: center;
}

/* Building Guide Clean Styles */
.building-guide-clean {
    padding: 0;
    max-height: 80vh;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Tab Navigation */
.guide-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: #ffffff;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

.tab-content.active {
    display: block;
    width: 100%;
}

.stats-content {
    padding: 10px;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Overview Tab */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
}

.category-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.category-summary:hover {
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.category-icon {
    font-size: 2rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    flex-shrink: 0;
}

.category-info h4 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
}

.category-info p {
    margin: 0 0 0.5rem 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.unlock-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Quick Tips */
.quick-tips {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

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

.tip-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: #007bff;
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.tip-text {
    color: #495057;
    font-size: 0.9rem;
}

/* Buildings Tab */
.building-categories {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.building-category-clean {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.category-emoji {
    font-size: 2rem;
}

.category-title h3 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.unlock-info {
    color: #6c757d;
    font-size: 0.8rem;
}

.building-progression {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow-x: auto;
}

.building-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.building-icon {
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.building-details {
    min-width: 120px;
}

.building-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.building-stats {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.merge-cost {
    font-size: 0.7rem;
    color: #dc3545;
    font-weight: 500;
}

.progression-arrow {
    color: #007bff;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0.5rem;
}

/* Strategy Tab */
.strategy-section {
    margin-bottom: 2rem;
}

.strategy-section h4 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007bff;
}

.adjacency-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.adjacency-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.adjacency-item:hover {
    border-color: #007bff;
    transform: translateX(4px);
}

.building-emoji {
    font-size: 1.5rem;
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.bonus-text {
    color: #495057;
    font-size: 0.9rem;
}

.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.strategy-item {
    padding: 1rem;
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    border-radius: 0 6px 6px 0;
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.4;
}

.strategy-item strong {
    color: #2c3e50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .building-guide-clean {
        max-height: 60vh;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .category-summary {
        padding: 0.75rem;
    }
    
    .building-progression {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .building-step {
        width: 100%;
        justify-content: flex-start;
    }
    
    .progression-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }
}

/* Compact Building Guide Styles */
.compact-guide {
    padding: 0;
}

.guide-section {
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.section-icon {
    font-size: 1.5rem;
}

.section-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
    flex: 1;
}

.section-subtitle {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

/* Building Chain Styles */
.building-chain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
}

.chain-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(116, 185, 255, 0.1);
    border: 1px solid rgba(116, 185, 255, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    flex: 1;
    min-width: 120px;
}

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

.item-details {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.item-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #2c3e50;
}

.item-stats {
    font-size: 0.7rem;
    color: #666;
}

.chain-arrow {
    font-size: 1rem;
    color: #74b9ff;
    font-weight: bold;
    flex-shrink: 0;
}

/* Special Buildings Compact */
.special-buildings-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.special-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: help;
    transition: all 0.2s ease;
}

.special-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: rgba(243, 156, 18, 0.15);
}

.special-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.special-details {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
}

.special-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
}

.special-unlock {
    font-size: 0.7rem;
    color: #e74c3c;
    font-weight: 500;
}

.special-effect {
    font-size: 0.7rem;
    color: #27ae60;
    font-weight: 500;
}

/* Guide Tips */
.guide-tips {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 6px;
    padding: 0.5rem;
    flex: 1;
}

.tip-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.tip-text {
    font-size: 0.75rem;
    color: #2c3e50;
    font-weight: 500;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    max-width: 250px;
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.show {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .building-chain {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chain-arrow {
        transform: rotate(90deg);
        align-self: center;
        margin: 0.25rem 0;
    }
    
    .special-buildings-compact {
        grid-template-columns: 1fr;
    }
    
    .guide-tips {
        flex-direction: column;
    }
}

.progression-item .building-stats {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.merge-arrow {
    font-size: 1.5rem;
    color: #74b9ff;
    font-weight: bold;
    margin: 0 0.5rem;
    align-self: center;
}

.special-buildings {
    margin-top: 2rem;
}

.special-buildings h4 {
    color: #f39c12;
    border-bottom-color: #f39c12;
}

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

.special-building-card {
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 15px;
}

.special-building-card .building-icon {
font-size: 2rem;
margin-bottom: 0.3rem;
filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
pointer-events: none;
}

.special-building-card .building-name {
font-size: 0.7rem;
font-weight: 600;
color: #2c3e50;
text-align: center;
text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
pointer-events: none;
}

.special-building-card .unlock-requirement {
background: rgba(52, 152, 219, 0.2);
color: #2980b9;
padding: 0.3rem 0.8rem;
border-radius: 15px;
font-size: 0.8rem;
margin-bottom: 0.8rem;
display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
    display: inline-block;
}

.special-building-card .building-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    margin-bottom: 0.8rem;
}

.special-building-card .adjacency-bonus {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
    padding: 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Building palette */
#building-palette {
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

#building-palette h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    text-align: center;
}

.building-category {
    margin-bottom: 1.5rem;
}

.building-category h4 {
    color: #34495e;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.3rem;
}

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

.building-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    cursor: grab;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.building-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.building-item:active {
    cursor: grabbing;
}

.building-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.building-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

.building-item.selected {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.2);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
}

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

.building-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.building-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.building-cost {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.2rem;
}

/* Objectives panel */
#objectives-panel {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    z-index: 50;
}

#objectives-panel h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.objective-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border-left: 4px solid #bdc3c7;
    transition: all 0.3s ease;
}

.objective-item.active {
    border-left-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.objective-item.completed {
    border-left-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
    opacity: 0.7;
}

.objective-text {
    font-size: 0.9rem;
    color: #2c3e50;
    flex: 1;
}

.objective-progress {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 600;
}

.objectives-help {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.help-btn {
    flex: 1;
    padding: 0.5rem;
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.next-steps {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(52, 152, 219, 0.05);
    border-radius: 8px;
    border-left: 3px solid #3498db;
}

.next-steps p {
    margin: 0 0 0.8rem 0;
    color: #2c3e50;
    font-size: 0.9rem;
    line-height: 1.4;
}

.hint-btn {
    width: 100%;
    padding: 0.6rem;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.hint-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

/* Tutorial overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.tutorial-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.3s ease;
    text-align: center;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 1rem;
}

.tutorial-header h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin: 0;
}

.tutorial-btn-small {
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 15px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-btn-small:hover {
    background: #7f8c8d;
}

.tutorial-body {
    margin-bottom: 2rem;
}

#tutorial-text {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.5;
}

#tutorial-image {
    font-size: 4rem;
    margin: 1rem 0;
}

.tutorial-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.tutorial-btn {
    flex: 1;
    padding: 1rem;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(116, 185, 255, 0.4);
}

/* Help panel */
#help-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1500;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.help-content {
    padding: 2rem;
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ecf0f1;
}

.blue-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 1rem;
    border-radius: 15px 15px 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    border-bottom: none;
}

.blue-header h3 {
    color: white;
    margin: 0;
}

.blue-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.blue-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.help-header h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 1;
    visibility: visible;
}

.close-btn:hover {
    background: rgba(255, 107, 107, 0.8);
    border-color: #ff6b6b;
    transform: scale(1.1);
}

.help-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(52, 152, 219, 0.05);
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.help-section h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.help-section p {
    color: #34495e;
    line-height: 1.5;
    margin: 0;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 1rem;
    position: relative;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 1.3rem;
}

.menu-close {
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid rgba(231, 76, 60, 0.3);
    position: absolute;
    right: 0;
    top: 0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1rem;
    cursor: pointer;
    color: #e74c3c;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.menu-close:hover {
    background: rgba(231, 76, 60, 0.8);
    color: white;
    transform: scale(1.1);
}

.modal-btn {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(116, 185, 255, 0.4);
}

.setting-item {
    margin-top: 1rem;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
    cursor: pointer;
}

/* Quick Actions Toolbar */
#quick-actions-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toolbar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    opacity: 0.9;
}

.quick-action-buttons {
    display: flex;
    gap: 0.5rem;
}

.quick-action-btn {
    position: relative;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.quick-action-btn.selected {
    background: rgba(52, 152, 219, 0.8);
    border-color: #3498db;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

.quick-action-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
}

.quick-action-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.quick-action-btn .hotkey {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    padding: 1px 3px;
    line-height: 1;
}

.quick-action-btn .building-icon {
    font-size: 1.5rem;
    margin-top: 8px;
}

/* Building Stats Panel Styles - Dark Theme */
.stats-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 12px 12px 0 0;
    border-bottom: 2px solid #3498db;
}

.stats-panel-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    white-space: nowrap;
}

.stats-panel-content {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 0 0 15px 15px;
    position: relative;
    color: #2c3e50;
}

.quick-improvements-section {
    position: relative;
    z-index: 1;
}

.quick-improvements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #007bff;
    color: white;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.quick-improvements-header:hover {
    background: #0056b3;
}

.dropdown-label {
    font-weight: 600;
    font-size: 0.9rem;
}

#quick-improvements-toggle {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.quick-improvements-header.expanded #quick-improvements-toggle {
    transform: rotate(180deg);
}

.quick-improvements-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
}

.stats-overview {
    margin-bottom: 1.5rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.analytics-card {
    padding: 0.6rem;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 6px;
    text-align: center;
    border: 1px solid rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
}

.analytics-card:hover {
    background: rgba(52, 152, 219, 0.2);
    transform: translateY(-1px);
}

.analytics-label {
    font-size: 0.75rem;
    color: #495057;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.analytics-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 0.2rem;
}

.analytics-note {
    font-size: 0.7rem;
    color: #6c757d;
    font-style: italic;
}

/* Efficiency Analysis */
.efficiency-analysis {
    margin-bottom: 0.6rem;
    padding: 0.6rem;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.efficiency-tip {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(116, 185, 255, 0.1);
    border-radius: 6px;
    border-left: 3px solid #74b9ff;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.action-list {
    margin-top: 0.5rem;
}

.action-item {
    margin: 0.25rem 0;
    padding: 0.4rem 0.6rem;
    background: rgba(46, 204, 113, 0.15);
    border-radius: 4px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.95);
    border-left: 2px solid #2ecc71;
}

/* Suggested Actions */
.suggested-actions {
    margin-bottom: 0.6rem;
    padding: 0.6rem;
    background: rgba(155, 89, 182, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.suggested-actions h4 {
    margin: 0 0 0.5rem 0;
    color: #9b59b6;
    font-size: 0.9rem;
}

.action-suggestion {
    margin: 0.4rem 0;
    padding: 0.5rem;
    background: rgba(155, 89, 182, 0.15);
    border-radius: 4px;
    border-left: 2px solid #9b59b6;
}

.action-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.action-positions {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.2rem;
}

.efficiency-value.highlight {
    color: #ffc107;
    font-weight: bold;
}

.efficiency-value.neutral {
    color: #74b9ff;
}

/* Responsive Design Classes */
@media (max-width: 768px) {
    .building-stats-panel {
        width: 95vw;
        max-height: 70vh;
        left: 2.5vw;
        top: 15vh;
    }
    
    .analytics-cards {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    
    .analytics-card {
        padding: 0.4rem;
    }
    
    .efficiency-analysis, .recommendations, .merge-opportunities {
        padding: 0.4rem;
        margin-bottom: 0.4rem;
    }
}

@media (max-width: 480px) {
    .building-stats-panel {
        width: 98vw;
        left: 1vw;
        top: 10vh;
        max-height: 80vh;
    }
    
    .analytics-value {
        font-size: 1.1rem;
    }
    
    .efficiency-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}

/* Tooltip System */
.game-tooltip {
    position: absolute;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 250px;
    word-wrap: break-word;
    animation: tooltipFadeIn 0.2s ease-out;
}

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

.efficiency-analysis h4 {
    margin: 0 0 0.5rem 0;
    color: #2ecc71;
    font-size: 0.9rem;
}

.efficiency-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

.efficiency-label {
    color: rgba(255, 255, 255, 0.8);
}

.efficiency-value.good {
    color: #2ecc71;
    font-weight: 600;
}

.efficiency-value.poor {
    color: #e74c3c;
    font-weight: 600;
}

.efficiency-tip {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.3rem;
    font-style: italic;
}

/* Merge Opportunities */
.merge-opportunities {
    margin-bottom: 0.6rem;
    padding: 0.6rem;
    background: rgba(241, 196, 15, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.merge-opportunities h4 {
    margin: 0 0 0.5rem 0;
    color: #f1c40f;
    font-size: 0.9rem;
}

.merge-tip {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.2rem;
    padding-left: 1rem;
    position: relative;
}

.merge-tip:before {
    content: '•';
    position: absolute;
    left: 0;
    color: #f1c40f;
}

/* Recommendations */
.recommendations {
    padding: 0.6rem;
    background: rgba(155, 89, 182, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.recommendations h4 {
    margin: 0 0 0.5rem 0;
    color: #9b59b6;
    font-size: 0.9rem;
}

.recommendation {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.2rem;
    padding-left: 1rem;
    position: relative;
    line-height: 1.3;
}

.recommendation:before {
    content: '→';
    position: absolute;
    left: 0;
    color: #9b59b6;
}

/* City Stats Panel */
.stats-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 280px;
    background-color: rgba(20, 30, 40, 0.85);
    border: 2px solid #4d90fe;
    border-radius: 8px;
    color: white;
    padding: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.stats-dropdown {
    cursor: pointer;
    user-select: none;
    margin-top: 10px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    transition: background 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .analytics-value {
        font-size: 1.2rem;
    }
    
    .efficiency-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}

/* Animation containers */
#merge-animation-container,
#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Merge animation */
.merge-animation {
    position: absolute;
    font-size: 2rem;
    animation: mergeEffect 1s ease-out forwards;
    pointer-events: none;
}

@keyframes mergeEffect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5);
        opacity: 0;
    }
}

/* Particle effects */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #f39c12;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 2s ease-out forwards;
}

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

/* Resource generation indicators */
.resource-popup {
    position: absolute;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2ecc71;
    pointer-events: none;
    animation: resourcePopup 2s ease-out forwards;
    z-index: 100;
}

@keyframes resourcePopup {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

/* Responsive design classes */
.responsive-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.responsive-grid {
    display: grid;
    gap: 1rem;
}

.responsive-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.responsive-hidden-mobile {
    display: block;
}

.responsive-hidden-desktop {
    display: none;
}

/* Responsive design */
@media (max-width: 1200px) {
    #game-main {
        flex-direction: column;
        gap: 1rem;
    }
    
    #building-palette {
        width: 100%;
        max-height: 200px;
        order: -1;
    }
    
    #objectives-panel {
        position: static;
        width: 100%;
        margin-top: 1rem;
    }
    
    .responsive-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #game-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    #resource-bar {
        gap: 1rem;
    }
    
    .resource-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    #city-grid {
        grid-template-columns: repeat(6, 60px);
        grid-template-rows: repeat(6, 60px);
        gap: 2px;
    }
    
    .grid-cell {
        width: 60px;
        height: 60px;
    }
    
    .building-icon-large {
        font-size: 1.5rem;
    }
    
    #game-title h1 {
        font-size: 1.5rem;
    }
    
    .responsive-hidden-mobile {
        display: none;
    }
    
    .responsive-hidden-desktop {
        display: block;
    }
    
    .quick-action-buttons {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    .quick-action-btn {
        width: 40px;
        height: 40px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3498db;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success/error states */
.success {
    border-color: #2ecc71 !important;
    background-color: rgba(46, 204, 113, 0.1) !important;
}

/* Contextual Building Menu */
.contextual-menu {
    position: absolute;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 200px;
    max-width: 280px;
    z-index: 2000;
    animation: menuSlideIn 0.2s ease-out;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.menu-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.2s ease;
    opacity: 1;
    visibility: visible;
}

.menu-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.menu-content {
    padding: 8px;
}

.menu-building-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.menu-building-option:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.menu-building-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.05);
}

.menu-building-option.disabled:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: transparent;
}

.menu-building-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.menu-building-info {
    flex: 1;
}

.menu-building-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 2px;
}

.menu-building-cost {
    font-size: 11px;
    color: #666;
}

.menu-building-cost.affordable {
    color: #059669;
}

.menu-building-cost.expensive {
    color: #dc2626;
}

.menu-building-unlock {
    font-size: 10px;
    color: #f59e0b;
    font-style: italic;
}

.error {
    border-color: #e74c3c !important;
    background-color: rgba(231, 76, 60, 0.1) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Highlight effect for tutorial */
.tutorial-highlight {
    position: relative;
    z-index: 1001;
    box-shadow: 0 0 0 4px rgba(255, 255, 0, 0.5), 0 0 20px rgba(255, 255, 0, 0.3) !important;
    animation: tutorialGlow 2s ease-in-out infinite;
}

@keyframes tutorialGlow {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 255, 0, 0.5), 0 0 20px rgba(255, 255, 0, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(255, 255, 0, 0.7), 0 0 30px rgba(255, 255, 0, 0.5); }
}

/* Quick Improvements Section */
.quick-improvements-section {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
}

.quick-improvements-header {
    cursor: pointer;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.quick-improvements-header:hover {
    background: rgba(0, 0, 0, 0.3);
}

.quick-improvements-content {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 5px;
    padding: 1rem;
    margin-top: 0.5rem;
    color: #ffffff;
}

.quick-improvements-content h4 {
    color: #74b9ff;
    margin-bottom: 0.5rem;
    text-align: center;
}

.quick-improvements-content .improvement-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 3px;
    border-left: 3px solid #74b9ff;
}

.quick-improvements-content .next-steps {
    background: rgba(116, 185, 255, 0.2);
    padding: 0.75rem;
    border-radius: 5px;
    margin-top: 1rem;
}

/* Building Info Panel Improvements */
.info-panel-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
}

.building-progression {
    margin-bottom: 2rem;
}

.building-progression h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.progression-chain {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.progression-item {
    flex: 1;
    min-width: 200px;
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.progression-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
}

.progression-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.progression-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
}

.progression-info h4 {
    color: #2c3e50;
    margin: 0 0 0.2rem 0;
    font-size: 1rem;
}

.progression-level {
    color: #7f8c8d;
    font-size: 0.8rem;
    font-weight: 600;
}

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

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #2c3e50;
}

.stat-icon {
    font-size: 0.9rem;
}

.progression-cost {
    font-weight: 600;
    color: #f39c12;
    font-size: 0.9rem;
    text-align: center;
    padding: 0.4rem;
    background: rgba(243, 156, 18, 0.1);
    border-radius: 6px;
}

.progression-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3498db;
    font-size: 1.5rem;
    margin: 0 0.5rem;
}

/* Adjacency Bonus Explanation */
.adjacency-explanation {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(52, 152, 219, 0.1));
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid #3498db;
}

.adjacency-explanation h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.adjacency-grid {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 2px;
    margin: 1rem auto;
    justify-content: center;
}

.adjacency-cell {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.adjacency-cell.center {
    background: rgba(52, 152, 219, 0.2);
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.adjacency-cell.adjacent {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
    animation: adjacencyPulse 2s ease-in-out infinite;
}

@keyframes adjacencyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.adjacency-legend {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.center {
    background: rgba(52, 152, 219, 0.4);
}

.legend-color.adjacent {
    background: rgba(46, 204, 113, 0.4);
}

/* Visual Adjacency Indicators on Grid */
.grid-cell.adjacency-bonus {
    box-shadow: inset 0 0 0 2px rgba(46, 204, 113, 0.6);
    animation: adjacencyGlow 2s ease-in-out infinite;
}

.grid-cell.adjacency-penalty {
    box-shadow: inset 0 0 0 2px rgba(231, 76, 60, 0.6);
    animation: penaltyGlow 2s ease-in-out infinite;
}

@keyframes adjacencyGlow {
    0%, 100% { box-shadow: inset 0 0 0 2px rgba(46, 204, 113, 0.6); }
    50% { box-shadow: inset 0 0 0 2px rgba(46, 204, 113, 0.9); }
}

@keyframes penaltyGlow {
    0%, 100% { box-shadow: inset 0 0 0 2px rgba(231, 76, 60, 0.6); }
    50% { box-shadow: inset 0 0 0 2px rgba(231, 76, 60, 0.9); }
}
