* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

.container, .game-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

h1 {
    color: #2c3e50;
    text-align: center;
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

/* Welcome page */
.welcome-box {
    background: white;
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.welcome-box h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.welcome-box p {
    font-size: 1.3em;
    margin: 15px 0;
    color: #333;
}

.start-button {
    display: inline-block;
    margin-top: 30px;
    padding: 20px 50px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1.5em;
    font-weight: bold;
    transition: transform 0.2s;
}

.start-button:hover {
    transform: scale(1.1);
    background: #45a049;
}

/* Game page */
.score-board {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 18px 15px;
    border-radius: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 2px solid rgba(255,255,255,0.5);
}

.score-board span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.score-board span > span {
    font-size: 1.6em;
    font-weight: 700;
    color: #2c3e50;
}

.stats-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
    padding: 15px;
    border-radius: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    border: 2px solid rgba(255,255,255,0.4);
}

.stats-panel span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    color: #555;
    font-weight: 500;
}

.stats-panel span > span {
    font-size: 1.3em;
    font-weight: 600;
    color: #34495e;
}

.control-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 15px 20px;
    border-radius: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    border: 2px solid rgba(255,255,255,0.4);
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.95em;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.simulation-area {
    position: relative;
    background: white;
    border-radius: 20px;
    margin-bottom: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.6);
}

#track-canvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8C8 100%);
    cursor: crosshair;
    border-radius: 18px;
}

.stations-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.station-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: all;
    background: white;
    padding: 10px;
    border-radius: 10px;
    border: 3px solid #667eea;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    min-width: 100px;
}

.station-emoji {
    font-size: 2em;
    margin-bottom: 5px;
}

.station-name {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9em;
}

.station-cargo-display {
    margin-top: 5px;
    font-size: 0.8em;
    color: #666;
    min-height: 20px;
}

.cargo-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 2px solid rgba(255,255,255,0.5);
}

.cargo-panel h3 {
    color: #667eea;
    margin-bottom: 18px;
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
}

.building-tools {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}

.tool-btn {
    padding: 18px 12px;
    border: 3px solid transparent;
    border-radius: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.tool-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.tool-btn:hover::before {
    left: 100%;
}

.tool-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.tool-btn.selected {
    border-color: #FFD700;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.tool-btn small {
    display: block;
    margin-top: 6px;
    font-size: 0.85em;
    opacity: 0.95;
    font-weight: 500;
}

.info-panel {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    padding: 18px;
    border-radius: 15px;
    margin-bottom: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    border: 2px solid rgba(255,255,255,0.6);
}

#city-status, #tool-info {
    font-size: 1em;
    color: #2c3e50;
    margin: 8px 0;
    font-weight: 500;
    text-align: center;
    line-height: 1.5;
}

h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px 50px;
    border-radius: 20px;
    font-size: 2em;
    font-weight: bold;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.feedback.success {
    background: #4CAF50;
    color: white;
    display: block;
}

.feedback.error {
    background: #f44336;
    color: white;
    display: block;
}

.feedback.info {
    background: #2196F3;
    color: white;
    display: block;
}
