/* ==========================================================================
   АвтоПрятки — дизайн-система
   Карта на всю площадь + плавающие панели, графит + оранжевое/красное свечение
   ========================================================================== */

:root {
  --bg: #1c1e27;
  --bg-deep: #14151c;
  --rail: #22242f;
  --panel: rgba(38, 41, 54, 0.9);
  --panel-solid: #272a37;
  --panel-2: #2f3342;
  --panel-3: #383c4d;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);

  --text: #eef0f6;
  --text-2: #a3a8ba;
  --text-3: #6c7187;

  --accent: #ff7a1a;
  --accent-2: #ff9a3d;
  --accent-soft: rgba(255, 122, 26, 0.14);
  --red: #ff4438;
  --red-soft: rgba(255, 68, 56, 0.14);
  --amber: #ffb224;
  --amber-soft: rgba(255, 178, 36, 0.14);
  --green: #35d399;
  --green-soft: rgba(53, 211, 153, 0.14);
  --blue: #4c7dff;
  --blue-soft: rgba(76, 125, 255, 0.16);
  --violet: #9b6bff;

  --hider: var(--amber);
  --seeker: var(--red);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);
  --glow: 0 0 24px rgba(255, 122, 26, 0.45);

  --rail-w: 76px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* iPhone: «чёлка»/Dynamic Island и строка статуса сверху, скругления по бокам в альбомной ориентации */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

/* ---------- Базовое ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.hidden { display: none !important; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Фоновая карта ---------- */
.bg-map { position: fixed; inset: 0; z-index: 0; }
.bg-map .leaflet-control-container { display: none; }
.bg-shade {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 70% 20%, transparent, rgba(20,21,28,.55) 60%, rgba(20,21,28,.92)),
    linear-gradient(180deg, rgba(20,21,28,.2), rgba(20,21,28,.75));
}

/* ---------- Иконочная навигация (rail) ---------- */
.rail {
  position: fixed; z-index: 900; left: 0; top: 0; bottom: 0; width: var(--rail-w);
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 0;
}
.rail-logo { width: 42px; height: 42px; margin-bottom: 18px; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--red)); box-shadow: var(--glow); }
.rail-logo svg { width: 24px; height: 24px; }
.rail-item {
  position: relative; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  color: var(--text-3); transition: color .2s, background .2s, transform .2s var(--spring);
}
.rail-item:hover { color: var(--text); background: rgba(255,255,255,.05); }
.rail-item:active { transform: scale(.92); }
.rail-item.active { color: var(--accent); background: var(--accent-soft); }
.rail-item.active::before {
  content: ''; position: absolute; left: -14px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: var(--glow); animation: growY .35s var(--ease);
}
.rail-item .badge { position: absolute; top: 6px; right: 6px; }
.rail-item[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 58px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; background: var(--panel-3); color: var(--text); font-size: 12px; font-weight: 700;
  padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow-sm); pointer-events: none; animation: fadeIn .15s;
}
.rail-spacer { flex: 1; }
/* Колокольчик «уведомления включены» — цветом, без полоски выбранного раздела */
.rail-item.is-on { color: var(--accent); }
.rail-item.is-on::after { content: ''; position: absolute; top: 11px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--rail); }

/* iPhone: подложка под строкой статуса — прокручиваемое содержимое не налезает на часы */
body::before { content: ''; position: fixed; z-index: 850; top: 0; left: 0; right: 0; height: var(--safe-t); pointer-events: none;
  background: linear-gradient(rgba(20, 21, 28, .96), rgba(20, 21, 28, .88)); }
.page-game::before, .page-admin::before { background: linear-gradient(rgba(20, 21, 28, .75), rgba(20, 21, 28, 0)); height: calc(var(--safe-t) + 12px); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--red)); color: #fff; font-weight: 800; font-size: 14px;
  text-transform: uppercase;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.muted-av { background: var(--panel-3); color: var(--text-2); }

/* ---------- Панели ---------- */
.panel {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel-head { padding: 22px 24px 12px; display: flex; align-items: flex-start; gap: 12px; }
.panel-head .grow { flex: 1; min-width: 0; }
.panel-title { font-size: 22px; font-weight: 800; line-height: 1.15; }
.panel-title.sm { font-size: 17px; }
.panel-sub { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.panel-body { padding: 8px 24px 22px; }
.panel-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.section-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); margin: 18px 0 10px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- Кнопки ---------- */
.btn {
  --b: var(--panel-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  background: var(--b); color: var(--text); font-weight: 700; font-size: 13.5px; white-space: nowrap;
  transition: transform .15s var(--spring), filter .2s, background .2s, box-shadow .2s, opacity .2s;
  position: relative; overflow: hidden; user-select: none;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.96); }
.btn:disabled, .btn.loading { opacity: .5; pointer-events: none; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff5a1f); color: #fff; box-shadow: 0 8px 24px rgba(255,110,26,.35); }
.btn-red { background: linear-gradient(135deg, var(--red), #e22a2a); color: #fff; box-shadow: 0 8px 24px rgba(255,68,56,.3); }
.btn-green { background: linear-gradient(135deg, #2fcf8f, #1eaa73); color: #07140e; box-shadow: 0 8px 24px rgba(53,211,153,.25); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.04); filter: none; }
.btn-soft { background: rgba(255,255,255,.06); }
.btn-danger-ghost { background: transparent; border: 1px solid rgba(255,68,56,.35); color: #ff7a70; }
.btn-lg { height: 56px; font-size: 16px; border-radius: 14px; padding: 0 22px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn.loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn.loading > * { visibility: hidden; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.35); transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field > label, .label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.input, .select, textarea.input {
  height: 44px; width: 100%; padding: 0 14px; border-radius: 10px;
  background: rgba(10, 11, 16, .45); border: 1px solid var(--line-2); color: var(--text);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { height: auto; min-height: 80px; padding: 12px 14px; resize: vertical; }
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: rgba(10,11,16,.6); }
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.input.valid { border-color: var(--green); }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a8ba' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.select option { background: var(--panel-solid); }
.input-row { display: flex; gap: 10px; }
.input-row > * { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--text-3); }
.hint.err { color: #ff7a70; }
.hint.ok { color: var(--green); }

/* Чекбокс как в референсе: оранжевый квадрат с галочкой */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--text); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--accent); display: grid; place-items: center;
  transition: background .2s, transform .2s var(--spring); flex: none;
}
.check .box svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3.2; fill: none; opacity: 0; transform: scale(.3); transition: all .2s var(--spring); }
.check input:checked + .box { background: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.check:active .box { transform: scale(.85); }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px var(--accent-soft); }

/* Переключатель */
.toggle { position: relative; width: 40px; height: 22px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 22px; background: var(--panel-3); transition: background .25s; cursor: pointer; }
.toggle span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .25s var(--spring); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(18px); }

/* Слайдер */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--panel-3); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); cursor: pointer; }
.range::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; cursor: pointer; }

