@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/inter-latin.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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  color: #faf6ff;
  background: #14111b;
  --surface: #20192d;
  --surface-hover: #2b203a;
  --muted: #beb2cc;
  --accent: #ffacc8;
  --border: #ffffff19;
  --touch: 44px;
  --modal-radius: 20px;
  --app-height: min(100dvh, var(--telegram-viewport, 100dvh));
  --safe-top: max(env(safe-area-inset-top, 0px), var(--telegram-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--telegram-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--telegram-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--telegram-right, 0px));
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
button, a, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
a { color: var(--accent); }
button { color: inherit; }
button:active:not(:disabled), .tabbar a:active { scale: .975; }
button:disabled { opacity: .44; cursor: default; }
:focus-visible { outline: 2px solid #ffc5d8; outline-offset: -2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3.8vw, 2.45rem); letter-spacing: -.055em; line-height: 1.12; }
h2 { font-size: 1.17rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
p { line-height: 1.55; }
img { display: block; object-fit: contain; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.shell {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  max-width: 1540px;
  margin: auto;
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + clamp(12px, 3vw, 28px))
    calc(var(--safe-bottom) + 10px) calc(var(--safe-left) + clamp(12px, 3vw, 28px));
  background: radial-gradient(ellipse at 34% -22%, #31203c 0, transparent 57%);
}
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; }
.brand { display: inline-flex; gap: 7px; align-items: center; min-height: 44px; text-decoration: none; }
.brand span { display: grid; align-content: center; }
.brand strong {
  background: linear-gradient(128deg, #ffc18d 6%, #fa84af 66%, #ca9fff);
  color: #ffacc8; background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 900; font-size: 1.46rem; line-height: .96; letter-spacing: -.06em; white-space: nowrap;
}
.brand small { color: white; font-weight: 780; font-size: .64rem; letter-spacing: .22em; padding-top: 4px; white-space: nowrap; }
.top-actions { display: flex; gap: 7px; }
.icon-button, .button, .chip, .map-list-button {
  min-height: var(--touch);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 13px;
  transition: background-color 140ms, border-color 140ms, color 140ms;
}
.icon-button { min-width: var(--touch); display: grid; place-items: center; padding: 0; }
.button, .chip { font-weight: 650; padding: 8px 13px; font-size: .875rem; }
.primary { background: #eaa0bd; color: #241523; border-color: #eaa0bd; }
.primary[aria-pressed='true'] { background: #365044; border-color: #a7e8c646; color: #c6ffe0; }
@media (hover: hover) {
  .icon-button:hover, .button:hover, .chip:hover, .map-list-button:hover, .entry-row:hover { background: var(--surface-hover); }
  .primary:hover { background: #ffbfd5; }
  .primary[aria-pressed='true']:hover { background: #456658; }
}
.glyph { width: 18px; height: 18px; display: block; position: relative; }
.glyph-search::before { content: ''; position: absolute; border: 2px solid; border-radius: 50%; width: 10px; height: 10px; left: 0; top: 0; }
.glyph-search::after { content: ''; position: absolute; background: currentColor; width: 8px; height: 2px; transform: rotate(45deg); left: 11px; top: 13px; border-radius: 2px; }
.glyph-settings { background: linear-gradient(currentColor, currentColor) 0 4px / 18px 2px no-repeat, linear-gradient(currentColor, currentColor) 0 12px / 18px 2px no-repeat; }
.glyph-settings::before, .glyph-settings::after { content: ''; position: absolute; width: 4px; height: 6px; border: 1px solid currentColor; background: var(--surface); border-radius: 2px; }
.glyph-settings::before { left: 4px; top: 1px; }
.glyph-settings::after { left: 11px; top: 9px; }
#main { min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.map-main { overflow: hidden; }
.content-screen { display: grid; gap: 14px; align-content: start; max-width: 740px; margin: auto; padding: 4px 1px 14px; animation: screen-in 160ms ease-out; }
@keyframes screen-in { from { opacity: .64; } to { opacity: 1; } }
.tabbar {
  --tab-index: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  width: min(100%, 452px);
  justify-self: center;
  border: 1px solid #ffffff1a;
  border-radius: 22px;
  background: #211a2ce8;
  box-shadow: inset 0 1px #ffffff08;
}
.tabbar::before {
  content: '';
  position: absolute; top: 6px; left: 6px; bottom: 6px;
  width: calc((100% - 24px) / 4);
  border-radius: 16px;
  background: #ffffff0e;
  border: 1px solid #ffffff0a;
  transform: translateX(calc(var(--tab-index) * (100% + 4px)));
  transition: transform 310ms cubic-bezier(.22, 1, .36, 1);
}
.tabbar a {
  position: relative; display: grid; justify-items: center; align-content: center;
  gap: 2px; min-width: 0; min-height: 54px; text-decoration: none;
  color: var(--muted); font-weight: 630; font-size: .75rem; border-radius: 16px;
}
.tabbar a[aria-current] { color: var(--accent); }
.tabbar img { width: 29px; height: 29px; }
.tabbar a[aria-current] img { animation: tab-pop 270ms ease-out; }
@keyframes tab-pop { 45% { transform: translateY(-2px) scale(1.07); } }
.map-screen { min-height: 100%; height: 100%; display: grid; grid-template-rows: auto minmax(180px, 1fr); gap: 10px; }
.map-filters { display: grid; gap: 7px; min-width: 0; }
.screen-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.chips {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 0;
  scrollbar-width: thin; scrollbar-color: #6d5376 transparent; overscroll-behavior-inline: contain; align-items: center;
}
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.chip img { width: 23px; height: 23px; margin-left: -3px; }
.chip[aria-pressed='true'] { color: #ffd2e4; border-color: #eca6c36b; background: #3a253c; }
.map-layout { min-width: 0; min-height: 0; display: grid; }
.map-stage {
  min-width: 0; min-height: 0; position: relative; overflow: hidden;
  border-radius: 20px; border: 1px solid #a68fc33e; background: #1b1933;
}
.map-stage canvas {
  display: block; width: 100%; height: 100%; min-height: 0;
  touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none;
}
.map-stage canvas:active { cursor: grabbing; }
.map-controls { display: grid; gap: 5px; position: absolute; right: 9px; top: 9px; }
.zoom-button { font-size: 1.35rem; background: #211b32f0; box-shadow: 0 3px 12px #100c2040; }
.map-list-button {
  position: absolute; left: 9px; bottom: 35px; display: flex; align-items: center; gap: 7px;
  padding: 0 11px; background: #211b32f0; font-size: .875rem; font-weight: 650;
}
.map-count { color: var(--accent); font-variant-numeric: tabular-nums; }
.map-credit {
  position: absolute; bottom: 4px; left: 7px; color: #f0e2f6;
  min-height: 24px; display: flex; align-items: center; border-radius: 6px;
  background: #181426eb; padding: 0 6px; font-size: .75rem; text-decoration-thickness: .075em;
}
.map-error {
  position: absolute; inset: 10px 60px auto 10px; display: grid; gap: 5px;
  justify-items: start; background: var(--surface); border-radius: 12px; padding: 8px;
}
.map-side { display: none; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 17px; }
.entry-list { display: grid; gap: 7px; min-width: 0; }
.entry-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 7px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  min-width: 0; text-align: left;
}
.row-icon {
  flex: 0 0 42px; height: 42px; display: grid; place-items: center; background: #332740; border-radius: 11px;
  background: color-mix(in srgb, var(--item-accent) 15%, #21192c);
}
.row-copy { flex: 1; min-width: 0; display: grid; gap: 4px; }
.row-copy strong { font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; }
.row-copy small, .detail-meta { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.row-mark { color: #ffcd8b; }
.row-chevron { border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); width: 7px; height: 7px; transform: rotate(45deg); margin: 0 5px 0 2px; flex: none; }
.empty { color: var(--muted); padding: 12px 0; }
.show-more { justify-self: center; margin-top: 3px; }
.message { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #ffffff20; border-top-color: var(--accent); animation: spin 850ms linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.progress-card { display: grid; gap: 7px; padding: 15px; }
.progress-card strong { font-size: 1.5rem; letter-spacing: -.045em; }
.progress-card small { color: var(--muted); font-size: .875rem; }
progress { accent-color: #eca9c4; width: 100%; height: 12px; }

dialog {
  --dialog-bottom: max(var(--safe-bottom), var(--keyboard-bottom, 0px));
  position: fixed; inset: calc(var(--safe-top) + 8px) auto auto calc(var(--safe-left) + 10px);
  width: calc(100% - var(--safe-left) - var(--safe-right) - 20px);
  height: calc(100vh - var(--safe-top) - var(--dialog-bottom) - 16px);
  height: calc(100dvh - var(--safe-top) - var(--dialog-bottom) - 16px);
  height: calc(var(--app-height) - var(--safe-top) - var(--dialog-bottom) - 16px);
  max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  overflow: visible; background: none; color: inherit;
}
dialog[open] { display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; }
dialog::backdrop { background: #0c0814c9; animation: screen-in 130ms ease-out; }
.dialog-card {
  display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(100%, 470px); min-height: 0; max-height: min(100%, 740px);
  border: 1px solid #dcb4ec37; border-radius: var(--modal-radius);
  background: radial-gradient(ellipse at 50% -40%, #4b2b54, transparent 69%), linear-gradient(#251b33, #1d1729);
  box-shadow: 0 20px 70px #080710ac;
}
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 9px 15px; gap: 6px; }
.dialog-header h2 { display: flex; align-items: center; gap: 6px; min-width: 0; padding-block: 4px; overflow-wrap: anywhere; }
.dialog-header img { width: 27px; height: 27px; }
.close { font-size: 1.65rem; line-height: 1; background: #ffffff08; flex: none; }
.dialog-body {
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #786583 transparent;
  padding: 1px 15px 15px; display: grid; gap: 12px; align-content: start;
  border-radius: 0 0 var(--modal-radius) var(--modal-radius); min-width: 0; min-height: 0;
}
.detail-actions, .source-links { display: flex; gap: 7px; flex-wrap: wrap; }
.detail-meta { line-height: 1.45; }
.related, .about { display: grid; gap: 8px; }
.source-link, .source-links a { justify-self: start; color: #f4bbd6; min-height: 44px; display: inline-flex; align-items: center; }
.facts { margin: 0; border: 1px solid var(--border); border-radius: 12px; }
.facts div { padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.facts div + div { border-top: 1px solid var(--border); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
.steps { margin: 0; padding-left: 1.4rem; display: grid; gap: 6px; line-height: 1.4; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.dialog-back { justify-self: start; }
input[type='search'], select {
  min-height: 44px; width: 100%; min-width: 0; border-radius: 12px; border: 1px solid #fff3;
  background: #1a1424; color: inherit; padding: 7px 11px; font-size: 1rem;
}
input[type='search']::placeholder { color: var(--muted); opacity: 1; }
.toggle-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface); cursor: pointer; }
.toggle-row small { display: block; margin-top: 4px; color: var(--muted); font-size: .875rem; }
.toggle-row input { width: 27px; height: 27px; flex: none; margin: 8px; accent-color: #eea8c6; cursor: pointer; }

@media (orientation: landscape) {
  .shell { grid-template-columns: minmax(0, 1fr) 82px; grid-template-rows: auto minmax(0, 1fr); gap: 8px 11px; }
  .topbar { grid-column: 1; }
  .tabbar { grid-column: 2; grid-row: 1 / span 2; align-self: center; height: min(100%, 342px); grid-template-columns: 1fr; grid-template-rows: repeat(4, minmax(44px, 1fr)); }
  .tabbar::before { bottom: auto; right: 6px; width: auto; height: calc((100% - 24px) / 4); transform: translateY(calc(var(--tab-index) * (100% + 4px))); }
  .tabbar a { min-height: 44px; }
}
@media (min-width: 980px) and (min-height: 540px) {
  .map-layout { grid-template-columns: minmax(0, 1fr) minmax(265px, 29%); gap: 10px; }
  .map-side { display: grid; grid-template-rows: auto auto; align-content: start; gap: 11px; padding: 13px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #786583 transparent; }
  .map-list-button { display: none; }
  .map-side .entry-row { background: #282035; }
  .map-side .entry-row:hover { background: #30243f; }
}
@media (min-width: 760px) and (min-height: 345px) and (max-height: 539px) and (orientation: landscape) {
  .map-layout { grid-template-columns: minmax(0, 1fr) minmax(201px, 28%); gap: 7px; }
  .map-side { display: grid; grid-template-rows: auto auto; align-content: start; gap: 7px; padding: 8px; overflow: auto; scrollbar-width: thin; scrollbar-color: #786583 transparent; }
  .map-list-button { display: none; }
}
@media (orientation: landscape) and (max-height: 450px) {
  .shell { gap: 5px 8px; padding-block: calc(var(--safe-top) + 3px) calc(var(--safe-bottom) + 3px); }
  .map-screen { grid-template-rows: auto minmax(117px, 1fr); gap: 5px; }
  .map-filters { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .screen-heading h1 { font-size: 1.45rem; }
  .screen-heading { gap: 5px; }
  .filter-button { padding-inline: 8px; }
  .map-controls { gap: 1px; top: 4px; right: 4px; }
  .map-credit { bottom: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
