:root {
  color-scheme: light;
  /* Палитра в духе Google Карт: белые поверхности, синий акцент, мягкие тени */
  --bg: #e8eaed;
  --panel: #ffffff;
  --surface: #f1f3f4;
  --surface-2: #e8eaed;
  --line: #dadce0;
  --line-soft: #e8eaed;
  --text: #202124;
  --muted: #5f6368;
  --faint: #80868b;
  --accent: #1a73e8;
  --accent-2: #1967d2;
  --accent-soft: #e8f0fe;
  /* Типы */
  --vuz: #d93025;                        /* красный */
  --college: #188038;                    /* зелёный */
  --unicollege: #e37400;                 /* оранжевый */
  --ok: #188038;
  --bad: #d93025;
  --map-bg: #f5f3ef;
  --shade: 60, 64, 67;
  --panel-w: 408px;
  --chip-shadow: 0 1px 2px rgba(var(--shade), 0.3), 0 1px 3px 1px rgba(var(--shade), 0.15);
  --shadow: 0 1px 2px rgba(var(--shade), 0.3), 0 2px 6px 2px rgba(var(--shade), 0.15);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --card: #ffffff;
  --hover: #f8f9fa;
  --soft-vuz: #fce8e6;
  --soft-college: #e6f4ea;
  --soft-unicollege: #fef0e1;
  --tiles-filter: saturate(0.55) contrast(0.95) brightness(1.03);
}

/* ───── Тёмная тема: выбранная вручную или системная ───── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f2124; --panel: #202124; --surface: #2a2c2f; --surface-2: #303134;
  --line: #3c4043; --line-soft: #303134; --text: #e8eaed; --muted: #bdc1c6; --faint: #9aa0a6;
  --accent: #8ab4f8; --accent-2: #aecbfa; --accent-soft: rgba(138, 180, 248, 0.16);
  --vuz: #f28b82; --college: #81c995; --unicollege: #fcad70; --ok: #81c995; --bad: #f28b82;
  --map-bg: #1c1d1f; --shade: 0, 0, 0; --card: #2a2c2f; --hover: #35373a;
  --soft-vuz: rgba(242, 139, 130, 0.16); --soft-college: rgba(129, 201, 149, 0.16); --soft-unicollege: rgba(252, 173, 112, 0.16);
  --tiles-filter: invert(1) hue-rotate(180deg) saturate(0.45) brightness(0.88) contrast(0.92);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1f2124; --panel: #202124; --surface: #2a2c2f; --surface-2: #303134;
    --line: #3c4043; --line-soft: #303134; --text: #e8eaed; --muted: #bdc1c6; --faint: #9aa0a6;
    --accent: #8ab4f8; --accent-2: #aecbfa; --accent-soft: rgba(138, 180, 248, 0.16);
    --vuz: #f28b82; --college: #81c995; --unicollege: #fcad70; --ok: #81c995; --bad: #f28b82;
    --map-bg: #1c1d1f; --shade: 0, 0, 0; --card: #2a2c2f; --hover: #35373a;
    --soft-vuz: rgba(242, 139, 130, 0.16); --soft-college: rgba(129, 201, 149, 0.16); --soft-unicollege: rgba(252, 173, 112, 0.16);
    --tiles-filter: invert(1) hue-rotate(180deg) saturate(0.45) brightness(0.88) contrast(0.92);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body { font: 400 14px/1.45 var(--font); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───── Карта ───── */
#map { position: absolute; inset: 0; }
.leaflet-container { font-family: var(--font); background: var(--map-bg); }
.base-tiles { filter: var(--tiles-filter); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--card) 80%, transparent) !important; color: var(--muted); font-size: 10.5px; }
.leaflet-bottom.leaflet-right { right: var(--panel-w); transition: right .3s cubic-bezier(.4, 0, .2, 1); }