/* ---------- Вкладки (подчёркивание, как во втором референсе) ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); padding: 0 24px; position: relative; }
.tab { padding: 12px 0; color: var(--text-3); font-weight: 700; font-size: 13.5px; position: relative; transition: color .2s; }
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; animation: growX .3s var(--ease); }
.seg { display: flex; padding: 4px; background: rgba(10,11,16,.45); border-radius: 12px; gap: 4px; }
.seg button { flex: 1; height: 38px; border-radius: 9px; font-weight: 700; color: var(--text-2); transition: all .25s var(--ease); }
.seg button.active { background: var(--panel-3); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Бейджи / чипы ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 26px; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.06); color: var(--text-2); white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-accent { background: var(--accent-soft); color: var(--accent-2); }
.chip-red { background: var(--red-soft); color: #ff7a70; }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-blue { background: var(--blue-soft); color: #8aa9ff; }
.chip-live .dot { animation: blink 1.4s infinite; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: inline-grid; place-items: center; box-shadow: 0 0 0 3px var(--rail); animation: pop .4s var(--spring); }

.status-registration { background: var(--blue-soft); color: #8aa9ff; }
.status-lobby { background: rgba(155,107,255,.16); color: #b99bff; }
.status-hiding { background: var(--amber-soft); color: var(--amber); }
.status-searching { background: var(--red-soft); color: #ff7a70; }
.status-finished { background: rgba(255,255,255,.06); color: var(--text-2); }

/* ---------- Полосы статистики (как в первом референсе) ---------- */
.stat-bar { margin-bottom: 18px; }
.stat-bar:last-child { margin-bottom: 0; }
.stat-bar-top { display: flex; align-items: baseline; gap: 10px; font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.stat-bar-top b { font-weight: 800; min-width: 44px; }
.stat-bar-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.stat-bar-fill { height: 100%; width: 0; border-radius: 4px; transition: width 1.1s var(--ease); }
.fill-red { background: var(--red); box-shadow: 0 0 12px var(--red); }
.fill-accent { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.fill-amber { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.fill-green { background: var(--green); box-shadow: 0 0 12px var(--green); }
.stat-foot { margin-top: 20px; color: var(--text-3); font-size: 14px; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.kpi b { display: block; font-size: 26px; font-weight: 800; line-height: 1; }
.kpi span { font-size: 12px; color: var(--text-3); font-weight: 700; }
.kpi.accent b { color: var(--accent-2); }

/* ---------- Списки ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,.035); border: 1px solid transparent;
  transition: background .2s, border-color .2s, transform .2s var(--ease);
}
.row:hover { background: rgba(255,255,255,.06); }
.row.clickable { cursor: pointer; }
.row.selected { border-color: var(--accent); background: var(--accent-soft); }
.row .grow { flex: 1; min-width: 0; }
.row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex: none; }
.row.is-seeker { box-shadow: inset 3px 0 0 var(--seeker); }
.row.is-hider { box-shadow: inset 3px 0 0 var(--hider); }
.row.is-sos { background: var(--red-soft); animation: sosRow 1.2s infinite; }
.row.is-stale { opacity: .6; }
.stagger > * { animation: fadeUp .45s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .1s; } .stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; } .stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; } .stagger > *:nth-child(n+8) { animation-delay: .3s; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13.5px; border: 1px dashed var(--line-2); border-radius: 14px; }
.empty .ic { width: 28px; height: 28px; display: block; margin: 0 auto 8px; opacity: .6; }

.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1.5px solid rgba(255,255,255,.35); flex: none; }

/* ---------- Госномер ---------- */
.plate {
  display: inline-flex; align-items: stretch; height: 24px; border-radius: 5px; overflow: hidden;
  background: #f4f5f7; color: #111; border: 1.5px solid #111; box-shadow: 0 0 0 1px rgba(255,255,255,.25);
  font: 800 13px/1 'JetBrains Mono', ui-monospace, Menlo, monospace; letter-spacing: .04em; vertical-align: middle;
  white-space: nowrap; flex: none;
}
.plate-main { padding: 0 6px; display: flex; align-items: center; }
.plate-region { padding: 0 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; border-left: 1.5px solid #111; font-size: 10px; }
.plate-region::after { content: 'RUS'; font-size: 6px; letter-spacing: .06em; margin-top: 1px; }
.plate.lg { height: 38px; font-size: 22px; border-width: 2px; border-radius: 7px; }
.plate.lg .plate-main { padding: 0 10px; }
.plate.lg .plate-region { font-size: 15px; padding: 0 8px; border-left-width: 2px; }
.plate.lg .plate-region::after { font-size: 8px; }
.plate-raw { padding: 0 6px; align-items: center; }

/* ---------- Модалки ---------- */
.modal {
  position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 9, 13, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  width: 100%; max-width: 460px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow);
  transform: translateY(24px) scale(.96); transition: transform .35s var(--spring);
}
.modal.open .modal-card { transform: none; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 22px 6px; }
.modal-head h3 { flex: 1; font-size: 19px; }
.modal-body { padding: 12px 22px 22px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.modal-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent); }
.modal-icon .ic { width: 28px; height: 28px; }
.modal-icon.red { background: var(--red-soft); color: var(--red); }
@media (max-width: 600px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; max-height: calc(100vh - var(--safe-t) - 16px); border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); transform: translateY(100%); }
}

/* ---------- Тосты ---------- */
.toasts { position: fixed; z-index: 4000; top: calc(16px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; width: 100%;
  background: rgba(39, 42, 55, .96); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600;
  backdrop-filter: blur(10px); animation: toastIn .45s var(--spring); pointer-events: auto;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .ic { width: 20px; height: 20px; }
.toast.success .ic { color: var(--green); }
.toast.error .ic { color: var(--red); }
.toast.warning .ic { color: var(--amber); }
.toast.info .ic { color: var(--accent-2); }
.toast.error { border-color: rgba(255,68,56,.35); }

/* ---------- Плашка «нет связи» ---------- */
.net-banner { position: fixed; z-index: 4100; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 30px; font-size: 13px; font-weight: 700;
  background: rgba(39, 42, 55, .97); border: 1px solid rgba(255,178,36,.45); color: var(--amber); box-shadow: var(--shadow-sm);
  transition: transform .35s var(--spring); pointer-events: none; white-space: nowrap; }
.net-banner.show { transform: translate(-50%, 0); }
.net-banner .spinner { width: 16px; height: 16px; border-width: 2px; border-top-color: var(--amber); }

/* ---------- Карта: Leaflet ---------- */
.leaflet-container { background: #1a1c24 !important; font-family: var(--font) !important; }
.leaflet-control-attribution { background: rgba(20,21,28,.6) !important; color: var(--text-3) !important; font-size: 10px !important; border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel-solid) !important; color: var(--text) !important; box-shadow: var(--shadow) !important; border: 1px solid var(--line-2); }
.leaflet-popup-content-wrapper { border-radius: 14px !important; }
.leaflet-popup-content { margin: 14px 16px !important; font-size: 13px; line-height: 1.5; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3) !important; }
.leaflet-tooltip.map-label { background: rgba(20,21,28,.85); border: 1px solid var(--line-2); color: var(--text); font-weight: 700; font-size: 11px; border-radius: 6px; box-shadow: none; padding: 2px 7px; }
.leaflet-tooltip.map-label::before { display: none; }
/* Запасной вариант, если тайл нельзя перекрасить на canvas (нет CORS) */
.tiles-dark-css { filter: invert(1) hue-rotate(195deg) saturate(.28) brightness(.82) contrast(1.08); }

/* Зона: оранжевый контур со «свечением» и бегущим пунктиром */
/* Свечение зоны — широкая полупрозрачная обводка (без filter: blur, он дорогой на телефонах) */
.zone-glow { stroke-linecap: round; stroke-linejoin: round; }
.zone-line { stroke-dasharray: 10 8; animation: dash 1.2s linear infinite; }
.zone-mask { pointer-events: none; }
.zone-deny { animation: dash 2.4s linear infinite reverse; }
.kind-seg { margin-bottom: 16px; }
.kind-seg button { height: 34px; font-size: 12.5px; }
.kind-seg button[data-kind="deny"].active { background: var(--red); color: #fff; box-shadow: 0 6px 18px rgba(255,68,56,.35); }
.draw-deny .tool .ic { color: var(--red); }
.draw-deny .tool.active { border-color: var(--red); background: var(--red-soft); }
.zone-selected { stroke-dasharray: none !important; animation: none !important; }

/* Маркеры */
.mk { background: none !important; border: 0 !important; }
.car-mk { position: relative; width: 44px; height: 44px; display: grid; place-items: center; }
.car-mk .car-svg { width: 22px; height: 38px; transition: transform .6s var(--ease); filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.car-mk .halo { position: absolute; inset: 2px; border-radius: 50%; border: 2px solid var(--c); box-shadow: 0 0 18px var(--c), inset 0 0 12px var(--c); opacity: .75; animation: halo 2.4s ease-out infinite; }
.car-mk.me .halo { border-width: 2.5px; }
.car-mk.stale { opacity: .45; }
.car-mk.stale .halo { animation: none; border-style: dashed; }
.car-mk.sos .halo { --c: var(--red) !important; animation: sosHalo .8s infinite; }
.car-mk .mk-tag { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: rgba(20,21,28,.9); border: 1px solid var(--c); color: #fff; }
.heat { position: relative; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, var(--c) 0%, color-mix(in srgb, var(--c) 45%, transparent) 25%, color-mix(in srgb, var(--c) 12%, transparent) 55%, transparent 72%);
  animation: heat 3s ease-in-out infinite; }
.heat::after { content: ''; position: absolute; inset: 18%; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); }
.base-mk { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--red)); box-shadow: 0 0 0 4px rgba(255,122,26,.25), var(--glow); animation: pop .5s var(--spring); }
.base-mk .ic { width: 20px; height: 20px; }
.base-mk::after { content: ''; position: absolute; inset: -10px; border-radius: 18px; border: 2px solid var(--accent); opacity: 0; animation: ping 2.2s ease-out infinite; }
.dot-mk { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 0 16px var(--c); }

/* Leaflet.draw — перекрашиваем вершины и подсказки */
.leaflet-draw-toolbar, .leaflet-draw-actions { display: none !important; }
.leaflet-editing-icon, .leaflet-div-icon.leaflet-editing-icon {
  width: 12px !important; height: 12px !important; margin-left: -6px !important; margin-top: -6px !important;
  border-radius: 4px !important; background: #fff !important; border: 2.5px solid var(--accent) !important; box-shadow: 0 0 10px rgba(255,122,26,.7);
}
.leaflet-editing-icon.leaflet-edit-move { border-radius: 50% !important; background: var(--accent) !important; border-color: #fff !important; }
.leaflet-draw-tooltip { background: rgba(20,21,28,.92) !important; border: 1px solid var(--line-2) !important; color: var(--text) !important; border-radius: 8px !important; font-family: var(--font); font-size: 12px !important; padding: 6px 10px !important; }
.leaflet-draw-tooltip::before { border-right-color: rgba(20,21,28,.92) !important; }
.leaflet-draw-tooltip-subtext { color: var(--text-2) !important; }
.leaflet-draw-guide-dash { background-color: var(--accent) !important; opacity: .8; }

/* Плавающие контролы карты (зум и т.п.) */
.map-ctrls { position: absolute; z-index: 800; right: 20px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.map-ctrl { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); backdrop-filter: blur(10px);
  transition: color .2s, transform .15s var(--spring), background .2s; }
.map-ctrl:hover { color: var(--text); }
.map-ctrl:active { transform: scale(.9); }
.map-ctrl.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.map-ctrl-group { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.map-ctrl-group .map-ctrl { border-radius: 0; box-shadow: none; }
.map-ctrl-group .map-ctrl + .map-ctrl { border-top: 0; }

/* ---------- Прочее ---------- */
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; height: 60px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--panel-3); border: 1px solid var(--line-2); font-size: 11px; font-weight: 800; color: var(--text-2); }
.confetti { position: fixed; inset: 0; z-index: 3500; pointer-events: none; }

/* ---------- Анимации ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes dash { to { stroke-dashoffset: -36; } }
@keyframes halo { 0% { transform: scale(.85); opacity: .9; } 70% { transform: scale(1.15); opacity: .35; } 100% { transform: scale(.85); opacity: .9; } }
@keyframes sosHalo { 50% { transform: scale(1.35); opacity: .2; } }
@keyframes heat { 50% { transform: scale(1.08); opacity: .8; } }
@keyframes ping { 0% { transform: scale(.7); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px) scale(.95); } }
@keyframes sosRow { 50% { background: rgba(255,68,56,.24); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes glowPulse { 50% { box-shadow: 0 0 0 10px rgba(255,122,26,0), var(--glow); } }
.shake { animation: shake .45s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Страница входа
   ========================================================================== */
.auth-shell { position: relative; z-index: 2; min-height: 100vh; display: grid; grid-template-columns: 1.1fr minmax(360px, 440px); gap: 48px; align-items: center; max-width: 1180px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 32px 40px; }
.auth-hero { animation: slideInLeft .7s var(--ease); }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.brand-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--red)); box-shadow: var(--glow); animation: glowPulse 2.6s infinite; }
.brand-mark svg { width: 28px; height: 28px; }
.brand-name { font-size: 22px; font-weight: 800; }
.brand-city { font-size: 13px; color: var(--text-3); font-weight: 600; }
.hero-title { font-size: clamp(36px, 5vw, 58px); line-height: 1.02; font-weight: 800; letter-spacing: -0.03em; }
.hero-title em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--red)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin: 18px 0 30px; font-size: 16px; color: var(--text-2); max-width: 480px; }
.hero-card { max-width: 420px; padding: 24px 26px; animation: fadeUp .8s .25s var(--ease) both; }
.hero-card .stat-bar-top { font-size: 15px; }
.auth-card { padding: 8px 0 4px; animation: fadeUp .6s .1s var(--ease) both; }
.auth-card .tabs { margin-bottom: 18px; }
.auth-form { padding: 0 24px 20px; display: none; }
.auth-form.active { display: block; animation: fadeUp .35s var(--ease); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--text-2); line-height: 1.5; margin: 4px 0 16px; }
.consent .check { margin-top: 1px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-3); border-radius: 8px; }
.pw-eye:hover { color: var(--text); }
.rule-note { display: flex; gap: 10px; align-items: center; margin-top: 26px; color: var(--text-3); font-size: 13px; }
.rule-note .ic { color: var(--amber); }
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; gap: 24px; padding: calc(28px + var(--safe-t)) 16px 40px; }
  .hero-card, .hero-sub { display: none; }
  .brand { margin-bottom: 18px; }
  .hero-title { font-size: 34px; }
}

