:root {
  --ink: #1c2333;
  --ink-soft: #4a5268;
  --muted: #8992a8;
  --line: #e3e6ee;
  --bg: #f6f7fb;
  --card: #ffffff;
  --accent: #5b7fde;
  --accent-soft: #eef1fb;
  --warn: #c8813f;
  --warn-bg: #fbf1e4;
  --danger: #c25b52;
  --danger-bg: #fbebe9;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-card: 14px;
  --radius-chip: 999px;
  --shadow-card: 0 1px 2px rgba(28,35,51,0.04), 0 8px 24px -12px rgba(28,35,51,0.10);
  --shadow-card-hover: 0 4px 16px rgba(28,35,51,0.08), 0 12px 32px -16px rgba(28,35,51,0.14);
}

* { box-sizing: border-box; }

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  background-image: radial-gradient(circle at 15% 8%, rgba(91,127,222,0.07), transparent 45%),
                     radial-gradient(circle at 85% 0%, rgba(200,129,63,0.05), transparent 40%);
  animation: noiseDrift 18s ease-in-out infinite alternate;
}

@keyframes noiseDrift {
  0% { transform: translate3d(0,0,0) scale(1); opacity: 0.38; }
  50% { transform: translate3d(1.2%, 0.8%, 0) scale(1.02); opacity: 0.44; }
  100% { transform: translate3d(-0.8%, 1.1%, 0) scale(1.01); opacity: 0.4; }
}

/* ───────── HERO ───────── */

.hero {
  position: relative;
  padding: 76px 24px 40px;
  background: linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  overflow: clip;
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.hero-kicker {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 18px;
  letter-spacing: 0.02em;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.05s;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.12s;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
  position: relative;
  display: inline-block;
}
.hero-title em::after {
  content: '';
  position: absolute;
  left: -2%; right: -2%; bottom: 0.08em; height: 0.32em;
  background: linear-gradient(90deg, rgba(91,127,222,0.14), rgba(91,127,222,0));
  z-index: -1;
  border-radius: 6px;
  transform: scaleX(0);
  transform-origin: left;
  animation: shimmerIn 0.9s ease 0.7s forwards;
}
@keyframes shimmerIn { to { transform: scaleX(1); } }

.hero-sub {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0 0 36px;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.2s;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 4px 6px 4px 18px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.28s;
}
.search-wrap:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}
.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-card-hover);
  transform: translateY(-1px);
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 0.18s ease, transform 0.18s ease;
}
.search-wrap:focus-within .search-icon {
  color: var(--accent);
  transform: scale(1.06);
}

#search {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 16px;
  padding: 14px 12px;
  color: var(--ink);
}

#search::placeholder { color: #a7aec2; }

.result-count {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 12px;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.36s;
}

.filter-chip {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-chip);
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.filter-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(91,127,222,0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.filter-chip:hover {
  border-color: #c7cee3;
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(28,35,51,0.06);
}
.filter-chip:hover::after { opacity: 1; }
.filter-chip:active { transform: translateY(0) scale(0.98); }
.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: 0 4px 14px rgba(28,35,51,0.18);
}

/* ───────── MAIN / GROUPS ───────── */

.main {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 100px;
  overflow: visible;
}

.region-group {
  margin-bottom: 36px;
  animation: fadeInUp 0.5s ease both;
  overflow: visible;
}

.region-group:last-child { margin-bottom: 0; }

.region-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.region-heading::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px; width: 0; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  animation: lineGrow 0.7s ease 0.3s forwards;
}
@keyframes lineGrow { to { width: 100%; } }

.region-heading h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}