/* ───── Боковая панель (справа, на всю высоту) ───── */
.panel {
  position: absolute; z-index: 1001; top: 0; right: 0; bottom: 0; width: var(--panel-w);
  background: var(--panel); box-shadow: 0 0 20px rgba(0, 0, 0, 0.18);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.panel-grip { display: none; }
.panel-top { padding: 12px 16px; flex: none; }

.search {
  display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 6px 0 6px;
  border-radius: 24px; background: var(--card); color: var(--muted); box-shadow: var(--chip-shadow);
  transition: box-shadow .2s;
}
.search:focus-within { box-shadow: 0 1px 3px rgba(var(--shade), 0.3), 0 4px 8px 3px rgba(var(--shade), 0.15); }
.brand-mark {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0 8px;
  font: 500 15px var(--font); color: var(--text);
}
.search input::placeholder { color: var(--faint); font-weight: 400; }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { width: 36px; display: grid; place-items: center; color: var(--muted); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface); }

.view { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow-y: auto; position: relative; }
.view::-webkit-scrollbar { width: 8px; }
.view::-webkit-scrollbar-thumb { background: #c4c7c9; border-radius: 4px; border: 2px solid var(--card); }

/* Заголовок списка */
.list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 20px 12px; border-bottom: 1px solid var(--line);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.list-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
#sort {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 8px;
  font: 600 12.5px var(--font); color: var(--text); cursor: pointer;
}

/* Список результатов */
.results { list-style: none; margin: 0; padding: 0; }
.result {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .15s;
}
.result:hover, .result.hl { background: var(--hover); }
.result .r-body { min-width: 0; flex: 1; }
.result .r-title { font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.result .r-meta { font-size: 13px; margin-top: 3px; color: var(--muted); }
.result .r-meta .t { color: var(--c); font-weight: 600; }
.result .r-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.result .r-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.result .r-icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--soft); color: var(--c);
}
.result.vuz, .r-icon.vuz { --c: var(--vuz); --soft: var(--soft-vuz); }
.result.college, .r-icon.college { --c: var(--college); --soft: var(--soft-college); }
.result.unicollege, .r-icon.unicollege { --c: var(--unicollege); --soft: var(--soft-unicollege); }
.tag {
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
}
.empty { padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.disclaimer { margin: 16px 20px 24px; font-size: 12px; color: var(--faint); line-height: 1.5; }
.disclaimer a { color: var(--accent); }

/* ───── Блок фильтров в панели (под поиском) ───── */
.chipbar { flex: none; padding: 4px 20px 14px; border-bottom: 1px solid var(--line); }
#panel:has(#view-card:not([hidden])) .chipbar { display: none; } /* в карточке фильтры прячем */
.f-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.f-head span { font-weight: 700; font-size: 15px; }
.link-btn { color: var(--accent); font-weight: 600; font-size: 13px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.f-row { margin-top: 10px; }
.f-row-2 { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 18px; }
.f-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.chip-group, .chip-line { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 8px; background: var(--card); color: var(--text); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--hover); }
.chip.active, .chip-check:has(input:checked), .chip-drop.has-value {
  background: var(--accent-soft); color: var(--accent-2); border-color: transparent;
}
.chip .cnt { font-size: 12px; color: var(--faint); font-weight: 500; }
.chip.active .cnt, .chip-drop.has-value .cnt { color: var(--accent-2); }
.chip-check input { display: none; }
.chip-check .check { display: none; margin-left: -4px; }
.chip-check:has(input:checked) .check { display: block; }
.chip-drop svg { margin-right: -6px; }
.chip-drop[aria-expanded="true"] svg { transform: rotate(180deg); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--c); }
.dot.vuz { --c: var(--vuz); }
.dot.college { --c: var(--college); }
.dot.unicollege { --c: var(--unicollege); }

