:root {
    --bg: #030b14;
    --card: rgba(7, 24, 43, 0.88);
    --border: #17416a;
    --text: #e8f2ff;
    --muted: #a9bfdc;
    --green: #00e6b0;
    --blue: #00bfff;
    --red: #ff315b;
    --yellow: #ffc400;
    --purple: #bd5cff;
}
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html {
    min-height: 100%;
    background: var(--bg);
}
body {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 12px 28px;
    overflow-x: hidden;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    text-align: center;
    color: var(--text);
    background: radial-gradient(ellipse at 50% 8%, rgba(0, 111, 170, 0.18), transparent 42%), linear-gradient(180deg, #071321 0%, #030a13 100%);
}
h2 {
    margin: 8px 0 14px;
    color: #f3f8ff;
    font-size: clamp(24px, 6vw, 30px);
    line-height: 1.2;
    letter-spacing: -0.6px;
    text-shadow: 0 0 20px rgba(0, 191, 255, 0.16);
}
#status {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 18px;
    padding: 9px 22px;
    border: 1px solid #205888;
    border-radius: 24px;
    background: rgba(9, 27, 47, 0.9);
    color: var(--green);
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.06);
}

.car-container {
    position: relative;
    width: 160px;
    height: 240px;
    margin: 25px auto 30px;
    background: linear-gradient(180deg, #16222f 0%, #0b121a 100%);
    border: 2px solid #233951;
    border-radius: 38px 38px 24px 24px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 
                inset 0 1px 2px rgba(255, 255, 255, 0.1),
                0 0 15px rgba(0, 191, 255, 0.05);
}

.car-container::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 25px;
    width: 108px;
    height: 140px;
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    pointer-events: none;
}

