/* Базовые стили интерфейса — «полевой планшет» в цветах эмблемы:
   тёплая бумага с горизонталями топокарты, чёрный и красный клуба как единственный акцент. */

@font-face { font-family: "Russo One"; src: url(../vendor/fonts/russo-one-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "Russo One"; src: url(../vendor/fonts/russo-one-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 400; src: url(../vendor/fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 400; src: url(../vendor/fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122,U+2212; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 500; src: url(../vendor/fonts/golos-text-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 500; src: url(../vendor/fonts/golos-text-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122,U+2212; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 600; src: url(../vendor/fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 600; src: url(../vendor/fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122,U+2212; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 700; src: url(../vendor/fonts/golos-text-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "Golos Text"; font-weight: 700; src: url(../vendor/fonts/golos-text-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122,U+2212; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; src: url(../vendor/fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; src: url(../vendor/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2212; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; src: url(../vendor/fonts/jetbrains-mono-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; src: url(../vendor/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2212; font-display: swap; }

:root {
  --bg: #efedea;
  --surface: #fbfaf8;
  --surface-2: #e6e2dd;
  --ink: #161413;
  --muted: #635d58;
  --line: #d8d2cc;
  --contour: #cfc7c0;
  --accent: #c8191b;
  --accent-ink: #ffffff;
  --accent-soft: #f6d9d6;
  --moss: #3d5a39;
  --danger: #a3161a;
  --ok: #2f7a3a;
  --shadow: 0 1px 0 rgba(20, 30, 20, .06), 0 6px 18px -10px rgba(20, 30, 20, .35);

  --f-display: "Russo One", "Arial Black", "Segoe UI", sans-serif;
  --f-body: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 10px;
  --r-lg: 16px;
  --gutter: clamp(16px, 4vw, 32px);
  --max: 1180px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* чёрный фон, графитовые плашки */
    --bg: #0d0e10; --surface: #2c3036; --surface-2: #383d44; --ink: #eef0f3; --muted: #aab1ba;
    --line: #3d434b; --contour: #434951; --accent: #f0524a; --accent-ink: #1c0706; --accent-soft: #4d2a2c;
    --moss: #9cc493; --danger: #ff9188; --ok: #82d08d;
    --shadow: 0 1px 0 rgba(0,0,0,.25), 0 8px 22px -12px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    /* чёрный фон, графитовые плашки */
    --bg: #0d0e10; --surface: #2c3036; --surface-2: #383d44; --ink: #eef0f3; --muted: #aab1ba;
    --line: #3d434b; --contour: #434951; --accent: #f0524a; --accent-ink: #1c0706; --accent-soft: #4d2a2c;
    --moss: #9cc493; --danger: #ff9188; --ok: #82d08d;
    --shadow: 0 1px 0 rgba(0,0,0,.25), 0 8px 22px -12px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: clamp(21px, 3vw, 27px); }
h3 { font-size: 18px; }
p { margin: 0; }
[hidden] { display: none !important; }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 900;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.brand-name { font-family: var(--f-display); font-size: 19px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 -2px 0 var(--accent); }
.me-slot { flex-shrink: 0; display: flex; gap: 8px; align-items: center; }

@media (max-width: 760px) {
  .topbar-in { flex-wrap: wrap; gap: 6px 12px; padding-block: 8px 0; }
  .brand-name { font-size: 17px; }
  .me-slot { margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); padding-bottom: 6px; }
}

/* ---------- Кнопки и поля ---------- */
.btn {
  --b: var(--surface); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--f-body); padding: 10px 14px; border-radius: 9px; cursor: pointer;
  background: var(--b); color: var(--c); border: 1px solid var(--line); text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .tile:focus-visible, .card-link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn.primary { --b: var(--accent); --c: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { --c: var(--danger); }
.btn.sm { padding: 7px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.is-locked { opacity: .5; cursor: not-allowed; filter: grayscale(1); }
.btn.is-locked:hover { border-color: var(--line); }
.btn.is-locked:active { transform: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.icon-btn { padding: 8px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
input[type="text"], input[type="url"], input[type="datetime-local"], input[type="date"], input[type="search"], textarea, select {
  width: 100%; font: 400 15px/1.4 var(--f-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 90px; }
input[type="file"] { font: inherit; color: var(--muted); max-width: 100%; }
.form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.error { color: var(--danger); font-size: 13px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.swatch-custom { position: relative; display: grid; place-items: center; overflow: hidden;
  background: conic-gradient(#e03131, #e8a317, #2f9e44, #0c8599, #2a7de1, #7048e8, #c2255c, #e03131); }
.swatch-custom span { font: 700 16px/1 var(--f-body); color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.7); pointer-events: none; }
.swatch-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ---------- Раскладка ---------- */
main { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); padding-block: 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.page-head > * { min-width: 0; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.section { display: grid; gap: 14px; min-width: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a { color: var(--muted); font-size: 14px; text-decoration: none; }
.section-head a:hover { color: var(--accent); }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }

/* ---------- Главная: шапка с горизонталями ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  padding: clamp(22px, 4vw, 40px); display: grid; gap: 22px 32px;
  grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr); align-items: center;
}
.emblem { position: relative; width: clamp(150px, 18vw, 220px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line), 0 18px 40px -18px rgba(0,0,0,.45); max-width: 100%; }
.emblem video, .emblem img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero > *:not(canvas) { position: relative; }
.hero h1 { font-size: clamp(34px, 6.4vw, 64px); }
.hero .tagline { font-size: 17px; color: var(--muted); margin-top: 10px; max-width: 34ch; }
.hero-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 22px; }
.hero-stats b { display: block; font-family: var(--f-mono); font-size: 26px; font-weight: 500; }
.hero-stats span { font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 980px) { .hero { grid-template-columns: auto minmax(0, 1fr); } .hero .next-event { grid-column: 1 / -1; } }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; justify-items: start; } .emblem { width: 140px; } }

.next-event { background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; text-decoration: none; }
.next-event .label { color: color-mix(in srgb, var(--bg) 65%, var(--ink)); }
.next-event h3 { font-size: 21px; }
.countdown { display: flex; gap: 14px; font-family: var(--f-mono); }
.countdown div { display: grid; }
.countdown b { font-size: 24px; font-weight: 500; }
.countdown span { font-size: 11px; opacity: .7; }

/* ---------- Участники ---------- */
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tag-card {
  position: relative; display: grid; gap: 12px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.tag-card:hover { transform: translateY(-2px); border-color: var(--c, var(--accent)); }
.tag-card::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 4px; border-radius: 0 0 4px 4px; background: var(--c, var(--accent)); }
.tag-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.tag-top > div { min-width: 0; }
.nick { font-family: var(--f-display); font-size: 19px; overflow-wrap: anywhere; }
.quad { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tag-stats { display: flex; gap: 16px; border-top: 1px dashed var(--line); padding-top: 10px; font-size: 13px; color: var(--muted); }
.tag-stats b { color: var(--ink); font-family: var(--f-mono); font-weight: 500; }

.avatar { width: var(--s, 52px); height: var(--s, 52px); border-radius: 50%; flex-shrink: 0; object-fit: cover; background: var(--c, var(--surface-2)); color: #fff; display: grid; place-items: center; font-family: var(--f-display); font-size: calc(var(--s, 52px) * .4); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c, var(--line)); }
.avatar.sm { --s: 28px; box-shadow: 0 0 0 2px var(--surface); }
.avatar.xs { --s: 22px; box-shadow: 0 0 0 1.5px var(--surface); font-size: 10px; }
/* Дуга рейтинга вокруг аватарки: «тахометр» от 6 часов по часовой стрелке, лидер = 360° */
@property --pp { syntax: "<number>"; inherits: false; initial-value: 0; }
.ava-ring { position: relative; display: inline-grid; flex-shrink: 0; border-radius: 50%; align-self: center; justify-self: center; width: max-content; height: max-content; }
.ava-ring > .avatar { box-shadow: none; }
.ava-ring::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; --pp: var(--p, 0);
  background: conic-gradient(from 180deg, var(--c) 0 calc(var(--pp) * 360deg), color-mix(in srgb, var(--c) 16%, var(--line)) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
          mask: radial-gradient(closest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  animation: ava-ring-in 5s cubic-bezier(.4, 0, .2, 1) both; }
.ava-ring.lead::before { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c) 60%, transparent)); }
@keyframes ava-ring-in { from { --pp: 0; } }
@media (prefers-reduced-motion: reduce) { .ava-ring::before { animation: none; } }
.avatar-stack { display: flex; }
.avatar-stack > * { margin-left: -8px; }
.avatar-stack > *:first-child { margin-left: 0; }

.profile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.profile .avatar { --s: 108px; }
.profile .nick { font-size: clamp(26px, 4vw, 38px); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); margin-top: 6px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) { .profile { grid-template-columns: auto minmax(0, 1fr); } .profile-actions { grid-column: 1 / -1; justify-content: flex-start; } .profile .avatar { --s: 76px; } }
.bio { max-width: 65ch; white-space: pre-wrap; }

/* ---------- Поездки ---------- */
.rides { display: grid; gap: 0; }
.ride { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ride:last-child { border-bottom: 0; }
.ride-bar { align-self: stretch; border-radius: 3px; background: var(--c, var(--accent)); }
.ride-title { font-weight: 600; overflow-wrap: anywhere; }
.ride-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.ride-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ride-who { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 500; color: var(--ink); }

/* ---------- Мероприятия ---------- */
.events-list { display: grid; gap: 14px; }
.event-card { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.event-card:hover { border-color: var(--accent); }
.event-logo { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.event-logo svg { width: 42px; height: 42px; }
.date-chip { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--f-mono); font-size: 13px; color: var(--accent); font-weight: 500; }
.event-card h3 { margin-top: 4px; font-size: 20px; }
.event-side { display: grid; gap: 6px; justify-items: end; text-align: right; font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.pill.hot { background: var(--accent-soft); color: var(--accent); }
.pill.past { color: var(--muted); }
@media (max-width: 620px) {
  .event-card { grid-template-columns: 64px minmax(0, 1fr); }
  .event-logo { width: 64px; height: 64px; }
  .event-side { grid-column: 1 / -1; justify-items: start; text-align: left; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
}
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { font: 600 14px var(--f-body); border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.event-hero { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; }
.event-hero .event-logo { width: 180px; height: 180px; border-radius: 18px; }
@media (max-width: 640px) { .event-hero { grid-template-columns: 1fr; } .event-hero .event-logo { width: 100%; height: auto; aspect-ratio: 16/9; max-width: 100%; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.fact { border-left: 3px solid var(--line); padding-left: 10px; }
.fact b { display: block; font-family: var(--f-mono); font-weight: 500; font-size: 15px; }

/* ---------- Карты ---------- */
.map { height: 420px; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); z-index: 0; }
.map.tall { height: min(72vh, 720px); }
.map.small { height: 280px; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .map-layout { grid-template-columns: 1fr; } .map.tall { height: 60vh; } }
.legend { display: grid; gap: 4px; align-content: start; max-height: min(72vh, 720px); overflow: auto; }
.legend label { display: grid; grid-template-columns: auto 14px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.legend label:hover { background: var(--surface-2); }
.legend .dot { width: 14px; height: 14px; border-radius: 4px; background: var(--c); }
.legend .dash, .event-dash { width: 14px; height: 0; border-top: 3px dashed var(--c, var(--accent)); display: inline-block; }
.legend .km { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.leaflet-container { font: 13px/1.4 var(--f-body); background: var(--surface-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content a { color: var(--accent); }
.leaflet-bar a, .leaflet-control-layers { background: var(--surface); color: var(--ink); border-color: var(--line) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
.wp-marker { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); border: 2px solid #fff; display: grid; place-items: center; font: 600 11px var(--f-mono); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.router-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.router-bar select { width: auto; }
.router-info { font-size: 13px; color: var(--muted); }

/* ---------- Чат ---------- */
.chat { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: min(74vh, 760px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.chat-log { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; max-width: min(640px, 92%); }
.msg-body { background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 8px 12px; display: grid; gap: 4px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.msg-head a { font-weight: 700; text-decoration: none; color: var(--c, var(--ink)); }
.msg-head time { color: var(--muted); font-family: var(--f-mono); font-size: 11px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-img { border-radius: 10px; max-height: 320px; width: auto; cursor: zoom-in; }
.msg.mine { align-self: flex-end; grid-template-columns: minmax(0, 1fr) auto; }
.msg.mine .avatar { order: 2; }
.msg.mine .msg-body { background: var(--accent-soft); border-radius: 14px 4px 14px 14px; }
.msg-body { cursor: default; }
.msg-tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s ease; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; }
@media (hover: none) { .msg-tools { opacity: .75; } }
.msg-tools .btn { padding: 3px 7px; font-size: 12px; }
.msg-quote { display: grid; gap: 1px; text-align: left; width: 100%; font: inherit; color: inherit; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 60%, transparent); border: 0; border-left: 3px solid var(--c, var(--accent)); border-radius: 6px; padding: 5px 9px; }
.msg-quote b { font-size: 12px; color: var(--c, var(--accent)); }
.msg-quote span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention { font-weight: 700; text-decoration: none; color: var(--c, var(--accent)); }
.mention.me { background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 4px; padding: 0 3px; }
.msg.to-me .msg-body { box-shadow: inset 3px 0 0 var(--accent); }
.msg.replying .msg-body { outline: 2px solid var(--accent); outline-offset: 1px; }
.msg.flash .msg-body { animation: msg-flash 1.4s ease; }
@keyframes msg-flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); } 100% { } }
.reply-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; border-left: 3px solid var(--c, var(--accent)); background: var(--surface-2); border-radius: 6px; padding: 6px 6px 6px 10px; }
.reply-bar > div { display: grid; min-width: 0; flex: 1; }
.reply-bar b { font-size: 12px; color: var(--c, var(--accent)); }
.reply-bar span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-input { position: relative; min-width: 0; }
.mention-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: grid; max-height: 260px; overflow-y: auto; }
.mention-opt { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: center; text-align: left; font: inherit; color: var(--ink); background: transparent; border: 0; border-radius: 7px; padding: 6px 8px; cursor: pointer; }
.mention-opt small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-opt[aria-selected="true"], .mention-opt:hover { background: var(--surface-2); }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); font-family: var(--f-mono); padding: 4px 10px; border-radius: 99px; background: var(--surface-2); }
.chat-form { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: end; }
.chat-form textarea { min-height: 44px; max-height: 160px; resize: none; display: block; }
.chat-attach { font-size: 12px; color: var(--muted); grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }

/* ---------- Галерея ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { width: auto; max-width: 100%; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px 10px; align-items: start; }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; } .tc-title { font-size: 12px; } }
.tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; border: 0; padding: 0; max-width: 100%; }
.tile > img, .tile > video { width: 100%; height: 100%; object-fit: cover; }
.tile .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: linear-gradient(transparent 50%, rgba(0,0,0,.45)); }
.tile .play svg { width: 44px; height: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.tile { width: 100%; display: block; }
.gallery.gallery-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile-wrap { margin: 0; display: grid; gap: 6px; align-content: start; min-width: 0; }
.tile-cap { display: grid; gap: 2px; min-width: 0; padding: 0 2px; }
.tc-title { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; min-height: 1.3em; }
.tc-title.tc-event { font-weight: 500; color: var(--muted); }
.tc-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.tc-meta .avatar { --s: 16px; font-size: 8px; box-shadow: none; }
.tc-nick { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Просмотр на весь экран: кадр вписывается в экран целиком (object-fit: contain), панели поверх кадра */
.lightbox { position: fixed; inset: 0; z-index: 2000; background: #000; color: #eef2ea; overflow: hidden; touch-action: none; outline: none; }
.lightbox:fullscreen { width: 100vw; height: 100vh; }
.lightbox .lb-stage { position: absolute; inset: 0; }
.lightbox .lb-media { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; transition: transform .2s ease; transform-origin: center; }
.lightbox.zoomed .lb-media { cursor: grab; transition: none; }
.lightbox .lb-bar { transition: opacity .25s ease; }
.lightbox.idle:not(.editing) .lb-bar { opacity: 0; pointer-events: none; }
.lightbox .lb-cap-edit { display: flex; gap: 8px; align-items: center; max-width: 760px; margin: 0 auto; right: 0; }
.lightbox .lb-cap-edit input { flex: 1; min-width: 0; background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 9px; padding: 9px 12px; font: 15px var(--f-body); }
.lightbox.idle { cursor: none; }
.lightbox .lb-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 28px; background: linear-gradient(rgba(0,0,0,.65), transparent); font-size: 14px; }
.lightbox .lb-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.lightbox .lb-actions { display: flex; gap: 6px; flex-shrink: 0; }
.lightbox .lb-cap { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 15px;
  padding: 28px 16px calc(env(safe-area-inset-bottom, 0px) + 14px); background: linear-gradient(transparent, rgba(0,0,0,.65)); text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.lightbox .btn { --b: rgba(0,0,0,.45); --c: #fff; border-color: rgba(255,255,255,.18); backdrop-filter: blur(4px); }
.lightbox .btn:hover { --b: rgba(0,0,0,.7); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); padding: 12px; }
.lb-nav svg { width: 22px; height: 22px; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
@media (hover: none) { .lb-nav { display: none; } }

/* ---------- Модальные окна ---------- */
dialog.modal { border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: var(--r-lg); width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog.modal.wide { width: min(920px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 14, 10, .55); }
.modal-in { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100dvh - 40px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.keybox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 9px; padding: 10px 12px; font-family: var(--f-mono); font-size: 13px; overflow-wrap: anywhere; }
.keybox code { flex: 1; min-width: 0; user-select: all; }

/* ---------- Прочее ---------- */
.empty { border: 1.5px dashed var(--line); border-radius: var(--r-lg); padding: 28px 20px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty h3 { color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); z-index: 3000; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); color: #fff; }
.loading { color: var(--muted); padding: 30px 0; text-align: center; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 9px 4px 6px; }
.strip a { text-decoration: none; display: grid; justify-items: center; align-content: start; gap: 6px; width: 76px; flex-shrink: 0; font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.footer { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 40px; color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Раздел «Карты» ---------- */
.app-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 12px; align-content: start; box-shadow: var(--shadow); border-top: 4px solid var(--c); }
.app-top { display: flex; gap: 12px; align-items: center; }
.app-top h3 { font-size: 21px; }
.app-top p { font-size: 13px; margin-top: 2px; }
.app-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--c); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.app-icon svg { width: 28px; height: 28px; }
.app-points { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.app-links { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.store-badge { display: inline-flex; align-items: center; height: 40px; line-height: 0; border-radius: 8px; }
.store-badge img { display: block; height: 40px; width: auto; }
.store-badge span { display: none; }
.store-badge.fallback { line-height: 1; padding: 0 14px; border: 1px solid var(--line, #8886); font-size: 14px; font-weight: 600; }
.store-badge.fallback span { display: inline; }
.store-badge:hover { opacity: .88; }
.store-badge:focus-visible, .site-globe:focus-visible { outline: 2px solid var(--accent, #c8191b); outline-offset: 2px; }
.site-globe { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line, #8886); color: inherit; }
.site-globe:hover { color: var(--accent, #c8191b); border-color: currentColor; }
.map-files { display: grid; gap: 10px; }
.map-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.mf-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.mf-icon svg { width: 26px; height: 26px; }
.mf-main { display: grid; gap: 4px; min-width: 0; }
.mf-main h3 { font-size: 18px; overflow-wrap: anywhere; }
.mf-desc { font-size: 14px; white-space: pre-wrap; }
.mf-by { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.mf-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 620px) { .map-file { grid-template-columns: auto minmax(0, 1fr); } .mf-actions { grid-column: 1 / -1; justify-content: flex-start; } }
.howto summary { cursor: pointer; }
.howto-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 12px 0; }
.howto h4 { margin: 0 0 6px; font-size: 15px; }
.howto ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.map-dir { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.map-dir:hover { border-color: var(--accent); }
.map-dir .mf-actions { color: var(--muted); font-size: 14px; align-self: center; }
.map-file.not-map { opacity: .8; }
.yd-crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); }
.upload-progress { margin-top: 8px; height: 22px; border-radius: 6px; background: var(--surface-2); position: relative; overflow: hidden; }
.upload-progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.upload-progress span { position: absolute; inset: 0; display: grid; place-items: center; font: 500 12px var(--f-mono); color: var(--ink); }

/* ---------- Сложность выезда ---------- */
.diff { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.diff-bars { display: inline-flex; gap: 2px; align-items: flex-end; }
.diff-bars i { width: 5px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 35%, transparent); }
.diff-bars i:nth-child(1) { height: 7px; } .diff-bars i:nth-child(2) { height: 10px; } .diff-bars i:nth-child(3) { height: 13px; }
.diff-bars i.on { background: var(--c); }
.next-event .diff { color: inherit; font-size: 13px; }
.fact-wide { grid-column: 1 / -1; }
.diff-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.diff-pick button { display: grid; gap: 3px; justify-items: start; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.diff-pick button small { color: var(--muted); font-size: 12px; }
.diff-pick button[aria-checked="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
@media (max-width: 560px) { .diff-pick { grid-template-columns: 1fr; } }
.pass-row { display: flex; gap: 6px; align-items: center; }
.pass-row input { flex: 1; min-width: 0; }

/* ---------- Админ ---------- */
.nav a[hidden] { display: none; }
.tabs a { font: 600 14px var(--f-body); color: var(--muted); padding: 8px 14px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.tabs a[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.adm-tabs { max-width: 100%; overflow-x: auto; margin: 4px 0 10px; }
.adm-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th, .adm-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.adm-table th { font-weight: 600; color: var(--muted); font-size: 13px; white-space: nowrap; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table td.num, .adm-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-table .nowrap { white-space: nowrap; }
.adm-table .ride-who { white-space: nowrap; }
.adm-act { white-space: nowrap; text-align: right !important; }
.adm-act .btn { margin-left: 2px; }
.adm-text { min-width: 220px; overflow-wrap: anywhere; }
.adm-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; vertical-align: middle; }
.adm-badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent); border-radius: 5px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.danger-ico:hover { color: var(--accent); }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.adm-media { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.adm-media img, .adm-media video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.adm-media figcaption { padding: 6px 8px; display: grid; gap: 4px; font-size: 13px; }
.adm-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-mrow { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.adm-mrow .ride-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
  .adm-scroll { border: 0; background: none; overflow: visible; }
  .adm-table thead { display: none; }
  .adm-table, .adm-table tbody { display: block; }
  .adm-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
  .adm-table td { border: 0 !important; padding: 0; }
  .adm-table td:first-child { width: 100%; font-size: 15px; }
  .adm-table td.num { text-align: left; color: var(--muted); }
  .adm-table td[data-l]::before { content: attr(data-l) " "; color: var(--muted); }
  .adm-table td.num[data-l]::before { content: ""; }
  .adm-table td.num[data-l]::after { content: " " attr(data-l); }
  .adm-text { min-width: 0; width: 100%; }
  .adm-act { width: 100%; text-align: left !important; white-space: normal; display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px !important; }
  .adm-act .btn { margin: 0; }
}

/* ---------- Реакции в чате ---------- */
.reacts { display: flex; flex-wrap: wrap; gap: 4px; }
.reacts:empty { display: none; }
.react-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: 600 12px var(--f-body); line-height: 1; }
.react-chip .re { font-size: 15px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.react-chip .rc { font-variant-numeric: tabular-nums; }
.react-chip:hover { border-color: var(--muted); }
.react-chip.mine { border-color: var(--accent); background: var(--accent-soft); }
.react-chip:focus-visible, .react-pop button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.react-pop { position: absolute; z-index: 60; display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow), 0 8px 24px rgba(0,0,0,.18); }
.react-pop[hidden] { display: none; }
.react-pop button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 22px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; transition: transform .12s ease, background .12s ease; }
.react-pop button:hover { transform: scale(1.18); background: var(--surface-2); }
.react-pop button.on { background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { .react-pop button { transition: none; } .react-pop button:hover { transform: none; } }
.store-badge.apple img { border-radius: 8px; }

/* ---------- Карты: превью и описание ---------- */
.mf-thumb { width: 88px; height: 88px; border-radius: 12px; overflow: hidden; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.mf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mf-thumb-empty svg { width: 34px; height: 34px; }
.mf-thumb.big { width: 120px; height: 120px; }
.map-file.has-thumb { align-items: start; }
.map-file .mf-desc { margin: 2px 0 0; color: var(--ink); line-height: 1.45; }
.mn-prev { display: flex; gap: 14px; align-items: flex-start; }
.mn-prev-ctl { display: grid; gap: 6px; min-width: 0; }
.mn-prev-ctl small { color: var(--muted); }
.mn-prev-ctl .btn { justify-self: start; }
.adm-maps { display: grid; gap: 10px; }
@media (max-width: 620px) {
  .mf-thumb { width: 64px; height: 64px; border-radius: 10px; }
  .mn-prev { flex-direction: column; }
}
.app-icon-img { object-fit: cover; background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.12); }
/* превью карты: щелчок — на весь экран */
.mf-thumb-btn { position: relative; padding: 0; border: 0; cursor: zoom-in; }
.mf-thumb-btn .mf-zoom { position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; opacity: .85; transition: opacity .15s ease; }
.mf-thumb-btn .mf-zoom svg { width: 14px; height: 14px; }
.mf-thumb-btn:hover .mf-zoom, .mf-thumb-btn:focus-visible .mf-zoom { opacity: 1; }
.mf-thumb-btn:hover img { filter: brightness(1.06); }
.mf-thumb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox .lb-info b { margin-right: 6px; font-weight: 700; }
.lightbox .lb-cap { white-space: pre-wrap; max-height: 40vh; overflow-y: auto; }
.lightbox .btn.primary { --b: var(--accent); --c: #fff; border-color: transparent; }
.lightbox .btn.primary:hover { --b: var(--accent); filter: brightness(1.1); }
/* админка: выбор и передача поездок */
.adm-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 0 0 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.adm-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.adm-field select { font: 15px var(--f-body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; max-width: 240px; }
.adm-sel-count { font-weight: 600; font-size: 14px; padding-bottom: 8px; margin-left: auto; }
.adm-chk { width: 34px; text-align: center !important; }
.adm-chk input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.adm-table tr.picked td { background: var(--accent-soft); }
@media (max-width: 700px) {
  .adm-tools { display: grid; grid-template-columns: 1fr; }
  .adm-field select { max-width: none; width: 100%; }
  .adm-sel-count { margin-left: 0; padding: 0; }
  .adm-table td.adm-chk { width: auto; order: -1; }
  .adm-table td.adm-chk + td { width: auto; flex: 1; font-size: 15px; }
  .adm-table tr:has(td.adm-chk) td:nth-child(2) { width: auto; }
  .adm-table tr.picked { background: var(--accent-soft); border-color: var(--accent); }
}
.owner-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.owner-pick b { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 560px) { .owner-pick { grid-template-columns: 1fr; } }
.adm-badge.grp { background: var(--ink); color: var(--surface); }
@media (min-width: 701px) { .adm-act { white-space: normal; min-width: 260px; } .adm-act .btn { margin: 2px; } }
/* подсказка про формат видео iPhone */
.ios-tip { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; }
.ios-tip[hidden] { display: none; }
.ios-tip p, .ios-tip ol { margin: 0; }
.ios-tip ol { padding-left: 20px; display: grid; gap: 2px; }
.ios-tip .muted { font-size: 13px; }
/* админка: место на сервере */
.disk-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; margin: 0 0 12px; }
.disk-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; font-size: 14px; }
.disk-head > span { color: var(--muted); }
.disk-free { color: var(--ink); }
.disk-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.disk-bar span { height: 100%; }
.disk-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.disk-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.s-media { background: #2f9e44; } .s-back { background: #1c7ed6; } .s-db { background: #f08c00; } .s-other { background: #868e96; }
.disk-panel.warn { border-color: #f08c00; } .disk-panel.warn .disk-free { color: #e67700; }
.disk-panel.bad { border-color: var(--accent); background: var(--accent-soft); } .disk-panel.bad .disk-free { color: var(--accent); }
.disk-warn { margin: 0; font-size: 13px; }
/* Telegram: вкладка админки */
.tg-admin { display: grid; gap: 8px; margin-bottom: 12px; }
.tg-admin p { margin: 0; }
.tg-admin-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tg-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.tg-token { display: flex; gap: 8px; flex-wrap: wrap; }
.tg-token[hidden] { display: none; }
.tg-token input { flex: 1; min-width: 220px; font: 15px var(--f-mono, monospace); background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.tg-group { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.tg-group.on b { color: var(--ok, #2f9e44); }
.tg-gcmd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tg-gcmd[hidden] { display: none; }
.tg-gcmd code { font: 600 15px var(--f-mono, monospace); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; user-select: all; overflow-wrap: anywhere; }
.tg-steps .btn { margin-right: 4px; }
.adm-sub { font-size: 18px; margin: 18px 0 8px; }
.legend .ev-date { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; margin-top: 1px; }
.ride-shared { display: inline-block; font: 600 11px var(--f-body); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 6px; vertical-align: 2px; }
.adm-credit { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adm-tools-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
@media (max-width: 700px) { .adm-tools-sep { width: auto; height: 1px; margin: 4px 0; } }
/* участники общего трека */
.part-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.part-chip { display: inline-flex; align-items: center; gap: 6px; font: 500 14px var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; }
.part-chip[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--c); }
.part-chip[aria-pressed="true"]::after { content: "✓"; font-weight: 700; color: var(--c); margin-left: 2px; }
.part-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.adm-btns { display: inline-flex; gap: 6px; flex-wrap: nowrap; }

/* ---------- Изолинии на плашках (как горизонтали на главной) ---------- */
:root { --iso-op: .16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --iso-op: .26; } }
:root[data-theme="dark"] { --iso-op: .26; }
.panel, .tag-card, .event-card, .app-card, .map-file, .disk-panel, .adm-tools, .chat {
  position: relative; isolation: isolate;
}
.panel::after, .tag-card::after, .event-card::after, .app-card::after, .map-file::after, .disk-panel::after, .adm-tools::after, .chat::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: var(--accent); opacity: var(--iso-op);
  -webkit-mask: url("../img/isolines.svg") var(--iso-pos, 0 0) / 960px 640px repeat;
          mask: url("../img/isolines.svg") var(--iso-pos, 0 0) / 960px 640px repeat;
}
/* соседние плашки — разные участки «карты» */
:is(.panel, .tag-card, .event-card, .app-card, .map-file):nth-child(3n+2) { --iso-pos: -310px -170px; }
:is(.panel, .tag-card, .event-card, .app-card, .map-file):nth-child(3n) { --iso-pos: -620px -400px; }
:is(.panel, .tag-card, .event-card, .app-card, .map-file):nth-child(4n+3) { --iso-pos: -150px -455px; }
/* в чате и в списке легенды карты линии тише, чтобы не мешать читать */
.chat::after, .legend::after { opacity: calc(var(--iso-op) * .6); }
@media print { .panel::after, .tag-card::after, .event-card::after, .app-card::after, .map-file::after, .chat::after { display: none; } }
/* чат: кто прочитал */
.msg-seen { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0 5px; height: 18px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 500 11px var(--f-mono); cursor: pointer; vertical-align: 1px; }
.msg-seen[hidden] { display: none; }
.msg-seen:hover, .msg-seen:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }
.msg-seen.all { color: var(--accent); }
.seen-pop { position: absolute; z-index: 60; min-width: 160px; max-width: 260px; max-height: 280px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow), 0 8px 24px rgba(0,0,0,.2); padding: 6px; display: grid; gap: 2px; }
.seen-pop[hidden] { display: none; }
.seen-pop .seen-title { font-size: 12px; color: var(--muted); padding: 4px 6px; }
.seen-pop a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14px; }
.seen-pop a:hover { background: var(--surface-2); }
.seen-pop .seen-guests { display: flex; align-items: center; gap: 8px; padding: 6px; margin-top: 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.seen-pop .seen-guest-ico { width: 20px; text-align: center; }
/* подвал: копирайт студии с контактами */
.footer-studio { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.footer-studio a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.footer-studio a:hover, .footer-studio a:focus-visible { color: var(--accent); }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; }
.footer-logo { flex-shrink: 0; }
.footer-studio a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Оформление текста: панель, предпросмотр, вывод ---------- */
.field > label:first-child { font-size: 13px; font-weight: 600; }
.fx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fx-btn { min-width: 34px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; font: 600 15px/1 var(--f-body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.fx-btn sup { font-size: 10px; margin-left: 1px; }
.fx-btn i { font-family: Georgia, serif; font-size: 16px; }
.fx-btn:hover { border-color: var(--accent); color: var(--accent); }
.fx-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fx-link { display: flex; flex: 1 1 260px; gap: 6px; align-items: center; min-width: 0; }
.fx-link[hidden] { display: none; }
.fx-link input { flex: 1; min-width: 0; height: 32px; padding: 4px 8px; }
.fx-preview { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); max-height: 220px; overflow: auto; }
.fx-preview[hidden] { display: none; }
.fx-preview-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.fx-preview-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form .fx-bar, .chat-form .fx-preview { grid-column: 1 / -1; }
.chat-form .fx-btn { min-width: 30px; height: 28px; font-size: 14px; }
.rich a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.rich a.mention { color: var(--c, var(--accent)); text-decoration: none; }
.fx-s1 { font-size: .75em; }
.fx-s2 { font-size: .875em; }
.fx-s4 { font-size: 1.25em; line-height: 1.35; }
.fx-s5 { font-size: 1.6em; line-height: 1.25; }
#ef-desc { min-height: 150px; }

/* ---------- Проходимость маршрута ---------- */
.tl-legend { background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 12px; display: grid; gap: 5px; box-shadow: var(--shadow); min-width: 150px; }
.tl-toggle { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.tl-toggle input { width: auto; margin: 0; accent-color: var(--accent); }
.tl-legend.off .tl-body { display: none; }
.tl-scale { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.tl-grad { flex: 1; min-width: 60px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgb(47,158,68), rgb(240,180,0), rgb(217,54,28)); }
.tl-na { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.tl-na i { width: 26px; height: 0; border-top: 3px dashed #aab1ba; }

.terrain { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.terrain-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.terrain-bar i { flex-basis: 0; min-width: 3px; background: var(--c); }
.terrain-bar i.tb-unknown, .terrain-list i.tb-unknown { background: repeating-linear-gradient(135deg, var(--c) 0 4px, transparent 4px 8px); }
.terrain-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 22px; }
.terrain-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 14px; }
.terrain-list li i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.terrain-list small { color: var(--muted); min-width: 3ch; text-align: right; }
.terrain-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.terrain-warn { color: var(--danger); font-weight: 600; }
.terrain-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.terrain-note { margin: 0; font-size: 12px; color: var(--muted); }

/* ---- мост чата с группой Telegram ---- */
.tg-ico { display: inline-block; vertical-align: -2px; }
.msg-head .msg-name { font-weight: 700; color: var(--c, var(--ink)); }
.msg-src { color: #229ed9; display: inline-flex; align-items: center; }
.msg-video { display: block; border-radius: 10px; max-height: 320px; max-width: 100%; background: #000; margin-top: 4px; }
.chat-bridge { display: flex; gap: 6px; align-items: center; }
.chat-bridge .tg-ico { color: #229ed9; flex: none; }
.tg-bridge { display: grid; gap: 10px; margin-bottom: 12px; }
.tg-bridge p { margin: 0; }
.tg-switch { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.tg-switch input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.tg-warn { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #e8a317 18%, transparent); border: 1px solid color-mix(in srgb, #e8a317 55%, transparent); }
.tg-people select { min-width: 160px; max-width: 100%; }
.tg-people tr.linked td:first-child b { color: var(--ok, #2f9e44); }
.tg-free { margin-top: 8px; }
.msg-in-gallery { display: inline-block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.tc-meta .msg-src { margin-left: 3px; vertical-align: -1px; }

/* ---------- Мастер-ломастер ---------- */
.tip-filters { display: grid; gap: 12px; margin-bottom: 18px; }
.tip-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.tip-chip { font: 600 13px var(--f-body); color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.tip-chip:hover { color: var(--ink); border-color: var(--muted); }
.tip-chip[aria-pressed="true"], .tip-chip[aria-checked="true"] { color: var(--accent-ink, #fff); background: var(--accent); border-color: var(--accent); }
.tip-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tip-tools input[type="search"] { width: 280px; max-width: 100%; }
.tip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; align-items: start; }
.tip-card { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.tip-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; text-decoration: none; }
.tip-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; transition: transform .3s ease; }
.tip-thumb:hover img { transform: scale(1.03); }
.tip-ph { color: var(--muted); font: 500 13px var(--f-mono); padding: 0 12px; text-align: center; overflow-wrap: anywhere; }
.tip-play { position: absolute; z-index: 2; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 88%, transparent); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.35); transition: transform .2s ease; }
.tip-play svg { width: 24px; height: 24px; margin-left: 3px; }
.tip-thumb:hover .tip-play { transform: scale(1.08); }
.tip-ext { position: absolute; z-index: 2; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; }
.tip-body { display: grid; gap: 8px; padding: 12px 14px 12px; }
.tip-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.tip-cat { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.tip-body h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.tip-body h3 a { color: var(--ink); text-decoration: none; }
.tip-body h3 a:hover { color: var(--accent); }
.tip-note { font-size: 14px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5em; overflow: hidden; }
.tip-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); }
.tip-own { margin-left: auto; display: flex; gap: 2px; }
.tip-player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.tip-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tip-prev { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.tip-prev[hidden] { display: none; }
.tip-prev img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.tip-prev div { display: grid; gap: 2px; }
.tip-prev b { display: inline-flex; align-items: center; gap: 6px; }
.tip-prev b svg { width: 14px; height: 14px; color: var(--accent); }
.tip-prev small { color: var(--muted); overflow-wrap: anywhere; }
.tip-prev.loading-prev { opacity: .6; }
@media (max-width: 560px) { .tip-tools input[type="search"] { width: 100%; } .tip-prev img { width: 88px; } }
.tip-body h3 { font-family: var(--f-body); font-weight: 700; }
.tip-thumb.is-video .tip-ph, .tip-thumb .tip-ph { position: absolute; left: 0; right: 0; bottom: 10px; font-size: 12px; }
.tip-thumb:not(.is-video) .tip-ph { position: static; font-size: 13px; }
.tip-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.tip-count { position: absolute; z-index: 2; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; font: 600 12px var(--f-body); }
.tip-count svg { width: 13px; height: 13px; }
.tip-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.tip-mini { position: relative; width: 52px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--muted); font: 600 13px var(--f-body); }
.tip-mini img, .tip-mini video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tip-mini.vid svg { position: relative; z-index: 1; width: 20px; height: 20px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tip-mini:hover, .tip-mini:focus-visible { border-color: var(--accent); outline: none; }
.tip-files { display: grid; gap: 6px; }
.tip-files:empty { display: none; }
.tip-file { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 4px; }
.tip-file img, .tip-file .tf-ico { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.tip-file .tf-ico svg { width: 18px; height: 18px; }
.tip-file .tf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.tip-file.gone { opacity: .45; }
.tip-file.gone .tf-name { text-decoration: line-through; }
.tip-file.new { border-style: dashed; }
.tip-pick { justify-self: start; cursor: pointer; }
.tip-pick svg { width: 15px; height: 15px; }