/* Выпадающее окно направлений */
.popover {
  position: absolute; z-index: 1100; top: 56px; width: 300px; max-height: calc(100vh - 80px); overflow-y: auto;
  background: var(--card); border-radius: 12px; box-shadow: 0 4px 8px 3px rgba(var(--shade), 0.15), 0 1px 3px rgba(var(--shade), 0.3);
  padding: 8px 0;
}
.popover-head { padding: 10px 16px 8px; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.hint { font-size: 12px; font-weight: 500; color: var(--faint); }
.popover-list { display: flex; flex-direction: column; }
.dir-opt {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; text-align: left; font-size: 14px; font-weight: 500;
}
.dir-opt:hover { background: var(--surface); }
.dir-opt .box {
  width: 18px; height: 18px; border-radius: 3px; border: 2px solid var(--muted); flex: none;
  display: grid; place-items: center; color: #fff;
}
.dir-opt.active .box { background: var(--accent); border-color: var(--accent); }
.dir-opt .box svg { display: none; }
.dir-opt.active .box svg { display: block; }

/* ───── Язычок сворачивания панели ───── */
.panel-tab {
  position: absolute; z-index: 1002; top: 50%; right: var(--panel-w); margin-top: -24px;
  width: 23px; height: 48px; border-radius: 8px 0 0 8px; background: var(--card); color: var(--muted);
  box-shadow: 0 1px 2px rgba(var(--shade), 0.3), -2px 1px 4px rgba(var(--shade), 0.15);
  display: grid; place-items: center; transition: right .3s cubic-bezier(.4, 0, .2, 1);
}
.panel-tab:hover { color: var(--text); }
.panel-tab svg { transition: transform .3s; }
.panel-collapsed .panel { transform: translateX(100%); }
.panel-collapsed .panel-tab { right: 0; }
.panel-collapsed .panel-tab svg { transform: rotate(180deg); }
.panel-collapsed .map-controls { right: 36px; }
.panel-collapsed .leaflet-bottom.leaflet-right { right: 0; }

/* ───── Легенда ───── */
.legend-card {
  position: absolute; z-index: 1000; left: 12px; bottom: 24px;
  background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted);
}
.legend-row { display: flex; gap: 12px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.zone { width: 16px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.zone.msk { background: rgba(26, 115, 232, 0.12); border: 2px solid var(--accent); }
.zone.mo { border: 2px dashed var(--accent); opacity: 0.8; }

/* ───── Кнопки карты (справа внизу, как у Google) ───── */
.map-controls {
  position: absolute; z-index: 1000; right: calc(var(--panel-w) + 36px); bottom: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: right .3s cubic-bezier(.4, 0, .2, 1);
}
.ctrl-stack { display: flex; flex-direction: column; background: var(--card); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.ctrl-btn { width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); background: var(--card); }
.ctrl-btn.single { border-radius: 8px; box-shadow: var(--shadow); }
.ctrl-stack .ctrl-btn + .ctrl-btn { border-top: 1px solid var(--line-soft); }
.ctrl-btn:hover { color: var(--text); background: var(--hover); }

/* ───── Карточка заведения ───── */
.back-btn {
  position: absolute; z-index: 2; top: 12px; left: 12px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--card); color: var(--text); display: grid; place-items: center; box-shadow: var(--chip-shadow);
}
.back-btn:hover { background: var(--hover); }
.card-hero {
  position: relative; height: 150px; overflow: hidden; flex: none; background: var(--c);
  background-image: radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.35), transparent 45%),
                    linear-gradient(160deg, transparent 40%, rgba(0, 0, 0, 0.28));
}
.card-hero.vuz { --c: var(--vuz); }
.card-hero.college { --c: var(--college); }
.card-hero.unicollege { --c: var(--unicollege); }
.card-hero svg { position: absolute; right: 18px; bottom: -18px; width: 140px; height: 140px; color: rgba(255, 255, 255, 0.22); }
.card-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-hero.has-photo { height: 200px; }
.card-hero.has-photo svg { display: none; }
.card-hero.has-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 35%); pointer-events: none; }
.photo-credit {
  position: absolute; z-index: 1; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 10.5px; text-decoration: none;
}
.photo-credit:hover { background: rgba(0, 0, 0, 0.7); }
.card-body { padding: 18px 24px 8px; }
.card-body.no-hero { padding-top: 64px; } /* без фото — место под кнопку «Назад» */
.card-title { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.25; }
.card-full { color: var(--muted); margin: 0 0 6px; font-size: 13.5px; }
.card-meta { font-size: 13.5px; color: var(--muted); }
.card-meta .t { color: var(--c); font-weight: 700; }
.card-meta.vuz { --c: var(--vuz); }
.card-meta.college { --c: var(--college); }
.card-meta.unicollege { --c: var(--unicollege); }

