:root {
  --bg: #0f1318;
  --panel: #161c23;
  --panel-2: #1d252e;
  --line: #2a3440;
  --text: #e6e1d3;
  --muted: #9aa3a8;
  --gold: #c9a227;
  --teal: #5ee0c8;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg) radial-gradient(1200px 600px at 80% -10%, #1c2a2a 0, transparent 60%);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: #0b0f13ee; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.logo { color: var(--gold); font: 700 20px Georgia, serif; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo .tri { color: var(--gold); }
.logo .sub { display: block; font: 12px system-ui, sans-serif; color: var(--muted); margin-top: -2px; }
.burger { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 18px; }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 15px;
}
.search input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.suggest {
  position: absolute; left: 0; right: 0; top: 42px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; max-height: 60vh; overflow: auto;
  box-shadow: 0 12px 30px #0008;
}
.suggest a { display: flex; gap: 10px; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.suggest a:hover, .suggest a.on { background: var(--panel-2); text-decoration: none; }
.suggest .k { color: var(--muted); font-size: 12px; margin-left: auto; }

.wrap { display: flex; min-height: calc(100vh - 58px); }
.side {
  width: 230px; flex: none; padding: 14px 10px; border-right: 1px solid var(--line);
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow: auto;
}
.side a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text);
}
.side a:hover { background: var(--panel-2); text-decoration: none; }
.side a.on { background: var(--panel-2); color: var(--gold); }
.side .ic { width: 20px; text-align: center; }
.side .cnt { margin-left: auto; color: var(--muted); font-size: 12px; }
.side h4 { margin: 14px 10px 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
main.full { padding: 0; }
h1 { font: 700 28px Georgia, serif; margin: 0 0 4px; color: var(--gold); }
h2 { font: 700 20px Georgia, serif; margin: 26px 0 10px; }
.lead { color: var(--muted); margin: 0 0 18px; }

/* Карта */
.mapwrap { position: relative; height: calc(100vh - 58px); }
#map { position: absolute; inset: 0; background: #0b0f13; }
.mapctl {
  position: absolute; z-index: 500; top: 12px; left: 12px; width: 290px; max-height: calc(100% - 24px); overflow: auto;
  background: #11161cf0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.layers { display: flex; gap: 4px; margin-bottom: 10px; }
.layers button {
  flex: 1; padding: 7px 4px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; font-size: 13px;
}
.layers button.on { background: var(--gold); color: #1a1406; border-color: var(--gold); font-weight: 600; }
.filters label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; font-size: 14px; }
.filters .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.filters .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.mapctl .row { display: flex; gap: 6px; margin-top: 10px; }
.mapctl .row button { flex: 1; font-size: 12px; padding: 5px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.mapctl .note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.mapctl .toggle { display: none; }

.pin {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #111; border: 2px solid #0008; box-shadow: 0 2px 6px #0009;
}
.pin.found { opacity: .35; filter: grayscale(.7); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-popup-content h3 { margin: 0 0 2px; font: 700 16px Georgia, serif; color: var(--gold); }
.leaflet-popup-content .en { color: var(--muted); font-size: 12px; }
.leaflet-popup-content p { margin: 6px 0; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-tooltip { background: #11161c; color: var(--text); border: 1px solid var(--line); }

/* Списки */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; color: var(--text); position: relative;
}
.card:hover { border-color: var(--gold); text-decoration: none; transform: translateY(-1px); }
.card .t { font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.card .en { color: var(--muted); font-size: 12px; }
.card .s { color: #c9c5b8; font-size: 14px; margin-top: 6px; }
.card .tag { position: absolute; top: 12px; right: 12px; font-size: 11px; color: var(--muted); }
.card.found::after { content: "✓"; position: absolute; bottom: 10px; right: 12px; color: var(--teal); font-weight: 700; }
.tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tools select, .tools input { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; width: 160px; }
.progress i { display: block; height: 100%; background: var(--teal); }

/* Статья */
.article { max-width: 820px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; font-size: 13px; color: var(--text); }
a.chip:hover { border-color: var(--gold); text-decoration: none; }
.article p { margin: 0 0 12px; }
.infobox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 18px 0; }
.btn {
  display: inline-flex; gap: 6px; align-items: center; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn.on { background: var(--teal); color: #08201b; border-color: var(--teal); }

.hero { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 18px; }
.hero a { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); }
.hero a:hover { border-color: var(--gold); text-decoration: none; }
.hero .ic { font-size: 22px; }
.hero b { display: block; margin-top: 6px; }
.hero span { color: var(--muted); font-size: 13px; }
footer.foot { color: var(--muted); font-size: 12px; margin-top: 40px; }

@media (max-width: 820px) {
  .burger { display: block; }
  .logo .sub { display: none; }
  .search { margin-left: 0; }
  .side {
    position: fixed; z-index: 900; left: 0; top: 58px; background: var(--bg); width: 260px;
    transform: translateX(-110%); transition: transform .2s; box-shadow: 10px 0 30px #0009;
  }
  .side.open { transform: none; }
  main { padding: 16px; }
  .mapctl { width: auto; right: 12px; max-height: 60%; }
  .mapctl .toggle { display: block; width: 100%; margin-top: 4px; }
  .mapctl.collapsed .filters, .mapctl.collapsed .row, .mapctl.collapsed .note { display: none; }
}
.spots { margin: 8px 0 0; padding: 0; list-style: none; columns: 2 280px; }
.spots li { padding: 3px 0; break-inside: avoid; }
.spots .en { color: var(--muted); font-size: 12px; }
.leaflet-control-attribution { background: #0b0f13cc !important; color: var(--muted) !important; }
.cimg { width: 34px; height: 34px; object-fit: contain; margin: -6px 2px -8px -2px; flex: none; }
.simg { width: 22px; height: 22px; object-fit: contain; }
.ahead { display: flex; gap: 14px; align-items: center; }
.aimg { width: 80px; height: 80px; object-fit: contain; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.piece { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.piece .pimg { width: 72px; height: 72px; object-fit: contain; display: block; margin: 0 auto 6px; }
.piece b { display: block; font-size: 14px; }
.piece span { color: var(--muted); font-size: 12px; }
.popimg { float: right; width: 48px; height: 48px; object-fit: contain; margin: 0 0 4px 8px; }
.ipin { width: 30px; height: 30px; border-radius: 50%; background: #11161cee; border: 2px solid #90caf9; display: grid; place-items: center; box-shadow: 0 2px 6px #0009; }
.ipin img { width: 24px; height: 24px; object-fit: contain; }
.ipin.found { opacity: .35; }

/* ── двуязычные названия: EN сверху, RU снизу ── */
.bi { display: inline-flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bi-en { font-weight: 700; }
.bi-ru { font-size: .78em; font-weight: 400; color: var(--muted); margin-top: 2px; }
h1 .bi-ru { font: 400 17px system-ui, sans-serif; color: var(--muted); margin-top: 6px; }
.bi.small .bi-en { font-weight: 600; }
.card .t { align-items: center; }
.cic { font-size: 18px; width: 24px; text-align: center; flex: none; }
.muted { color: var(--muted); font-size: 12px; }
.ahead { margin-bottom: 4px; }
.piece .bi { align-items: center; text-align: center; }
.piece .slot { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ── панель карты ── */
.mapctl input[type=search] { width: 100%; margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px; }
.flt h5 { margin: 12px 0 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.flt label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; font-size: 13px; }
.flt .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px #0008; }
.flt .fl { display: flex; flex-direction: column; line-height: 1.15; }
.flt .fl small { color: var(--muted); font-size: 11px; }
.flt .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.flt label.arts { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.maptip { background: #0d1217f2; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; box-shadow: 0 6px 18px #0009; }
.maptip::before { border-top-color: #0d1217f2 !important; }
.tiprow { display: flex; align-items: center; gap: 8px; }
.tipimg { width: 32px; height: 32px; object-fit: contain; }
.pop h3 { margin: 0 0 4px; font: 700 16px Georgia, serif; color: var(--gold); }
.pop h3 .bi-ru { font: 400 13px system-ui, sans-serif; }
.pop .popimg { float: right; width: 72px; height: 72px; object-fit: contain; margin: 0 0 6px 10px; background: #0d1217; border-radius: 10px; }
.pop p { margin: 8px 0; }
.pop .coords { color: var(--muted); font: 12px ui-monospace, monospace; margin: 6px 0 8px; }
.maplabel { pointer-events: none; text-align: center; text-shadow: 0 0 3px #000, 0 0 6px #000, 0 0 10px #000; color: #fff; }
.maplabel .bi { align-items: center; width: 100%; }
.maplabel.region .bi-en { font: 700 17px Georgia, serif; letter-spacing: .14em; text-transform: uppercase; }
.maplabel.region .bi-ru { font-size: 13px; color: #e8e2cf; letter-spacing: .08em; }
.maplabel.place .bi-en { font: 600 12px system-ui, sans-serif; }
.maplabel.place .bi-ru { font-size: 11px; color: #d8d2bf; }

/* ── задания ── */
.qlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.quest { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.quest.found { opacity: .55; }
.quest .qh { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.quest .qp { margin-top: 6px; font-size: 13px; }
.quest .qd { color: #c9c5b8; font-size: 13px; margin: 8px 0 0; }
.mini { background: var(--panel-2); border: 1px solid var(--line); color: var(--teal); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; flex: none; }
.chk { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; }
.suggest a.tomap { color: var(--teal); }
.suggest a.none { color: var(--muted); }
.suggest .bi-ru { font-size: 12px; }

/* ── панель объекта на карте ── */
.detail { position: absolute; z-index: 600; top: 12px; right: 56px; bottom: 28px; width: 380px; overflow: auto;
  background: #11161cf5; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 12px 40px #000a; }
.detail .x { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.detail .dh { display: flex; gap: 12px; align-items: center; padding-right: 20px; }
.detail .dimg { width: 72px; height: 72px; object-fit: contain; background: #0d1217; border-radius: 12px; flex: none; }
.detail h3 { margin: 0 0 4px; font: 700 18px Georgia, serif; color: var(--gold); }
.detail h3 .bi-ru { font: 400 14px system-ui, sans-serif; }
.detail h4 { margin: 16px 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.detail .dex { margin: 8px 0 0; font-size: 14px; }
.gcoord { display: flex; gap: 8px; align-items: stretch; }
.gcoord span { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: 700 17px ui-monospace, monospace; text-align: center; }
.gcoord small { display: block; font: 11px system-ui, sans-serif; color: var(--muted); }
.gcoord .mini { height: auto; }
.how { margin: 0; padding-left: 18px; font-size: 14px; }
.how li { margin: 4px 0; }
.how1 { font-size: 13px; margin-top: 2px; }
.snaps { display: flex; gap: 8px; flex-wrap: wrap; }
.snap { position: relative; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); background: #0b0f13; flex: none; }
.snap img { position: absolute; width: 256px; height: 256px; max-width: none; }
.snap .cross { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px solid #ff5252;
  border-radius: 50%; box-shadow: 0 0 0 2px #0009, 0 0 10px #ff5252; }
.snap .cross::before, .snap .cross::after { content: ""; position: absolute; background: #ff5252; }
.snap .cross::before { left: 50%; top: -9px; bottom: -9px; width: 2px; margin-left: -1px; }
.snap .cross::after { top: 50%; left: -9px; right: -9px; height: 2px; margin-top: -1px; }
.snap .scale { position: absolute; left: 6px; bottom: 6px; font: 11px system-ui; color: #fff; background: #000a; padding: 1px 6px; border-radius: 4px; }
.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pics a { display: block; color: var(--text); font-size: 11px; }
.pics .pic { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; display: block; border: 1px solid var(--line); }
.pics a:hover .pic { border-color: var(--gold); }
.pics span { display: block; margin-top: 3px; color: var(--muted); }
.dbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dbtns .btn { font-size: 13px; padding: 7px 11px; }
.lightbox { position: absolute; inset: 0; z-index: 900; background: #000d; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 40px); border-radius: 8px; }
.lightbox .cap { color: #ddd; margin-top: 8px; font-size: 13px; }
.pulse { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #ff5252; animation: pulse 1.4s ease-out infinite; box-shadow: 0 0 12px #ff5252; }
@keyframes pulse { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
.spots li { break-inside: avoid; margin-bottom: 8px; }
@media (max-width: 820px) {
  .detail { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 62%; }
}
.lightbox[hidden], .detail[hidden] { display: none !important; }

/* переключатель языка */
.langbtn { order: 3; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font: 600 13px/1 inherit; letter-spacing: .04em; cursor: pointer; margin-left: 12px; }
.langbtn:hover { border-color: var(--gold); color: var(--gold); }
