:root {
  color-scheme: dark;

  --bg-0: #050810;
  --bg-1: #0a1220;
  --surface: rgba(14, 24, 38, 0.72);
  --surface-solid: #0e1826;
  --surface-hi: rgba(255, 255, 255, 0.035);

  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);

  --text: #eaf2fb;
  --muted: #8ea3bd;
  --muted-2: #566a82;

  --accent: #5cc8ff;
  --accent-2: #2f7fe0;
  --accent-soft: rgba(92, 200, 255, 0.12);
  --accent-glow: rgba(92, 200, 255, 0.22);

  /* historical — приглушённый cyan-slate */
  --historical: #8fb8d4;
  --historical-soft: rgba(143, 184, 212, 0.08);
  --historical-line: rgba(143, 184, 212, 0.22);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-lg: 0 24px 60px -28px rgba(0, 0, 0, 0.9);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, sans-serif;
  background: var(--bg-0);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(80% 50% at 50% -20%, rgba(92, 200, 255, 0.07) 0%, transparent 60%),
    radial-gradient(60% 40% at 100% 0%, rgba(47, 127, 224, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 70%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.2;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 4px 4px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 20%, transparent 80%);
}

/* ============================================================
   TOPBAR / SEARCH
   ============================================================ */

.topbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 100;
  padding: 18px 12px 0;
}

.topbar .searchbox {
  width: 100%;
  align-self: stretch;
}

.searchbox {
  position: relative;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow:
    0 1px 0 var(--surface-hi) inset,
    0 10px 30px -20px rgba(0, 0, 0, 0.9);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.searchbox:focus-within {
  border-color: rgba(92, 200, 255, 0.4);
  box-shadow:
    0 1px 0 var(--surface-hi) inset,
    0 0 0 3px rgba(92, 200, 255, 0.08),
    0 10px 30px -20px rgba(0, 0, 0, 0.9);
}

.inputwrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: text;
}

.searchicon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--muted);
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: color 0.2s var(--ease);
}

.searchbox:focus-within .searchicon {
  color: var(--accent);
}

.searchicon svg {
  width: 100%;
  height: 100%;
  display: block;
}

input {
  width: 100%;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  letter-spacing: -0.01em;
  caret-color: var(--accent);
}

input::placeholder {
  color: var(--muted-2);
}

input::-webkit-search-cancel-button {
  display: none;
}

.clear {
  display: none;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  place-items: center;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease);
}

.clear:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.clear:active {
  transform: scale(0.9);
}

.history-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.history-btn svg {
  width: 14px;
  height: 14px;
}

.history-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.history-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: rgba(92, 200, 255, 0.4);
  background: var(--accent-soft);
  transform: rotate(180deg);
}

/* ============================================================
   HISTORY PANEL
   ============================================================ */

.history-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 4px;
  right: 4px;
  z-index: 200;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(14, 24, 38, 0.98);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow: var(--shadow-lg), 0 1px 0 var(--surface-hi) inset;
  animation: appear 0.18s var(--ease) both;
  transform-origin: top center;
}

.history-panel[hidden] {
  display: none;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-clear {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-transform: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.history-clear:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--line-strong);
}

.history-list {
  display: grid;
  gap: 1px;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  overflow: hidden;
  transition: background 0.12s var(--ease);
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.history-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.history-item .h-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--muted-2);
  display: grid;
  place-items: center;
}

.history-item .h-icon svg {
  width: 100%;
  height: 100%;
}

.history-item .h-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

/* ============================================================
   LIVEBAR
   ============================================================ */

.livebar {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0;
  transition: width 0.3s var(--ease), opacity 0.3s var(--ease);
}

.searchbox.busy .livebar {
  width: 60%;
  opacity: 1;
  animation: pulse 1.2s ease-in-out infinite;
}

/* ============================================================
   MAIN / STATUS / RESULTS
   ============================================================ */

main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  width: min(100%, 640px);
  margin: 0 auto;
  padding: 4px 12px 8px;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 24px;
  margin: 10px 4px 14px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dot {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: blink 1.2s ease-in-out infinite;
}

.results {
  display: grid;
  gap: 8px;
}

.results[hidden] {
  display: none !important;
}

/* ---------- result card ---------- */

.result {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: 0 1px 0 var(--surface-hi) inset;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  animation: appear 0.24s var(--ease) both;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease),
    transform 0.1s var(--ease);
}

.result::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.3);
  transform-origin: center;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.result:hover {
  border-color: var(--line-strong);
  background: #101c2e;
}

.result:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.result:active {
  transform: scale(0.995);
}