.card-actions {
  display: flex; justify-content: space-around; gap: 4px; padding: 14px 16px 16px;
  border-bottom: 1px solid var(--line);
}
.act { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--accent); font-size: 12.5px; font-weight: 600; min-width: 72px; }
.act .ic {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--accent); background: var(--card); transition: background .15s;
}
.act:hover .ic { background: var(--accent-soft); }
.act.primary .ic { background: var(--accent); border-color: var(--accent); color: #fff; }
.act.primary:hover .ic { background: var(--accent-2); }

.info { list-style: none; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
.info li { display: flex; gap: 20px; align-items: flex-start; padding: 10px 24px; font-size: 14px; }
.info svg { flex: none; width: 22px; height: 22px; color: var(--accent); margin-top: -1px; }
.info .k { color: var(--muted); }
.info .note { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.info button.row { width: 100%; text-align: left; }
.info button.row:hover { background: var(--hover); }
.info .row b { font-weight: 700; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--bad); font-weight: 700; }
.nodata { color: var(--faint); }

.card-dirs { padding: 16px 24px 28px; }
.card-dirs h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.card-dirs .tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ───── Метки ───── */
.mk { position: relative; width: 30px; height: 30px; }
.mk-core {
  position: absolute; inset: 0; border-radius: 50%; background: var(--c); color: #fff;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  display: grid; place-items: center; transition: transform .2s;
}
.mk.vuz { --c: var(--vuz); }
.mk.college { --c: var(--college); }
.mk.unicollege { --c: var(--unicollege); }
.leaflet-marker-icon:hover .mk-core { transform: scale(1.15); }
.mk.active .mk-core { transform: scale(1.4); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); }
.mk.active::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--c); animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

.cluster-wrap { background: none; }
.cl { width: 100%; height: 100%; border-radius: 50%; padding: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.cl-in {
  width: 100%; height: 100%; border-radius: 50%; background: var(--card); color: var(--text);
  display: grid; place-items: center; font: 700 13px var(--font);
}

/* Карточка при наведении на метку */
.leaflet-tooltip.hover-card {
  width: 260px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; white-space: normal;
  background: var(--card); color: var(--text); box-shadow: 0 4px 8px 3px rgba(var(--shade), 0.15), 0 1px 3px rgba(var(--shade), 0.3);
  font: 400 13px/1.4 var(--font);
}
.leaflet-tooltip.hover-card::before { display: none; }
.hc-photo { position: relative; height: 130px; background: var(--surface); }
.hc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hc-ph { position: absolute; inset: 0; display: none; place-items: center; color: #fff; background: var(--c);
  background-image: radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.35), transparent 50%); }
.hc-ph svg { opacity: 0.85; }
.hc-ph.show, .broken .hc-ph { display: grid; }
.broken img { display: none; }
.hc-ph.vuz { --c: var(--vuz); }
.hc-ph.college { --c: var(--college); }
.hc-ph.unicollege { --c: var(--unicollege); }
.hc-body { padding: 10px 14px 12px; }
.hc-title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.hc-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hc-meta .t { color: var(--c); font-weight: 700; }
.hc-meta.vuz { --c: var(--vuz); }
.hc-meta.college { --c: var(--college); }
.hc-meta.unicollege { --c: var(--unicollege); }
.hc-addr { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hc-facts { display: flex; gap: 12px; font-size: 12.5px; margin-top: 6px; }
.hc-hint { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-top: 8px; }

.leaflet-tooltip.pin-tip {
  background: var(--card); color: var(--text); border: 0; border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px 10px; font: 700 13px var(--font);
}
.leaflet-tooltip.pin-tip::before { display: none; }

.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(26, 115, 232, 0.2); }

/* ───── Телефон: шторка снизу, чипсы сверху ───── */
@media (max-width: 760px) {
  :root { --peek: 132px; }
  .panel-tab, .popover-head .hint { display: none; }
  .popover { left: 12px !important; right: 12px; width: auto; }
  .leaflet-bottom.leaflet-right { right: 0; }
  .map-controls { right: 12px; bottom: calc(var(--peek) + 16px); transition: opacity .2s; }
  .sheet-up .map-controls { opacity: 0; pointer-events: none; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 82vh;
    border-radius: 16px 16px 0 0; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(calc(100% - var(--peek))); transition: transform .3s ease;
  }
  .panel.half { transform: translateY(40%); }
  .panel.open { transform: translateY(0); }
  .panel-grip { display: block; flex: none; width: 100%; height: 20px; position: relative; }
  .panel-grip::after {
    content: ""; position: absolute; left: 50%; top: 8px; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: var(--line);
  }
  .panel-top { padding-top: 0; }
  .card-hero { height: 110px; }
  .brand-name { font-size: 14px; }
}

