:root {
  --accent: #6d5dfc;
  --accent-2: #ff5da2;
  --grad: linear-gradient(135deg, #6d5dfc 0%, #b25cf6 50%, #ff5da2 100%);
  --text: #111322;
  --muted: #6b6f85;
  --line: rgba(17, 19, 34, .08);
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #ffffff;
  --chip: rgba(17, 19, 34, .05);
  --shadow: 0 20px 50px -12px rgba(30, 20, 80, .28), 0 2px 8px rgba(30, 20, 80, .08);
  --radius: 22px;
  --panel-w: 400px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #f3f3fa;
    --muted: #9a9db5;
    --line: rgba(255, 255, 255, .09);
    --surface: rgba(24, 24, 36, .74);
    --surface-solid: #1b1b28;
    --chip: rgba(255, 255, 255, .07);
    --shadow: 0 20px 50px -12px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #dfe3ea;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* Космос рисуется на холсте #space (space.js), карта над ним — прозрачная */
#space { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #05070f; }
#map { position: fixed; inset: 0; background: transparent; }
/* Падающие звёзды и метеориты — между небом и картой (планета закрывает их) */
#meteors { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-attrib { font-size: 10px; background: var(--surface) !important; color: var(--muted); backdrop-filter: blur(10px); }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-bottom-right { margin: 0 4px 4px 0; }
/* Масштаб карты (нажатие — км ↔ мили) */
.maplibregl-ctrl-scale {
  background: var(--surface) !important; color: var(--text) !important; border-color: var(--text) !important;
  backdrop-filter: blur(10px); font: 600 11px/1.6 Inter, system-ui, sans-serif !important; border-radius: 0 0 4px 4px;
  margin: 0 8px 6px 0 !important; transition: background .15s; user-select: none;
}
.maplibregl-ctrl-scale:hover { background: var(--surface-solid) !important; }
@media (max-width: 720px) { .maplibregl-ctrl-bottom-right { display: none; } }
.maplibregl-marker { will-change: transform; }
/* Метки появляются только когда карта загрузилась */
body:not(.map-ready) .maplibregl-marker { visibility: hidden; }

.glass {
  background: var(--surface);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- Панель ---------- */
.panel {
  position: fixed; z-index: 500;
  top: 16px; left: 16px; bottom: 16px;
  width: var(--panel-w);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: height .35s cubic-bezier(.2, .8, .2, 1);
}
.sheet-handle { display: none; }
.panel-top { display: flex; gap: 10px; padding: 14px 14px 8px; align-items: center; }
.search { position: relative; flex: 1; display: flex; align-items: center; gap: 8px; background: var(--chip); border-radius: 14px; padding: 0 12px; height: 42px; color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; height: 100%; min-width: 0; color: var(--text); }
.search-results {
  position: absolute; top: 48px; left: 0; right: 0; z-index: 10;
  background: var(--surface-solid); border-radius: 14px; box-shadow: var(--shadow);
  border: 1px solid var(--line); overflow: hidden; color: var(--text);
}
.search-results button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; }
.search-results button:hover { background: var(--chip); }
.search-results .sr-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); flex: none; }
.search-results .sr-photo { overflow: hidden; padding: 0; }
.search-results .sr-photo img { width: 100%; height: 100%; object-fit: cover; }
.search-results small { color: var(--muted); display: block; font-size: 12px; }
.search-results .empty { padding: 12px; color: var(--muted); }

.avatar-btn { flex: none; border-radius: 50%; transition: transform .15s; }
.avatar-btn:hover { transform: scale(1.06); }

.av {
  display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 22px; line-height: 1;
  background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5);
}
.av.xs { width: 22px; height: 22px; font-size: 12px; }
.av.sm { width: 34px; height: 34px; font-size: 17px; }
.av.lg { width: 96px; height: 96px; font-size: 50px; }

.tabs { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); margin: 4px 14px 6px; background: var(--chip); border-radius: 12px; padding: 3px; }
.tabs button { position: relative; z-index: 1; padding: 7px 4px; font-weight: 600; font-size: 13px; color: var(--muted); border-radius: 9px; transition: color .2s; }
.tabs button.active { color: var(--text); }
.tab-indicator { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3); background: var(--surface-solid); border-radius: 9px; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.tabs.hidden-tab .tab-indicator { opacity: 0; }