.car-pillar {
    position: absolute;
    background: rgba(35, 57, 81, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    z-index: 5;
    pointer-events: none;
}

.car-hood {
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: 54px;
    background: linear-gradient(180deg, #1c2d3f 0%, #131f2c 100%);
    border-bottom: 2px solid #283f57;
    border-radius: 38px 38px 0 0; 
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.3);
    pointer-events: none;
}

.headlight {
    position: absolute;
    top: 2px;
    width: 24px;
    height: 8px;
    background: #cdd9e5;
    border: 1px solid #486581;
    transition: all 0.3s ease;
}
.headlight.left {
    left: 11px;
    border-radius: 10px 0px 3px 2px;
    transform: rotate(-5deg);
}
.headlight.right {
    right: 11px;
    border-radius: 0px 10px 3px 2px;
    transform: rotate(5deg);
}

.headlight.active {
    background: #fff;
    border-color: #fff;
    box-shadow: 0 0 30px #fff, 0 0 40px var(--blue);
}

.rearlight1 {
    position: absolute;
    top: 223px;
    width: 5px;
    height: 10px;
    background: #500000;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.rearlight1.left { left: 5px; transform: rotate(130deg); }
.rearlight1.right { right: 5px; transform: rotate(-130deg); }

.rearlight2 {
    position: absolute;
    top: 228px;
    width: 6px;
    height: 10px;
    background: #500000;
    border-radius: 4px;
    transition: all 0.3s ease;
}
.rearlight2.left { left: 15px; transform: rotate(100deg); }
.rearlight2.right { right: 15px; transform: rotate(-100deg); }

.car-container.lights-on .rearlight1,
.car-container.lights-on .rearlight2 {
    background: #b40000;
    box-shadow: 0 0 10px #fb2600, 0 0 10px var(--red);
}

.car-windshield {
    position: absolute;
    top: 54px;
    left: 5px;
    width: 150px;
    height: 50px;
    background: linear-gradient(180deg, #0b151f 0%, #17283c 100%);
    border: 1px solid #233951;
    border-radius: 8px 8px 4px 4px;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.1);
}
.car-roof {
    position: absolute;
    top: 90px;
    left: 5px;
    width: 150px;
    height: 125px;
    background: linear-gradient(180deg, #14202c 0%, #0f1822 100%);
    border-left: 1px solid #1f3247;
    border-right: 1px solid #1f3247;
}
.car-rear-window {
    position: absolute;
    top: 210px;
    left: 5px;
    width: 150px;
    height: 10px;
    background: linear-gradient(180deg, #17283c 0%, #0b151f 100%);
    border: 1px solid #233951;
    border-radius: 4px 4px 10px 10px;
    box-shadow: inset 0 -2px 5px rgba(255,255,255,0.05);
}
.mirror {
    position: absolute;
    top: 52px;
    width: 20px;
    height: 10px;
    background: #1c2d3f;
    border: 1px solid #283f57;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.mirror.left { left: -19px; transform: rotate(-12deg); border-right: none; }
.mirror.right { right: -19px; transform: rotate(12deg); border-left: none; }

.door {
    position: absolute;
    z-index: 99;
    width: 6px;
    height: 65px;
    background: var(--green);
    border-radius: 3px;
    box-shadow: 0 0 8px var(--green);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, box-shadow 0.3s;
}
.door.open {
    background: var(--red);
    box-shadow: 0 0 12px var(--red);
}
.door.fl { top: 65px; left: -3px; transform-origin: top left; }
.door.fl.open, .door.rl.open { transform: rotate(60deg); }
.door.rl { top: 134px; left: -3px; transform-origin: top left; }
.door.fr { top: 65px; right: -3px; transform-origin: top right; }
.door.fr.open, .door.rr.open { transform: rotate(-55deg); }
.door.rr { top: 134px; right: -3px; transform-origin: top right; }

.trunk-lid {
    position: absolute;
    z-index: 99;
    bottom: -1px;
    left: 24px;
    width: 108px;
    height: 6px;
    background: var(--green);
    border-radius: 3px;
    box-shadow: 0 0 8px var(--green);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.trunk-lid.open {
    bottom: -14px;
    background: var(--red);
    box-shadow: 0 0 12px var(--red);
    transform: scaleX(0.9);
}
.lock-status {
    position: absolute;
    top: 122px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(3, 11, 20, 0.95);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.lock-status.secured {
    color: var(--green);
    border-color: rgba(0, 230, 176, 0.2);
    text-shadow: 0 0 6px rgba(0, 230, 176, 0.4);
}
.lock-status.unsecured {
    color: #ffb547;
    border-color: rgba(255, 181, 71, 0.2);
    text-shadow: 0 0 6px rgba(255, 181, 71, 0.4);
}

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    width: 100%;
    margin: 16px auto;
}
.tele-card {
    min-width: 0;
    padding: 13px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    overflow-wrap: anywhere;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.15);
}
.tele-val {
    margin-top: 6px;
    color: var(--text);
    font-size: clamp(18px, 5vw, 22px);
    font-weight: 750;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}

.tele-card.ext-temp-zone {
    grid-column: 1 / -1;
    border-color: var(--blue);
    background: rgba(0, 153, 255, 0.08);
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease;
}
.tele-card.ext-temp-zone:active {
    background: rgba(0, 153, 255, 0.16);
}
.tele-card.ext-temp-zone .tele-val {
    color: var(--blue);
}
.setup-indicator {
    position: absolute;
    top: 13px;
    right: 14px;
    font-size: 10px;
    color: var(--blue);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
}

.start-group {
    width: 100%;
    margin: 20px auto 10px;
    padding: 15px 12px;
    border: 1px solid var(--green);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(0, 230, 176, 0.09), rgba(0, 230, 176, 0.025));
}
.start-group > span {
    display: block;
    color: var(--green) !important;
    font-size: 13px !important;
    line-height: 1.4;
}
.btn-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 13px;
}
.btn {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 5px auto;
    padding: 13px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}
.btn:active {
    transform: scale(0.98);
    filter: brightness(1.25);
}
.btn-inline {
    flex: 1;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 12px 4px;
    border: 1px solid rgba(0, 230, 176, 0.65);
    border-radius: 11px;
    background: rgba(0, 230, 176, 0.12);
    color: var(--green);
    font-size: 15px;
}
.btn-acc-on {
    background: rgba(0, 153, 255, 0.12);
    border-color: #087fc1;
    color: #73d7ff;
}
.btn-acc-off {
    background: rgba(20, 35, 55, 0.65);
    border-color: var(--border);
    color: #8298b5;
}
.btn-stop {
    padding: 16px 12px;
    border: 1px solid var(--red);
    border-radius: 14px;
    background: linear-gradient(100deg, #a80f32, #78152d);
    color: #fff;
    font-size: 19px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 0 20px rgba(255, 49, 91, 0.10);
}
.btn-diag, .btn-log {
    padding: 11px 5px;
    background: rgba(7, 24, 43, 0.94);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
}
.btn-log { color: #b9cfff; }
.btn-download-file {
    display: none;
    background: rgba(189, 92, 255, 0.08);
    border-color: var(--purple);
    color: var(--purple);
    font-size: 13px;
}
.collapsible-trigger {
    width: 100%;
    margin: 12px auto 5px;
    padding: 13px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    user-select: none;
}
.collapsible-content { display: none; width: 100%; margin: 0 auto; }
.upload-zone {
    margin: 8px auto;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: rgba(7, 24, 43, 0.75);
}
.file-input { display: none; }
.file-label {
    display: inline-block;
    margin-bottom: 8px;
    padding: 9px 14px;
    border: 1px solid #34495e;
    border-radius: 8px;
    background: #2c3e50;
    color: #e8f2ff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.btn-upload, .btn-reboot {
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.btn-upload { background: #b94b0b; }
.btn-reboot { margin-top: 8px; background: #7f2d22; }

.start-group .btn, body > .btn, body > div > .btn { margin-top: 0; margin-bottom: 0; }
.start-group + div, .start-group + div + .btn-stop, .btn-stop + div, .btn + .collapsible-trigger { margin-top: 10px; }
.btn-row { margin-top: 12px; gap: 10px; }
.action-row { display: flex; gap: 10px; width: 100%; margin: 10px auto; }
.action-row .btn { flex: 1; width: 0; max-width: none; min-width: 0; margin: 0; }

@media (max-width: 380px) {
    body { padding: 12px 9px 22px; }
    h2 { font-size: 23px; }
    .telemetry-grid { gap: 7px; }
    .tele-card { padding: 11px 9px; font-size: 12px; }
    .tele-val { font-size: 17px; }
    .btn { font-size: 13px; }
    .btn-inline { font-size: 14px; }
    .btn-diag, .btn-log { font-size: 11px; }
}
@media (min-width: 700px) {
    .tele-card { padding: 16px; font-size: 14px; }
    .tele-val { font-size: 23px; }
}

/* --- ВСПЛЫВАЮЩАЯ КАРТОКА В НАТИВНОМ ЦВЕТОВОМ РЕШЕНИИ САЙТА --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(3, 11, 20, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    width: 88%;
    max-width: 340px;
    padding: 18px;
    background: rgba(7, 24, 43, 0.98);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    text-align: left;
    transform: scale(0.94);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.12);
}
.modal-overlay.active .modal-card {
    transform: scale(1);
}
.modal-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 750;
    color: #f3f8ff;
    border-bottom: 1px solid rgba(232, 242, 255, 0.1);
    padding-bottom: 6px;
}
.form-group {
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.checkbox-label input {
    width: 15px;
    height: 15px;
    accent-color: var(--blue);
}
.form-input, .form-select {
    width: 100%;
    padding: 9px;
    background: rgba(3, 11, 20, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--blue);
}
.modal-actions {
    display: flex;
    flex-wrap: wrap; /* Разрешаем перенос кнопок */
    gap: 10px;
    margin-top: 16px;
    width: 100%;
}
.modal-actions .btn {
    flex: 1;
    min-width: 120px; /* Кнопки не будут сжиматься в точку */
    margin: 0;
    padding: 11px;
    font-size: 13px;
}