/* ───── Новое: избранное, «ещё фильтры», дом, сравнение, легенда ───── */
.r-side { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.star {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 19px; line-height: 1; color: var(--faint);
}
.star:hover { background: var(--surface); color: #f9ab00; }
.star.on { color: #f9ab00; }
.act .star-ic { font-size: 20px; color: #f9ab00; }
.act.fav-on .ic { background: rgba(249, 171, 0, 0.14); border-color: transparent; }
.tag.strong { color: var(--text); border-color: transparent; background: var(--surface); font-weight: 600; }
.dist { color: var(--accent-2); font-weight: 600; }

.more { margin-top: 10px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "▸"; transition: transform .2s; }
.more[open] summary::before { transform: rotate(90deg); }
.more summary .cnt { color: var(--accent-2); }
.home-line { display: flex; gap: 6px; }
.home-line input {
  flex: 1; min-width: 0; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px;
  background: var(--card); color: var(--text); font: 500 13px var(--font);
}
.home-line input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.home-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.home-state #home-label { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-state select, .legend-mode select, #sort {
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 5px 6px;
  font: 600 12.5px var(--font); cursor: pointer;
}
.hint-line { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.home-pin { font-size: 22px; line-height: 30px; text-align: center; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }

.list-tools { display: flex; align-items: center; gap: 6px; }
.compare-btn { height: 30px; background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.compare-btn .cnt { color: var(--accent-2); }

.legend-mode { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.legend-row { flex-wrap: wrap; }

.progs-h { margin-top: 18px !important; }
.progs-h .hint { font-weight: 500; }
.progs { margin: 0; padding: 0 0 0 18px; font-size: 13.5px; color: var(--text); columns: 1; }
.progs li { margin: 3px 0; }

.compare {
  width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px;
  background: var(--panel); color: var(--text); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.compare::backdrop { background: rgba(0, 0, 0, 0.45); }
.compare-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.compare-wrap { overflow: auto; max-height: calc(100vh - 120px); }
.compare table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.compare th, .compare td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; min-width: 150px; }
.compare tbody th { color: var(--muted); font-weight: 600; min-width: 120px; position: sticky; left: 0; background: var(--panel); }
.compare thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; font-size: 14px; }
.compare thead th .link-btn { font-size: 14px; color: var(--text); text-align: left; }
.compare a { color: var(--accent); }

/* Тёмная тема: детали, которые не берутся из переменных */
:root[data-theme="dark"] .view::-webkit-scrollbar-thumb { background: #5f6368; }
:root[data-theme="dark"] .cl-in { background: var(--card); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .view::-webkit-scrollbar-thumb { background: #5f6368; }
}

/* Телефон: доработки */
@media (max-width: 760px) {
  .chipbar { max-height: 46vh; overflow-y: auto; }
  .list-head { padding: 6px 16px 10px; }
  .list-tools { flex: none; }
  .card-actions { flex-wrap: wrap; justify-content: center; }
  .act { min-width: 64px; }
  .compare { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; }
  .compare-wrap { max-height: calc(100vh - 56px); }
  .compare th, .compare td { min-width: 130px; }
  .result { padding: 14px 16px; }
}

/* ───── Калькулятор ЕГЭ ───── */
.calc-cta {
  flex: none; margin: 0 16px 10px; padding: 10px 14px; border-radius: 14px; display: flex; align-items: center; gap: 12px; text-align: left;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 40%, var(--card))); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.calc-cta:hover { border-color: var(--accent); }
.calc-cta-ic { font-size: 24px; }
.calc-cta b { display: block; font-size: 14.5px; }
.calc-cta small { color: var(--muted); font-size: 12.5px; }
.calc-cta svg { margin-left: auto; color: var(--accent); }
#panel:has(#view-card:not([hidden])) .calc-cta,
#panel:has(#view-calc:not([hidden])) .calc-cta,
#panel:has(#view-calc:not([hidden])) .chipbar { display: none; }

.calc-head { display: flex; align-items: center; gap: 12px; padding: 4px 16px 12px; border-bottom: 1px solid var(--line); }
.back-btn.static { position: static; flex: none; }
.calc-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 14px 16px 6px; }
.calc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 10px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--muted); background: var(--card);
}
.calc-row.filled { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.calc-row input {
  width: 52px; height: 30px; border: 1px solid var(--line); border-radius: 8px; text-align: center;
  font: 700 14px var(--font); color: var(--text); background: var(--panel);
}
.calc-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.calc-opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 16px 12px; border-bottom: 1px solid var(--line); }
.calc-opts select { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 6px; font: 600 12.5px var(--font); }
.calc-empty { padding: 28px 20px; color: var(--muted); text-align: center; }
.calc-sec { border-bottom: 1px solid var(--line); }
.calc-sec summary { cursor: pointer; padding: 12px 16px; font-weight: 700; font-size: 14px; list-style: none; }
.calc-sec summary::-webkit-details-marker { display: none; }
.calc-sec summary .cnt { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.calc-sec ul { list-style: none; margin: 0; padding: 0 0 6px; }
.calc-item { padding: 10px 16px 10px 13px; border-left: 3px solid var(--c); cursor: pointer; }
.calc-item:hover { background: var(--hover); }
.calc-item.pass { --c: var(--ok); }
.calc-item.near { --c: #f9ab00; }
.calc-item.paid { --c: var(--line); }
.ci-vuz { font-weight: 700; font-size: 14px; }
.ci-prog { font-size: 13.5px; margin-top: 1px; }
.ci-lv { color: var(--faint); }
.ci-nums { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ci-ex { font-size: 11px; font-weight: 600; color: var(--unicollege); }
@media (max-width: 760px) {
  .calc-form { grid-template-columns: 1fr; }
  .calc-cta { margin: 0 12px 8px; }
}
.calc-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.calc-tab { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13.5px; text-align: left; }
.calc-tab small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.calc-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.calc-row.wide { grid-column: 1 / -1; }
.calc-row.wide input { width: 72px; }


/* ───── Телефон: быстрые кнопки, свёрнутые фильтры, компактная легенда ───── */
.m-bar { display: none; }
@media (max-width: 760px) {
  .panel { height: 88vh; height: 88dvh; padding-bottom: env(safe-area-inset-bottom); }
  .panel-grip { height: 22px; touch-action: none; cursor: grab; }
  .panel-top { touch-action: none; padding-bottom: 8px; }
  .m-bar { display: flex; gap: 6px; padding: 0 12px 10px; flex: none; touch-action: none; overflow-x: auto; scrollbar-width: none; }
  .m-bar::-webkit-scrollbar { display: none; }
  .m-pill {
    flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 8px; border-radius: 18px; border: 1px solid var(--line); background: var(--card);
    font: 700 13px var(--font); color: var(--text); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  }
  .m-pill .cnt { font-weight: 600; color: var(--faint); }
  .m-pill.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); }
  .m-pill.has-value, .m-filters-open #m-filters { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
  .m-pill.has-value .cnt { color: var(--accent-2); }
  /* большая кнопка калькулятора и фильтры — по кнопкам, чтобы список был виден */
  .calc-cta { display: none; }
  .chipbar { display: none; max-height: 52vh; }
  .m-filters-open .chipbar { display: block; }
  #panel:has(#view-card:not([hidden])) .m-bar, #panel:has(#view-calc:not([hidden])) .m-bar { display: none; }
  /* «+/−» не нужны: карту приближают пальцами */
  .map-controls .ctrl-stack { display: none; }
  .map-controls { gap: 8px; }
  /* компактная легенда сверху слева */
  .legend-card { left: 8px; top: 8px; bottom: auto; padding: 6px 8px; font-size: 11px; gap: 3px; max-width: calc(100vw - 16px); }
  .legend-card .legend-row:last-child { display: none; }
  .legend-mode { font-size: 11px; }
  .legend-mode select { padding: 2px 4px; font-size: 11px; }
  .sheet-up .legend-card { opacity: 0; pointer-events: none; }
  /* карточка: фото пониже, кнопки крупнее для пальца */
  .card-hero.has-photo { height: 150px; }
  .act .ic { width: 44px; height: 44px; }
  .star { width: 40px; height: 40px; }
  body .cookie-note { top: auto; bottom: calc(var(--peek) + 12px); }
}
