Просмотр исходного кода

Удалить 'Shlakbaym1.html'

u23-27burdyko 1 месяц назад
Родитель
Сommit
d14433157f
1 измененных файлов с 0 добавлено и 1865 удалено
  1. 0 1865
      Shlakbaym1.html

+ 0 - 1865
Shlakbaym1.html

@@ -1,1865 +0,0 @@
-<!DOCTYPE html>
-<html lang="ru">
-<head>
-<meta charset="UTF-8">
-<title>КПП-3 · Пост охраны</title>
-<style>
-  * { box-sizing: border-box; margin: 0; padding: 0; }
-  html, body { height: 100%; overflow: hidden; background: #050810;
-    color: #a8b8c8; font-family: "Courier New", monospace; font-size: 13px; }
-  .app { height: 100vh; display: flex; flex-direction: column; }
-  header { display: flex; align-items: center; gap: 20px; padding: 8px 20px;
-    background: linear-gradient(180deg, #202830, #10161e);
-    border-bottom: 1px solid #000; flex-shrink: 0; }
-  .brand { color: #ffd060; font-weight: bold; letter-spacing: 2px;
-    font-size: 14px; text-shadow: 0 0 10px rgba(255,208,96,.5); }
-  .brand small { color: #506080; font-weight: normal; letter-spacing: 1px;
-    font-size: 10px; margin-left: 8px; }
-  .header-status { display: flex; align-items: center; gap: 10px; margin-left: auto; }
-  .clock { color: #6090c0; letter-spacing: 2px; font-size: 13px; }
-  .sys-status { display: flex; align-items: center; gap: 8px;
-    color: #40d080; font-weight: bold; font-size: 12px; letter-spacing: 1px; }
-  .sys-status .led { width: 10px; height: 10px; border-radius: 50%;
-    background: #40d080; box-shadow: 0 0 10px #40d080; }
-  .sys-status.alarm { color: #ff4040; }
-  .sys-status.alarm .led { background: #ff4040;
-    box-shadow: 0 0 15px #ff4040; animation: blink .4s infinite; }
-  .sys-status.wait { color: #ffb040; }
-  .sys-status.wait .led { background: #ffb040; box-shadow: 0 0 10px #ffb040; }
-  .sys-status.pause { color: #60a0e0; }
-  .sys-status.pause .led { background: #60a0e0; box-shadow: 0 0 10px #60a0e0; }
-  .sys-status.senior { color: #a0c8ff; }
-  .sys-status.senior .led { background: #a0c8ff; box-shadow: 0 0 10px #a0c8ff; }
-  @keyframes blink { 50% { opacity: .2; } }
-  main { flex: 1; display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
-  .stage { position: relative; background: #02040a; overflow: hidden; }
-  .stage canvas { display: block; width: 100%; height: 100%; }
-  aside { background: #0a0e14; border-left: 1px solid #1a2028;
-    display: flex; flex-direction: column; overflow: hidden; }
-  aside .section { border-bottom: 1px solid #1a2028; }
-  aside .section h3 { padding: 8px 14px; background: #080c12; color: #6070a0;
-    font-size: 10.5px; letter-spacing: 2px; font-weight: normal;
-    border-bottom: 1px solid #1a2028; }
-  aside .content { padding: 10px 12px; }
-  .passes-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
-  .pass-card { background: #060a10; border: 1px solid #202836;
-    border-radius: 3px; padding: 8px 10px; font-size: 11.5px; }
-  .pass-card .head { color: #506080; font-size: 9.5px; letter-spacing: 1.5px;
-    margin-bottom: 6px; text-transform: uppercase; }
-  .pass-card .num { color: #ffd060; font-weight: bold; font-size: 15px;
-    letter-spacing: 1px; margin-bottom: 4px; }
-  .pass-card .name { color: #c0d0e0; margin-bottom: 4px; font-size: 11px; line-height: 1.3; }
-  .pass-card .dept { color: #607890; font-size: 10px; margin-bottom: 6px; }
-  .pass-card .status { padding: 3px 6px; border-radius: 2px; font-size: 10px;
-    letter-spacing: 1px; text-align: center; display: inline-block; }
-  .pass-card .status.ok { background: rgba(64,208,128,.15); color: #40d080;
-    border: 1px solid rgba(64,208,128,.4); }
-  .pass-card .status.bad { background: rgba(255,64,64,.15); color: #ff6060;
-    border: 1px solid rgba(255,64,64,.4); }
-  .pass-card .status.empty { background: rgba(80,90,110,.1); color: #506080;
-    border: 1px dashed #303848; }
-  .decision-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
-    padding: 10px 12px; border-bottom: 1px solid #1a2028; }
-  button.big { background: linear-gradient(180deg, #1a2028, #101418);
-    color: #c0d0e0; border: 1px solid #304050;
-    border-radius: 3px; padding: 14px 10px;
-    font-family: inherit; font-size: 13px; letter-spacing: 1.5px;
-    cursor: pointer; transition: all .15s; font-weight: bold; }
-  button.big.allow { border-color: #206030; color: #80e0a0; }
-  button.big.allow:hover:not(:disabled) {
-    background: linear-gradient(180deg, #204830, #103020); border-color: #40d080; }
-  button.big.deny { border-color: #702020; color: #ffb0b0; }
-  button.big.deny:hover:not(:disabled) {
-    background: linear-gradient(180deg, #401818, #200808); border-color: #ff4040; }
-  button.big:disabled { opacity: .3; cursor: not-allowed; }
-  .action-buttons { padding: 10px 12px; display: flex; flex-direction: column;
-    gap: 6px; border-bottom: 1px solid #1a2028; }
-  button.ctrl { background: linear-gradient(180deg, #1a2028, #101418);
-    color: #c0d0e0; border: 1px solid #304050;
-    border-radius: 2px; padding: 8px 12px;
-    font-family: inherit; font-size: 11.5px; letter-spacing: .5px;
-    cursor: pointer; transition: all .15s; }
-  button.ctrl:hover { background: linear-gradient(180deg, #243040, #182028);
-    border-color: #4080c0; }
-  button.ctrl.primary { border-color: #4060a0; color: #a0d0ff; }
-  button.ctrl.danger { border-color: #702020; color: #ffb0b0; }
-  .cond-row { display: flex; align-items: center; gap: 8px;
-    padding: 6px 0; font-size: 11.5px; color: #8090a0; }
-  .cond-row label { min-width: 60px; color: #607890; }
-  .cond-row select {
-    flex: 1; background: #060a10; color: #c0d0e0;
-    border: 1px solid #304050; border-radius: 2px;
-    padding: 5px 8px; font-family: inherit; font-size: 11.5px;
-    cursor: pointer; }
-  .log { flex: 1; overflow-y: auto; padding: 8px 12px;
-    font-size: 10.5px; line-height: 1.7; }
-  .log .entry { color: #8090a8; }
-  .log .entry.warn { color: #ffb040; }
-  .log .entry.alarm { color: #ff4040; font-weight: bold; }
-  .log .entry.ok { color: #40d080; }
-  .log .entry.info { color: #60a0e0; }
-  .log .entry.senior { color: #a0c8ff; font-weight: bold; }
-  .log .entry .time { color: #405060; margin-right: 6px; }
-  .hint { padding: 8px 12px; background: rgba(96,160,224,.08);
-    border-left: 2px solid #4080c0; color: #a0c0e0;
-    font-size: 11px; line-height: 1.5; }
-  .hint b { color: #ffd060; }
-  .modal { position: fixed; inset: 0; background: rgba(0,0,0,.75);
-    display: none; align-items: center; justify-content: center;
-    z-index: 100; padding: 20px; }
-  .modal.on { display: flex; }
-  .modal-content {
-    background: linear-gradient(180deg, #1a2230, #0d141c);
-    border: 2px solid #3a4858;
-    border-radius: 4px;
-    box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0,0,0,.9);
-    padding: 24px 28px; width: min(480px, 100%);
-    color: #c0d0e0; font-family: "Courier New", monospace; }
-  .modal-content h2 {
-    color: #ffd060; font-size: 16px; letter-spacing: 2px;
-    margin-bottom: 20px; text-align: center;
-    text-shadow: 0 0 10px rgba(255,208,96,.4); }
-  .modal-content .row {
-    display: flex; justify-content: space-between;
-    padding: 8px 0; border-bottom: 1px solid #1a2028;
-    font-size: 12.5px; }
-  .modal-content .row:last-of-type { border-bottom: none; }
-  .modal-content .row .k { color: #8090a0; }
-  .modal-content .row .v { color: #a0d0ff; font-weight: bold; }
-  .modal-content .row .v.good { color: #40d080; }
-  .modal-content .row .v.bad { color: #ff6060; }
-  .modal-content button {
-    display: block; margin: 20px auto 0;
-    padding: 10px 30px; font-family: inherit;
-    font-size: 13px; letter-spacing: 1.5px;
-    background: linear-gradient(180deg, #1a2028, #101418);
-    color: #c0d0e0; border: 1px solid #4060a0;
-    border-radius: 3px; cursor: pointer; }
-  .modal-content button:hover { background: linear-gradient(180deg, #243040, #182028); }
-  .refuse-menu {
-    display: none; padding: 10px 12px;
-    background: rgba(200,80,80,.08);
-    border-top: 1px solid rgba(255,64,64,.3);
-    border-bottom: 1px solid #1a2028; }
-  .refuse-menu.on { display: block; }
-  .refuse-menu .title {
-    font-size: 10.5px; color: #ffb040; letter-spacing: 1.5px;
-    margin-bottom: 8px; }
-  .refuse-menu button.ctrl {
-    width: 100%; margin-bottom: 5px;
-    text-align: left; font-size: 11.5px; padding: 7px 10px; }
-  .refuse-menu button.ctrl:last-child { margin-bottom: 0; }
-</style>
-</head>
-<body>
-
-<div class="app">
-  <header>
-    <div class="brand">◤ КПП-3<small>СИСТЕМА КОНТРОЛЯ ДОСТУПА</small></div>
-    <div class="header-status">
-      <div class="clock" id="clock">--:--:--</div>
-      <div class="sys-status" id="sysStatus"><span class="led"></span><span id="sysStatusText">ПОСТ СВОБОДЕН</span></div>
-    </div>
-  </header>
-
-  <main>
-    <div class="stage"><canvas id="cv"></canvas></div>
-    <aside>
-      <div class="section">
-        <h3>СРАВНЕНИЕ ПРОПУСКОВ</h3>
-        <div class="content"><div class="passes-compare" id="passesCompare"></div></div>
-      </div>
-      <div class="hint" id="hint">Нажмите «Следующая машина».</div>
-      <div class="decision-buttons">
-        <button class="big allow" id="btnAllow" disabled>✓ РАЗРЕШИТЬ</button>
-        <button class="big deny" id="btnDeny" disabled>✕ ЗАПРЕТИТЬ</button>
-      </div>
-      <div class="refuse-menu" id="refuseMenu">
-        <div class="title">МАШИНА ЖДЁТ РЕШЕНИЯ</div>
-        <button class="ctrl" data-refuse="explain">📢 Объяснить причину отказа</button>
-        <button class="ctrl" data-refuse="senior">📞 Вызвать старшего смены</button>
-      </div>
-      <div class="action-buttons">
-        <button class="ctrl primary" id="btnNext">▸ Следующая машина</button>
-        <button class="ctrl danger" id="btnBreach">⚠ Силовой проезд</button>
-        <button class="ctrl" id="btnNote">✎ Отметить в журнале</button>
-        <button class="ctrl" id="btnEndShift">⏹ Закончить смену</button>
-        <button class="ctrl" id="btnReset">↻ Сброс</button>
-      </div>
-      <div class="section">
-        <h3>ВНЕШНИЕ УСЛОВИЯ</h3>
-        <div class="content">
-          <div class="cond-row">
-            <label>Время</label>
-            <select id="selTimeOfDay">
-              <option value="day">☀ День</option>
-              <option value="night">🌙 Ночь</option>
-            </select>
-          </div>
-          <div class="cond-row">
-            <label>Погода</label>
-            <select id="selWeather">
-              <option value="clear">☀ Ясно</option>
-              <option value="rain">🌧 Дождь</option>
-              <option value="snow">❄ Снег</option>
-              <option value="fog">🌫 Туман</option>
-            </select>
-          </div>
-        </div>
-      </div>
-      <div class="section" style="flex:1; display:flex; flex-direction:column; min-height:0">
-        <h3>ЖУРНАЛ СОБЫТИЙ</h3>
-        <div class="log" id="logContent"></div>
-      </div>
-    </aside>
-  </main>
-</div>
-
-<div class="modal" id="shiftModal">
-  <div class="modal-content">
-    <h2>СМЕНА ЗАВЕРШЕНА</h2>
-    <div class="row"><span class="k">Впущено автомобилей:</span><span class="v good" id="statIn">0</span></div>
-    <div class="row"><span class="k">Отказано в проезде:</span><span class="v" id="statOut">0</span></div>
-    <div class="row"><span class="k">Верных решений:</span><span class="v good" id="statCorrect">0</span></div>
-    <div class="row"><span class="k">Ошибок оператора:</span><span class="v bad" id="statWrong">0</span></div>
-    <div class="row"><span class="k">Сработало тревог:</span><span class="v bad" id="statAlarms">0</span></div>
-    <div class="row"><span class="k">Силовых проездов:</span><span class="v bad" id="statBreaches">0</span></div>
-    <div class="row"><span class="k">Вызовов старшего:</span><span class="v" id="statSenior">0</span></div>
-    <div class="row"><span class="k">Оценка смены:</span><span class="v" id="statGrade">—</span></div>
-    <button id="btnCloseShift">ЗАКРЫТЬ И СБРОСИТЬ</button>
-  </div>
-</div>
-
-<script>
-const cv = document.getElementById('cv');
-const ctx = cv.getContext('2d');
-let W = 0, H = 0;
-
-function resizeCanvas() {
-  const stage = cv.parentElement;
-  const dpr = window.devicePixelRatio || 1;
-  W = stage.clientWidth; H = stage.clientHeight;
-  cv.width = Math.floor(W * dpr); cv.height = Math.floor(H * dpr);
-  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
-}
-window.addEventListener('resize', resizeCanvas);
-
-function L() {
-  return {
-    horizonY: H * 0.32,
-    topLaneY: H * 0.58, topLaneTop: H * 0.52, topLaneBot: H * 0.66,
-    botLaneY: H * 0.78, botLaneTop: H * 0.72, botLaneBot: H * 0.84,
-    boothX: W * 0.40, boothW: 150, boothH: 165, boothBaseY: H * 0.55,
-    pillarX: W * 0.72, pillarW: 30, pillarH: 260,
-    pivotX: W * 0.72, pivotY: H * 0.58 - 80,
-    armLen: 240, armH: 16
-  };
-}
-
-const state = {
-  time: 0,
-  barrier: { level: 0, target: 0 },
-  car: null,
-  correctPass: null, presentedPass: null,
-  phase: 'idle',
-  userDecision: null, correctDecision: null,
-  alarm: false, alarmEnd: 0, sparks: [],
-  police: null, tow: null, towDriver: null, towCable: false, leaving: false,
-  timeOfDay: 'night',
-  weather: 'clear',
-  weatherParticles: [],
-  senior: null,
-  stats: { in: 0, out: 0, correct: 0, wrong: 0, alarms: 0, breaches: 0, senior: 0 }
-};
-
-const logEntries = [];
-function logEvent(text, cls) {
-  const now = new Date();
-  const t = String(now.getHours()).padStart(2,'0')+':'+String(now.getMinutes()).padStart(2,'0')+':'+String(now.getSeconds()).padStart(2,'0');
-  logEntries.push({ t, text, cls: cls||'info' });
-  if (logEntries.length > 80) logEntries.shift();
-  renderLog();
-}
-function renderLog() {
-  const el = document.getElementById('logContent');
-  el.innerHTML = logEntries.map(e => `<div class="entry ${e.cls}"><span class="time">${e.t}</span>${e.text}</div>`).join('');
-  el.scrollTop = el.scrollHeight;
-}
-function setStatus(text, cls) {
-  document.getElementById('sysStatusText').textContent = text;
-  document.getElementById('sysStatus').className = 'sys-status' + (cls ? ' ' + cls : '');
-}
-function setHint(text) { document.getElementById('hint').innerHTML = text; }
-
-/* ===== ОСВЕЩЕНИЕ ===== */
-function lighting() {
-  const isDay = state.timeOfDay === 'day';
-  const w = state.weather;
-  if (w === 'fog') return isDay ? { mode: 'dawn' } : { mode: 'dusk' };
-  if (w === 'rain') return isDay ? { mode: 'overcast' } : { mode: 'wetnight' };
-  if (w === 'snow') return isDay ? { mode: 'overcast' } : { mode: 'snownight' };
-  return isDay ? { mode: 'day' } : { mode: 'night' };
-}
-function skyColors() {
-  const m = lighting().mode;
-  switch (m) {
-    case 'day':       return ['#4a6a8a', '#8ab4d4'];
-    case 'dawn':      return ['#3a4a6a', '#a0b0c0'];
-    case 'dusk':      return ['#2a2030', '#504858'];
-    case 'overcast':  return ['#5a6068', '#8890a0'];
-    case 'night':     return ['#05080f', '#182230'];
-    case 'wetnight':  return ['#0a0f18', '#1a2030'];
-    case 'snownight': return ['#0d1220', '#2a3040'];
-  }
-  return ['#05080f', '#182230'];
-}
-function isSunVisible() {
-  const m = lighting().mode;
-  return m === 'day' || m === 'dawn';
-}
-function isStarVisible() {
-  const m = lighting().mode;
-  return m === 'night' || m === 'wetnight' || m === 'snownight' || m === 'dusk';
-}
-function weatherLabel() {
-  const w = { clear: 'ясно', rain: 'дождь', snow: 'снег', fog: 'туман' }[state.weather];
-  const t = state.timeOfDay === 'night' ? 'ночь' : 'день';
-  return t + ', ' + w;
-}
-
-/* ===== ПРОПУСКА ===== */
-const firstNames = ['Иванов','Петров','Сидоров','Кузнецов','Морозов','Волков','Соколов','Лебедев'];
-const initials = ['И.И.','П.П.','С.С.','А.В.','Д.А.','М.Н.'];
-const departments = ['Администрация','Служба охраны','Бухгалтерия','Отдел кадров','ИТ-отдел','Логистика'];
-const series = ['А','Б','В','Г'];
-function randomPass() {
-  return {
-    num: series[Math.floor(Math.random()*series.length)]+'-'+String(Math.floor(Math.random()*900)+100),
-    name: firstNames[Math.floor(Math.random()*firstNames.length)]+' '+initials[Math.floor(Math.random()*initials.length)],
-    dept: departments[Math.floor(Math.random()*departments.length)],
-    valid: Math.random() > 0.25
-  };
-}
-function generateScenario(mode) {
-  const correct = randomPass(); correct.valid = true;
-  if (mode === 'breach') return { correct, presented: null, shouldAllow: false };
-  const r = Math.random();
-  let presented, shouldAllow;
-  if (r < 0.4) { presented = { ...correct }; shouldAllow = true; }
-  else if (r < 0.65) { presented = randomPass(); while (presented.num === correct.num) presented = randomPass(); shouldAllow = false; }
-  else { presented = { ...correct, valid: false }; shouldAllow = false; }
-  return { correct, presented, shouldAllow };
-}
-function renderPasses() {
-  const el = document.getElementById('passesCompare');
-  const c = state.correctPass, p = state.presentedPass;
-  const card = (head, pass) => {
-    if (!pass) return `<div class="pass-card"><div class="head">${head}</div><div class="num">—</div><div class="name">не предъявлен</div><div class="dept">—</div><div class="status empty">НЕТ ДАННЫХ</div></div>`;
-    return `<div class="pass-card"><div class="head">${head}</div><div class="num">${pass.num}</div><div class="name">${pass.name}</div><div class="dept">${pass.dept}</div><div class="status ${pass.valid?'ok':'bad'}">${pass.valid?'АКТИВЕН':'ОТОЗВАН'}</div></div>`;
-  };
-  el.innerHTML = card('В БАЗЕ', c) + card('ПРЕДЪЯВЛЕН', p);
-  const active = state.phase === 'waiting' && state.userDecision === null;
-  document.getElementById('btnAllow').disabled = !active;
-  document.getElementById('btnDeny').disabled = !active;
-}
-function showRefuseMenu() { document.getElementById('refuseMenu').classList.add('on'); }
-function hideRefuseMenu() { document.getElementById('refuseMenu').classList.remove('on'); }
-
-function speedMult() {
-  if (state.weather === 'rain') return 0.75;
-  if (state.weather === 'snow') return 0.6;
-  if (state.weather === 'fog')  return 0.85;
-  return 1;
-}
-
-/* ===== СЦЕНАРИИ ===== */
-function nextCar() {
-  if (state.phase !== 'idle') return;
-  const scen = generateScenario('normal');
-  state.correctPass = scen.correct;
-  state.presentedPass = scen.presented;
-  state.correctDecision = scen.shouldAllow ? 'allow' : 'deny';
-  state.userDecision = null;
-  state.senior = null;
-  state.phase = 'approaching';
-  hideRefuseMenu();
-  const colors = ['#3a5a8a','#8a3a3a','#2a2a30','#3a6a4a','#7a6a2a','#5a3a6a'];
-  state.car = {
-    x: -250, speed: 160 * speedMult(),
-    color: colors[Math.floor(Math.random()*colors.length)],
-    wheelAngle: 0, isPriora: false
-  };
-  setStatus('ПРИБЛИЖАЕТСЯ АВТО', 'wait');
-  logEvent('Приближается автомобиль' + (state.weather !== 'clear' || state.timeOfDay === 'night' ? ` (${weatherLabel()})` : ''), 'info');
-  renderPasses();
-  setHint('Автомобиль подъезжает.');
-}
-function breachCar() {
-  if (state.phase !== 'idle') return;
-  const scen = generateScenario('breach');
-  state.correctPass = scen.correct;
-  state.presentedPass = null;
-  state.correctDecision = 'deny';
-  state.userDecision = null;
-  state.senior = null;
-  state.phase = 'approaching';
-  hideRefuseMenu();
-  state.car = { x: -250, speed: 340 * speedMult(), color: '#0a0a0a', wheelAngle: 0, isPriora: true };
-  setStatus('НАРУШИТЕЛЬ !', 'alarm');
-  logEvent('Чёрная тонированная Лада Приора не сбрасывает скорость!', 'alarm');
-  renderPasses();
-  setHint('Нарушитель не останавливается.');
-}
-
-function decide(decision) {
-  if (state.phase !== 'waiting' || state.userDecision !== null) return;
-  state.userDecision = decision;
-  const correct = (decision === state.correctDecision);
-  if (correct) state.stats.correct++; else state.stats.wrong++;
-  logEvent(`Решение «${decision==='allow'?'РАЗРЕШИТЬ':'ЗАПРЕТИТЬ'}» — ${correct?'верно':'ОШИБКА'}`,
-           correct?'ok':'warn');
-
-  if (decision === 'allow') {
-    state.car.action = 'pass';
-    state.barrier.target = 1;
-    state.phase = 'resolved';
-    setStatus('ПРОЕЗД РАЗРЕШЁН');
-    setHint('Шлагбаум открывается, автомобиль проезжает.');
-    hideRefuseMenu();
-  } else {
-    state.car.action = 'wait';
-    state.phase = 'refuse_wait';
-    setStatus('МАШИНА ЖДЁТ', 'pause');
-    setHint('Объясните причину отказа или вызовите старшего смены.');
-    showRefuseMenu();
-  }
-  renderPasses();
-}
-
-document.querySelectorAll('[data-refuse]').forEach(b => {
-  b.onclick = () => {
-    const action = b.dataset.refuse;
-    if (action === 'explain') {
-      logEvent('Оператор объяснил причину отказа водителю', 'info');
-      state.stats.out++;
-      state.car.action = 'turn';
-      state.phase = 'resolved';
-      setStatus('ОТКАЗ', 'wait');
-      setHint('Машина уезжает в обратном направлении.');
-      hideRefuseMenu();
-      renderPasses();
-    }
-    if (action === 'senior') {
-      state.stats.senior++;
-      logEvent('Оператор вызвал старшего смены', 'senior');
-      state.phase = 'senior_walk';
-      const carX = state.car ? state.car.x : 0;
-      state.senior = {
-        x: W + 40,
-        y: L().botLaneY,
-        targetX: carX + 130,
-        targetY: L().topLaneY,
-        state: 'walk_to_lane',
-        walking: true,
-        alpha: 0,
-        decideTimer: 0
-      };
-      hideRefuseMenu();
-      setStatus('СТАРШИЙ ВЫЗВАН', 'senior');
-      setHint('Старший смены направляется к машине.');
-    }
-  };
-});
-
-function resetAll() {
-  state.car = null; state.correctPass = null; state.presentedPass = null;
-  state.userDecision = null; state.correctDecision = null;
-  state.phase = 'idle'; state.barrier.target = 0; state.barrier.level = 0;
-  state.alarm = false; state.sparks = []; state.police = null;
-  state.tow = null; state.towDriver = null; state.towCable = false; state.leaving = false;
-  state.senior = null;
-  hideRefuseMenu();
-  logEntries.length = 0; renderLog(); renderPasses();
-  setStatus('ПОСТ СВОБОДЕН'); setHint('Нажмите <b>«Следующая машина»</b>.');
-  logEvent('Система сброшена', 'ok');
-}
-document.getElementById('btnNext').onclick = nextCar;
-document.getElementById('btnBreach').onclick = breachCar;
-document.getElementById('btnReset').onclick = resetAll;
-document.getElementById('btnAllow').onclick = () => decide('allow');
-document.getElementById('btnDeny').onclick = () => decide('deny');
-
-document.getElementById('btnNote').onclick = () => {
-  const txt = prompt('Введите отметку для журнала:', '');
-  if (txt && txt.trim()) logEvent('[ОПЕРАТОР] ' + txt.trim(), 'info');
-};
-
-document.getElementById('btnEndShift').onclick = () => {
-  const s = state.stats;
-  document.getElementById('statIn').textContent = s.in;
-  document.getElementById('statOut').textContent = s.out;
-  document.getElementById('statCorrect').textContent = s.correct;
-  document.getElementById('statWrong').textContent = s.wrong;
-  document.getElementById('statAlarms').textContent = s.alarms;
-  document.getElementById('statBreaches').textContent = s.breaches;
-  document.getElementById('statSenior').textContent = s.senior;
-  const total = s.correct + s.wrong;
-  let grade = '—';
-  if (total > 0) {
-    const pct = s.correct / total;
-    if (pct >= 0.95) grade = 'ОТЛИЧНО';
-    else if (pct >= 0.8) grade = 'ХОРОШО';
-    else if (pct >= 0.6) grade = 'УДОВЛЕТВОРИТЕЛЬНО';
-    else grade = 'ТРЕБУЕТСЯ ПОДГОТОВКА';
-  }
-  document.getElementById('statGrade').textContent = grade;
-  document.getElementById('shiftModal').classList.add('on');
-  logEvent('Смена завершена. Открыт отчёт.', 'info');
-};
-document.getElementById('btnCloseShift').onclick = () => {
-  document.getElementById('shiftModal').classList.remove('on');
-  state.stats = { in: 0, out: 0, correct: 0, wrong: 0, alarms: 0, breaches: 0, senior: 0 };
-  logEntries.length = 0; renderLog();
-  logEvent('Начата новая смена', 'ok');
-};
-
-document.getElementById('selTimeOfDay').onchange = (e) => {
-  state.timeOfDay = e.target.value;
-  logEvent('Время суток: ' + (state.timeOfDay === 'day' ? 'день' : 'ночь'), 'info');
-  if (state.timeOfDay === 'night') logEvent('Камеры переведены в ИК-режим', 'info');
-};
-document.getElementById('selWeather').onchange = (e) => {
-  state.weather = e.target.value;
-  const names = { clear: 'ясно', rain: 'дождь', snow: 'снег', fog: 'туман' };
-  logEvent('Погода: ' + names[state.weather], 'info');
-  if (state.weather === 'fog') logEvent('Туман — сумеречный режим', 'warn');
-  if (state.weather === 'rain') logEvent('Мокрое покрытие — снижение скорости ТС', 'warn');
-  if (state.weather === 'snow') logEvent('Снегопад — ограничение скорости ТС', 'warn');
-  state.weatherParticles = [];
-};
-
-/* ===== ФОН ===== */
-function drawSky() {
-  const l = L();
-  const [c1, c2] = skyColors();
-  const grad = ctx.createLinearGradient(0, 0, 0, l.horizonY);
-  grad.addColorStop(0, c1); grad.addColorStop(1, c2);
-  ctx.fillStyle = grad; ctx.fillRect(0, 0, W, l.horizonY);
-
-  if (isStarVisible()) {
-    for (let i = 0; i < 80; i++) {
-      const x = (i * 173.5) % W, y = (i * 97.3) % (l.horizonY - 15);
-      const a = (0.15 + 0.4 * Math.abs(Math.sin(state.time * 0.5 + i))) *
-                (state.weather === 'clear' ? 1 : 0.4);
-      ctx.fillStyle = `rgba(200,220,255,${a})`; ctx.fillRect(x, y, 1.5, 1.5);
-    }
-    ctx.beginPath(); ctx.arc(W * 0.12, l.horizonY * 0.4, 24, 0, Math.PI * 2);
-    ctx.fillStyle = 'rgba(220,220,200,.15)'; ctx.fill();
-  }
-  if (isSunVisible()) {
-    const isDawn = lighting().mode === 'dawn';
-    const sy = l.horizonY * (isDawn ? 0.55 : 0.35);
-    ctx.beginPath(); ctx.arc(W * 0.15, sy, 30, 0, Math.PI * 2);
-    const sg = ctx.createRadialGradient(W * 0.15, sy, 4, W * 0.15, sy, 60);
-    sg.addColorStop(0, isDawn ? 'rgba(255,220,180,.85)' : 'rgba(255,250,200,.9)');
-    sg.addColorStop(1, isDawn ? 'rgba(255,200,150,0)' : 'rgba(255,250,200,0)');
-    ctx.fillStyle = sg; ctx.fill();
-  }
-  const m = lighting().mode;
-  let bcol = '#0a1220';
-  if (m === 'day') bcol = '#3a4a5a';
-  else if (m === 'overcast') bcol = '#4a5058';
-  else if (m === 'dawn') bcol = '#3a4050';
-  else if (m === 'dusk') bcol = '#202028';
-  ctx.fillStyle = bcol;
-  for (let i = 0; i < 24; i++) {
-    const bx = i * (W / 24), bw = 18 + (i % 4) * 12, bh = 25 + (i % 5) * 10;
-    ctx.fillRect(bx, l.horizonY - bh, bw, bh);
-  }
-  if (isStarVisible() || state.weather !== 'clear') {
-    for (let i = 0; i < 40; i++) {
-      const bx = (i * 47.3) % W, by = l.horizonY - 12 - (i % 4) * 7;
-      if ((i * 7) % 3 === 0) {
-        const a = state.weather === 'clear' ? 0.7 : 0.35;
-        ctx.fillStyle = i % 2 === 0 ? `rgba(255,200,120,${a})` : `rgba(180,220,255,${a})`;
-        ctx.fillRect(bx, by, 2, 2);
-      }
-    }
-  }
-}
-function drawGround() {
-  const l = L();
-  const m = lighting().mode;
-  let g;
-  if (m === 'day' || m === 'overcast') {
-    g = ctx.createLinearGradient(0, l.horizonY, 0, H);
-    g.addColorStop(0, '#2a3a28'); g.addColorStop(1, '#101810');
-  } else if (m === 'dawn' || m === 'dusk') {
-    g = ctx.createLinearGradient(0, l.horizonY, 0, H);
-    g.addColorStop(0, '#1a2018'); g.addColorStop(1, '#0a0e08');
-  } else {
-    g = ctx.createLinearGradient(0, l.horizonY, 0, H);
-    g.addColorStop(0, '#0a1410'); g.addColorStop(1, '#050a08');
-  }
-  ctx.fillStyle = g; ctx.fillRect(0, l.horizonY, W, H - l.horizonY);
-}
-function drawRoads() {
-  const l = L();
-  const m = lighting().mode;
-  let c1, c2, edge, dash;
-  if (m === 'day') {
-    c1 = ['#3a3e44', '#25282c']; c2 = ['#3a3e44', '#25282c'];
-    edge = 'rgba(180,180,180,.7)'; dash = 'rgba(220,200,140,.6)';
-  } else if (m === 'overcast' || m === 'dawn') {
-    c1 = ['#2a2e34', '#1a1d22']; c2 = ['#2a2e34', '#1a1d22'];
-    edge = 'rgba(140,150,160,.6)'; dash = 'rgba(200,180,140,.5)';
-  } else if (m === 'dusk') {
-    c1 = ['#1a1d24', '#0d1014']; c2 = ['#1a1d24', '#0d1014'];
-    edge = 'rgba(120,130,140,.5)'; dash = 'rgba(200,180,140,.4)';
-  } else {
-    c1 = ['#1a1e24', '#0d1014']; c2 = ['#1a1e24', '#0d1014'];
-    edge = 'rgba(120,130,140,.5)'; dash = 'rgba(220,200,140,.4)';
-  }
-  const g1 = ctx.createLinearGradient(0, l.topLaneTop, 0, l.topLaneBot);
-  g1.addColorStop(0, c1[0]); g1.addColorStop(1, c1[1]);
-  ctx.fillStyle = g1; ctx.fillRect(0, l.topLaneTop, W, l.topLaneBot - l.topLaneTop);
-  const g2 = ctx.createLinearGradient(0, l.botLaneTop, 0, l.botLaneBot);
-  g2.addColorStop(0, c2[0]); g2.addColorStop(1, c2[1]);
-  ctx.fillStyle = g2; ctx.fillRect(0, l.botLaneTop, W, l.botLaneBot - l.botLaneTop);
-  ctx.strokeStyle = edge; ctx.lineWidth = 2;
-  ctx.beginPath(); ctx.moveTo(0, (l.topLaneBot + l.botLaneTop) / 2);
-  ctx.lineTo(W, (l.topLaneBot + l.botLaneTop) / 2); ctx.stroke();
-  ctx.strokeStyle = dash; ctx.lineWidth = 3;
-  ctx.setLineDash([30, 25]);
-  ctx.beginPath(); ctx.moveTo(0, (l.topLaneBot + l.botLaneTop) / 2 + 6);
-  ctx.lineTo(W, (l.topLaneBot + l.botLaneTop) / 2 + 6); ctx.stroke();
-  ctx.setLineDash([]);
-}
-function drawBooth() {
-  const l = L();
-  const bx = l.boothX, by = l.boothBaseY, bw = l.boothW, bh = l.boothH;
-  const m = lighting().mode;
-  const bright = (m === 'day' || m === 'overcast' || m === 'dawn');
-  ctx.fillStyle = 'rgba(0,0,0,.5)';
-  ctx.beginPath(); ctx.ellipse(bx + bw/2, by + 6, bw/2 + 10, 8, 0, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#0a0f14'; ctx.fillRect(bx - 8, by, bw + 16, 12);
-  const wg = ctx.createLinearGradient(bx, 0, bx + bw, 0);
-  if (bright) { wg.addColorStop(0, '#5a6472'); wg.addColorStop(1, '#3a4452'); }
-  else { wg.addColorStop(0, '#2a3442'); wg.addColorStop(1, '#182028'); }
-  ctx.fillStyle = wg; ctx.fillRect(bx, by - bh, bw, bh);
-  ctx.strokeStyle = '#4a5a70'; ctx.lineWidth = 2; ctx.strokeRect(bx, by - bh, bw, bh);
-  ctx.fillStyle = '#0a0f14'; ctx.fillRect(bx - 12, by - bh - 14, bw + 24, 14);
-  ctx.strokeStyle = '#3a4452'; ctx.strokeRect(bx - 12, by - bh - 14, bw + 24, 14);
-  const glow = bright ? 0.35 + 0.1 * Math.sin(state.time * 1.5) : 0.55 + 0.15 * Math.sin(state.time * 1.5);
-  ctx.fillStyle = `rgba(255,220,140,${glow})`;
-  ctx.fillRect(bx + 15, by - bh + 25, 60, 60);
-  ctx.strokeStyle = '#4a5a70'; ctx.strokeRect(bx + 15, by - bh + 25, 60, 60);
-  ctx.beginPath(); ctx.moveTo(bx + 45, by - bh + 25); ctx.lineTo(bx + 45, by - bh + 85); ctx.stroke();
-  ctx.fillStyle = '#1a2028'; ctx.fillRect(bx + bw - 45, by - bh + 25, 35, bh - 25);
-  ctx.strokeStyle = '#4a5a70'; ctx.strokeRect(bx + bw - 45, by - bh + 25, 35, bh - 25);
-  ctx.fillStyle = '#c0a040'; ctx.beginPath(); ctx.arc(bx + bw - 40, by - bh/2 - 5, 2.5, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#607890'; ctx.font = 'bold 11px "Courier New"';
-  ctx.textAlign = 'center'; ctx.fillText('ОХРАНА', bx + bw/2, by - bh - 22); ctx.textAlign = 'left';
-}
-function drawGuard(x, y) {
-  ctx.fillStyle = 'rgba(0,0,0,.55)';
-  ctx.beginPath(); ctx.ellipse(x, y + 2, 14, 4, 0, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#1a2230';
-  ctx.fillRect(x - 8, y - 35, 7, 35); ctx.fillRect(x + 1, y - 35, 7, 35);
-  ctx.fillStyle = '#0a0a0a';
-  ctx.fillRect(x - 10, y - 3, 10, 5); ctx.fillRect(x, y - 3, 10, 5);
-  ctx.fillStyle = '#2a4a70'; ctx.fillRect(x - 11, y - 68, 22, 36);
-  ctx.strokeStyle = '#1a3050'; ctx.lineWidth = 1; ctx.strokeRect(x - 11, y - 68, 22, 36);
-  ctx.fillStyle = '#d0d0e0';
-  ctx.fillRect(x - 11, y - 68, 5, 3); ctx.fillRect(x + 6, y - 68, 5, 3);
-  ctx.fillStyle = '#1a1a1a'; ctx.fillRect(x - 11, y - 38, 22, 4);
-  ctx.fillStyle = '#2a4a70';
-  ctx.fillRect(x - 16, y - 66, 6, 30); ctx.fillRect(x + 10, y - 66, 6, 30);
-  ctx.fillStyle = '#d0a880';
-  ctx.fillRect(x - 16, y - 38, 6, 7); ctx.fillRect(x + 10, y - 38, 6, 7);
-  ctx.fillStyle = '#d0a880'; ctx.fillRect(x - 3, y - 72, 6, 4);
-  ctx.beginPath(); ctx.arc(x, y - 81, 9, 0, Math.PI * 2); ctx.fillStyle = '#d0a880'; ctx.fill();
-  ctx.fillStyle = '#1a1a1a';
-  ctx.beginPath(); ctx.arc(x - 3, y - 82, 1, 0, Math.PI * 2); ctx.fill();
-  ctx.beginPath(); ctx.arc(x + 3, y - 82, 1, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#1a3050'; ctx.beginPath(); ctx.arc(x, y - 88, 10, Math.PI, Math.PI * 2); ctx.fill();
-  ctx.fillRect(x - 11, y - 88, 22, 3);
-  ctx.fillStyle = '#0a1a30'; ctx.fillRect(x - 12, y - 85, 24, 3);
-  ctx.fillStyle = '#c0a040'; ctx.beginPath(); ctx.arc(x, y - 90, 2, 0, Math.PI * 2); ctx.fill();
-}
-function drawBarrier() {
-  const l = L();
-  const pillarX = l.pillarX, pillarW = l.pillarW, pillarH = l.pillarH;
-  const groundBase = l.topLaneY;
-  const pillarTopY = groundBase - pillarH;
-  const pivotX = pillarX, pivotY = groundBase - 80;
-  const armLen = l.armLen, armH = l.armH;
-  const level = state.barrier.level;
-  const m = lighting().mode;
-  const bright = (m === 'day' || m === 'overcast' || m === 'dawn');
-
-  ctx.fillStyle = 'rgba(0,0,0,.5)';
-  ctx.beginPath(); ctx.ellipse(pillarX + pillarW/2, groundBase + 4, 24, 7, 0, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#1a1e24'; ctx.fillRect(pillarX - 10, groundBase - 10, pillarW + 20, 16);
-  ctx.strokeStyle = '#3a4858'; ctx.lineWidth = 1.5; ctx.strokeRect(pillarX - 10, groundBase - 10, pillarW + 20, 16);
-
-  const g = ctx.createLinearGradient(pillarX, 0, pillarX + pillarW, 0);
-  if (bright) { g.addColorStop(0, '#3a4858'); g.addColorStop(0.4, '#5a6878'); g.addColorStop(1, '#2a3442'); }
-  else { g.addColorStop(0, '#1a2028'); g.addColorStop(0.4, '#3a4858'); g.addColorStop(1, '#0a1018'); }
-  ctx.fillStyle = g; ctx.fillRect(pillarX, pillarTopY, pillarW, pillarH);
-  ctx.strokeStyle = '#000'; ctx.lineWidth = 1.5; ctx.strokeRect(pillarX, pillarTopY, pillarW, pillarH);
-  for (let i = 0; i < 4; i++) {
-    ctx.fillStyle = i % 2 === 0 ? '#a08030' : '#1a1a1a';
-    ctx.fillRect(pillarX, pillarTopY + pillarH - 90 + i * 20, pillarW, 20);
-  }
-  ctx.fillStyle = '#505860';
-  ctx.beginPath();
-  ctx.moveTo(pillarX - 5, pillarTopY); ctx.lineTo(pillarX + pillarW + 5, pillarTopY);
-  ctx.lineTo(pillarX + pillarW, pillarTopY - 12); ctx.lineTo(pillarX, pillarTopY - 12);
-  ctx.closePath(); ctx.fill();
-  ctx.strokeStyle = '#000'; ctx.stroke();
-
-  const blink = Math.sin(state.time * 4) > 0;
-  const lampColor = level > 0.9 ? '#40d080' : (level > 0.1 ? '#ffb040' : '#ff2020');
-  ctx.beginPath(); ctx.arc(pillarX + pillarW/2, pillarTopY - 26, 9, 0, Math.PI * 2);
-  ctx.fillStyle = blink ? lampColor : 'rgba(50,50,50,.85)';
-  ctx.shadowColor = blink ? lampColor : 'transparent';
-  ctx.shadowBlur = blink ? 26 : 0; ctx.fill(); ctx.shadowBlur = 0;
-  ctx.strokeStyle = '#000'; ctx.lineWidth = 1; ctx.stroke();
-
-  ctx.beginPath(); ctx.arc(pivotX, pivotY, 15, 0, Math.PI * 2);
-  ctx.fillStyle = '#2a3442'; ctx.fill();
-  ctx.strokeStyle = '#000'; ctx.lineWidth = 2; ctx.stroke();
-  ctx.beginPath(); ctx.arc(pivotX, pivotY, 6, 0, Math.PI * 2);
-  const hg = ctx.createRadialGradient(pivotX - 2, pivotY - 2, 1, pivotX, pivotY, 6);
-  hg.addColorStop(0, '#a0b0c0'); hg.addColorStop(1, '#506070');
-  ctx.fillStyle = hg; ctx.fill();
-
-  const angle = Math.PI + level * Math.PI / 2;
-  ctx.save();
-  ctx.translate(pivotX, pivotY); ctx.rotate(angle);
-  const seg = 14;
-  for (let i = 0; i < seg; i++) {
-    ctx.fillStyle = i % 2 === 0 ? '#e04040' : '#e8e8e8';
-    ctx.fillRect(i * (armLen / seg), -armH/2, armLen / seg, armH);
-  }
-  ctx.strokeStyle = '#000'; ctx.lineWidth = 2; ctx.strokeRect(0, -armH/2, armLen, armH);
-  ctx.strokeStyle = 'rgba(255,255,255,.4)'; ctx.lineWidth = 1.5;
-  ctx.beginPath(); ctx.moveTo(2, -armH/2 + 2); ctx.lineTo(armLen - 2, -armH/2 + 2); ctx.stroke();
-  ctx.beginPath(); ctx.arc(armLen, 0, 12, 0, Math.PI * 2);
-  ctx.fillStyle = '#e8e8e8'; ctx.fill();
-  ctx.strokeStyle = '#000'; ctx.lineWidth = 2; ctx.stroke();
-  ctx.beginPath(); ctx.arc(armLen, 0, 5, 0, Math.PI * 2);
-  ctx.fillStyle = '#a0a8b0'; ctx.fill();
-  ctx.restore();
-
-  if (level < 0.9) {
-    const endX = pivotX + Math.cos(angle) * armLen;
-    const endY = pivotY + Math.sin(angle) * armLen;
-    const blinkE = Math.sin(state.time * 6) > 0;
-    ctx.beginPath(); ctx.arc(endX, endY, 6, 0, Math.PI * 2);
-    ctx.fillStyle = blinkE ? '#ff4040' : '#601010';
-    ctx.shadowColor = blinkE ? '#ff4040' : 'transparent';
-    ctx.shadowBlur = blinkE ? 22 : 0; ctx.fill(); ctx.shadowBlur = 0;
-  }
-}
-
-/* ===== БАЗОВЫЕ КОЛЁСА ===== */
-function drawWheels(x, y, dxRear, dxFront, radius, rim, angle) {
-  [x - dxRear, x + dxFront].forEach(wx => {
-    ctx.beginPath(); ctx.arc(wx, y, radius, 0, Math.PI * 2);
-    const tg = ctx.createRadialGradient(wx - radius*0.3, y - radius*0.3, 1, wx, y, radius);
-    tg.addColorStop(0, '#1a1a1a'); tg.addColorStop(1, '#000');
-    ctx.fillStyle = tg; ctx.fill();
-    ctx.beginPath(); ctx.arc(wx, y, radius * 0.55, 0, Math.PI * 2);
-    ctx.fillStyle = '#202830'; ctx.fill();
-    ctx.strokeStyle = rim; ctx.lineWidth = 1.5; ctx.stroke();
-    ctx.save(); ctx.translate(wx, y); ctx.rotate(angle);
-    ctx.strokeStyle = rim; ctx.lineWidth = 1.2;
-    for (let i = 0; i < 5; i++) {
-      const a = (i / 5) * Math.PI * 2;
-      ctx.beginPath(); ctx.moveTo(0, 0);
-      ctx.lineTo(Math.cos(a) * radius * 0.45, Math.sin(a) * radius * 0.45); ctx.stroke();
-    }
-    ctx.beginPath(); ctx.arc(0, 0, radius * 0.14, 0, Math.PI * 2);
-    ctx.fillStyle = rim; ctx.fill();
-    ctx.restore();
-  });
-}
-
-/* ===== ОБЫЧНЫЙ СЕДАН ===== */
-function drawSedan(x, y, color, wheelAngle) {
-  ctx.fillStyle = 'rgba(0,0,0,.5)';
-  ctx.beginPath(); ctx.ellipse(x, y + 4, 90, 6, 0, 0, Math.PI * 2); ctx.fill();
-  const bg = ctx.createLinearGradient(0, y - 55, 0, y);
-  bg.addColorStop(0, color); bg.addColorStop(1, '#050505');
-  ctx.fillStyle = bg; ctx.strokeStyle = '#000'; ctx.lineWidth = 2;
-  ctx.beginPath();
-  ctx.moveTo(x + 85, y - 8); ctx.lineTo(x + 78, y - 26); ctx.lineTo(x + 40, y - 30);
-  ctx.lineTo(x + 15, y - 52); ctx.lineTo(x - 25, y - 54); ctx.lineTo(x - 55, y - 42);
-  ctx.lineTo(x - 78, y - 24); ctx.lineTo(x - 85, y - 8); ctx.lineTo(x - 85, y);
-  ctx.lineTo(x + 85, y); ctx.closePath(); ctx.fill(); ctx.stroke();
-  ctx.fillStyle = 'rgba(60,100,140,.65)';
-  ctx.beginPath();
-  ctx.moveTo(x + 12, y - 50); ctx.lineTo(x - 22, y - 52); ctx.lineTo(x - 48, y - 40);
-  ctx.lineTo(x - 48, y - 30); ctx.lineTo(x + 12, y - 30); ctx.closePath(); ctx.fill();
-  ctx.fillStyle = '#fff8c0'; ctx.shadowColor = '#fff8c0'; ctx.shadowBlur = 15;
-  ctx.beginPath(); ctx.arc(x + 80, y - 14, 4, 0, Math.PI * 2); ctx.fill(); ctx.shadowBlur = 0;
-  ctx.fillStyle = '#c02020'; ctx.shadowColor = '#c02020'; ctx.shadowBlur = 10;
-  ctx.fillRect(x - 85, y - 22, 4, 10); ctx.shadowBlur = 0;
-  drawWheels(x, y, 55, 55, 14, '#a0a8b0', wheelAngle);
-}
-
-/* =========================================================
-   ЛАДА ПРИОРА — узнаваемая, чёрная тонированная
-   ========================================================= */
-function drawPriora(x, y, wheelAngle) {
-  ctx.fillStyle = 'rgba(0,0,0,.6)';
-  ctx.beginPath(); ctx.ellipse(x, y + 4, 105, 8, 0, 0, Math.PI * 2); ctx.fill();
-
-  const bg = ctx.createLinearGradient(0, y - 58, 0, y);
-  bg.addColorStop(0, '#2e2e2e');
-  bg.addColorStop(0.35, '#0d0d0d');
-  bg.addColorStop(0.85, '#000000');
-  bg.addColorStop(1, '#000000');
-
-  ctx.fillStyle = bg;
-  ctx.strokeStyle = '#000';
-  ctx.lineWidth = 2;
-  ctx.beginPath();
-  ctx.moveTo(x - 105, y - 10);
-  ctx.lineTo(x - 100, y - 28);
-  ctx.lineTo(x - 80, y - 34);
-  ctx.lineTo(x - 55, y - 42);
-  ctx.lineTo(x - 35, y - 54);
-  ctx.lineTo(x + 25, y - 54);
-  ctx.lineTo(x + 45, y - 42);
-  ctx.lineTo(x + 55, y - 34);
-  ctx.lineTo(x + 92, y - 30);
-  ctx.lineTo(x + 105, y - 12);
-  ctx.lineTo(x + 105, y);
-  ctx.lineTo(x - 105, y);
-  ctx.closePath();
-  ctx.fill();
-  ctx.stroke();
-
-  ctx.strokeStyle = 'rgba(230,235,240,.6)';
-  ctx.lineWidth = 1.5;
-  ctx.beginPath();
-  ctx.moveTo(x - 100, y - 22);
-  ctx.lineTo(x + 100, y - 22);
-  ctx.stroke();
-
-  ctx.fillStyle = 'rgba(3,5,10,.95)';
-  ctx.beginPath();
-  ctx.moveTo(x + 45, y - 40);
-  ctx.lineTo(x + 18, y - 40);
-  ctx.lineTo(x + 18, y - 30);
-  ctx.lineTo(x + 52, y - 30);
-  ctx.closePath();
-  ctx.fill();
-  ctx.beginPath();
-  ctx.moveTo(x - 55, y - 40);
-  ctx.lineTo(x - 35, y - 50);
-  ctx.lineTo(x - 10, y - 50);
-  ctx.lineTo(x - 10, y - 30);
-  ctx.lineTo(x - 55, y - 30);
-  ctx.closePath();
-  ctx.fill();
-  ctx.fillStyle = 'rgba(3,5,10,.88)';
-  ctx.fillRect(x - 8, y - 30, 25, 10);
-
-  ctx.fillStyle = '#0a0a0a';
-  ctx.fillRect(x + 15, y - 50, 4, 20);
-
-  // Решётка с ромбом Лада
-  ctx.fillStyle = '#0a0a0a';
-  ctx.strokeStyle = '#707880';
-  ctx.lineWidth = 1;
-  ctx.fillRect(x + 82, y - 26, 20, 12);
-  ctx.strokeRect(x + 82, y - 26, 20, 12);
-  for (let i = 0; i < 3; i++) {
-    ctx.beginPath();
-    ctx.moveTo(x + 83, y - 24 + i * 4);
-    ctx.lineTo(x + 101, y - 24 + i * 4);
-    ctx.stroke();
-  }
-  ctx.fillStyle = '#d8dce0';
-  ctx.beginPath();
-  ctx.moveTo(x + 92, y - 25);
-  ctx.lineTo(x + 97, y - 20);
-  ctx.lineTo(x + 92, y - 15);
-  ctx.lineTo(x + 87, y - 20);
-  ctx.closePath();
-  ctx.fill();
-  ctx.strokeStyle = '#404040';
-  ctx.stroke();
-
-  // Угловатые фары
-  ctx.fillStyle = '#fff8c0';
-  ctx.shadowColor = '#fff8c0';
-  ctx.shadowBlur = 22;
-  ctx.beginPath();
-  ctx.moveTo(x + 84, y - 22);
-  ctx.lineTo(x + 100, y - 22);
-  ctx.lineTo(x + 100, y - 12);
-  ctx.lineTo(x + 84, y - 12);
-  ctx.closePath();
-  ctx.fill();
-  ctx.shadowBlur = 0;
-  ctx.fillStyle = '#c0e8ff';
-  ctx.fillRect(x + 86, y - 20, 12, 2);
-
-  ctx.fillStyle = '#ffe080';
-  ctx.shadowColor = '#ffe080';
-  ctx.shadowBlur = 12;
-  ctx.fillRect(x + 90, y - 6, 12, 3);
-  ctx.shadowBlur = 0;
-
-  ctx.fillStyle = '#c02020';
-  ctx.shadowColor = '#c02020';
-  ctx.shadowBlur = 16;
-  ctx.fillRect(x - 105, y - 24, 6, 14);
-  ctx.shadowBlur = 0;
-
-  const beamGrad = ctx.createLinearGradient(x + 105, y - 14, x + 320, y + 10);
-  beamGrad.addColorStop(0, 'rgba(255,240,180,.4)');
-  beamGrad.addColorStop(1, 'rgba(255,240,180,0)');
-  ctx.fillStyle = beamGrad;
-  ctx.beginPath();
-  ctx.moveTo(x + 105, y - 22);
-  ctx.lineTo(x + 320, y - 30);
-  ctx.lineTo(x + 320, y + 22);
-  ctx.lineTo(x + 105, y - 4);
-  ctx.closePath();
-  ctx.fill();
-
-  drawSilverWheels(x, y, 62, 58, 17, wheelAngle);
-}
-
-/* Серебряные 5-спицевые диски */
-function drawSilverWheels(cx, cy, offsetRear, offsetFront, radius, angle) {
-  [cx - offsetRear, cx + offsetFront].forEach(wx => {
-    ctx.beginPath();
-    ctx.arc(wx, cy, radius, 0, Math.PI * 2);
-    const tg = ctx.createRadialGradient(wx - radius*0.3, cy - radius*0.3, 1, wx, cy, radius);
-    tg.addColorStop(0, '#2a2a2a');
-    tg.addColorStop(1, '#000');
-    ctx.fillStyle = tg;
-    ctx.fill();
-
-    const rimGrad = ctx.createRadialGradient(wx - 3, cy - 3, 2, wx, cy, radius*0.68);
-    rimGrad.addColorStop(0, '#ffffff');
-    rimGrad.addColorStop(0.5, '#d0d4d8');
-    rimGrad.addColorStop(1, '#808890');
-    ctx.beginPath();
-    ctx.arc(wx, cy, radius * 0.68, 0, Math.PI * 2);
-    ctx.fillStyle = rimGrad;
-    ctx.fill();
-    ctx.strokeStyle = '#505860';
-    ctx.lineWidth = 1;
-    ctx.stroke();
-
-    ctx.save();
-    ctx.translate(wx, cy);
-    ctx.rotate(angle);
-    ctx.strokeStyle = '#e8ecf0';
-    ctx.lineWidth = 2.8;
-    ctx.lineCap = 'round';
-    for (let i = 0; i < 5; i++) {
-      const a = (i / 5) * Math.PI * 2 - Math.PI / 2;
-      ctx.beginPath();
-      ctx.moveTo(0, 0);
-      ctx.lineTo(Math.cos(a) * radius * 0.6, Math.sin(a) * radius * 0.6);
-      ctx.stroke();
-    }
-    ctx.beginPath();
-    ctx.arc(0, 0, radius * 0.18, 0, Math.PI * 2);
-    ctx.fillStyle = '#a0a8b0';
-    ctx.fill();
-    ctx.strokeStyle = '#505860';
-    ctx.lineWidth = 1;
-    ctx.stroke();
-    ctx.restore();
-  });
-}
-
-/* =========================================================
-   VW PASSAT B3 — КРАСНЫЙ, морда СМОТРИТ ВЛЕВО
-   ========================================================= */
-function drawPolice(x, y, wheelAngle) {
-  ctx.fillStyle = 'rgba(0,0,0,.6)';
-  ctx.beginPath(); ctx.ellipse(x, y + 4, 105, 8, 0, 0, Math.PI * 2); ctx.fill();
-
-  const bg = ctx.createLinearGradient(0, y - 58, 0, y);
-  bg.addColorStop(0, '#e83030');
-  bg.addColorStop(0.4, '#b81818');
-  bg.addColorStop(0.85, '#600808');
-  bg.addColorStop(1, '#400404');
-
-  ctx.fillStyle = bg;
-  ctx.strokeStyle = '#000';
-  ctx.lineWidth = 2;
-  ctx.beginPath();
-  ctx.moveTo(x + 105, y - 10);
-  ctx.lineTo(x + 100, y - 28);
-  ctx.lineTo(x + 80, y - 34);
-  ctx.lineTo(x + 55, y - 42);
-  ctx.lineTo(x + 35, y - 54);
-  ctx.lineTo(x - 25, y - 54);
-  ctx.lineTo(x - 45, y - 42);
-  ctx.lineTo(x - 55, y - 34);
-  ctx.lineTo(x - 92, y - 30);
-  ctx.lineTo(x - 105, y - 12);
-  ctx.lineTo(x - 105, y);
-  ctx.lineTo(x + 105, y);
-  ctx.closePath();
-  ctx.fill();
-  ctx.stroke();
-
-  ctx.strokeStyle = 'rgba(255,220,220,.5)';
-  ctx.lineWidth = 1.5;
-  ctx.beginPath();
-  ctx.moveTo(x - 100, y - 22);
-  ctx.lineTo(x + 100, y - 22);
-  ctx.stroke();
-
-  ctx.fillStyle = 'rgba(15,20,35,.85)';
-  ctx.beginPath();
-  ctx.moveTo(x - 45, y - 40);
-  ctx.lineTo(x - 18, y - 40);
-  ctx.lineTo(x - 18, y - 30);
-  ctx.lineTo(x - 52, y - 30);
-  ctx.closePath();
-  ctx.fill();
-  ctx.beginPath();
-  ctx.moveTo(x + 55, y - 40);
-  ctx.lineTo(x + 35, y - 50);
-  ctx.lineTo(x + 10, y - 50);
-  ctx.lineTo(x + 10, y - 30);
-  ctx.lineTo(x + 55, y - 30);
-  ctx.closePath();
-  ctx.fill();
-  ctx.fillRect(x - 12, y - 30, 25, 10);
-
-  ctx.fillStyle = '#600808';
-  ctx.fillRect(x - 15, y - 50, 4, 20);
-
-  ctx.save();
-  ctx.fillStyle = '#ffffff';
-  ctx.font = 'bold 11px "Courier New"';
-  ctx.textAlign = 'center';
-  ctx.textBaseline = 'middle';
-  ctx.shadowColor = 'rgba(0,0,0,.8)';
-  ctx.shadowBlur = 3;
-  ctx.fillText('ПОЛИЦИЯ', x - 40, y - 12);
-  ctx.fillText('ПОЛИЦИЯ', x + 30, y - 12);
-  ctx.restore();
-
-  ctx.fillStyle = '#1a3a80';
-  ctx.fillRect(x - 95, y - 6, 190, 3);
-
-  ctx.fillStyle = '#0a0a0a';
-  ctx.strokeStyle = '#404040';
-  ctx.lineWidth = 1;
-  ctx.fillRect(x - 100, y - 26, 18, 12);
-  ctx.strokeRect(x - 100, y - 26, 18, 12);
-  for (let i = 0; i < 3; i++) {
-    ctx.beginPath();
-    ctx.moveTo(x - 99, y - 24 + i * 4);
-    ctx.lineTo(x - 83, y - 24 + i * 4);
-    ctx.stroke();
-  }
-
-  ctx.fillStyle = '#fff8c0';
-  ctx.shadowColor = '#fff8c0';
-  ctx.shadowBlur = 20;
-  ctx.fillRect(x - 100, y - 20, 14, 6);
-  ctx.shadowBlur = 0;
-
-  ctx.fillStyle = '#c02020';
-  ctx.shadowColor = '#c02020';
-  ctx.shadowBlur = 14;
-  ctx.fillRect(x + 100, y - 24, 5, 14);
-  ctx.shadowBlur = 0;
-
-  // Мигалки
-  const blink = Math.sin(state.time * 12) > 0;
-  ctx.fillStyle = '#1a1a1a';
-  ctx.fillRect(x - 30, y - 60, 60, 5);
-  ctx.fillStyle = blink ? '#ff2020' : '#401010';
-  ctx.shadowColor = blink ? '#ff2020' : 'transparent';
-  ctx.shadowBlur = blink ? 34 : 0;
-  ctx.beginPath();
-  ctx.moveTo(x - 30, y - 60);
-  ctx.lineTo(x, y - 60);
-  ctx.lineTo(x, y - 70);
-  ctx.lineTo(x - 30, y - 70);
-  ctx.closePath();
-  ctx.fill();
-  ctx.shadowBlur = 0;
-  ctx.fillStyle = !blink ? '#2060ff' : '#101040';
-  ctx.shadowColor = !blink ? '#2060ff' : 'transparent';
-  ctx.shadowBlur = !blink ? 34 : 0;
-  ctx.beginPath();
-  ctx.moveTo(x, y - 60);
-  ctx.lineTo(x + 30, y - 60);
-  ctx.lineTo(x + 30, y - 70);
-  ctx.lineTo(x, y - 70);
-  ctx.closePath();
-  ctx.fill();
-  ctx.shadowBlur = 0;
-  ctx.strokeStyle = '#000';
-  ctx.lineWidth = 1;
-  ctx.beginPath();
-  ctx.moveTo(x - 30, y - 60); ctx.lineTo(x - 30, y - 70);
-  ctx.moveTo(x, y - 60);       ctx.lineTo(x, y - 70);
-  ctx.moveTo(x + 30, y - 60);  ctx.lineTo(x + 30, y - 70);
-  ctx.stroke();
-
-  // Луч фар — влево
-  const beamGrad = ctx.createLinearGradient(x - 105, y - 14, x - 300, y + 10);
-  beamGrad.addColorStop(0, 'rgba(255,240,180,.4)');
-  beamGrad.addColorStop(1, 'rgba(255,240,180,0)');
-  ctx.fillStyle = beamGrad;
-  ctx.beginPath();
-  ctx.moveTo(x - 105, y - 20);
-  ctx.lineTo(x - 300, y - 28);
-  ctx.lineTo(x - 300, y + 20);
-  ctx.lineTo(x - 105, y - 4);
-  ctx.closePath();
-  ctx.fill();
-
-  drawBlackWheels(x, y, 65, 60, 15, wheelAngle);
-}
-
-/* Чёрные штампованные диски */
-function drawBlackWheels(cx, cy, offsetRear, offsetFront, radius, angle) {
-  [cx - offsetRear, cx + offsetFront].forEach(wx => {
-    ctx.beginPath();
-    ctx.arc(wx, cy, radius, 0, Math.PI * 2);
-    const tg = ctx.createRadialGradient(wx - radius*0.3, cy - radius*0.3, 1, wx, cy, radius);
-    tg.addColorStop(0, '#2a2a2a');
-    tg.addColorStop(1, '#000');
-    ctx.fillStyle = tg;
-    ctx.fill();
-
-    ctx.beginPath();
-    ctx.arc(wx, cy, radius * 0.62, 0, Math.PI * 2);
-    ctx.fillStyle = '#1a1a1a';
-    ctx.fill();
-    ctx.strokeStyle = '#404040';
-    ctx.lineWidth = 1.5;
-    ctx.stroke();
-
-    ctx.beginPath();
-    ctx.arc(wx, cy, radius * 0.28, 0, Math.PI * 2);
-    ctx.fillStyle = '#404040';
-    ctx.fill();
-    ctx.strokeStyle = '#606060';
-    ctx.lineWidth = 1;
-    ctx.stroke();
-
-    ctx.beginPath();
-    ctx.arc(wx, cy, radius * 0.1, 0, Math.PI * 2);
-    ctx.fillStyle = '#808890';
-    ctx.fill();
-  });
-}
-
-/* =========================================================
-   ЭВАКУАТОР
-   ========================================================= */
-function drawTowTruck(x, y, wheelAngle, doorOpen) {
-  ctx.fillStyle = 'rgba(0,0,0,.55)';
-  ctx.beginPath(); ctx.ellipse(x, y + 4, 105, 7, 0, 0, Math.PI * 2); ctx.fill();
-  const bg = ctx.createLinearGradient(0, y - 60, 0, y);
-  bg.addColorStop(0, '#d0b030'); bg.addColorStop(1, '#705010');
-  ctx.fillStyle = bg; ctx.strokeStyle = '#000'; ctx.lineWidth = 2;
-  ctx.beginPath();
-  ctx.moveTo(x - 100, y - 8); ctx.lineTo(x - 100, y - 55); ctx.lineTo(x - 55, y - 55);
-  ctx.lineTo(x - 40, y - 25); ctx.lineTo(x - 20, y - 25); ctx.lineTo(x - 20, y - 8);
-  ctx.lineTo(x - 20, y); ctx.lineTo(x - 100, y); ctx.closePath(); ctx.fill(); ctx.stroke();
-  ctx.fillStyle = 'rgba(80,120,160,.7)';
-  ctx.beginPath();
-  ctx.moveTo(x - 95, y - 50); ctx.lineTo(x - 60, y - 50); ctx.lineTo(x - 48, y - 28);
-  ctx.lineTo(x - 95, y - 28); ctx.closePath(); ctx.fill();
-  ctx.fillStyle = '#3a3a3a';
-  ctx.fillRect(x - 98, y - 40, 3, 10);
-  if (doorOpen) {
-    ctx.save();
-    ctx.translate(x - 100, y - 8);
-    ctx.rotate(-0.5);
-    ctx.fillStyle = '#b09020'; ctx.strokeStyle = '#000'; ctx.lineWidth = 2;
-    ctx.beginPath(); ctx.rect(-3, -40, 6, 42); ctx.fill(); ctx.stroke();
-    ctx.strokeStyle = 'rgba(0,0,0,.4)'; ctx.lineWidth = 1;
-    ctx.beginPath(); ctx.rect(-1, -38, 2, 38); ctx.stroke();
-    ctx.restore();
-  }
-  const pg = ctx.createLinearGradient(0, y - 20, 0, y - 8);
-  pg.addColorStop(0, '#b09020'); pg.addColorStop(1, '#705010');
-  ctx.fillStyle = pg; ctx.fillRect(x + 20, y - 18, 85, 10);
-  ctx.strokeStyle = '#000'; ctx.strokeRect(x + 20, y - 18, 85, 10);
-  ctx.strokeStyle = '#806010'; ctx.lineWidth = 5;
-  ctx.beginPath();
-  ctx.moveTo(x + 5, y - 18); ctx.lineTo(x + 40, y - 55); ctx.lineTo(x + 80, y - 55); ctx.stroke();
-  ctx.lineWidth = 2; ctx.strokeStyle = '#c0a020';
-  ctx.beginPath(); ctx.moveTo(x + 80, y - 55); ctx.lineTo(x + 90, y - 32); ctx.stroke();
-  ctx.strokeStyle = '#a0a8b0';
-  ctx.beginPath(); ctx.arc(x + 90, y - 28, 4, 0, Math.PI * 1.5); ctx.stroke();
-  const blink = Math.sin(state.time * 8) > 0;
-  ctx.fillStyle = blink ? '#ffb040' : '#604010';
-  ctx.shadowColor = blink ? '#ffb040' : 'transparent';
-  ctx.shadowBlur = blink ? 22 : 0;
-  ctx.fillRect(x - 65, y - 62, 12, 6); ctx.shadowBlur = 0;
-  ctx.fillStyle = '#fff8c0'; ctx.shadowColor = '#fff8c0'; ctx.shadowBlur = 15;
-  ctx.beginPath(); ctx.arc(x - 95, y - 14, 4, 0, Math.PI * 2); ctx.fill(); ctx.shadowBlur = 0;
-  drawWheels(x, y, 70, 25, 14, '#606060', wheelAngle);
-  const wx = x + 60;
-  ctx.beginPath(); ctx.arc(wx, y, 14, 0, Math.PI * 2);
-  ctx.fillStyle = '#0a0a0a'; ctx.fill();
-  ctx.beginPath(); ctx.arc(wx, y, 5, 0, Math.PI * 2);
-  ctx.fillStyle = '#606060'; ctx.fill();
-}
-function drawTowDriver(x, y, walking, alpha) {
-  ctx.save();
-  ctx.globalAlpha = alpha !== undefined ? Math.max(0, Math.min(1, alpha)) : 1;
-  const wobble = walking ? Math.sin(state.time * 10) * 2 : 0;
-  ctx.fillStyle = 'rgba(0,0,0,.55)';
-  ctx.beginPath(); ctx.ellipse(x, y + 2, 13, 4, 0, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#1a1a1a';
-  ctx.fillRect(x - 10, y - 5 + wobble, 11, 7); ctx.fillRect(x + 1, y - 5 - wobble, 11, 7);
-  ctx.fillStyle = '#0a0a0a';
-  ctx.fillRect(x - 11, y + 1 + wobble, 12, 2); ctx.fillRect(x, y + 1 - wobble, 12, 2);
-  ctx.fillStyle = '#252c38';
-  ctx.fillRect(x - 8, y - 33, 7, 29 + wobble); ctx.fillRect(x + 1, y - 33, 7, 29 - wobble);
-  ctx.fillStyle = '#d8d8d8';
-  ctx.fillRect(x - 8, y - 19 + wobble * 0.5, 7, 2); ctx.fillRect(x + 1, y - 19 - wobble * 0.5, 7, 2);
-  ctx.fillStyle = '#703810'; ctx.fillRect(x - 11, y - 64, 22, 36);
-  const jg = ctx.createLinearGradient(x - 11, 0, x + 11, 0);
-  jg.addColorStop(0, '#b06818'); jg.addColorStop(0.4, '#f09030'); jg.addColorStop(1, '#a85810');
-  ctx.fillStyle = jg; ctx.fillRect(x - 10, y - 63, 20, 33);
-  ctx.strokeStyle = '#703810'; ctx.lineWidth = 1; ctx.strokeRect(x - 10, y - 63, 20, 33);
-  ctx.fillStyle = '#f0f0f0';
-  ctx.fillRect(x - 10, y - 56, 20, 3); ctx.fillRect(x - 10, y - 44, 20, 3);
-  ctx.fillStyle = '#803810'; ctx.fillRect(x - 6, y - 64, 12, 3);
-  ctx.fillStyle = '#b06818';
-  ctx.fillRect(x - 16, y - 60, 6, 23); ctx.fillRect(x + 10, y - 60, 6, 23);
-  ctx.fillStyle = '#e8c020';
-  ctx.fillRect(x - 17, y - 39, 8, 8); ctx.fillRect(x + 10, y - 39, 8, 8);
-  ctx.fillStyle = '#d0a880'; ctx.fillRect(x - 3, y - 67, 6, 5);
-  ctx.beginPath(); ctx.arc(x, y - 76, 9, 0, Math.PI * 2);
-  const fg = ctx.createRadialGradient(x - 3, y - 78, 2, x, y - 76, 9);
-  fg.addColorStop(0, '#e8b890'); fg.addColorStop(1, '#c09870');
-  ctx.fillStyle = fg; ctx.fill();
-  ctx.strokeStyle = '#8a6a50'; ctx.lineWidth = 1; ctx.stroke();
-  ctx.fillStyle = '#1a1a1a';
-  ctx.beginPath(); ctx.arc(x - 3, y - 77, 1.2, 0, Math.PI * 2); ctx.fill();
-  ctx.beginPath(); ctx.arc(x + 3, y - 77, 1.2, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#e8c020';
-  ctx.beginPath(); ctx.arc(x, y - 82, 11, Math.PI, 0); ctx.fill();
-  ctx.fillRect(x - 11, y - 83, 22, 4);
-  ctx.strokeStyle = '#8a6a10'; ctx.lineWidth = 1;
-  ctx.beginPath(); ctx.arc(x, y - 82, 11, Math.PI, 0); ctx.stroke();
-  ctx.beginPath(); ctx.moveTo(x - 11, y - 79); ctx.lineTo(x + 11, y - 79); ctx.stroke();
-  ctx.fillStyle = '#c0a010'; ctx.fillRect(x - 1.5, y - 93, 3, 12);
-  ctx.strokeRect(x - 1.5, y - 93, 3, 12);
-  ctx.beginPath();
-  ctx.moveTo(x - 12, y - 79); ctx.lineTo(x + 12, y - 79);
-  ctx.lineTo(x + 10, y - 76); ctx.lineTo(x - 10, y - 76);
-  ctx.closePath(); ctx.fill(); ctx.stroke();
-  ctx.restore();
-}
-
-/* ===== СТАРШИЙ СМЕНЫ ===== */
-function drawSenior(x, y, walking, alpha) {
-  ctx.save();
-  ctx.globalAlpha = alpha !== undefined ? Math.max(0, Math.min(1, alpha)) : 1;
-  const wobble = walking ? Math.sin(state.time * 9) * 2 : 0;
-
-  ctx.fillStyle = 'rgba(0,0,0,.55)';
-  ctx.beginPath(); ctx.ellipse(x, y + 2, 15, 5, 0, 0, Math.PI * 2); ctx.fill();
-
-  ctx.fillStyle = '#0a0a0a';
-  ctx.fillRect(x - 10, y - 5 + wobble, 11, 7); ctx.fillRect(x + 1, y - 5 - wobble, 11, 7);
-  ctx.fillStyle = '#050505';
-  ctx.fillRect(x - 11, y + 1 + wobble, 12, 2); ctx.fillRect(x, y + 1 - wobble, 12, 2);
-
-  ctx.fillStyle = '#1a2340';
-  ctx.fillRect(x - 8, y - 35, 7, 31 + wobble); ctx.fillRect(x + 1, y - 35, 7, 31 - wobble);
-  ctx.fillStyle = '#3060a0';
-  ctx.fillRect(x - 8, y - 35, 2, 31 + wobble); ctx.fillRect(x + 6, y - 35, 2, 31 - wobble);
-
-  ctx.fillStyle = '#2a3a5a';
-  ctx.fillRect(x - 12, y - 70, 24, 38);
-  ctx.strokeStyle = '#1a2540'; ctx.lineWidth = 1; ctx.strokeRect(x - 12, y - 70, 24, 38);
-
-  ctx.fillStyle = '#101828';
-  ctx.fillRect(x - 13, y - 68, 26, 32);
-  ctx.strokeStyle = '#0a0f1a'; ctx.lineWidth = 1.5; ctx.strokeRect(x - 13, y - 68, 26, 32);
-  ctx.fillStyle = '#1a2840';
-  ctx.fillRect(x - 11, y - 66, 22, 12);
-  ctx.fillRect(x - 11, y - 52, 22, 12);
-  ctx.fillStyle = '#3a4a60';
-  ctx.fillRect(x - 2, y - 68, 4, 32);
-  ctx.fillStyle = '#c0a040';
-  ctx.beginPath(); ctx.arc(x - 7, y - 60, 2.5, 0, Math.PI * 2); ctx.fill();
-
-  ctx.fillStyle = '#d0d0e0';
-  ctx.fillRect(x - 13, y - 70, 6, 3);
-  ctx.fillRect(x + 7, y - 70, 6, 3);
-  ctx.fillStyle = '#ffd060';
-  ctx.beginPath(); ctx.arc(x - 10, y - 71, 1.5, 0, Math.PI * 2); ctx.fill();
-  ctx.beginPath(); ctx.arc(x + 10, y - 71, 1.5, 0, Math.PI * 2); ctx.fill();
-
-  ctx.fillStyle = '#2a3a5a';
-  ctx.fillRect(x - 18, y - 68, 6, 32);
-  ctx.fillRect(x + 12, y - 68, 6, 32);
-  ctx.fillStyle = '#1a1a1a';
-  ctx.fillRect(x - 18, y - 38, 7, 8);
-  ctx.fillRect(x + 12, y - 38, 7, 8);
-
-  ctx.fillStyle = '#d0a880';
-  ctx.fillRect(x - 3, y - 74, 6, 5);
-
-  ctx.beginPath();
-  ctx.arc(x, y - 83, 10, 0, Math.PI * 2);
-  const fg = ctx.createRadialGradient(x - 3, y - 85, 2, x, y - 83, 10);
-  fg.addColorStop(0, '#e8b890'); fg.addColorStop(1, '#c09870');
-  ctx.fillStyle = fg; ctx.fill();
-  ctx.strokeStyle = '#8a6a50'; ctx.lineWidth = 1; ctx.stroke();
-
-  ctx.fillStyle = '#1a1a1a';
-  ctx.beginPath(); ctx.arc(x - 3, y - 84, 1.3, 0, Math.PI * 2); ctx.fill();
-  ctx.beginPath(); ctx.arc(x + 3, y - 84, 1.3, 0, Math.PI * 2); ctx.fill();
-
-  ctx.fillStyle = '#1a2c52';
-  ctx.beginPath();
-  ctx.arc(x, y - 90, 13, Math.PI, 0);
-  ctx.fill();
-  ctx.fillRect(x - 13, y - 90, 26, 5);
-  ctx.strokeStyle = '#0f1a35'; ctx.lineWidth = 1.5;
-  ctx.beginPath(); ctx.arc(x, y - 90, 13, Math.PI, 0); ctx.stroke();
-  ctx.beginPath(); ctx.moveTo(x - 13, y - 85); ctx.lineTo(x + 13, y - 85); ctx.stroke();
-  ctx.fillStyle = 'rgba(100,150,220,.3)';
-  ctx.beginPath(); ctx.arc(x - 4, y - 94, 4, 0, Math.PI * 2); ctx.fill();
-  ctx.fillStyle = '#0f1a35';
-  ctx.beginPath();
-  ctx.moveTo(x - 14, y - 85);
-  ctx.lineTo(x + 14, y - 85);
-  ctx.lineTo(x + 12, y - 81);
-  ctx.lineTo(x - 12, y - 81);
-  ctx.closePath();
-  ctx.fill();
-  ctx.strokeStyle = '#05080f';
-  ctx.stroke();
-  ctx.strokeStyle = '#c0a040'; ctx.lineWidth = 1.5;
-  ctx.beginPath();
-  ctx.moveTo(x, y - 103);
-  ctx.lineTo(x, y - 90);
-  ctx.stroke();
-  ctx.fillStyle = '#0f1a2a';
-  ctx.fillRect(x - 15, y - 66, 3, 26);
-  ctx.fillRect(x + 12, y - 66, 3, 26);
-
-  ctx.restore();
-}
-
-/* ===== МАСШТАБ ===== */
-const CAR_SCALE = 1.56;
-function drawCarScaled(drawFn, x, y, ...args) {
-  ctx.save();
-  ctx.translate(x, y);
-  ctx.scale(CAR_SCALE, CAR_SCALE);
-  ctx.translate(-x, -y);
-  drawFn(x, y, ...args);
-  ctx.restore();
-}
-
-/* ===== ПОГОДА ===== */
-function updateWeatherParticles(dt) {
-  if (state.weather === 'clear' || state.weather === 'fog') {
-    state.weatherParticles = []; return;
-  }
-  const targetCount = state.weather === 'rain' ? 220 : 120;
-  while (state.weatherParticles.length < targetCount) {
-    state.weatherParticles.push({
-      x: Math.random() * W, y: Math.random() * H,
-      vx: state.weather === 'rain' ? 60 + Math.random() * 40 : -10 + Math.random() * 20,
-      vy: state.weather === 'rain' ? 600 + Math.random() * 200 : 30 + Math.random() * 40,
-      size: state.weather === 'rain' ? 1 : 1.5 + Math.random() * 1.5,
-      alpha: state.weather === 'rain' ? 0.5 + Math.random() * 0.4 : 0.7 + Math.random() * 0.3
-    });
-  }
-  if (state.weatherParticles.length > targetCount) state.weatherParticles.length = targetCount;
-  state.weatherParticles.forEach(p => {
-    p.x += p.vx * dt; p.y += p.vy * dt;
-    if (state.weather === 'rain') {
-      if (p.y > H) { p.y = -10; p.x = Math.random() * W; }
-    } else {
-      p.x += Math.sin(state.time * 2 + p.y * 0.02) * 15 * dt;
-      if (p.y > H) { p.y = -10; p.x = Math.random() * W; }
-      if (p.x < -10) p.x = W + 10;
-      if (p.x > W + 10) p.x = -10;
-    }
-  });
-}
-function drawWeatherParticles() {
-  if (state.weather === 'rain') {
-    ctx.strokeStyle = 'rgba(180,200,220,.55)';
-    ctx.lineWidth = 1;
-    state.weatherParticles.forEach(p => {
-      ctx.beginPath();
-      ctx.moveTo(p.x, p.y);
-      ctx.lineTo(p.x - 1, p.y - 12);
-      ctx.stroke();
-    });
-  } else if (state.weather === 'snow') {
-    state.weatherParticles.forEach(p => {
-      ctx.fillStyle = `rgba(240,248,255,${p.alpha})`;
-      ctx.beginPath(); ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2); ctx.fill();
-    });
-  } else if (state.weather === 'fog') {
-    const fogGrad = ctx.createLinearGradient(0, 0, 0, H);
-    fogGrad.addColorStop(0, 'rgba(200,205,215,.30)');
-    fogGrad.addColorStop(0.5, 'rgba(215,220,230,.20)');
-    fogGrad.addColorStop(1, 'rgba(200,205,215,.35)');
-    ctx.fillStyle = fogGrad;
-    ctx.fillRect(0, 0, W, H);
-    for (let i = 0; i < 6; i++) {
-      const y = (state.time * 12 + i * 80) % (H + 200) - 100;
-      const cx = W * (0.2 + 0.15 * Math.sin(i + state.time * 0.3));
-      const fogCloud = ctx.createRadialGradient(cx, y, 20, cx, y, 300);
-      fogCloud.addColorStop(0, 'rgba(215,220,230,.20)');
-      fogCloud.addColorStop(1, 'rgba(215,220,230,0)');
-      ctx.fillStyle = fogCloud;
-      ctx.fillRect(0, y - 200, W, 400);
-    }
-  }
-}
-function drawCameraHUD() {
-  const isIR = !isSunVisible();
-  const camText = isIR ? 'CAM-1 [IR]' : 'CAM-1 [DAY]';
-  ctx.font = 'bold 11px "Courier New"';
-  const tw = ctx.measureText(camText).width + 24;
-  ctx.fillStyle = 'rgba(0,0,0,.55)';
-  ctx.fillRect(W - tw - 20, 20, tw, 22);
-  ctx.strokeStyle = isIR ? '#40d080' : '#60a0e0';
-  ctx.lineWidth = 1;
-  ctx.strokeRect(W - tw - 20, 20, tw, 22);
-  ctx.fillStyle = isIR ? '#40d080' : '#60a0e0';
-  ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
-  ctx.fillText(camText, W - tw/2 - 20, 31);
-  ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';
-  const blink = Math.sin(state.time * 3) > 0;
-  if (blink) {
-    ctx.beginPath();
-    ctx.arc(W - tw - 28, 31, 4, 0, Math.PI * 2);
-    ctx.fillStyle = '#ff4040';
-    ctx.shadowColor = '#ff4040'; ctx.shadowBlur = 8;
-    ctx.fill(); ctx.shadowBlur = 0;
-  }
-}
-
-/* ===== ЛОГИКА ===== */
-let lastTs = 0;
-
-function updateScene(dt) {
-  const l = L();
-
-  if (state.alarm && state.time > state.alarmEnd) state.alarm = false;
-
-  const diff = state.barrier.target - state.barrier.level;
-  const step = Math.min(Math.abs(diff), dt * 1.6);
-  state.barrier.level += Math.sign(diff) * step;
-  if (Math.abs(diff) < 0.005) state.barrier.level = state.barrier.target;
-
-  const stopX = l.pivotX - l.armLen - 60;
-
-  if (state.car) {
-    const c = state.car;
-    if (state.phase === 'approaching') {
-      if (c.x < stopX) {
-        c.x += c.speed * dt; c.wheelAngle += c.speed * dt * 0.06;
-      } else if (c.isPriora) {
-        c.x += c.speed * dt; c.wheelAngle += c.speed * dt * 0.06;
-        if (c.x >= l.pivotX - l.armLen - 20 && state.barrier.level < 0.5) {
-          c.x = l.pivotX - l.armLen - 20; crash();
-        } else if (c.x > W + 300) {
-          state.car = null; state.phase = 'idle';
-        }
-      } else {
-        state.phase = 'waiting';
-        setStatus('ОЖИДАНИЕ РЕШЕНИЯ', 'wait');
-        setHint('Сравните пропуска и примите решение.');
-        renderPasses();
-      }
-    }
-    else if (state.phase === 'resolved') {
-      if (c.action === 'pass') {
-        if (state.barrier.level > 0.9) {
-          c.x += c.speed * dt; c.wheelAngle += c.speed * dt * 0.06;
-          if (c.x > W + 300) {
-            logEvent('Автомобиль проехал КПП', 'ok');
-            state.stats.in++;
-            state.car = null; state.phase = 'idle';
-            state.barrier.target = 0;
-            setStatus('ПОСТ СВОБОДЕН');
-            setHint('Нажмите <b>«Следующая машина»</b>.');
-            state.senior = null;
-          }
-        }
-      } else if (c.action === 'turn') {
-        c.x -= c.speed * dt; c.wheelAngle -= c.speed * dt * 0.06;
-        if (c.x < -350) {
-          logEvent('Автомобиль уехал', 'info');
-          state.car = null; state.phase = 'idle';
-          setStatus('ПОСТ СВОБОДЕН');
-          setHint('Нажмите <b>«Следующая машина»</b>.');
-          state.senior = null;
-        }
-      }
-    }
-  }
-
-  // Старший смены — принимает решение САМ
-  if (state.senior) {
-    const s = state.senior;
-    const SPEED = 90;
-
-    if (s.state === 'walk_to_lane') {
-      s.alpha = Math.min(1, (s.alpha || 0) + dt * 1.5);
-      s.walking = true;
-      s.y = l.botLaneY;
-      const targetX = (state.car ? state.car.x : 0) + 140;
-      s.targetX = targetX;
-      if (s.x > targetX) {
-        s.x -= SPEED * dt;
-      } else {
-        s.state = 'walk_up';
-      }
-    } else if (s.state === 'walk_up') {
-      s.walking = true;
-      if (s.y > l.topLaneY + 2) {
-        s.y -= SPEED * 0.7 * dt;
-      } else {
-        s.y = l.topLaneY;
-        s.walking = false;
-        s.state = 'review';
-        s.decideTimer = 0;
-        setStatus('СТАРШИЙ У МАШИНЫ', 'senior');
-        setHint('Старший смены проверяет документы...');
-        logEvent('Старший смены подошёл к машине', 'senior');
-      }
-    } else if (s.state === 'review') {
-      s.decideTimer += dt;
-      s.walking = false;
-      if (s.decideTimer > 2.0) {
-        const allow = (state.correctDecision === 'allow');
-        if (allow) {
-          logEvent('Старший смены: пропуск действителен — пропускаем', 'senior');
-          setStatus('СТАРШИЙ ПРОПУСКАЕТ', 'ok');
-          setHint('Старший смены разрешил проезд.');
-          state.car.action = 'pass';
-          state.barrier.target = 1;
-          state.phase = 'resolved';
-          state.userDecision = 'allow';
-          renderPasses();
-        } else {
-          logEvent('Старший смены: пропуск недействителен — отказ', 'senior');
-          setStatus('СТАРШИЙ ОТКАЗЫВАЕТ', 'wait');
-          setHint('Старший смены отказал в проезде.');
-          state.car.action = 'turn';
-          state.phase = 'resolved';
-          state.userDecision = 'deny';
-          state.stats.out++;
-          renderPasses();
-        }
-        s.state = 'returning';
-      }
-    } else if (s.state === 'returning') {
-      s.walking = true;
-      if (s.y < l.botLaneY - 2) {
-        s.y += SPEED * 0.7 * dt;
-      } else {
-        s.y = l.botLaneY;
-        s.x += SPEED * dt;
-        if (s.x > W + 60) state.senior = null;
-      }
-    }
-  }
-
-  // Сцена ДТП
-  if (state.phase === 'crash_scene') {
-    if (state.police) {
-      const p = state.police;
-      if (p.state === 'arriving') {
-        p.x -= p.speed * dt;
-        p.wheelAngle -= p.speed * dt * 0.06;
-        if (p.x <= p.targetX) { p.x = p.targetX; p.state = 'stopped'; }
-      } else if (p.state === 'leaving') {
-        p.x += p.speed * dt;
-        p.wheelAngle += p.speed * dt * 0.06;
-      }
-    }
-    if (state.tow) {
-      const t2 = state.tow;
-      if (t2.state === 'arriving') {
-        t2.x += t2.speed * dt;
-        t2.wheelAngle -= t2.speed * dt * 0.06;
-        if (t2.x >= t2.targetX) {
-          t2.x = t2.targetX; t2.state = 'stopped'; t2.stopTimer = 0;
-        }
-      } else if (t2.state === 'stopped') {
-        t2.stopTimer = (t2.stopTimer || 0) + dt;
-      } else if (t2.state === 'leaving') {
-        t2.x -= t2.speed * dt;
-        t2.wheelAngle += t2.speed * dt * 0.06;
-      }
-    }
-    if (state.car && state.car.towed && state.tow) {
-      state.car.x = state.tow.x + 220;
-      state.car.wheelAngle += state.tow.speed * dt * 0.06;
-    }
-    if (state.tow && state.tow.state === 'stopped' &&
-        state.tow.stopTimer > 1.2 &&
-        !state.towDriver && !state.leaving && state.car) {
-      const doorX = state.tow.x - 150;
-      const carX = state.car.x;
-      const carApproachX = carX - 160;
-      state.towDriver = {
-        x: doorX, y: l.topLaneY, homeX: doorX, doorX: doorX,
-        carApproachX: carApproachX,
-        state: 'exiting', exitTimer: 0, alpha: 0,
-        walking: false, attachTimer: 0, boardTimer: 0
-      };
-      state.tow.doorOpen = true;
-      logEvent('Водитель выходит из кабины эвакуатора', 'info');
-    }
-    if (state.towDriver) {
-      const td = state.towDriver;
-      const underY = l.topLaneBot + 25;
-      const SPD = 55;
-      if (td.state === 'exiting') {
-        td.exitTimer += dt;
-        td.alpha = Math.min(1, td.exitTimer / 0.8);
-        td.walking = false;
-        if (td.exitTimer > 0.8) { td.alpha = 1; td.state = 'walking_out_down'; }
-      }
-      else if (td.state === 'walking_out_down') {
-        if (td.y < underY - 2) { td.y += SPD * dt; td.walking = true; }
-        else { td.y = underY; td.state = 'walking_right'; }
-      }
-      else if (td.state === 'walking_right') {
-        if (td.x < td.carApproachX - 2) { td.x += SPD * dt; td.walking = true; }
-        else { td.x = td.carApproachX; td.state = 'walking_up'; }
-      }
-      else if (td.state === 'walking_up') {
-        if (td.y > l.topLaneY + 2) { td.y -= SPD * dt; td.walking = true; }
-        else { td.y = l.topLaneY; td.state = 'attaching'; td.attachTimer = 0; }
-      }
-      else if (td.state === 'attaching') {
-        td.attachTimer += dt; td.walking = false;
-        if (td.attachTimer > 0.6 && !state.towCable) {
-          state.towCable = true;
-          logEvent('Автомобиль зацеплен', 'info');
-        }
-        if (td.attachTimer > 1.4) td.state = 'returning_down';
-      }
-      else if (td.state === 'returning_down') {
-        if (td.y < underY - 2) { td.y += SPD * dt; td.walking = true; }
-        else { td.y = underY; td.state = 'returning_left'; }
-      }
-      else if (td.state === 'returning_left') {
-        if (td.x > td.doorX + 2) { td.x -= SPD * dt; td.walking = true; }
-        else { td.x = td.doorX; td.state = 'returning_up'; }
-      }
-      else if (td.state === 'returning_up') {
-        if (td.y > l.topLaneY + 2) { td.y -= SPD * dt; td.walking = true; }
-        else {
-          td.y = l.topLaneY;
-          td.state = 'boarding';
-          td.boardTimer = 0; td.walking = false;
-        }
-      }
-      else if (td.state === 'boarding') {
-        td.boardTimer += dt; td.walking = false;
-        td.alpha = Math.max(0, 1 - td.boardTimer / 0.8);
-        td.x += 20 * dt;
-        if (td.boardTimer > 0.8) {
-          td.state = 'gone'; td.alpha = 0;
-          if (state.tow) state.tow.doorOpen = false;
-          if (!state.leaving) {
-            state.leaving = true;
-            logEvent('Водитель сел в эвакуатор', 'info');
-            setTimeout(() => {
-              logEvent('Эвакуатор увозит автомобиль', 'info');
-              if (state.car) state.car.towed = true;
-              if (state.police) state.police.state = 'leaving';
-              if (state.tow) state.tow.state = 'leaving';
-            }, 600);
-          }
-        }
-      }
-    }
-    if (state.tow && state.tow.state === 'leaving' && state.tow.x < -600) {
-      state.car = null; state.police = null; state.tow = null;
-      state.towDriver = null; state.towCable = false; state.leaving = false;
-      state.phase = 'idle'; state.barrier.target = 0;
-      state.alarm = false;
-      setStatus('ПОСТ СВОБОДЕН');
-      setHint('Инцидент исчерпан. Нажмите «Следующая машина».');
-      logEvent('Инцидент закрыт', 'ok');
-    }
-  }
-
-  updateWeatherParticles(dt);
-}
-
-function crash() {
-  logEvent('!!! СТОЛКНОВЕНИЕ СО ШЛАГБАУМОМ !!!', 'alarm');
-  setStatus('ТРЕВОГА !', 'alarm');
-  setHint('Нарушитель врезался. Вызваны полиция и эвакуатор.');
-  state.alarm = true;
-  state.alarmEnd = state.time + 5;
-  state.phase = 'crash_scene';
-  state.leaving = false;
-  state.stats.alarms++;
-  state.stats.breaches++;
-  if (state.car) { state.car.action = 'crashed'; state.car.speed = 0; }
-
-  const l = L();
-  for (let i = 0; i < 40; i++) {
-    state.sparks.push({
-      x: l.pivotX - l.armLen - 30, y: l.topLaneY - 40,
-      vx: (Math.random() - .5) * 400, vy: (Math.random() - .5) * 300 - 80,
-      life: 1
-    });
-  }
-  setTimeout(() => {
-    state.police = {
-      x: W + 300, targetX: l.pivotX - 100,
-      speed: 260, state: 'arriving', wheelAngle: 0
-    };
-    logEvent('Прибывает VW Passat B3 полиции', 'warn');
-  }, 700);
-  setTimeout(() => {
-    const carX = state.car ? state.car.x : (l.pivotX - l.armLen - 20);
-    state.tow = {
-      x: -300, targetX: carX - 340,
-      speed: 200, state: 'arriving', wheelAngle: 0,
-      stopTimer: 0, doorOpen: false
-    };
-    logEvent('Прибывает эвакуатор', 'warn');
-  }, 1400);
-}
-
-/* ===== ОТРИСОВКА ===== */
-function drawScene() {
-  const l = L();
-  const t = state.time;
-  ctx.fillStyle = '#02040a'; ctx.fillRect(0, 0, W, H);
-
-  drawSky(); drawGround(); drawRoads();
-  drawBooth();
-  drawGuard(l.boothX + l.boothW + 25, l.boothBaseY);
-
-  if (state.towCable && state.tow && state.car) {
-    const fromX = state.tow.x + 140;
-    const fromY = l.topLaneY - 20;
-    const toX = state.car.x - 140;
-    const toY = l.topLaneY - 15;
-    ctx.strokeStyle = 'rgba(200,200,200,.85)'; ctx.lineWidth = 2;
-    ctx.beginPath(); ctx.moveTo(fromX, fromY);
-    const midX = (fromX + toX) / 2;
-    const midY = Math.max(fromY, toY) + 22;
-    ctx.quadraticCurveTo(midX, midY, toX, toY); ctx.stroke();
-  }
-
-  drawBarrier();
-
-  if (state.car) {
-    if (state.car.isPriora) drawCarScaled(drawPriora, state.car.x, l.topLaneY, state.car.wheelAngle);
-    else drawCarScaled(drawSedan, state.car.x, l.topLaneY, state.car.color, state.car.wheelAngle);
-  }
-  if (state.police) drawCarScaled(drawPolice, state.police.x, l.botLaneY, state.police.wheelAngle);
-  if (state.tow) drawCarScaled(drawTowTruck, state.tow.x, l.topLaneY, state.tow.wheelAngle, state.tow.doorOpen);
-
-  if (state.towDriver && state.towDriver.state !== 'gone') {
-    drawTowDriver(state.towDriver.x, state.towDriver.y,
-                  state.towDriver.walking,
-                  state.towDriver.alpha !== undefined ? state.towDriver.alpha : 1);
-  }
-
-  if (state.senior) {
-    drawSenior(state.senior.x, state.senior.y,
-               state.senior.walking,
-               state.senior.alpha !== undefined ? state.senior.alpha : 1);
-  }
-
-  state.sparks = state.sparks.filter(s => s.life > 0);
-  state.sparks.forEach(s => {
-    s.x += s.vx / 60; s.y += s.vy / 60; s.vy += 500 / 60; s.life -= 1.2 / 60;
-    ctx.fillStyle = `rgba(255,${Math.floor(160 + Math.random()*90)},60,${Math.max(0, s.life)})`;
-    ctx.beginPath(); ctx.arc(s.x, s.y, 2 + s.life * 3, 0, Math.PI * 2); ctx.fill();
-  });
-
-  drawWeatherParticles();
-  drawCameraHUD();
-
-  if (state.alarm) {
-    const pulse = 0.5 + Math.sin(t * 8) * 0.5;
-    ctx.strokeStyle = `rgba(255,40,40,${pulse * 0.5})`; ctx.lineWidth = 12;
-    ctx.strokeRect(6, 6, W - 12, H - 12);
-    ctx.fillStyle = `rgba(255,60,60,${0.5 + 0.3 * Math.abs(Math.sin(t * 5))})`;
-    ctx.font = 'bold 36px "Courier New"'; ctx.textAlign = 'center';
-    ctx.fillText('!!! ТРЕВОГА !!!', W / 2, 60); ctx.textAlign = 'left';
-  }
-
-  const hintText = {
-    idle: 'ПОСТ СВОБОДЕН · НАЖМИТЕ «СЛЕДУЮЩАЯ МАШИНА»',
-    approaching: 'АВТОМОБИЛЬ ПРИБЛИЖАЕТСЯ',
-    waiting: 'ОЖИДАНИЕ РЕШЕНИЯ ОПЕРАТОРА',
-    refuse_wait: 'МАШИНА ЖДЁТ · ОБЪЯСНИТЕ ПРИЧИНУ ИЛИ ВЫЗОВИТЕ СТАРШЕГО',
-    senior_walk: 'СТАРШИЙ СМЕНЫ ИДЁТ К МАШИНЕ',
-    resolved: 'ОБРАБОТКА РЕЗУЛЬТАТА',
-    crash_scene: 'НА МЕСТЕ ПРОИСШЕСТВИЯ'
-  }[state.phase] || '';
-
-  if (hintText) {
-    ctx.font = 'bold 12px "Courier New"';
-    const tw = ctx.measureText(hintText).width + 40;
-    ctx.fillStyle = 'rgba(10,14,20,.78)';
-    ctx.fillRect(W / 2 - tw / 2, 20, tw, 28);
-    ctx.strokeStyle = 'rgba(96,160,224,.5)'; ctx.lineWidth = 1;
-    ctx.strokeRect(W / 2 - tw / 2, 20, tw, 28);
-    ctx.fillStyle = '#a0c0e0'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
-    ctx.fillText(hintText, W / 2, 34); ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';
-  }
-}
-
-function loop(ts) {
-  if (!lastTs) lastTs = ts;
-  const dt = Math.min(0.05, (ts - lastTs) / 1000);
-  lastTs = ts;
-  state.time += dt;
-  updateScene(dt);
-  drawScene();
-  requestAnimationFrame(loop);
-}
-
-function updateClock() {
-  const d = new Date();
-  document.getElementById('clock').textContent =
-    String(d.getHours()).padStart(2,'0')+':'+String(d.getMinutes()).padStart(2,'0')+':'+String(d.getSeconds()).padStart(2,'0');
-}
-setInterval(updateClock, 1000); updateClock();
-
-resizeCanvas(); renderPasses(); renderLog();
-setHint('Нажмите <b>«Следующая машина»</b>.');
-logEvent('Система КПП-3 запущена', 'ok');
-logEvent('Смена: ' + weatherLabel(), 'info');
-requestAnimationFrame(loop);
-</script>
-</body>
-</html>