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

@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: #121010; --surface: #1b1817; --surface-2: #26211f; --ink: #efe9e5; --muted: #a39a94;
    --line: #332d2b; --contour: #2d2725; --accent: #ef4a41; --accent-ink: #1a0605; --accent-soft: #3a1715;
    --moss: #93b98a; --danger: #ff8a80; --ok: #7cc987;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121010; --surface: #1b1817; --surface-2: #26211f; --ink: #efe9e5; --muted: #a39a94;
    --line: #332d2b; --contour: #2d2725; --accent: #ef4a41; --accent-ink: #1a0605; --accent-soft: #3a1715;
    --moss: #93b98a; --danger: #ff8a80; --ok: #7cc987;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.7);
  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="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; }
.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-bottom: 6px; }
.strip a { text-decoration: none; display: grid; justify-items: center; 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; }
/* у Google Play и F-Droid в картинке есть прозрачные поля — компенсируем */
.store-badge.gplay img, .store-badge.fdroid img { height: 58px; margin: -9px -8px; }
.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; } }
