* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #2b2b2b;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', 'Roboto', system-ui, sans-serif;
}

#app-container {
    display: flex;
    flex-direction: row;
    background: #3a3a3a;
    border-radius: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), inset 0 1px 2px #5a5a5a;
    padding: 20px;
    gap: 20px;
    max-width: 1800px;
    width: fit-content;
}

/* LEFT UI PANEL */
#ui-panel {
    width: 300px;
    background: #2f2f2f;
    border-radius: 20px;
    padding: 20px 16px;
    box-shadow: inset 0 2px 6px #1a1a1a, 0 8px 0 #1e1e1e;
    border: 1px solid #e67e22;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 {
    margin: 0 0 4px 0;
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #f39c12;
    text-shadow: 3px 3px 0 #1a1a1a;
}

.car-specs {
    font-size: 1rem;
    background: #404040;
    padding: 6px 12px;
    border-radius: 40px;
    text-align: center;
    border: 1px solid #3498db;
    margin-bottom: 6px;
}

.stat-card {
    background: #3c3c3c;
    border-radius: 18px;
    padding: 14px 12px;
    box-shadow: inset 0 1px 4px #1e1e1e, 0 5px 0 #262626;
    border-left: 4px solid #e67e22;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #b0b0b0;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #f1f1f1;
    line-height: 1.2;
}

.hint {
    font-size: 0.8rem;
    color: #9aa;
    margin-top: 6px;
}

.control-group {
    background: #3a3a3a;
    padding: 14px 12px;
    border-radius: 18px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: #d4d4d4;
    margin-bottom: 8px;
}

input[type=range] {
    width: 100%;
    accent-color: #3498db;
    background: #4a4a4a;
    height: 6px;
    border-radius: 10px;
}

input[type="color"] {
    background: #2a2a2a;
    border: 1px solid #555;
    padding: 2px;
    height: 45px;
}

#zoom-value {
    font-family: monospace;
    background: #2a2a2a;
    padding: 2px 10px;
    border-radius: 30px;
}

.primary-btn {
    background: #e67e22;
    border: none;
    color: white;
    font-weight: bold;
    padding: 14px 10px;
    border-radius: 60px;
    font-size: 1.2rem;
    box-shadow: 0 6px 0 #b85e0a;
    cursor: pointer;
    transition: all 0.08s;
    border: 1px solid #f39c12;
    /* margin-top: 8px; */
}

.primary-btn:hover {
    background: #f39c12;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #b85e0a;
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b85e0a;
}

.legend {
    margin-top: 8px;
    font-size: 0.85rem;
    background: #2a2a2a;
    padding: 12px;
    border-radius: 16px;
    color: #ccc;
}

.legend .key {
    display: inline-block;
    background: #404040;
    border-radius: 8px;
    padding: 2px 10px;
    margin-right: 8px;
    font-weight: bold;
    border: 1px solid #3498db;
}

/* CENTER CANVAS */
#canvas-wrapper {
    background: #353535;
    border-radius: 24px;
    padding: 10px;
    box-shadow: inset 0 0 0 3px #4a4a4a, 0 10px 0 #1e1e1e;
}

canvas {
    display: block;
    border-radius: 16px;
    background: #4B4B4B;
    box-shadow: inset 0 0 0 2px #555;
    cursor: crosshair;
}

/* RIGHT CAR PANEL */
#car-panel {
    width: 400px;
    background: #2f2f2f;
    border-radius: 20px;
    padding: 20px 16px;
    box-shadow: inset 0 2px 6px #1a1a1a, 0 8px 0 #1e1e1e;
    border: 1px solid #3498db;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 935px;
    overflow-y: auto;
}

#car-panel h2 {
    margin: 0 0 4px 0;
    color: #3498db;
    text-shadow: 2px 2px 0 #1a1a1a;
    font-size: 1.8rem;
}

#car-panel h3 {
    margin: 8px 0 6px 0;
    color: #3498db;
    font-size: 1.2rem;
}

.section {
    background: #3a3a3a;
    padding: 14px 12px;
    border-radius: 16px;
    border-left: 3px solid #e67e22;
}

.sub-section {
    margin-top: 6px;
}

.sub-section label {
    margin-bottom: 4px;
}

.car-select {
    width: 100%;
    padding: 10px;
    background: #2a2a2a;
    color: white;
    border: 1px solid #3498db;
    border-radius: 8px;
    font-size: 1rem;
}

.car-details {
    font-size: 0.9rem;
    line-height: 1.6;
    background: #333;
    padding: 10px;
    border-radius: 10px;
}

.car-details span {
    color: #f39c12;
    font-weight: bold;
}

.form-group {
    margin-bottom: 4px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    background: #2a2a2a;
    border: 1px solid #555;
    color: white;
    border-radius: 6px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.half {
    flex: 1;
}

.secondary-btn,
.small-btn,
.danger-btn {
    background: #3498db;
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #1f5a7a;
    transition: 0.08s;
    width: 100%;
    margin-top: 8px;
    font-size: 0.9rem;
}

.small-btn {
    background: #5a5a5a;
    box-shadow: 0 4px 0 #3a3a3a;
    margin-top: 5px;
}

.danger-btn {
    background: #c0392b;
    box-shadow: 0 4px 0 #8b2a1f;
}

.secondary-btn:hover,
.small-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #1f5a7a;
}

.danger-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #8b2a1f;
}

textarea {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: #2a2a2a;
    color: white;
    border: 1px solid #555;
    border-radius: 8px;
    resize: vertical;
    font-family: monospace;
    font-size: 0.8rem;
}

/* Mode toggle buttons */
.mode-btn {
    flex: 1;
    padding: 10px;
    background: #3a3a3a;
    border: 1px solid #555;
    color: #ccc;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s;
}

.mode-btn.active {
    background: #e67e22;
    border-color: #f39c12;
    color: white;
    box-shadow: 0 3px 0 #b85e0a;
}

.mode-btn:hover {
    filter: brightness(1.1);
}

.selected-object {
    outline: 3px solid #f39c12 !important;
    outline-offset: 2px;
}