/* ==========================================================================
   Кабинет игрока
   ========================================================================== */
.app-main { position: relative; z-index: 2; margin-left: var(--rail-w); padding: calc(32px + var(--safe-t)) 36px 60px; min-height: 100vh; }
.app-head { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; animation: fadeUp .5s var(--ease); }
.app-head h1 { font-size: 30px; }
.app-head .grow { flex: 1; min-width: 0; }
.cab-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.cab-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cab-grid .panel { animation: fadeUp .55s var(--ease) both; }
.cab-col:nth-child(2) .panel:nth-child(1) { animation-delay: .08s; }
.cab-col:nth-child(2) .panel:nth-child(2) { animation-delay: .16s; }

.game-card { padding: 16px; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; transition: transform .25s var(--ease), border-color .25s, background .25s; }
.game-card:hover { transform: translateY(-2px); border-color: var(--line-2); background: rgba(255,255,255,.05); }
.game-card-title { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.game-card-meta { grid-column: 1; display: flex; gap: 14px; color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; }
.game-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.game-card-meta .ic { width: 14px; height: 14px; }
.game-card .act { grid-column: 2; grid-row: 1 / span 2; }
.game-card.live { border-color: rgba(255,122,26,.35); background: linear-gradient(135deg, rgba(255,122,26,.1), rgba(255,68,56,.04)); }

.car-card { position: relative; overflow: hidden; padding: 22px; }
.car-card-top { display: flex; gap: 18px; align-items: center; }
.car-visual { width: 86px; height: 120px; flex: none; display: grid; place-items: center; position: relative; }
.car-visual::before { content: ''; position: absolute; inset: 10px 0; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c, var(--accent)) 45%, transparent), transparent 70%); filter: blur(8px); animation: heat 3s infinite; }
.car-visual svg { position: relative; width: 52px; height: 92px; filter: drop-shadow(0 8px 10px rgba(0,0,0,.6)); animation: float 4s ease-in-out infinite; }
.car-info .model { font-size: 18px; font-weight: 800; margin: 10px 0 4px; }

