* {
    user-select: none;
    box-sizing: border-box;
}

/* ===== НАСТРАИВАЕМЫЕ ПАРАМЕТРЫ ===== */
:root {
    /* === Настройки выреза наклейки === */
    --single-cutout-radius-percent: 14.6%;
    --single-sticker-radius-percent: 32.5%;
    --full-cutout-radius-percent: 14.6%;
    --full-sticker-radius-percent: 32.5%;
    
    /* === Размеры дисков (в процентах от ширины контейнера) === */
    --single-wheel-size: 65%;
    --full-wheel-size: 15.1%;
    
    /* === Позиции дисков (в процентах от контейнера) === */
    --full-wheel-left: 21.3%;
    --full-wheel-right: 77.1%;
    --full-wheel-top: 60.5%;
    
    /* === Настройки изображения авто === */
    --single-car-scale: 5.8;
    --single-car-translate-x: 20.2%;
    --single-car-translate-y: -8%;
    --full-car-scale: 1.8;
    
    /* === Настройки фона (бесшовная текстура) === */
    --bg-speed-factor: 8000;
    --bg-scale: 0.5;
    --bg-offset-y: 100%;
    
    /* === Размер пользовательского диска (в процентах от колеса) === */
    --custom-disc-size: 75%;
    
    /* === Отладка === */
    --show-debug-bounds: 0;
}

body {
    background: linear-gradient(145deg, #1a2a3a 0%, #0f1a24 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 20px;
}

.editor-card {
    background: rgba(30, 40, 50, 0.75);
    backdrop-filter: blur(2px);
    border-radius: 10px;
    padding: 25px 30px 35px;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}

.brand-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,215,150,0.3);
}

.brand-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #ffdd99, #ffaa66);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}

.brand-model {
    font-size: 0.75rem;
    color: #aabbcc;
    margin: 8px 0 0 0;
    letter-spacing: 0.5px;
}

/* Панель выбора цвета */
.color-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.color-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    opacity: 0.7;
}

.color-btn.active {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 0 3px white, 0 4px 10px rgba(0,0,0,0.4);
}

.color-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* Панель выбора колеса */
.wheel-selector-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.wheel-selector-btn {
    background: #2c3e4e;
    border: none;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 8px 18px;
    border-radius: 10px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 250px;
    max-width: 250px;
    text-align: center;
}

.wheel-selector-btn.active {
    background: #d48c2c;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.wheel-selector-btn:hover {
    background: #3a5e6b;
    color: white;
}

.wheel-file-label {
    background: #3a5e6b;
    padding: 8px 18px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 0.85rem;
}

.wheel-file-label:hover {
    background: #4f7f8f;
}

.view-mode-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.view-mode-btn {
    background: #2c3e4e;
    border: none;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 8px 20px;
    border-radius: 10px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-mode-btn.active {
    background: #d48c2c;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.view-mode-btn:hover {
    background: #3a5e6b;
    color: white;
}

.wheel-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    aspect-ratio: 16 / 9;
    max-width: 100%;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(0,0,0,0.3);
}


.road-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
    transition: none;
}

.car-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1;
    transition: all 0.4s ease-out;
}

.car-image {
    transition: all 0.4s ease-out;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wheel-stage.single-mode .car-image {
    transform: scale(var(--single-car-scale)) translateX(var(--single-car-translate-x)) translateY(var(--single-car-translate-y));
    object-fit: cover;
}

.wheel-stage.full-mode .car-image {
    transform: scale(var(--full-car-scale)) translateX(0) translateY(0);
    object-fit: contain;
}

.wheel-canvas {
    position: absolute;
    display: block;
    border-radius: 50%;
    z-index: 2;
    transition: all 0.3s ease-out;
}

.wheel-stage.single-mode .left-wheel {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: var(--single-wheel-size);
    height: auto;
    aspect-ratio: 1 / 1;
}

.wheel-stage.single-mode .right-wheel {
    display: none;
}

.wheel-stage.full-mode .left-wheel {
    left: var(--full-wheel-left);
    top: var(--full-wheel-top);
    transform: translate(-50%, -50%);
    width: var(--full-wheel-size);
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
}

.wheel-stage.full-mode .right-wheel {
    left: var(--full-wheel-right);
    top: var(--full-wheel-top);
    transform: translate(-50%, -50%);
    width: var(--full-wheel-size);
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
}

.speed-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.speed-display, .direction-indicator {
    text-align: center;
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 40px;
    border: 1px solid rgba(255, 200, 100, 0.3);
}

.direction-indicator {
    border-color: rgba(100, 200, 150, 0.3);
}

.speed-label, .direction-label {
    font-size: 0.7rem;
    color: #aaa;
    letter-spacing: 1px;
    margin-right: 8px;
}

.speed-value {
    font-size: 1.6rem;
    font-weight: bold;
    color: #ffcc66;
    font-family: 'Monaco', 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(255,200,0,0.3);
}

.speed-unit {
    font-size: 0.7rem;
    color: #aaa;
    margin-left: 4px;
}

.direction-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #88ffaa;
}

