/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
    overflow: hidden;
    background: #87CEEB;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Top Bar */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

/* Bottom Panel */
#bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.item-list {
    display: flex;
    gap: 10px;
    padding: 10px;
    height: 100%;
    align-items: center;
}

/* Buttons */
.btn {
    min-width: 80px;
    height: 50px;
    font-size: 20px;
    font-weight: bold;
    border: 3px solid #333;
    border-radius: 15px;
    background: linear-gradient(to bottom, #fff, #f0f0f0);
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 4px 0 #999;
    position: relative;
    top: 0;
}

#sound-btn {
    position: absolute;
    right: 10px;
    top: 10px;
}

.btn:active {
    top: 3px;
    box-shadow: 0 1px 0 #999;
}

.btn-play {
    min-width: 70px;
    height: 70px;
    border-radius: 50%;
    font-size: 30px;
    background: linear-gradient(to bottom, #4CAF50, #45a049);
    color: white;
    border-color: #2d6b2f;
    box-shadow: 0 6px 0 #2d6b2f;
}

.btn-play.playing {
    background: linear-gradient(to bottom, #ff9800, #f57c00);
    border-color: #c65100;
    box-shadow: 0 6px 0 #c65100;
}

.btn-play:active {
    top: 4px;
    box-shadow: 0 2px 0 #2d6b2f;
}

.btn.active {
    background: linear-gradient(to bottom, #FFD700, #FFA500);
    border-color: #ff8c00;
}

/* Item Buttons */
.item-btn {
    min-width: 80px;
    height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: 3px solid #666;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 3px 0 #999;
    position: relative;
    top: 0;
    flex-shrink: 0;
}

.item-btn:active {
    top: 2px;
    box-shadow: 0 1px 0 #999;
}

.item-btn.selected {
    background: #FFD700;
    border-color: #ff8c00;
    box-shadow: 0 3px 0 #cc7000;
}

.item-icon {
    font-size: 32px;
    line-height: 1;
}

.item-label {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
}

/* Canvas Container */
#canvas-container {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 120px;
    overflow: hidden;
}

#canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    #top-bar {
        height: 60px;
        padding: 8px;
    }
    
    .btn {
        min-width: 70px;
        height: 44px;
        font-size: 18px;
    }
    
    #sound-btn {
        right: 8px;
        top: 8px;
    }
    
    .btn-play {
        min-width: 60px;
        height: 60px;
        font-size: 26px;
    }
    
    #bottom-panel {
        height: 100px;
    }
    
    .item-btn {
        min-width: 70px;
        height: 80px;
    }
    
    .item-icon {
        font-size: 28px;
    }
    
    .item-label {
        font-size: 10px;
    }
    
    #canvas-container {
        top: 60px;
        bottom: 100px;
    }
}

/* Custom train car icons */
.icon-diesel {
    width: 32px;
    height: 24px;
    background: linear-gradient(to bottom, #FFB020 0%, #FF9C20 100%);
    border: 2px solid #333;
    border-radius: 2px;
    position: relative;
    margin: 0 auto;
}

.icon-diesel::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 4px;
    width: 24px;
    height: 8px;
    background: linear-gradient(to bottom, #FFD700 0%, #FFA500 100%);
    border-radius: 1px;
}

.icon-diesel::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 6px;
    width: 6px;
    height: 4px;
    background: #87CEEB;
    box-shadow: 12px 0 0 #87CEEB;
}

.icon-passenger {
    width: 32px;
    height: 20px;
    background: linear-gradient(to bottom, #A8D8EA 0%, #87CEEB 100%);
    border: 2px solid #333;
    border-radius: 2px;
    position: relative;
    margin: 0 auto;
}

.icon-passenger::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 3px;
    width: 5px;
    height: 5px;
    background: #4682B4;
    box-shadow: 8px 0 0 #4682B4, 16px 0 0 #4682B4;
}

.icon-caboose {
    width: 32px;
    height: 24px;
    position: relative;
    margin: 0 auto;
}

.icon-caboose::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 32px;
    height: 16px;
    background: linear-gradient(to bottom, #DD0000 0%, #CC0000 100%);
    border: 2px solid #333;
    border-radius: 2px;
}

.icon-caboose::after {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 16px;
    height: 12px;
    background: linear-gradient(to bottom, #CC0000 0%, #AA0000 100%);
    border: 2px solid #333;
    border-radius: 1px;
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    #top-bar {
        height: 50px;
    }
    
    #bottom-panel {
        height: 80px;
    }
    
    .btn {
        min-width: 60px;
        height: 36px;
        font-size: 16px;
    }
    
    #sound-btn {
        right: 10px;
        top: 7px;
    }
    
    .btn-play {
        min-width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .item-btn {
        min-width: 60px;
        height: 60px;
    }
    
    .item-icon {
        font-size: 24px;
    }
    
    #canvas-container {
        top: 50px;
        bottom: 80px;
    }
}