.notify-card { padding: 18px 20px; }
.notify-head { display: flex; gap: 14px; align-items: center; }
.notify-head .grow { flex: 1; min-width: 0; }
.notify-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.06); color: var(--text-2); }
.notify-ico.on { background: var(--accent-soft); color: var(--accent); }
.notify-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.notify-steps { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.notify-steps b { color: var(--text); }
.notify-steps .ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--blue); }
.winner-card { padding: 14px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.winner-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.winner-card-head .grow { flex: 1; min-width: 0; font-weight: 800; }
.winner-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.trophy { color: var(--amber); filter: drop-shadow(0 0 8px rgba(255,178,36,.6)); }

/* Модалка «Игра найдена» */
.match-card { text-align: center; padding: 30px 26px 24px; }
.match-label { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--accent-2); text-transform: uppercase; }
.match-title { font-size: 24px; font-weight: 800; margin: 6px 0 18px; }
.ring { position: relative; width: 150px; height: 150px; margin: 0 auto 20px; }
.ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: rgba(255,255,255,.08); }
.ring .prog { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 8px rgba(255,122,26,.7)); }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; }
.ring-center b { font-size: 34px; font-weight: 800; }
.ring-center span { font-size: 11px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.match-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 20px; }
.match-pl { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; animation: pop .45s var(--spring) both; }
.match-pl .avatar { position: relative; transition: all .3s; }
.match-pl.waiting .avatar { background: var(--panel-3); color: var(--text-3); }
.match-pl.ready .avatar { box-shadow: 0 0 0 3px var(--green), 0 0 18px rgba(53,211,153,.5); }
.match-pl.ready .avatar::after { content: '✓'; position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #07140e; font-size: 11px; display: grid; place-items: center; animation: pop .35s var(--spring); }
.match-pl small { font-size: 11px; color: var(--text-2); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.color-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); transition: transform .2s var(--spring), box-shadow .2s; }
.swatch:hover { transform: scale(1.12); }
.swatch.selected { box-shadow: 0 0 0 3px var(--panel-solid), 0 0 0 5px var(--accent); transform: scale(1.1); }

