#stats {
    position: absolute;
    top: 60px;
    right: 15px;
    background: rgba(10, 10, 30, 0.88);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 11px;
    z-index: 10;
    width: 196px;
    overflow: hidden;
}

.stat-section + .stat-section {
    border-top: 1px solid rgba(255,255,255,0.06);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    font-size: 9px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
}
.stat-header:hover { color: #888; }

.stat-chevron {
    width: 8px;
    height: 8px;
    color: #555;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    transform: rotate(90deg);
}
.stat-section.collapsed .stat-chevron {
    transform: rotate(0deg);
}

.stat-header-inline {
    margin-left: auto;
    color: #4a9eff;
    font-weight: 600;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.stat-section.collapsed .stat-header-inline {
    opacity: 1;
}

.stat-body {
    padding: 0 12px 8px;
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}
.stat-section.collapsed .stat-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}
.stat-label { color: #888; font-size: 11px; }
.stat-value {
    color: #4a9eff;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-value.danger { color: #ff4a4a; }

.stat-row-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}
.stat-row-bar .stat-label { flex-shrink: 0; }
.stat-row-bar .stat-value { flex-shrink: 0; min-width: 32px; text-align: right; font-size: 10px; }

.stat-bar-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    min-width: 30px;
}
.stat-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: #4eff7a;
    transition: width 0.15s ease, background-color 0.3s ease;
}

.stat-bar-full-wrap {
    height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    margin: 2px 0 4px;
}
.stat-bar-full {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: #4a9eff;
    transition: width 0.3s ease;
}

.stat-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stat-dot.green { background: #4eff7a; box-shadow: 0 0 4px #4eff7a; }
.stat-dot.yellow { background: #ffc04a; box-shadow: 0 0 4px #ffc04a; }
.stat-dot.red { background: #ff4a4a; box-shadow: 0 0 4px #ff4a4a; }
.stat-dot.off { background: #333; box-shadow: none; }

.stat-score {
    color: #ffcc00 !important;
    font-size: 14px !important;
    font-weight: 700;
}

#status-msg {
    position: fixed;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 30, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 10px 24px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
    max-width: 500px;
}
#status-msg.visible { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Camera dropdown */
.cam-dropdown {
    position: fixed;
    background: rgba(10,10,30,0.95);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 4px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
    z-index: 100;
}
.cam-dropdown.visible { display: flex; }
.cam-dropdown button {
    padding: 6px 12px;
    margin: 0;
    border: none;
    border-radius: 4px;
    background: none;
    color: #aaa;
    font-size: 11px;
    cursor: pointer;
    text-align: left;
    flex: none;
}
.cam-dropdown button:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Arc indicator */
.arc-indicator {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(74, 158, 255, 0.6);
    border-radius: 8px;
    padding: 8px 16px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
    pointer-events: none;
    display: none;
}
.arc-indicator.visible { display: block; }

.palette-label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    margin-top: 8px;
}
.palette-label:first-child { margin-top: 0; }

/* Attempt history */
.attempt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #aaa;
    padding: 2px 0;
}
.attempt-row + .attempt-row {
    border-top: 1px solid rgba(255,255,255,0.04);
}
.attempt-score {
    color: #ffcc00;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.attempt-empty {
    color: #555;
    font-size: 10px;
    font-style: italic;
    text-align: center;
    padding: 4px 0;
}

/* Hidden legacy elements kept for JS compat */
#carSelect { display: none; }
