* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #0b0e14;
    color: #e5e9f0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---------- top bar ---------- */

#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: linear-gradient(180deg, #171b26, #12151e);
    border-bottom: 1px solid #262b38;
    z-index: 5;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
}

.brand .tagline {
    font-size: 12px;
    font-weight: 400;
    color: #8a91a3;
}

.top-stats {
    display: flex;
    gap: 22px;
}

.top-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 66px;
}

.top-stats label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7d8496;
}

.top-stats span {
    font-size: 17px;
    font-weight: 700;
    color: #7dd3fc;
    font-variant-numeric: tabular-nums;
}

/* ---------- main layout ---------- */

#main {
    position: relative;
    flex: 1;
    display: flex;
    overflow: hidden;
}

#worldCanvas {
    flex: 1;
    display: block;
    background: #bfe3ff;
    cursor: grab;
}
#worldCanvas:active { cursor: grabbing; }

#minimapWrap {
    position: absolute;
    right: 328px;
    bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
}

#minimapCanvas { display: block; }

.camera-reset {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 4;
}

/* ---------- sidebar ---------- */

#sidebar {
    width: 312px;
    flex-shrink: 0;
    background: #12151e;
    border-left: 1px solid #262b38;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel {
    background: #171b26;
    border: 1px solid #262b38;
    border-radius: 12px;
    padding: 14px;
}

.panel h2 {
    margin: 0 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa2b8;
}

.btn-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

button {
    flex: 1;
    background: #232838;
    color: #e5e9f0;
    border: 1px solid #33394d;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
button:hover { background: #2c3345; }
button:active { transform: scale(0.97); }

button.primary { background: #2563eb; border-color: #3b76f0; }
button.primary:hover { background: #2f6fef; }

button.danger { background: #3a1f22; border-color: #63292e; color: #ff9a9a; }
button.danger:hover { background: #4a2226; }

.camera-reset {
    width: auto;
    flex: none;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #9aa2b8;
}

.field input[type="number"] {
    background: #0d1017;
    border: 1px solid #33394d;
    color: #e5e9f0;
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 14px;
    width: 100%;
}

.speed-row {
    display: flex;
    gap: 6px;
}

.speed-btn {
    flex: 1;
    padding: 7px 0;
    font-size: 12px;
}

.speed-btn.active {
    background: #2563eb;
    border-color: #3b76f0;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-list input {
    accent-color: #2563eb;
    width: 15px;
    height: 15px;
}

#carInfoPanel h3 {
    margin: 0 0 8px;
    font-size: 15px;
    color: #7dd3fc;
    letter-spacing: 0.03em;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #1e2330;
    font-size: 13px;
}

.stat-row span { color: #9aa2b8; }
.stat-row b { color: #e5e9f0; font-variant-numeric: tabular-nums; }

.muted { color: #6b7288; font-size: 13px; margin: 0; }

#nnCanvas {
    width: 100%;
    height: auto;
    background: #0d1017;
    border-radius: 8px;
    border: 1px solid #262b38;
}

/* ---------- scrollbar ---------- */
#sidebar::-webkit-scrollbar { width: 8px; }
#sidebar::-webkit-scrollbar-thumb { background: #2c3345; border-radius: 8px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
    #minimapWrap { right: 16px; bottom: 16px; }
    #sidebar { width: 260px; }
}