@media (max-width: 1100px) { .cab-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Экран игры
   ========================================================================== */
.page-game { overflow: hidden; }
#gameMap { position: fixed; inset: 0; z-index: 0; }
.hud { position: fixed; z-index: 800; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-main { flex: 1; min-width: 0; padding: 12px 16px 14px; animation: fadeUp .5s var(--ease); max-width: 520px; margin: 0 auto; }
.hud-row { display: flex; align-items: center; gap: 10px; }
.hud-title { flex: 1; min-width: 0; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-timer { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; margin: 8px 0 10px; font-variant-numeric: tabular-nums; transition: color .3s; }
.hud-timer.warn { color: var(--amber); }
.hud-timer.danger { color: var(--red); text-shadow: 0 0 22px rgba(255,68,56,.6); }
.hud-timer.pulse { animation: blink 1s infinite; }
.hud-progress { height: 4px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.hud-progress i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), var(--red)); box-shadow: 0 0 10px var(--accent); transform-origin: left; transition: transform 1s linear; }
.hud-counters { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hud-side { display: flex; flex-direction: column; gap: 8px; }
.hud-btn { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); color: var(--text-2); transition: transform .15s var(--spring); }
.hud-btn:active { transform: scale(.9); }
.hud-btn.sos { background: linear-gradient(135deg, var(--red), #c81f1f); color: #fff; border: 0; box-shadow: 0 8px 24px rgba(255,68,56,.4); font-weight: 900; font-size: 12px; letter-spacing: .04em; }
.gps { font-size: 11.5px; font-weight: 800; padding: 0 8px; height: 24px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; background: var(--green-soft); color: var(--green); }
.gps .ic { width: 13px; height: 13px; }
.gps.warn { background: var(--amber-soft); color: var(--amber); }
.gps.err { background: var(--red-soft); color: #ff7a70; }
.role-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 30px; font-weight: 800; font-size: 13px; }
.role-pill .ic { width: 16px; height: 16px; }
.role-pill i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.role-pill.hider { background: var(--amber-soft); color: var(--amber); } .role-pill.hider i { background: var(--amber); color: #1b1300; }
.role-pill.seeker { background: var(--red-soft); color: #ff7a70; } .role-pill.seeker i { background: var(--red); }

.sheet { position: fixed; z-index: 800; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); max-width: 520px; margin: 0 auto; padding: 16px; animation: fadeUp .5s .1s var(--ease) both; }
.sheet-status { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; margin-bottom: 14px; min-height: 22px; }
.sheet-status .ic { width: 20px; height: 20px; }
.sheet-status.ok { color: var(--green); }
.sheet-status.bad { color: #ff7a70; }
.sheet-status.warn { color: var(--amber); }
.sheet-actions { display: flex; gap: 8px; margin-top: 10px; }
.sheet-actions .btn { flex: 1; }
.big-action { height: 64px; font-size: 17px; border-radius: 16px; width: 100%; }
.big-action.pulse-ready { animation: glowPulse 1.8s infinite; }
.map-ctrls.game { bottom: auto; top: 50%; transform: translateY(-50%); right: 12px; }

/* Дисквалификация — видят все игроки */
.dq-banner { position: fixed; inset: 0; z-index: 3300; display: grid; place-items: center; padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b)); background: radial-gradient(circle at 50% 40%, rgba(255,68,56,.35), rgba(8,9,13,.9) 65%); backdrop-filter: blur(6px); animation: fadeIn .25s; cursor: pointer; }
.dq-banner.out { animation: fadeOutDq .4s forwards; }
.dq-card { text-align: center; max-width: 360px; animation: dqSlam .55s var(--spring); }
.dq-stamp { display: inline-block; padding: 8px 18px; border: 3px solid var(--red); border-radius: 10px; color: var(--red); font-size: 26px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; transform: rotate(-6deg); box-shadow: 0 0 30px rgba(255,68,56,.5), inset 0 0 18px rgba(255,68,56,.3); margin-bottom: 18px; background: rgba(20,21,28,.6); }
.dq-car { margin: 0 auto 10px; width: 46px; height: 82px; filter: grayscale(.6) drop-shadow(0 8px 10px rgba(0,0,0,.6)); }
.dq-car svg { width: 46px; height: 82px; }
.dq-name { margin-top: 10px; font-weight: 800; font-size: 17px; }
.dq-reason { margin-top: 8px; color: #ff9a92; font-weight: 600; }
.dq-banner.me .dq-stamp { font-size: 32px; }
@keyframes dqSlam { 0% { transform: scale(1.8); opacity: 0; } 60% { transform: scale(.95); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fadeOutDq { to { opacity: 0; } }
.lobby-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; max-height: 30vh; overflow: auto; }
.lobby-car { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); transition: all .3s var(--ease); }
.lobby-car i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--text-3); flex: none; }
.lobby-car i .ic { width: 12px; height: 12px; stroke-width: 3; }
.lobby-car.ready { border-color: rgba(53,211,153,.45); background: var(--green-soft); }
.lobby-car.ready i { background: var(--green); color: #07140e; animation: pop .35s var(--spring); }
.lobby-car.me { box-shadow: 0 0 0 2px var(--accent); }
.cand-grid { display: grid; gap: 8px; max-height: 50vh; overflow: auto; padding: 2px; }
.victory { position: fixed; inset: 0; z-index: 3200; display: none; place-items: center; padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b)); background: radial-gradient(circle at 50% 35%, rgba(255,122,26,.25), rgba(8,9,13,.92) 60%); backdrop-filter: blur(8px); }
.victory.open { display: grid; animation: fadeIn .4s; }
.victory-card { text-align: center; max-width: 420px; width: 100%; }
.victory-crown { width: 110px; height: 110px; margin: 0 auto 10px; border-radius: 34px; display: grid; place-items: center; background: linear-gradient(135deg, #ffcf4a, var(--accent)); box-shadow: 0 0 60px rgba(255,178,36,.6); animation: pop .7s var(--spring), float 3s 1s ease-in-out infinite; color: #2a1600; }
.victory-crown .ic { width: 56px; height: 56px; stroke-width: 1.6; }
.victory.neutral .victory-crown { background: var(--panel-3); box-shadow: none; color: var(--text-2); }
.victory-title { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; margin-top: 12px; animation: fadeUp .6s .2s var(--ease) both; }
.victory-sub { color: var(--text-2); margin: 6px 0 22px; animation: fadeUp .6s .3s var(--ease) both; }
.victory .list { animation: fadeUp .6s .4s var(--ease) both; margin-bottom: 20px; text-align: left; }

/* ==========================================================================
   Админка
   ========================================================================== */
.page-admin { overflow: hidden; }
#adminMap { position: fixed; top: 0; bottom: 0; left: var(--rail-w); right: 0; z-index: 0; }
.side-panel { position: fixed; z-index: 700; top: calc(20px + var(--safe-t)); bottom: 20px; left: calc(var(--rail-w) + 20px); width: 400px; display: flex; flex-direction: column; overflow: hidden; animation: slideInLeft .45s var(--ease); }
.side-panel .scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.side-panel .panel-head { padding-bottom: 14px; }
.game-picker { position: relative; }
.game-picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; background: rgba(10,11,16,.45); border: 1px solid var(--line-2); text-align: left; transition: border-color .2s; }
.game-picker-btn:hover { border-color: var(--accent); }
.game-picker-btn .grow { flex: 1; min-width: 0; }
.game-picker-menu { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); max-height: 360px; overflow: auto; padding: 6px; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); animation: fadeUp .2s var(--ease); }
.game-picker-menu .row { background: transparent; }
.game-picker-menu .row:hover { background: rgba(255,255,255,.06); }