.view { flex: 1; overflow-y: auto; padding: 8px 14px 20px; scrollbar-width: thin; }
.view-enter { animation: viewIn .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; transition: transform .12s, opacity .2s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(109, 93, 252, .7); }
.btn.ghost { background: var(--chip); }
.btn.danger { background: rgba(255, 59, 48, .12); color: #ff3b30; }
.btn.block { width: 100%; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); }

/* ---------- Списки ---------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 16px; text-align: left; width: 100%; transition: background .15s; }
.item:hover { background: var(--chip); }
.item .thumb { width: 56px; height: 56px; border-radius: 14px; background: var(--grad) center/cover; flex: none; display: grid; place-items: center; font-size: 24px; }
.item .meta { flex: 1; min-width: 0; }
.item .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta span { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty-state { text-align: center; padding: 30px 10px; }
.empty-state .big { font-size: 56px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin: 6px 0 18px; }

.hero-card { background: var(--grad); color: #fff; border-radius: 20px; padding: 16px; margin: 6px 0 4px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.hero-card .num { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.hero-card .sub { opacity: .9; font-size: 13px; }

/* ---------- Детальный вид ---------- */
.detail-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; border-radius: 18px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { scroll-snap-align: center; width: 100%; flex: none; aspect-ratio: 4/3; object-fit: cover; border-radius: 18px; background: var(--chip); }
.gallery-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.gallery-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: all .2s; }
.gallery-dots i.on { width: 18px; background: var(--accent); }
.placeholder-hero { aspect-ratio: 16/9; border-radius: 18px; background: var(--grad); display: grid; place-items: center; font-size: 54px; }
.author { display: flex; gap: 10px; align-items: center; margin: 14px 0 4px; }
.author b { display: block; }
.author span { color: var(--muted); font-size: 13px; }
.loc { color: var(--muted); font-size: 13px; display: flex; gap: 4px; align-items: center; }
.desc { margin: 12px 0; white-space: pre-wrap; }
video { width: 100%; border-radius: 16px; background: #000; display: block; }
.track { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--chip); margin-bottom: 8px; }
.track .row b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track audio { width: 100%; height: 36px; }
.track-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #fff; flex: none; font-size: 15px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; background: var(--chip); font-size: 12px; font-weight: 600; transition: transform .12s, background .2s; }
.action:active { transform: scale(.96); }
.action .e { font-size: 20px; }
.action.liked { background: rgba(255, 93, 162, .15); color: var(--accent-2); }
.action.danger { color: #ff3b30; }
.action.confirm { background: #ff3b30; color: #fff; }

/* ---------- Форма ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; border: 1px solid var(--line); background: var(--chip); border-radius: 12px; padding: 11px 12px; outline: 0; transition: border .2s, box-shadow .2s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(109, 93, 252, .15); }
textarea.input { resize: vertical; min-height: 90px; }
.input.error { border-color: #ff3b30; animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.loc-chip { display: inline-flex; gap: 6px; align-items: center; background: var(--chip); border-radius: 999px; padding: 6px 12px; font-size: 13px; margin-bottom: 14px; color: var(--muted); max-width: 100%; }
.loc-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-grid .m { position: relative; aspect-ratio: 1; border-radius: 12px; background: var(--chip) center/cover; overflow: hidden; }
.media-grid .m video { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.media-add { aspect-ratio: 1; border-radius: 12px; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; padding: 6px; transition: border-color .2s, color .2s; }
.media-add:hover { border-color: var(--accent); color: var(--accent); }
.media-add .e { font-size: 22px; display: block; }
.rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; display: grid; place-items: center; }
.audio-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--chip); margin-bottom: 6px; font-size: 14px; }
.audio-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-row .rm { position: static; }

/* ---------- Друзья / лента ---------- */
.code-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--chip); }
.code-card code { font: 700 16px/1 ui-monospace, "SF Mono", Consolas, monospace; }
.feed-card { border-radius: 20px; background: var(--chip); overflow: hidden; margin-bottom: 12px; cursor: pointer; transition: transform .15s; text-align: left; width: 100%; display: block; }
.feed-card:hover { transform: translateY(-2px); }
.feed-card .fc-head { display: flex; gap: 10px; align-items: center; padding: 12px; }
.feed-card .fc-head b { display: block; font-size: 14px; }
.feed-card .fc-head span { font-size: 12px; color: var(--muted); }
.feed-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: var(--line); }
.feed-card .fc-body { padding: 12px; }
.feed-card .fc-body p { margin: 4px 0 8px; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-solid); }