.region-count {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  grid-auto-rows: auto;
  overflow: visible;
}
@media (min-width: 880px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 640px) and (max-width: 879px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ───────── CARD ───────── */

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: cardIn 0.52s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 52ms);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  will-change: transform;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 96px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: #d6dbe9;
}
.card.open {
  border-color: #c7cee3;
  box-shadow: var(--shadow-card-hover);
  z-index: 20;
  overflow: visible;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ── ТОП-3 во всю ширину ── */
.card.featured {
  grid-column: 1 / -1;
  border-width: 1.5px;
  min-height: 84px;
}
/* 1 — лесная (NOT-A-DNS) */
.card.featured.f1 {
  border-color: #2e7d43;
  background: linear-gradient(180deg, #f4faf5 0%, #e7f3ea 100%);
}
.card.featured.f1:hover { border-color: #256636; }
/* 2 — семка (Semqka, акцент #6d8dff с их сайта) */
.card.featured.f2 {
  border-color: #6d8dff;
  background: linear-gradient(180deg, #f6f8ff 0%, #e8edff 100%);
}
.card.featured.f2:hover { border-color: #5474f0; }
/* 3 — материал ю (Wlrus, Material You #6750a4) */
.card.featured.f3 {
  border-color: #6750a4;
  background: linear-gradient(180deg, #faf7ff 0%, #ece6f0 100%);
}
.card.featured.f3:hover { border-color: #523d8a; }
.card.featured .card-name { font-size: 17px; }
.card.featured .card-tagline { -webkit-line-clamp: unset; min-height: auto; font-size: 13.5px; }
.medal {
  font-size: 20px;
  line-height: 1;
  align-self: flex-start;
  margin-top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
/* кнопка-скачивание как копировать */
a.addr.dl {
  text-decoration: none;
  display: inline-block;
  background: var(--ink);
  color: #fff;
}
a.addr.dl:hover { background: #000; color: #fff; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  position: relative;
  min-height: 76px;
  flex: 1;
}
.card-head::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(91,127,222,0.03), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.card-head:hover::after { opacity: 1; }

.card-flag {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.18s ease;
  width: 28px;
  text-align: center;
}
.card:hover .card-flag { transform: scale(1.08) rotate(-2deg); }
.card.open .card-flag { transform: scale(1.06); }

.card-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }

.card-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-tagline {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.card-chevron {
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 0;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s ease;
}
.card:hover .card-chevron { color: var(--ink-soft); }
.card.open .card-chevron { transform: rotate(180deg); }

.card-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 6px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 0;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  animation: dotPulse 2.2s ease infinite;
}
.badge-dot.warn { background: var(--warn); }
.badge-dot.danger { background: var(--danger); animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,129,63,0.0); }
  50% { box-shadow: 0 0 0 6px rgba(200,129,63,0.08); }
}
.badge-dot.danger { animation-name: dotPulseDanger; }
@keyframes dotPulseDanger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194,91,82,0.0); }
  50% { box-shadow: 0 0 0 6px rgba(194,91,82,0.10); }
}

/* inline card-body hidden — details now in pirate map overlay */
.card-body { display: none !important; }
.card-body::before { display: none !important; }
.card-body-inner { display: none !important; }

/* ── pirate map overlay + wire ── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.overlay[hidden] { display: none !important; }
.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16,22,36,0.38);
  backdrop-filter: blur(6px) saturate(1.1);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.overlay.open .overlay-backdrop { opacity: 1; }
.wire-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1001;
  overflow: visible;
}
.wire-svg { display: none !important; }
#wire-path { display: none !important; }
#wire-dot { display: none !important; }
.overlay-map {
  position: relative;
  z-index: 1002;
  width: min(760px, 94vw);
  max-height: 88vh;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 32px -12px rgba(28,35,51,0.18), 0 24px 64px -24px rgba(28,35,51,0.24);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.16,1,0.3,1), opacity 0.20s ease;
}
.overlay.open .overlay-map {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  transition: all 0.16s ease;
  display: grid;
  place-items: center;
}
.overlay-close:hover { background: var(--ink); color: #fff; border-color: var(--ink); transform: rotate(90deg); }
.overlay-content {
  padding: 28px 28px 0;
  overflow: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.overlay-content::-webkit-scrollbar { width: 6px; }
.overlay-content::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.overlay-bottom-space { display: none !important; }
.overlay-map .profile { padding: 12px 0; border-top: 1px solid #e8dcc3; }
.overlay-map .profile:first-child { border-top: none; }
.overlay-map .card-name { font-size: 22px; }
.overlay-map .card-tagline { font-size: 14px; -webkit-line-clamp: unset; min-height: auto; }

.profile {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.profile:first-child { border-top: none; padding-top: 4px; }

.profile-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
}

.addr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 6px;
}

.addr-row:last-child { margin-bottom: 0; }

.addr-row-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  align-self: center;
  min-width: 34px;
}

.addr {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--accent-soft);
  color: #3d54a3;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: background 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
  position: relative;
}
.addr:hover { background: #e2e7f9; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(61,84,163,0.12); }
.addr:active { transform: translateY(0) scale(0.97); }
.addr.copied { background: #dbf0e2; color: #2c7a4b; }

.notes { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.note {
  font-size: 12.5px;
  padding: 9px 11px;
  border-radius: 8px;
  line-height: 1.45;
  display: flex;
  gap: 9px;
  animation: fadeInUp 0.4s ease both;
}

.note-icon { flex-shrink: 0; margin-top: 1px; }

.note.info { background: #eef3f9; color: #3a5872; }
.note.warn { background: var(--warn-bg); color: #8a5a26; }
.note.danger { background: var(--danger-bg); color: #963f36; }

/* ───────── DISCLAIMER (russia section) ───────── */

.disclaimer {
  background: var(--danger-bg);
  border: 1px solid #f0d2ce;
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 12px;
  animation: fadeInUp 0.45s ease both;
}

.disclaimer-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  color: #963f36;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.disclaimer p {
  font-size: 13px;
  line-height: 1.6;
  color: #7d4038;
  margin: 0;
}

/* ───────── EMPTY STATE ───────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
  animation: fadeInUp 0.4s ease both;
}

/* ───────── FOOTER ───────── */

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 60px;
  position: relative;
  z-index: 2;
}

.site-footer p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

/* ───────── FOCUS / A11Y ───────── */

button:focus-visible,
input:focus-visible,
.filter-chip:focus-visible,
.card-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ───────── RESPONSIVE ───────── */

@media (max-width: 560px) {
  .hero { padding: 56px 18px 32px; }
  .main { padding: 36px 18px 80px; }
  .card-head { padding: 12px 14px; min-height: 68px; }
  .card-body-inner { padding: 0 14px 14px; }
  .search-wrap { padding: 3px 4px 3px 14px; }
  #search { font-size: 15px; padding: 12px 8px; }
  .result-count { display: none; }
}