.stepper { display: flex; align-items: center; gap: 4px; padding: 4px 24px 16px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; position: relative; }
.step i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--text-3); font-style: normal; font-size: 11px; transition: all .4s var(--spring); position: relative; z-index: 1; }
.step i .ic { width: 14px; height: 14px; }
.step::before { content: ''; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--panel-3); }
.step:first-child::before { display: none; }
.step.done { color: var(--text-2); }
.step.done i { background: var(--accent-soft); color: var(--accent); }
.step.done::before, .step.current::before { background: linear-gradient(90deg, var(--accent), var(--accent)); }
.step.current { color: var(--text); }
.step.current i { background: var(--accent); color: #fff; box-shadow: var(--glow); transform: scale(1.12); }

.checklist { display: grid; gap: 6px; margin-bottom: 14px; }
.check-item { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.035); }
.check-item .ic { width: 16px; height: 16px; }
.check-item.ok .ic { color: var(--green); }
.check-item.bad { color: var(--amber); }
.check-item .grow { flex: 1; }

.float-panel { position: fixed; z-index: 650; animation: fadeUp .5s var(--ease); }
.layers-panel { top: calc(20px + var(--safe-t)); left: calc(var(--rail-w) + 440px); width: 420px; padding: 20px 24px 22px; }
.layers-panel .panel-title { font-size: 26px; }
.layers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 18px; }
.stats-panel { right: 76px; bottom: 24px; width: 380px; padding: 24px 28px; }

