* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    overflow: hidden;
    background-color: #e0e0e0;
    font-family: sans-serif;
    touch-action: none;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    touch-action: none;
}

#master-mode-switcher {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    gap: 5px;
    pointer-events: auto;
    z-index: 1000;
}

.panel, #ui-top, #ui-info, #ui-dubins, #ui-actions, #ui-selection, #ui-depot-preview {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    pointer-events: auto;
}

#ui-top {
    top: 60px;
    left: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 95vw;
}

#ui-info {
    top: 175px;
    left: 10px;
    font-size: 14px;
    line-height: 1.5;
}

#ui-depot-preview {
    top: 175px;
    left: 10px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 70vh;
    overflow-y: auto;
}

#ui-dubins {
    bottom: 70px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#ui-actions {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

#ui-selection {
    top: 175px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 220px;
    max-height: 70vh;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: white;
    font-weight: bold;
    transition: 0.1s;
}

    button.active {
        background: #004494;
        box-shadow: inset 0 3px 5px rgba(0,0,0,0.3);
        transform: translateY(1px);
    }

    button.success {
        background: #28a745;
    }

    button.danger {
        background: #dc3545;
    }

    button:active {
        filter: brightness(0.9);
    }

.divider {
    width: 1px;
    height: 24px;
    background: #ccc;
    margin: 0 4px;
}

.h-divider {
    width: 100%;
    height: 1px;
    background: #ccc;
    margin: 4px 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

input[type=range] {
    vertical-align: middle;
}

    input[type=range]:disabled {
        opacity: 0.5;
    }

input[type=color] {
    height: 30px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

label {
    font-size: 12px;
    font-weight: bold;
}

.number-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

    .number-input button {
        padding: 4px 10px;
        font-size: 16px;
        background: #ddd;
        color: #333;
        border-radius: 4px;
    }

        .number-input button:active {
            background: #bbb;
        }

    .number-input input, #selection-depot-props input[type="text"], #selection-depot-props input[type="number"] {
        width: 70px;
        text-align: center;
        padding: 6px;
        border: 1px solid #ccc;
        border-radius: 4px;
        font-size: 14px;
        font-weight: bold;
    }

#line-stations li {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 4px;
    border-bottom: 1px solid #eee;
}

    #line-stations li input {
        width: 40px;
        font-size: 11px;
        padding: 2px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 3px;
    }

    #line-stations li button {
        padding: 2px 5px;
        font-size: 10px;
    }

#attribution {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 10px;
    color: #555;
    background: rgba(255,255,255,0.7);
    padding: 2px 4px;
    pointer-events: none;
}

/* COMPACT MOBILE UI */
@media (max-width: 768px) {
    #master-mode-switcher {
        top: 5px;
        padding: 3px;
        font-size: 11px;
    }

        #master-mode-switcher button {
            padding: 4px 6px;
            font-size: 11px;
        }

    #ui-top {
        top: 40px;
        left: 5px;
        gap: 5px;
        padding: 6px;
    }

    button {
        padding: 5px 8px;
        font-size: 11px;
    }

    .control-group {
        flex-direction: row;
        align-items: center;
        gap: 5px;
    }

    label {
        font-size: 10px;
        white-space: nowrap;
    }

    .number-input input, #selection-depot-props input[type="text"], #selection-depot-props input[type="number"] {
        width: 50px;
        padding: 4px;
        font-size: 11px;
    }

    .number-input button {
        padding: 2px 6px;
    }

    #ui-info, #ui-depot-preview {
        top: 125px;
        left: 5px;
        font-size: 11px;
        padding: 6px;
    }

    #ui-selection {
        top: 125px;
        right: 5px;
        padding: 8px;
        max-width: 180px;
    }

    #ui-dubins {
        bottom: 60px;
        left: 5px;
        padding: 6px;
    }

    .panel {
        top: 40px !important;
        left: 5px !important;
    }
}
