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

body {
    background-color: #2c1810;
    font-family: 'Press Start 2P', monospace;
    color: #ffffff;
    overflow-x: auto;
}

#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Start Screen */
#start-screen {
    text-align: center;
    background-color: #4a3728;
    padding: 40px;
    border: 4px solid #8b7355;
    border-radius: 8px;
    max-width: 700px;
}

#start-screen h1 {
    font-size: 24px;
    color: #ff6b35;
    margin-bottom: 10px;
}

#start-screen h2 {
    font-size: 12px;
    margin-bottom: 20px;
    color: #d4af37;
}

#tutorial {
    background-color: rgba(0, 255, 0, 0.1);
    border: 2px solid #00ff00;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 8px;
    color: #00ff00;
    line-height: 1.4;
}

#journey-selection, #difficulty-buttons {
    margin-bottom: 20px;
}

#journey-selection h3 {
    font-size: 10px;
    margin-bottom: 15px;
    color: #d4af37;
}

#journey-selection button, #difficulty-buttons button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 15px 25px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    background-color: #654321;
    color: #ffffff;
    border: 3px solid #8b7355;
    cursor: pointer;
    transition: all 0.2s;
}

#journey-selection button:hover, #difficulty-buttons button:hover {
    background-color: #8b7355;
    transform: translateY(-2px);
}

#journey-selection button.selected {
    background-color: #2a6a2a;
    border-color: #90ee90;
    color: #90ee90;
}

/* Game Interface */
#game-interface {
    width: 100%;
    max-width: 1600px;
}

/* Progression HUD */
#progression-hud {
    background: linear-gradient(135deg, #1a4a1a, #2a6a2a);
    border: 3px solid #90ee90;
    padding: 15px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

#day-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.day-number {
    font-size: 18px;
    color: #90ee90;
    font-weight: bold;
}

.journey-progress {
    font-size: 8px;
    color: #d4af37;
}

#timeline-tracker {
    flex: 1;
    text-align: center;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#journey-progress-bar {
    flex: 1;
    height: 20px;
    background-color: #333;
    border: 2px solid #666;
    border-radius: 10px;
    overflow: hidden;
}

#journey-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #90ee90);
    transition: width 0.5s ease;
}

#progress-percentage {
    font-size: 10px;
    color: #90ee90;
    min-width: 40px;
}

#auto-progress-indicator {
    text-align: center;
}

#progress-status {
    font-size: 8px;
    color: #d4af37;
    display: block;
}

#progress-timer {
    font-size: 10px;
    color: #ffaa00;
    margin-top: 5px;
    font-weight: bold;
}

/* Day Controls */
#day-controls {
    background-color: rgba(42, 106, 42, 0.3);
    border: 2px solid #2a6a2a;
    padding: 15px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
}

#daily-objectives h4 {
    font-size: 10px;
    color: #90ee90;
    margin-bottom: 10px;
}

.objective {
    font-size: 8px;
    padding: 5px 10px;
    margin-bottom: 5px;
    border-radius: 3px;
    transition: all 0.3s;
}

.objective.incomplete {
    background-color: #4a1a1a;
    color: #ff6666;
    border-left: 3px solid #ff6666;
}

.objective.complete {
    background-color: #1a4a1a;
    color: #90ee90;
    border-left: 3px solid #90ee90;
}

#progression-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: end;
}

.progression-btn {
    padding: 10px 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    background-color: #2a6a2a;
    color: #90ee90;
    border: 2px solid #90ee90;
    cursor: pointer;
    transition: all 0.2s;
}

.progression-btn:hover {
    background-color: #90ee90;
    color: #2a6a2a;
    transform: translateY(-2px);
}

.progression-btn.secondary {
    background-color: #4a4a4a;
    color: #cccccc;
    border-color: #666;
}

.progression-btn.active {
    background-color: #90ee90;
    color: #2a6a2a;
}

#speed-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    font-size: 7px;
}

.speed-btn {
    padding: 5px 10px;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    background-color: #333;
    color: #999;
    border: 1px solid #666;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-btn.active {
    background-color: #ffaa00;
    color: #000;
}

/* Regular HUD */
#hud {
    background-color: #1a1a1a;
    padding: 15px;
    border: 3px solid #4a4a4a;
    margin-bottom: 10px;
}

#resources {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.resource {
    font-size: 10px;
    background-color: #2d2d2d;
    padding: 8px 12px;
    border: 2px solid #555;
    border-radius: 4px;
    position: relative;
    min-width: 120px;
}

.trend-arrow {
    position: absolute;
    top: -5px;
    right: 5px;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.trend-up { color: #00ff00; }
.trend-down { color: #ff4444; }
.trend-stable { color: #ffff00; }

#progress-container {
    margin-top: 10px;
}

#progress-label {
    font-size: 10px;
    margin-bottom: 5px;
    color: #d4af37;
}

#progress-bar {
    position: relative;
    width: 100%;
    height: 25px;
    background-color: #333;
    border: 2px solid #666;
}

#progress-fill {
    height: 100%;
    background-color: #ff6b35;
    transition: width 0.5s;
}