.tools { position: fixed; z-index: 700; top: calc(20px + var(--safe-t)); right: 20px; width: 230px; padding: 16px; animation: slideInRight .45s var(--ease); }
.tools-title { font-size: 13px; font-weight: 800; margin: 2px 0 10px; }
.tools-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.tool { height: 58px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--text-2); font-size: 10.5px; font-weight: 700; transition: all .2s var(--ease); }
.tool .ic { width: 22px; height: 22px; color: var(--blue); transition: color .2s, transform .25s var(--spring); }
.tool:hover { color: var(--text); background: rgba(255,255,255,.07); }
.tool:hover .ic { transform: scale(1.12); }
.tool.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.tool.active .ic { color: var(--accent); }
.tool:disabled { opacity: .35; pointer-events: none; }

.topbar-actions { position: fixed; z-index: 700; top: calc(20px + var(--safe-t)); right: 20px; display: flex; gap: 10px; align-items: center; animation: fadeIn .4s; }
.editor-mode .topbar-actions { right: 270px; }
.map-search { position: relative; }
.map-search .input { width: 280px; padding-left: 38px; height: 40px; background: var(--panel); backdrop-filter: blur(10px); }
.map-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; max-height: 320px; overflow: auto; animation: fadeUp .2s var(--ease); }
.search-results button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); }
.search-results button:hover { background: rgba(255,255,255,.06); color: var(--text); }

.zone-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid transparent; cursor: pointer; transition: all .2s; }
.zone-item:hover { background: rgba(255,255,255,.06); }
.zone-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.zone-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.prop { padding: 10px 12px; border-radius: 10px; background: rgba(10,11,16,.4); }
.prop span { display: block; font-size: 11px; color: var(--text-3); font-weight: 700; }
.prop b { font-size: 15px; }
.vertex-list { max-height: 220px; overflow: auto; display: grid; gap: 4px; font: 600 11.5px/1.4 ui-monospace, Menlo, monospace; }
.vertex-list div { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,.03); color: var(--text-2); }
.vertex-list div i { font-style: normal; color: var(--accent); min-width: 22px; }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); display: inline-block; animation: blink 1.2s infinite; }
.hint-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
/* Ручка шторки — только на телефоне */
.sheet-handle { display: none; justify-content: center; align-items: center; width: 100%; height: 22px; flex: none; cursor: grab; touch-action: none; }
.sheet-handle span { width: 44px; height: 5px; border-radius: 5px; background: rgba(255,255,255,.22); transition: background .2s, width .2s; }
.sheet-handle:active span { background: var(--accent); width: 56px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.draw-hint { position: fixed; z-index: 700; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; animation: fadeUp .3s var(--ease); }

.overlay-page { position: fixed; z-index: 750; top: 0; bottom: 0; right: 0; left: var(--rail-w); padding: calc(24px + var(--safe-t)) 24px 24px; background: rgba(20,21,28,.55); backdrop-filter: blur(4px); display: none; }
.overlay-page.open { display: block; animation: fadeIn .25s; }
.overlay-page > .panel { height: 100%; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; animation: fadeUp .4s var(--ease); }
.overlay-page .scroll { flex: 1; overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-solid); z-index: 1; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr { transition: background .2s; }
.table tbody tr:hover { background: rgba(255,255,255,.03); }
.table .user-cell { display: flex; align-items: center; gap: 10px; }

.log-day { margin-bottom: 22px; }
.log-day-head { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 10px; color: var(--text-2); }
.log-game { border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid var(--line); margin-bottom: 8px; overflow: hidden; }
.log-game-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.log-game-head .grow { flex: 1; min-width: 0; }
.log-game-head .chev { transition: transform .3s var(--ease); color: var(--text-3); }
.log-game.open .chev { transform: rotate(90deg); }
.log-game-body { display: none; padding: 0 16px 16px; }
.log-game.open .log-game-body { display: block; animation: fadeUp .3s var(--ease); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; padding: 5px 0; font-size: 13px; display: flex; gap: 10px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel-3); border: 2px solid var(--c, var(--text-3)); }
.tl-item time { color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 42px; }