.result:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pin {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.result:hover .pin {
  color: var(--accent);
  border-color: rgba(92, 200, 255, 0.25);
}

.pin svg {
  width: 15px;
  height: 15px;
}

/* ---------- address ---------- */

.address {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--text);
  padding-right: 40px;
}

/* mark — подчёркивание, не заливка */
.address mark {
  padding: 0;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  box-shadow: none;
}

/* ---------- skeleton ---------- */

.skeleton {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  overflow: hidden;
}

.sk-pin {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.sk-line {
  height: 12px;
  border-radius: 6px;
}

.sk-pin,
.sk-line {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ---------- empty ---------- */

.empty {
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  text-align: center;
  animation: appear 0.3s var(--ease) both;
}

.empty .glyph {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted-2);
}

.empty .glyph svg {
  width: 22px;
  height: 22px;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.empty span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-2);
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  width: min(100%, 640px);
  margin: 0 auto;
  padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
  text-align: center;
  flex: 0 0 auto;
}

.footer-link {
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}

.footer-link:hover {
  opacity: 1;
  color: var(--muted);
}

.footer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  opacity: 1;
}

/* ============================================================
   ABOUT DATA MODAL
   ============================================================ */

body.modal-open {
  overflow: hidden;
}

.about-data-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: appear 0.2s var(--ease) both;
}

.about-data-modal[hidden] {
  display: none;
}

.about-data-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 16, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.about-data-card {
  position: relative;
  width: min(100%, 480px);
  max-height: min(80vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 24px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg), 0 1px 0 var(--surface-hi) inset;
  color: var(--text);
  animation: appear 0.22s var(--ease) both;
}

.about-data-card h2 {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.about-data-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.about-data-card p:last-child {
  margin-bottom: 0;
}

.about-data-card strong {
  color: var(--text);
  font-weight: 600;
}

.about-data-card a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(92, 200, 255, 0.3);
  transition: border-color 0.15s var(--ease);
}

.about-data-card a:hover {
  border-bottom-color: var(--accent);
}

.about-data-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease);
}

.about-data-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.about-data-close:active {
  transform: scale(0.9);
}

/* ============================================================
   MAP SHEET
   ============================================================ */

.map-sheet {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  align-items: end;
}

.map-sheet[hidden] {
  display: none;
}

.map-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: appear 0.2s var(--ease) both;
}

.map-sheet-panel {
  position: relative;
  width: 100%;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-strong);
  border-radius: 20px 20px 0 0;
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.28s var(--ease) both;
}

.map-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.map-sheet-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.map-sheet-headtext {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-sheet-coords {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    border-color 0.15s var(--ease), transform 0.12s var(--ease);
}

.map-sheet-coords:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--line-strong);
}

.map-sheet-coords:active {
  transform: scale(0.97);
}

.map-sheet-coords:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.map-sheet-coords.copied {
  color: #6bd28a;
  border-color: rgba(107, 210, 138, 0.4);
  background: rgba(107, 210, 138, 0.08);
}

.map-sheet-coords-icon {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.map-sheet-coords-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.map-sheet-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.map-sheet-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.map-sheet-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-1);
}

#mapContainer {
  width: 100%;
  height: 100%;
  min-height: 46dvh;
}

.leaflet-container {
  background: var(--bg-1);
  font-family: inherit;
}

.leaflet-control-attribution {
  background: rgba(10, 18, 32, 0.8) !important;
  color: var(--muted-2) !important;
  font-size: 10px !important;
  backdrop-filter: blur(6px);
}

.leaflet-control-attribution a {
  color: var(--muted) !important;
}