#competitors {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
}

.competitor {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 2px 4px;
    border-radius: 2px;
    transition: left 0.5s;
}

.competitor.apple {
    background-color: rgba(255, 107, 53, 0.9);
}

/* Main Content */
#main-content {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

#canvas {
    border: 4px solid #4a4a4a;
    background-color: #87ceeb;
    image-rendering: pixelated;
}

#event-log {
    width: 350px;
    background-color: #2d2d2d;
    border: 3px solid #4a4a4a;
    padding: 15px;
}

#event-log h3 {
    font-size: 12px;
    color: #d4af37;
    margin-bottom: 10px;
}

#daily-summary {
    background-color: #1a4a1a;
    border: 2px solid #2a6a2a;
    padding: 10px;
    border-radius: 4px;
}

#events-list {
    height: 200px;
    overflow-y: auto;
}

.event {
    font-size: 8px;
    margin-bottom: 10px;
    padding: 8px;
    background-color: #1a1a1a;
    border-left: 3px solid #ff6b35;
    line-height: 1.3;
}

/* Controls */
#controls {
    background-color: #2d2d2d;
    border: 3px solid #4a4a4a;
    padding: 15px;
}

#controls h3 {
    font-size: 12px;
    color: #d4af37;
    margin-bottom: 15px;
}

#action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.action-btn {
    position: relative;
    padding: 15px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background-color: #654321;
    color: #ffffff;
    border: 3px solid #8b7355;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.action-btn:hover {
    background-color: #8b7355;
    transform: translateY(-2px);
}

.action-btn:active {
    background-color: #4a3728;
    transform: translateY(0);
}

.action-counter {
    font-size: 6px;
    color: #cccccc;
    margin-top: 5px;
}

.uses-count {
    color: #ffaa00;
    font-weight: bold;
}

#inventory {
    margin-bottom: 20px;
}

#inventory h4 {
    font-size: 10px;
    color: #d4af37;
    margin-bottom: 10px;
}

#projects-list {
    background-color: #1a1a1a;
    border: 2px solid #4a4a4a;
    padding: 10px;
    min-height: 60px;
}

.project {
    font-size: 8px;
    margin-bottom: 5px;
    color: #90ee90;
}

#game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#game-controls button {
    padding: 10px 15px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background-color: #444;
    color: #ffffff;
    border: 2px solid #666;
    cursor: pointer;
    transition: background-color 0.2s;
}

#game-controls button:hover {
    background-color: #666;
}

#debug-advance {
    background-color: #cc4400 !important;
    border-color: #ff6600 !important;
    animation: pulse-warning 1s infinite;
}

/* Game Over Screen */
#game-over-screen {
    text-align: center;
    background-color: #4a3728;
    padding: 40px;
    border: 4px solid #8b7355;
    border-radius: 8px;
    max-width: 600px;
}

#game-over-screen h1 {
    font-size: 24px;
    color: #ff6b35;
    margin-bottom: 20px;
}

#ending-text {
    font-size: 12px;
    margin-bottom: 15px;
    line-height: 1.5;
    color: #d4af37;
}

#final-stats {
    background-color: rgba(0,0,0,0.3);
    padding: 15px;
    border: 2px solid #666;
    border-radius: 4px;
}

#final-stats div {
    margin-bottom: 5px;
}

#play-again {
    padding: 15px 25px;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    background-color: #654321;
    color: #ffffff;
    border: 3px solid #8b7355;
    cursor: pointer;
    transition: background-color 0.2s;
}

#play-again:hover {
    background-color: #8b7355;
}

/* Recovery Modal */
#recovery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #4a3728;
    border: 4px solid #ff6600;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
}

.modal-content h3 {
    color: #ff6600;
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 10px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-content button {
    margin: 5px;
    padding: 10px 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    border: 2px solid #666;
    cursor: pointer;
}

#fix-progression {
    background-color: #2a6a2a;
    color: #90ee90;
    border-color: #90ee90;
}

#close-modal {
    background-color: #666;
    color: #ccc;
    border-color: #999;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Responsive Design */
@media (max-width: 1400px) {
    #main-content {
        flex-direction: column;
    }
    
    #canvas {
        width: 100%;
        height: auto;
    }
    
    #event-log {
        width: 100%;
    }
    
    #progression-hud {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 12px;
    }
    
    #progression-hud {
        padding: 10px;
    }
    
    #day-controls {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    #progression-controls {
        align-items: center;
    }
    
    #resources {
        justify-content: center;
    }
    
    .resource {
        font-size: 8px;
        padding: 6px 8px;
        min-width: 100px;
    }
    
    #action-buttons {
        grid-template-columns: 1fr;
    }
    
    .action-btn {
        min-height: 60px;
        font-size: 7px;
    }
    
    #canvas {
        width: 100%;
        height: 300px;
    }
}

/* Enhanced scrollbar styling */
#events-list::-webkit-scrollbar {
    width: 8px;
}

#events-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

#events-list::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
}

#events-list::-webkit-scrollbar-thumb:hover {
    background: #666;
}