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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8E8 100%);
    color: #2C3E50;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
}

.screen.active {
    display: flex;
}

/* Start Screen */
#startScreen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.start-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.game-title {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.game-subtitle {
    font-size: 20px;
    color: #666;
    margin-bottom: 30px;
}

.lesson-selector {
    margin: 30px 0;
    text-align: left;
}

.lesson-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 15px;
}

.lesson-item {
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.lesson-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.lesson-item.selected {
    background: #667eea;
    color: white;
    border-color: #764ba2;
}

.btn-large {
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s;
    font-weight: bold;
}

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

.btn-primary:hover:not(:disabled) {
    background: #218838;
    transform: scale(1.05);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #667eea;
    color: white;
}

.btn-secondary:hover {
    background: #764ba2;
    transform: scale(1.05);
}

/* Game Screen Layout */
#gameScreen {
    flex-direction: column;
}

/* Top HUD */
.top-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.hud-left, .hud-right {
    display: flex;
    gap: 10px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: help;
    transition: all 0.2s;
    position: relative;
}

.stat-box:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-box i {
    font-size: 20px;
}

.stat-box:nth-child(1) i { color: #FFD700; }
.stat-box:nth-child(2) i { color: #4CAF50; }
.stat-box:nth-child(3) i { color: #FF9800; }

/* Resource Tooltip */
.resource-tooltip {
    position: fixed;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    pointer-events: none;
    font-size: 14px;
    min-width: 200px;
    max-width: 300px;
}

.tooltip-content {
    line-height: 1.6;
}

.tooltip-content strong {
    color: #FFD700;
}

.tooltip-content .positive {
    color: #4CAF50;
}

.tooltip-content .negative {
    color: #FF6B6B;
}

.tooltip-content .neutral {
    color: #95A5A6;
}

.tooltip-content hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin: 8px 0;
}

.lesson-info {
    text-align: center;
    font-weight: bold;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #FF6B35;
    font-size: 18px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.icon-btn:hover {
    background: #764ba2;
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-left {
    border-right: 1px solid #ddd;
}

.sidebar-right {
    border-left: 1px solid #ddd;
}

.tab-menu {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 15px 5px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.tab-btn i {
    font-size: 20px;
}

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

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Buildings List */
.buildings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.building-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.building-card:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.building-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.building-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.building-icon {
    font-size: 30px;
}

.building-details h4 {
    margin: 0;
    color: #2C3E50;
}

.building-details p {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #666;
}

.building-cost {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 14px;
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* City Canvas */
.city-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB 0%, #90EE90 50%, #8FBC8F 100%);
}

#cityCanvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#cityCanvas:active {
    cursor: grabbing;
}

/* Floating Pickups */
#pickupsContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pickup {
    position: absolute;
    pointer-events: all;
    cursor: pointer;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.pickup-coin {
    font-size: 30px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
}

/* Active Boosts */
.active-boosts {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.boost-item {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.boost-timer {
    font-weight: bold;
    color: #FF6B35;
}

/* Building Info Panel */
.building-info, .production-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.info-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
}

.upgrade-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.upgrade-btn:hover:not(:disabled) {
    background: #218838;
    transform: scale(1.02);
}

.upgrade-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Bottom Action Bar */
.bottom-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.action-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    background: #667eea;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Quiz Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}

.quiz-modal h3 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 30px;
    color: #2C3E50;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.quiz-option {
    padding: 20px;
    border: 3px solid #ddd;
    border-radius: 15px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.quiz-option:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: scale(1.05);
}

.quiz-option.correct {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.quiz-option.incorrect {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    animation: shake 0.5s;
}

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

.quiz-feedback {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    min-height: 30px;
    margin: 20px 0;
}

.quiz-progress {
    margin-top: 20px;
}

.quiz-progress-text {
    display: block;
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #667eea, #764ba2);
    transition: width 0.3s;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 2000;
    transition: top 0.5s;
}

.achievement-popup.show {
    top: 20px;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    font-size: 20px;
    font-weight: bold;
}

.achievement-content i {
    font-size: 30px;
}

/* Close Button */
.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar-right {
        display: none;
    }
    
    .sidebar-left {
        width: 200px;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .bottom-bar {
        flex-wrap: wrap;
    }
    
    .action-btn span {
        display: none;
    }
}