/* ---------- Профиль / аватар ---------- */
.profile-head { text-align: center; padding: 8px 0; }
.profile-head .av { margin: 0 auto 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 12px; font-size: 20px; background: var(--chip); transition: transform .12s, box-shadow .2s; }
.emoji-grid button:hover { transform: scale(1.08); }
.emoji-grid button.on { box-shadow: 0 0 0 2px var(--accent); background: var(--surface-solid); }
.color-row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.color-row button { width: 30px; height: 30px; border-radius: 50%; transition: transform .12s; }
.color-row button.on { box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 4px var(--accent); }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.lang-grid button { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: var(--chip); font-weight: 600; transition: box-shadow .2s, background .2s; }
.lang-grid button .f { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line); flex: none; }
.lang-grid button.on { background: var(--surface-solid); box-shadow: 0 0 0 2px var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px; border-radius: 16px; background: var(--chip); text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- Кнопки карты ---------- */
.map-controls { position: fixed; top: 16px; right: 16px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.ctrl-group { border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.ctrl-group button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--text); transition: background .15s, color .15s; }
.ctrl-group button + button { border-top: 1px solid var(--line); }
.ctrl-group button:hover { background: var(--chip); }
.ctrl-group button.active { color: var(--accent); }
.ctrl-group button.txt { font-weight: 800; font-size: 13px; letter-spacing: -.02em; }
.compass { transition: transform .1s linear; }
/* Компас виден, только когда карта повёрнута или наклонена (как в Apple Maps) */
#northBtn.idle { display: none; }

/* Большая кнопка «＋ Добавить место» — по центру свободной части карты (не мешает кнопке ⓘ справа) */
.fab {
  position: fixed; bottom: 28px; z-index: 600;
  left: calc((100vw + var(--panel-w) + 16px) / 2); translate: -50% 0;
  height: 58px; padding: 0 22px 0 16px; border-radius: 999px;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px; white-space: nowrap;
  box-shadow: 0 14px 30px -8px rgba(109, 93, 252, .8);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
  animation: fabIn .5s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes fabIn { from { transform: scale(.6); opacity: 0; } }
.fab .ic { width: 28px; height: 28px; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.fab:hover { transform: scale(1.05); }
.fab:hover .ic { transform: rotate(90deg); }
body.picking .fab, body.adding .fab { transform: scale(0); }

/* ---------- Маркеры ---------- */
.pin-wrap { background: none; border: 0; width: 52px; height: 60px; cursor: pointer; }
.pin-wrap:hover { z-index: 10; }
.pin { position: relative; width: 52px; height: 60px; transition: transform .2s cubic-bezier(.2, .8, .2, 1); transform-origin: 50% 100%; }
.pin:hover { transform: scale(1.12); }
.pin-img { width: 52px; height: 52px; border-radius: 50%; padding: 3px; background: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); overflow: hidden; }
.pin.mine .pin-img { background: var(--grad); }
.pin-img img, .pin-img .av { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; font-size: 24px; box-shadow: none; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 2px; z-index: -1; box-shadow: 2px 2px 4px rgba(0, 0, 0, .2); }
.pin.mine::after { background: #b25cf6; }
.pin-badge { position: absolute; right: -4px; top: -4px; border-radius: 50%; border: 2px solid #fff; }
.pin-badge .av { display: grid; }
.pin.pop { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(0); } }
/* ---------- Корабли ---------- */
/* Картинка 48×192, масштаб зависит от приближения (--ship-scale задаёт ships.js) */
.ship { cursor: pointer; line-height: 0; }
.ship img { width: calc(48px * var(--ship-scale, .3)); height: calc(192px * var(--ship-scale, .3)); display: block; user-select: none; }
.ship-popup .maplibregl-popup-content { background: var(--surface-solid); color: var(--text); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); font-family: inherit; }
.ship-popup .maplibregl-popup-tip { border-top-color: var(--surface-solid) !important; border-bottom-color: var(--surface-solid) !important; }
.ship-pop { display: flex; flex-direction: column; gap: 3px; min-width: 170px; }
.ship-pop b { font-size: 15px; }
.ship-pop span, .ship-pop small { color: var(--muted); font-size: 12px; }
.ship-pop .route { font-weight: 600; font-size: 13px; margin-top: 2px; }
.ship-pop .live { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #ff3b30; }
.ship-pop .live i { width: 7px; height: 7px; border-radius: 50%; background: #ff3b30; animation: livePulse 1.4s ease-in-out infinite; }
@keyframes livePulse { 50% { opacity: .25; transform: scale(.7); } }

/* ---------- Достопримечательности (фото из Википедии) ---------- */
/* Внимание: у корневого элемента маркера нельзя задавать position — MapLibre сам ставит absolute */
.landmark { cursor: pointer; }
.lm-dot { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .35); background: #ddd; transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.lm-dot img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.lm-cam { position: absolute; right: -6px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: #fff; font-size: 10px; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
/* Наведение — фото плавно увеличивается в ~2.5 раза и поднимается над соседними иконками */
.landmark:hover { z-index: 20; }
.lm-dot { will-change: transform; }
.landmark:hover .lm-dot { transform: scale(2.6); box-shadow: 0 10px 28px rgba(0, 0, 0, .45); transition-duration: .25s; }
.landmark:hover .lm-cam { transform: scale(.45); transform-origin: 100% 100%; }
.lm-cam { transition: transform .25s; }
/* Знаменитые места (видны издалека) — крупнее, с золотой рамкой */
.landmark.famous .lm-dot { width: 46px; height: 46px; border-color: #ffd166; box-shadow: 0 0 0 2px rgba(255, 209, 102, .5), 0 4px 12px rgba(0, 0, 0, .4); }
.landmark.famous:hover .lm-dot { transform: scale(2.4); }
.lm-hero { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 18px; background: var(--chip); display: block; }
a.btn { text-decoration: none; color: inherit; }

/* ---------- Страны и «Хочу поехать» ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--chip); border-radius: 12px; padding: 3px; margin: 6px 0 10px; }
.seg button { padding: 8px 6px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .1); }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .25); margin: 8px 0 6px; overflow: hidden; position: relative; z-index: 1; }
.progress i { display: block; height: 100%; background: #fff; border-radius: 3px; }
.country-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.country-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--chip); font-size: 13px; font-weight: 600; }
.flag { width: 20px; height: 14px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.thumb.wish { background: linear-gradient(135deg, #f6d365, #fda085); }
.wish-btn { background: linear-gradient(135deg, #f6d365, #fda085) !important; color: #5a3200 !important; box-shadow: 0 6px 18px -6px rgba(253, 160, 133, .8); }
.wish-badge-big { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; background: linear-gradient(135deg, #f6d365, #fda085); color: #5a3200; }
.placeholder-hero.wish { background: linear-gradient(135deg, #f6d365, #fda085); }
.wants-chip { display: inline-block; margin: 8px 0 4px; padding: 6px 12px; border-radius: 12px; background: rgba(246, 211, 101, .22); color: var(--text); font-weight: 600; font-size: 13px; }
.wish-item { cursor: default; }
.wish-item .thumb { font-size: 22px; }
.pin.wish .pin-img { background: linear-gradient(135deg, #f6d365, #fda085); }
.pin.wish::after { background: #fda085; }
.wish-star { background: #fff8e1 !important; font-size: 22px; }
.wish-badge { background: #fff; width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; }

/* ---------- ⚡ Панель «Эффекты» ---------- */
.fx-panel { position: fixed; z-index: 700; top: 120px; right: 72px; width: 280px; border-radius: 18px; padding: 14px; animation: rise .25s cubic-bezier(.2, .8, .2, 1); }
.fx-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.fps { font: 700 12px/1 ui-monospace, Consolas, monospace; padding: 4px 8px; border-radius: 8px; background: var(--chip); }
.fps.good { color: #1faa59; } .fps.ok { color: #e5a100; } .fps.bad { color: #ff3b30; }
.fx-hint { margin: 6px 0 10px; line-height: 1.35; }
.fx-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 2px; font-weight: 600; font-size: 14px; cursor: pointer; }
.fx-row + .fx-row { border-top: 1px solid var(--line); }
.fx-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.fx-actions .btn { min-width: 0; padding: 0 8px; font-size: 12px; white-space: normal; line-height: 1.15; height: auto; min-height: 34px; }
/* Переключатель как в iPhone */
.switch { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
@media (max-width: 720px) { .fx-panel { top: 12px; right: 58px; width: min(280px, calc(100vw - 76px)); } }

/* ---------- Маршрут до места ---------- */
.route-label { pointer-events: none; z-index: 30; }
.route-plane { font-size: 28px; line-height: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); pointer-events: none; }
.route-text { display: flex; flex-direction: column; align-items: center; background: var(--surface-solid); color: var(--text); padding: 5px 10px; border-radius: 12px; box-shadow: var(--shadow); line-height: 1.2; white-space: nowrap; }
.route-text b { font-size: 14px; }
.route-text small { font-size: 11px; color: var(--muted); }

/* ---------- Фильтр «только друг» ---------- */
.focus-chip { position: fixed; z-index: 550; top: 16px; left: calc(50% + var(--panel-w) / 2); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border-radius: 999px; font-weight: 600; font-size: 13px; white-space: nowrap; animation: toastIn .3s cubic-bezier(.2, .8, .2, 1); }
.focus-chip button { background: var(--chip); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.focus-chip button:hover { background: var(--accent); color: #fff; }
.item.clickable, .author.clickable { cursor: pointer; }
.author.clickable { border-radius: 14px; padding: 4px; margin-left: -4px; transition: background .15s; }
.author.clickable:hover { background: var(--chip); }
.chev { color: var(--muted); font-size: 20px; padding: 0 2px; }

/* Синяя точка «Вы здесь» с пульсацией (у корня маркера position не задаём!) */
.me-wrap { width: 18px; height: 18px; }
.me-dot { position: absolute; inset: 0; border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.me-pulse { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: rgba(10, 132, 255, .35); animation: mePulse 2s ease-out infinite; }
@keyframes mePulse { from { transform: scale(1); opacity: .9; } to { transform: scale(4.5); opacity: 0; } }

/* ---------- Выбор точки ---------- */
/* Булавка: красный шарик + игла. Кончик иглы — нижний край элемента = точная точка на карте */
/* Булавка — в центре видимой части карты (справа от панели 420px), совпадает с map.getCenter() */
.pick-pin { position: fixed; left: calc(50vw + 210px); top: 50%; z-index: 550; pointer-events: none; transform: translate(-50%, -100%); }
.pushpin { width: 22px; height: 46px; }
.pick-pin .pushpin { position: relative; } /* в маркере карты position задаёт сам MapLibre */
.pp-ball {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a80 0%, #ff3b30 45%, #b3120a 100%);
  box-shadow: inset -2px -3px 4px rgba(0, 0, 0, .25), 0 3px 6px rgba(0, 0, 0, .35);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
  z-index: 2;
}
.pp-ball::after { content: ""; position: absolute; left: 5px; top: 4px; width: 6px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .75); }
.pp-needle {
  position: absolute; left: 10px; top: 18px; width: 2px; height: 28px; border-radius: 0 0 1px 1px;
  background: linear-gradient(90deg, #9aa0a6, #eceff1 50%, #7b8288);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.pp-shadow { position: absolute; left: 50%; bottom: -3px; width: 10px; height: 5px; margin-left: -5px; border-radius: 50%; background: rgba(0, 0, 0, .35); filter: blur(1px); }
/* Пока карту двигают, булавка «приподнимается», а при остановке «втыкается» */
.pick-pin.lifting .pp-ball, .pick-pin.lifting .pp-needle { transform: translateY(-10px); }
.pick-pin.lifting .pp-shadow { transform: scale(1.4); opacity: .6; }
.pushpin.drop .pp-ball, .pushpin.drop .pp-needle { animation: pinDrop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pinDrop { from { transform: translateY(-30px); } }
.maplibregl-marker .pushpin { cursor: grab; }
.pick-bar { position: fixed; z-index: 600; left: calc(50vw + 210px); bottom: 28px; transform: translateX(-50%); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; font-weight: 600; width: min(380px, calc(100% - 32px)); text-align: center; }
.pick-bar .row { width: 100%; }
.pick-bar .btn { flex: 1; }
body.picking .panel { opacity: .35; pointer-events: none; }

/* ---------- Модальное окно ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 10, 25, .35); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 26px; padding: 24px; background: var(--surface-solid); animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.97); } }
.logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 4px; }
.logo-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 24px; box-shadow: 0 8px 20px -6px rgba(109, 93, 252, .7); }
.logo b { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.center { text-align: center; }
.steps { display: flex; gap: 6px; justify-content: center; margin: 14px 0 18px; }
.steps i { width: 28px; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--accent); }
.check-list { display: flex; flex-direction: column; gap: 4px; margin: 12px 0 18px; }
.check-list label { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; cursor: pointer; }
.check-list label:hover { background: var(--chip); }
.check-list input { width: 20px; height: 20px; accent-color: var(--accent); margin-left: auto; }

/* ---------- Уведомление ---------- */
.toast { position: fixed; z-index: 1100; left: 50%; top: 20px; transform: translateX(-50%); background: rgba(20, 20, 30, .92); color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: toastIn .3s cubic-bezier(.2, .8, .2, 1); max-width: calc(100% - 32px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } }

/* ---------- Телефон ---------- */
@media (max-width: 720px) {
  /* Шторка: раскрытая 46% экрана, свёрнутая 140px (как SHEET_PEEK в app.js) — видны поиск и вкладки */
  :root { --sheet-h: 46vh; --sheet-peek: 140px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); width: auto; height: var(--sheet-h); border-radius: 24px; }
  .panel.collapsed { height: var(--sheet-peek); }
  .panel.collapsed .view { display: none; }
  .sheet-handle { display: block; width: 100%; height: 22px; flex: none; position: relative; touch-action: none; }
  .sheet-handle::after { content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; border-radius: 3px; background: var(--muted); opacity: .5; transform: translateX(-50%); }
  .panel-top { padding-top: 0; }
  /* «Добавить место» — круглая кнопка «＋», не закрывает карту */
  .fab { bottom: calc(var(--sheet-h) + 22px); left: auto; right: 14px; translate: none; width: 56px; height: 56px; padding: 0; justify-content: center; }
  .fab span { display: none; }
  body.sheet-collapsed .fab { bottom: calc(var(--sheet-peek) + 22px); }
  .pick-pin { top: calc((100vh - var(--sheet-h) - 8px) / 2); }
  body.sheet-collapsed .pick-pin { top: calc((100vh - var(--sheet-peek) - 8px) / 2); }
  /* «День/ночь» и «Достопримечательности» на телефоне — в панели ⚡, чтобы столбик кнопок был короче */
  #dayNightBtn, #landmarksBtn { display: none; }
  .map-controls { top: max(12px, env(safe-area-inset-top)); right: 12px; gap: 8px; }
  /* На телефоне кнопки компактнее, а «+/−» не нужны — приближают двумя пальцами */
  .map-controls .ctrl-group:first-child { display: none; }
  .ctrl-group button { width: 38px; height: 38px; }
  .ctrl-group .ic { width: 18px; height: 18px; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .pick-pin { left: 50%; }
  .pick-bar { left: 50%; }
  .focus-chip { left: 12px; transform: none; top: max(12px, env(safe-area-inset-top)); max-width: calc(100% - 80px); }
  .focus-chip span { overflow: hidden; text-overflow: ellipsis; }
}