.controls {
    background: rgba(25, 35, 45, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid rgba(255,215,150,0.4);
    margin-bottom: 20px;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.second-row {
    padding-top: 5px;
    border-top: 1px solid rgba(255,215,150,0.2);
}

.reset-angle-btn {
    background: #3a5e6b;
    border: none;
    font-weight: bold;
    padding: 8px 18px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-size: 1.2rem;
}

.start-btn {
    background: #2c6e3a;
    border: none;
    font-weight: bold;
    padding: 8px 18px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    font-size: 1.1rem;
    min-width: 130px;
    max-width: 130px;
}

.start-btn.stop {
    background: #8b3a3a;
}

.reset-angle-btn:active, .start-btn:active {
    transform: scale(0.96);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e2a32;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #ffdd99;
    font-weight: bold;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #88ffaa;
}

.speed-slider {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #1e2a32;
    padding: 10px 20px;
    border-radius: 10px;
    align-items: center;
}

.speed-slider label {
    color: #ffdd99;
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}

input[type="range"] {
    width: 220px;
    cursor: pointer;
    background: linear-gradient(to right, #88ffaa, #ffcc66, #ffaa88);
    height: 4px;
    border-radius: 5px;
}

.slider-value-display {
    text-align: center;
    font-size: 0.9rem;
}

/* Кнопка загрузки */
.file-label {
    background: #3a5e6b;
    padding: 8px 22px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 0.9rem;
    min-width: 220px;
    text-align: center;
    display: inline-block;
}

.file-label:hover {
    background: #4f7f8f;
}

input[type="file"] {
    display: none;
}

/* Статус */
.status {
    background: #00000066;
    border-radius: 10px;
    padding: 6px 18px;
    font-size: 0.75rem;
    color: #ffecb3;
    font-weight: 500;
    min-width: 250px;
    max-width: 250px;
    text-align: center;
    display: inline-block;
}

.filter-panel {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid rgba(100, 200, 150, 0.5);
}

.filter-header {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    user-select: none;
    background: #2c3a2f;
    color: #aaffcc;
}

.filter-header:hover {
    filter: brightness(1.1);
}

.filter-content {
    padding: 15px 20px;
    transition: all 0.3s;
}

.filter-panel.collapsed .filter-content {
    display: none;
}

.filter-slider {
    margin-bottom: 15px;
}

.filter-slider label {
    display: block;
    margin-bottom: 8px;
    color: #ddd;
    font-size: 0.85rem;
}

.filter-slider input {
    width: 100%;
    max-width: 300px;
}

.reset-filters {
    background: #6b3a3a;
    margin-top: 10px;
    padding: 6px 16px;
    font-size: 0.85rem;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
}

.reset-filters:hover {
    background: #8a4a4a;
}

@media (max-width: 800px) {
    :root {
        --full-wheel-size: 20%;
        --full-wheel-left: 20%;
        --full-wheel-right: 80%;
        --single-wheel-size: 70%;
    }
    .brand-title { font-size: 1.3rem; }
    .brand-model { font-size: 0.65rem; }
    .start-btn { min-width: 110px; max-width: 110px; font-size: 0.9rem; }
    .reset-angle-btn { font-size: 1rem; padding: 6px 14px; }
    .color-btn { width: 40px; height: 40px; }
}

@media (max-width: 600px) {
    :root {
        --full-wheel-size: 18%;
        --full-wheel-left: 18%;
        --full-wheel-right: 82%;
        --single-wheel-size: 60%;
    }
    .start-btn { min-width: 90px; max-width: 90px; font-size: 0.8rem; }
    .reset-angle-btn { font-size: 0.9rem; padding: 5px 12px; }
    .checkbox-label { font-size: 0.7rem; padding: 5px 12px; }
    .color-btn { width: 36px; height: 36px; }
}

.wheel-selector-btn.active {
    background: #d48c2c;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Панель выбора цвета колпака HALODISC */
.cap-color-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cap-color-btn {
    background: #2c3e4e;
    border: none;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 8px 18px;
    border-radius: 10px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
    text-align: center;
}

.cap-color-btn.active {
    background: #d48c2c;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.cap-color-btn:hover {
    background: #3a5e6b;
    color: white;
}