.sos-alert { position: fixed; z-index: 3100; top: calc(20px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(92vw, 480px); padding: 16px 18px; display: flex; gap: 14px; align-items: center; border: 1px solid rgba(255,68,56,.5); animation: toastIn .45s var(--spring), sosRow 1.2s .5s infinite; }
.moved-alert { top: calc(110px + var(--safe-t)); border-color: rgba(255,178,36,.5); animation: toastIn .45s var(--spring); }
.sos-alert .modal-icon { margin: 0; width: 48px; height: 48px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1400px) { .layers-panel { width: 340px; } .layers-panel .panel-title { font-size: 21px; } .stats-panel { width: 320px; padding: 20px 22px; } }
@media (max-width: 1180px) { .layers-panel { display: none; } }
@media (max-width: 900px) {
  :root { --rail-w: 0px; }
  .rail { top: auto; right: 0; width: auto; height: calc(64px + var(--safe-b)); padding: 6px calc(8px + var(--safe-r)) calc(6px + var(--safe-b)) calc(8px + var(--safe-l)); flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); }
  .rail-logo, .rail-spacer, .rail .avatar { display: none; }
  .rail-item.active::before { left: 12px; right: 12px; top: -7px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .rail-item[data-tip]:hover::after { display: none; }
  .app-main { padding: calc(20px + var(--safe-t)) calc(14px + var(--safe-r)) calc(100px + var(--safe-b)) calc(14px + var(--safe-l)); }
  .app-head h1 { font-size: 24px; }
  .kpi b { font-size: 22px; }
  .panel-head { padding: 18px 18px 10px; } .panel-body { padding: 6px 18px 18px; } .tabs { padding: 0 18px; }
  #adminMap { left: 0; bottom: calc(64px + var(--safe-b)); }
  /* Панели админки на телефоне — выдвижная шторка снизу (ручка: тап/свайп) */
  .side-panel { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(72px + var(--safe-b)); height: 58vh; animation: sheetUp .35s var(--ease); }
  .sheet-handle { display: flex; }
  .side-panel.collapsed { height: auto; }
  .side-panel.collapsed .scroll, .side-panel.collapsed .tabs, .side-panel.collapsed .stepper { display: none; }
  .side-panel.collapsed .panel-head { padding-top: 4px; padding-bottom: 10px; }
  .side-panel.collapsed .panel-foot { border-top: 0; padding-top: 0; }
  .stats-panel, .layers-panel { display: none; }
  /* Палитра редактора: переключатель + одна полоса инструментов во всю ширину */
  .tools { top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
  .tools .tools-title, .tools .hide-mobile { display: none; }
  .kind-seg { margin: 0; width: 100%; }
  .kind-seg button { height: 34px; }
  .tools-row { display: contents; }
  .tool { flex: 1 1 0; min-width: 38px; height: 44px; font-size: 0; gap: 0; }
  .topbar-actions { top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); left: calc(8px + var(--safe-l)); }
  .editor-mode .topbar-actions { display: none; }
  .map-search .input { width: 100%; }
  .map-search { flex: 1; }
  .map-ctrls { right: calc(8px + var(--safe-r)); bottom: auto; top: calc(120px + var(--safe-t)); }
  .editor-mode .map-ctrls { top: calc(128px + var(--safe-t)); }
  /* Пока шторка развёрнута — кнопки карты не наезжают на неё */
  .page-admin:has(.side-panel:not(.collapsed):not(.hidden)) .map-ctrls { opacity: 0; pointer-events: none; }
  .map-ctrls { transition: opacity .25s; }
  .draw-hint { left: calc(8px + var(--safe-l)); right: calc(60px + var(--safe-r)); top: calc(128px + var(--safe-t)); bottom: auto; transform: none; font-size: 12.5px; align-items: flex-start; }
  .leaflet-draw-tooltip { display: none !important; } /* дублирует нашу подсказку и перекрывает палец */
  .overlay-page { left: 0; bottom: calc(64px + var(--safe-b)); padding: calc(8px + var(--safe-t)) 8px 8px; }
  .table .hide-sm { display: none; }
  .hud-timer { font-size: 32px; }
}

/* ==========================================================================
   Облегчённый режим для телефонов (html.lite ставит mapkit.js)
   Визуал тот же, но без эффектов, которые перерисовываются каждый кадр
   ========================================================================== */
/* backdrop-filter: blur пересчитывается при каждом движении карты под панелью */
html.lite .panel, html.lite .map-ctrl, html.lite .hud-btn, html.lite .toast, html.lite .modal,
html.lite .map-search .input, html.lite .victory, html.lite .dq-banner { -webkit-backdrop-filter: none; backdrop-filter: none; }
html.lite .panel { background: rgba(36, 39, 51, .97); }
html.lite .map-ctrl, html.lite .hud-btn:not(.sos), html.lite .toast { background: rgba(38, 41, 54, .97); }
html.lite .modal { background: rgba(8, 9, 13, .8); }
/* Бегущий пунктир зоны перерисовывает весь SVG-слой — на телефоне пунктир статичный */
html.lite .zone-line, html.lite .zone-deny { animation: none; }
/* Анимации box-shadow — перерисовка каждый кадр */
html.lite .pulse-ready, html.lite .brand-mark, html.lite .base-mk::after { animation: none; }
html.lite .heat { animation: none; }
html.lite .stagger > * { animation-duration: .25s; }
html.lite .leaflet-fade-anim .leaflet-tile { transition: none; }