.leaflet-bar a {
  background: rgba(14, 24, 38, 0.95) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.leaflet-bar a:hover {
  background: rgba(24, 40, 60, 0.95) !important;
}

/* ============================================================
   MAP ACTIONS
   ============================================================ */

.map-sheet-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.map-sheet-actions .btn-primary {
  flex: 1;
}

.btn-primary {
  position: relative;
  min-height: 50px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(92, 200, 255, 0.4);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.btn-primary:hover {
  background: rgba(92, 200, 255, 0.18);
  border-color: rgba(92, 200, 255, 0.6);
}

.btn-primary::after {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11l19-9-9 19-2-8-8-2z'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11l19-9-9 19-2-8-8-2z'/></svg>") center/contain no-repeat;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(92, 200, 255, 0.4);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.btn-icon:hover {
  background: rgba(92, 200, 255, 0.18);
  border-color: rgba(92, 200, 255, 0.6);
}

.btn-icon svg {
  width: 19px;
  height: 19px;
  display: block;
}

.btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   HISTORICAL — «pārdēvēta»
   Намеренно тише обычных: без цветового акцента, лёгкая карточка.
   ============================================================ */
.result.result-historical {
  border-color: var(--line);
  background: rgba(14, 24, 38, 0.55);
  box-shadow: none;
  padding-top: 12px;
  padding-bottom: 12px;
}

.result.result-historical::before {
  display: none;
}

.result.result-historical:hover {
  border-color: var(--line-strong);
  background: rgba(20, 32, 48, 0.6);
}

.result.result-historical .pin {
  color: var(--muted-2);
  border-color: var(--line);
  background: transparent;
  opacity: 0.8;
}

.result.result-historical:hover .pin {
  color: var(--muted);
  border-color: var(--line-strong);
  opacity: 1;
}

/* badge — штамп в углу, не занимает поток */
.badge-historical {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  opacity: 0.85;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- old → new pair (компактно) ---------- */

.address-pair {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.address-old {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--muted-2);
  overflow-wrap: anywhere;
  opacity: 0.9;
  padding-right: 70px; /* место под штамп в правом верхнем углу */
}

.address-old::before {
  content: "↺";
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted-2);
  opacity: 0.7;
  transform: translateY(-0.5px);
}

.address-old .address-old-text {
  flex: 1;
  min-width: 0;
}

.address-old mark {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 0;
  box-shadow: none;
}

/* пунктир — тонкая линия, минимальные отступы */
.address-arrow {
  align-self: flex-start;
  margin-left: 15px;
  margin-top: 2px;
  margin-bottom: 2px;
  width: calc(100% - 15px - 70px);
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: transparent;
  font-size: 0;
  line-height: 0;
  user-select: none;
}

.address-new {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
  color: var(--text);
  padding-right: 70px; /* тоже не залезаем под штамп */
}

.result-historical .address-new mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 -0.45em 0 var(--accent-soft);
  opacity: 0.85;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 380px) {
  .logo svg { height: 32px; }
}

@media (min-width: 520px) {
  html,
  body {
    overflow: auto;
    height: auto;
  }

  body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .topbar {
    padding-left: 24px;
    padding-right: 24px;
    padding-top: 18px;
    position: static;
    z-index: auto;
  }

  .searchbox {
    position: sticky;
    top: 10px;
    z-index: 100;
  }

  main {
    flex: 1 0 auto;
    min-height: auto;
    overflow: visible;
    overscroll-behavior: auto;
    -webkit-overflow-scrolling: auto;
    padding-left: 24px;
    padding-right: 24px;
  }

  .footer {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

body:has(#mapSheet:not([hidden])) .topbar {
  filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: filter 0.2s var(--ease), opacity 0.2s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .result {
    user-select: text;
    -webkit-user-select: text;
  }
}

/* ---------- map sheet: old address (historical) ---------- */

.map-sheet-old {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted-2);
  overflow-wrap: anywhere;
}

.map-sheet-old::before {
  content: "↺ ";
  opacity: 0.7;
}


/* ---------- map sheet: чуть светлее ---------- */

.map-sheet-title {
  color: var(--text);
  font-weight: 700;
}

.map-sheet-coords {
  color: var(--text) !important;
  border-color: var(--line-strong) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.map-sheet-coords:hover {
  color: var(--text) !important;
  border-color: rgba(92, 200, 255, 0.5) !important;
  background: rgba(92, 200, 255, 0.12) !important;
}

.map-sheet-coords-icon {
  opacity: 0.9;
}

.map-sheet-old {
  margin-top: 2px;
  color: var(--muted) !important;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.map-sheet-old::before {
  content: "↺ ";
  color: var(--muted-2) !important;
  opacity: 0.9;
}


/* ---------- PWA install button (same as .footer-link) ---------- */


/* ---------- footer install (compact) ---------- */

.footer-install {
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: 0.01em;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}

.footer-install:hover { opacity: 1; color: var(--muted); }
.footer-install:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }
.footer-install:disabled { opacity: 0.4; cursor: progress; }

.footer-install svg,
.footer-install-icon {
  opacity: 0.85;
}


/* ---------- footer-sep: только когда install виден ---------- */

.footer-sep {
  display: none;
  width: 1px;
  height: 12px;
  margin: 0 4px;
  background: var(--line-strong);
  opacity: 0.6;
  vertical-align: middle;
}

.footer-install:not([hidden]) + .footer-sep {
  display: inline-block;
}

/* ---------- locate button ---------- */
/* ---------- standalone (PWA) — скрыть footer ---------- */
@media (display-mode: standalone) {
  .footer { display: none !important; }
  main { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

.addr-distance {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  background: transparent;
  border: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
