:root {
  --header-h: 70px;
  --footer-h: 58px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
}
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
  font-family: "Rubik", sans-serif;
  background: #08112c;
  color: #fff;
}

.main-menu {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 10;
  background: rgba(8, 17, 44, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
  overflow: visible; /* список поиска раскрывается поверх карты, не обрезается */
}
.menu-container {
  height: 100%;
  padding: 0 26px;
  display: flex;
  align-items: center;
  min-width: 0;
}
.menu-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.logo {
  flex-shrink: 0;
}
.logo img {
  width: 50px;
  height: 50px;
}
.logo-text {
  font-size: 18px;
  font-weight: 100;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.map-wrap {
  width: 100%;
  height: 100%;
  padding-top: var(--header-h);
  padding-bottom: var(--footer-h);
  overflow: hidden;
}
.map-inner {
  transform-origin: 0 0;
  transition: none;
  overflow: hidden;
}

/* Включаем ускорение (и размытие) ТОЛЬКО во время движения */
.map-inner.is-animating {
  will-change: transform;
  transform: translateZ(0); /* Force GPU only during move */
}

.map-inner.is-animating svg {
  shape-rendering: optimizeSpeed;
}

.map-inner.is-animating path {
  stroke-width: 0.5;
  filter: none !important;
}

.map-inner.no-transition {
  transition: none !important;
  cursor: grabbing !important;
}

/* --- ОПТИМИЗАЦИЯ КАРТЫ (End) --- */
.info-card {
  position: absolute;
  left: 26px;
  bottom: calc(var(--footer-h) + 18px);
  width: 310px;
  padding: 16px;
  background: rgba(12, 12, 12, 0.45);
  border: 1px solid rgba(95, 150, 255, 0.35);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 300ms ease, transform 300ms ease;
}
.info-card.hidden {
  opacity: 0;
  transform: translateY(30px);
  pointer-events: none;
}
.info-icon img {
  width: 45px;
  height: 45px;
}
.info-text {
  font-size: 16px;
  line-height: 24px;
}

.country-info {
  position: absolute;
  left: 26px;
  bottom: calc(var(--footer-h) + 30px);
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}
.country-info.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.country-flag {
  width: 60px !important;
  height: auto !important;
  border-radius: 0 !important;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: none !important;
}
.country-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.country-name {
  font-size: 14px;
  line-height: 1.7;
  max-width: 400px;
}
.country-density-value {
  font-size: 22px;
}
.country-density-label {
  font-size: 10px;
  opacity: 0.7;
  color: #fff;
}

.scale {
  position: absolute;
  right: 30px;
  bottom: calc(var(--footer-h) + 18px);
  display: flex;
  align-items: center;
  gap: 12px;
}
.scale .line {
  width: 32px;
  border-top: 2px solid #fff;
}
.scale-text {
  font-size: 16px;
}

.zoom {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 92px;
  background: rgba(12, 12, 12, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(6px);
  overflow: hidden;
  z-index: 20;
}
.zoom-btn {
  flex: 0 0 46px;
  min-height: 46px;
  max-height: 46px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.zoom-btn img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}
.zoom-btn:hover {
  background: #2e6cf8;
}
.zoom-divider {
  flex: 0 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-h);
  background: rgba(8, 17, 44, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
  z-index: 55;
  overflow: hidden;
}
.footer-container {
  height: 100%;
  padding: 0 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #bcbcbc;
  min-width: 0;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 25, 0.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}
.popup {
  width: 560px;
  max-height: 96vh;
  background: #0b1e3d;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.popup-overlay.active .popup {
  transform: scale(1);
}
.popup-header {
  background: #3b6ff2;
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.popup-header-left {
  display: flex;
  gap: 14px;
  align-items: center;
}
.popup-flag {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}
.popup-title {
  font-size: 22px;
  font-weight: 100;
  line-height: 1.2;
}
.popup-code {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.8;
}
.popup-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.popup-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
.popup-body {
  padding: 22px;
  overflow-y: auto;
}
.popup-ministry {
  font-size: 15px;
  color: #fff;
  font-weight: 100;
  margin-bottom: 4px;
  opacity: 0.9;
}
.popup-department {
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 0px;
  opacity: 0.9;
}
.popup-conventions p {
  font-size: 14px;
  line-height: 1.55;
  opacity: 0.6;
  margin: 0 0 10px;
}
.popup-conventions p:last-child {
  margin-bottom: 0;
}
.popup-section-title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 100;
  color: #fff;
  opacity: 0.9;
}
.popup-contacts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.popup-contacts .contact-item {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 12px 48px 12px 40px;
  transition: background 200ms ease, box-shadow 200ms ease;
}
.popup-contacts .contact-label {
  font-size: 12px;
  opacity: 0.65;
  margin-bottom: 4px;
}
.popup-contacts .contact-value {
  font-size: 13px;
  font-weight: 100;
  line-height: 1.4;
}
.popup-contacts .contact-item::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 32%;
  width: 18px;
  height: 20px;
  transform: translateY(-50%);
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.9;
}
.popup-contacts .email::before {
  background-image: url("/assets/images/icons/mail.svg");
}
.popup-contacts .phone::before {
  background-image: url("/assets/images/icons/phone.svg");
}
.popup-contacts .address::before {
  background-image: url("/assets/images/icons/location.svg");
}
.popup-contacts .copy {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
}
.popup-contacts .copy img {
  width: 20px;
  height: 20px;
  opacity: 0.85;
}
.popup-contacts .contact-item:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 0 #ffffff;
}
.popup-files {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 14px 20px;
  transition: background 0.2s ease;
  cursor: default;
}
.file-item:hover {
  background: rgba(255, 255, 255, 0.12);
}
.file-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.file-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  transform: translateX(-10px);
  background-image: url("/assets/images/icons/file-doc.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px 40px;
}
.file-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform: translateX(-15px);
  min-width: 0;
}
.file-name {
  font-size: 15px;
  font-weight: 100;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}
.file-download-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  transform: translateX(13px);
  background-image: url("/assets/images/icons/download.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.file-download-btn:active {
  transform: none;
  opacity: 1;
}
.popup-body::-webkit-scrollbar {
  width: 6px;
}
.popup-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}

.detailed-overlay {
  position: fixed;
  top: 70px;
  bottom: 58px;
  left: 0;
  right: 0;
  z-index: 50;
  background-color: #08112c !important;
  overflow: hidden;
  padding: 20px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}
.detailed-overlay.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.split-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  max-width: 1700px;
  margin: 0 auto;
  gap: 60px;
}
.col-left {
  width: 50%;
  min-width: 600px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start !important;
  flex-direction: column;
  overflow: hidden;
}
.col-right {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
}

/* -----------------------------------------------------------
   ЛЕВАЯ ПАНЕЛЬ (ГЛАВНАЯ КАРТОЧКА)
   ----------------------------------------------------------- */
.left-panel-card {
  width: 100%;
  background: #0d2043; /* Непрозрачный фон */
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  display: flex !important;
  flex-direction: column !important;
  overflow: hidden;
  scroll-behavior: smooth;
  /* УБРАЛИ боковой padding у контейнера, чтобы границы были от края до края */
  padding: 0px 0 18px 0;

  flex: 0 1 auto !important;
  height: auto !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* -----------------------------------------------------------
   ЗАГОЛОВКИ (HEADERS)
   ----------------------------------------------------------- */
.card-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  width: 100% !important;
  margin: 0 !important; /* Никаких внешних отступов */

  /* Внутренний отступ перенесли сюда (чтобы контент был ровным) */
  padding: 18px 20px 18px 32px;

  border-bottom: none;

  background: #0d2043;
  position: relative;
  z-index: 2;
}

/* -----------------------------------------------------------
   СПЕЦ. СТИЛЬ ДЛЯ РАСКРЫВАЮЩИХСЯ БЛОКОВ (B1, B2)
   ----------------------------------------------------------- */
.block-header {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: -1px !important;
  padding-top: 18px;
  padding-bottom: 18px;

  z-index: 5;
}

/* -----------------------------------------------------------
   КОНТЕНТ (BODY) И АНИМАЦИЯ
   ----------------------------------------------------------- */
.card-anim-wrapper {
  display: grid !important;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible !important;
  flex: none !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Закрытое состояние: Высота 0, ничего не видно */
.card-anim-wrapper.closed {
  grid-template-rows: 0fr !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.card-body,
.card-body.scrollable-content {
  flex: none !important;
  min-height: 0;
  overflow: visible !important;
  height: auto !important;
  display: block !important;

  /* УМНЫЙ ОТСТУП: 
       Добавили паддинг слева/справа здесь (вместо контейнера).
       Снизу 40px - воздух до следующей линии. */
  padding: 24px 32px 40px 32px !important;

  opacity: 1;
  transition: opacity 0.3s ease 0.1s;
}

/* Когда закрыто: контент исчезает */
.card-anim-wrapper.closed .card-body {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.card-header + .card-anim-wrapper.closed + .block-header {
  margin-top: -1px !important;
}
.block-header + .card-anim-wrapper:not(.closed) {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.card-header + .card-anim-wrapper:not(.closed) {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.card-header .btn-toggle-info {
  margin-left: 24px; /* или 32px, подбери визуально */
}

/* ----------------------------------------------------------- */

.header-main {
  display: flex;
  align-items: center;
  gap: 20px;
}
.flag-circle {
  width: 80px !important;
  height: auto !important;
  border-radius: 0 !important;
  object-fit: contain;
  border: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  background: transparent;
}
#detail-name {
  font-size: 24px;
  font-weight: 100;
  margin: 0;
  color: #fff;
  line-height: 1.2;
}
.code-text {
  font-size: 14px;
  color: #fff;
  margin-top: 4px;
  font-weight: 100;
}
.btn-back {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
  padding: 0;
  margin-top: 15px;
}
.btn-back:hover {
  color: #fff;
}
.back-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.info-group.mt-auto {
  margin-top: auto;
  margin-bottom: 0;
}
.section-title {
  font-size: 15px;
  color: #fff;
  margin: 0 0 16px 0;
  font-weight: 100;
  opacity: 0.9;
}
.text-desc {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  white-space: pre-line;
}

.embassy-row-item {
  display: flex;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 8px;
  transition: background 0.2s;
}
.embassy-row-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.embassy-icon {
  flex-shrink: 0;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #2c6cf8;
}
.embassy-text {
  font-size: 14px;
  line-height: 1.5;
  color: #ffffff !important;
  opacity: 1 !important;
  font-weight: 400;
  word-break: break-word;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
}
.file-card:hover {
  background: rgba(255, 255, 255, 0.06);
}
.fc-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background-image: url("/assets/images/icons/file-doc.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px 40px;
}
.fc-name {
  font-size: 13px;
  color: #fff;
  font-weight: 100;
}
.fc-download {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  transform: translateX(5px);
  background-image: url("/assets/images/icons/download.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.map-wrapper-right img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  display: block;
}
.btn-back > * {
  pointer-events: none;
}
.popup-link-details {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #4d84fe;
  cursor: pointer;
  transition: opacity 0.2s ease, gap 0.2s ease;
}
.popup-link-details span {
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(77, 132, 254, 0.4);
}
.popup-link-details svg {
  display: block;
  flex-shrink: 0;
}
.popup-link-details:hover {
  opacity: 0.8;
  gap: 14px;
}
.popup-link-details:hover span {
  text-decoration-color: #4d84fe;
}

body.details-open .main-menu {
  background: #08112c;
  backdrop-filter: none;
  border-bottom: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
body.details-open .footer {
  border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
  z-index: 55;
  background-color: #08112c;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#mini-map-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#mini-map-container svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: scale(1.4);
  transform-origin: center center;
}
#mini-map-container path,
#mini-map-container g {
  fill: #5b94ff !important;
  stroke: #ffffff;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 15px 40px rgba(0, 0, 0, 0.5));
}

@media (max-width: 1024px) {
  .split-container {
    padding: 0 20px;
  }
  .col-left {
    width: 55%;
  }
  .col-right.map-preview-area {
    width: 45%;
  }
}
@media (max-width: 768px) {
  .split-container {
    flex-direction: column-reverse;
    padding: 0;
    display: flex;
  }
  .col-left {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    padding-top: 20px;
    overflow-y: visible;
  }
  .left-panel-card {
    margin-top: 0;
    min-height: auto;
    box-shadow: none;
    background: transparent;
  }
  .col-right.map-preview-area {
    position: relative;
    width: 100%;
    height: 300px;
    top: 0;
    right: auto;
    bottom: auto;
    z-index: 1;
    background: #060e23;
    order: -1;
  }
  #mini-map-container {
    min-height: auto;
    padding: 20px;
  }
  #mini-map-container svg {
    transform: scale(1.1);
  }
  .country-title h1 {
    font-size: 24px;
  }
  .back-link {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 14px;
  }
}

.map-loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #08112c;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.globe-spinner {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid #3b6ff2;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(59, 111, 242, 0.5);
  background-image: url("/assets/images/union.svg");
  background-repeat: no-repeat;
  background-size: auto 90%;
  animation: passMap 3.5s linear infinite;
}
@keyframes passMap {
  0% {
    background-position: -250px center;
  }
  100% {
    background-position: 400px center;
  }
}
.map-loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.bx-panel-fixed .main-menu {
  top: 39px !important;
}
body.bx-panel-fixed .popup-overlay,
body.bx-panel-fixed .detailed-overlay {
  top: 39px !important;
}
@media screen and (max-width: 1024px) {
  body.bx-panel-fixed .main-menu {
    top: 39px !important;
  }
}
.logo-globe-animated {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1.5px solid #3b6ff2;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 5px rgba(59, 111, 242, 0.5);
  background: transparent;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}
.logo-globe-animated::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 300%;
  background-image: url("/assets/images/union.svg");
  background-repeat: repeat-x;
  background-position: left center;
  background-size: 90px auto;
  will-change: transform;
  animation: smoothLoop 15s linear infinite;
}
@keyframes smoothLoop {
  0% {
    transform: translateX(-90px);
  }
  100% {
    transform: translateX(0px);
  }
}
#detailed-page .info-group {
  margin: 0;
}
#detailed-page .info-group + .info-group {
  margin-top: 36px;
}
#detailed-page .section-title,
#detailed-page .popup-section-title {
  margin: 0 0 16px 0;
}
#detailed-page .popup-ministry {
  margin-bottom: 4px;
}
#detailed-page .popup-department {
  margin-bottom: 0;
}
#detailed-page .popup-conventions p {
  margin: 0 0 10px;
}
#detailed-page .popup-conventions p:last-child {
  margin-bottom: 0;
}
#detailed-page .info-group:has(.popup-conventions) {
  margin-top: 16px;
}
#detailed-page .col-right {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Десктоп: левая/правая колонки и контур страны — без изменений */
#detailed-page .map-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 50px;
  margin-top: 0;
  width: 100%;
}
#detailed-page .country-flag-map,
#detailed-page svg.country-flag-map {
  width: auto !important;
  max-width: min(90%, 420px);
  max-height: 70vh;
  height: auto !important;
  border-radius: 0 !important;
  object-fit: contain;
  box-shadow: none;
  display: block;
}
.btn-icon-action svg {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.4 !important;
}
.btn-icon-action svg path {
  stroke: #ffffff !important;
  stroke-width: 2px !important;
  transition: all 0.2s ease;
}
.file-card .fc-download {
  opacity: 1 !important;
  transition: opacity 0.2s ease;
}
.fc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.file-card .fc-download {
  transform: none !important;
  background-color: transparent;
}
.btn-toggle-info {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}
.btn-toggle-info .icon-plus {
  display: none;
}
.btn-toggle-info .icon-minus {
  display: block;
}
.btn-toggle-info.active .icon-plus {
  display: block;
}
.btn-toggle-info.active .icon-minus {
  display: none;
}
.search-wrapper {
  position: relative;
  margin-right: 15px;
  z-index: 1000;
}
.search-container {
  display: flex;
  align-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  padding: 6px 16px;
  width: 260px;
  transition: all 0.3s ease;
}
.search-container:hover {
  border-color: rgba(255, 255, 255, 0.5);
}
.search-container:focus-within {
  background: rgba(255, 255, 255, 0.05);
  border-color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}
.search-icon {
  opacity: 0.7;
  width: 16px;
  height: 16px;
  margin-right: 10px;
  color: #fff;
}
.search-input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: "Rubik", sans-serif;
  font-size: 14px;
  width: 100%;
}
.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.search-toggle-label {
  cursor: pointer;
  display: flex;
  align-items: center;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  margin-left: 5px;
  opacity: 0.7;
  transition: 0.3s;
}
.search-toggle-label:hover {
  opacity: 1;
}
.search-toggle-label input {
  display: none;
}
.chevron-icon {
  width: 8px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.3s;
}
.search-toggle-label input:checked ~ .chevron-icon {
  transform: rotate(225deg) translateY(-2px);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 100%;
  background: rgba(13, 32, 67, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  backdrop-filter: blur(15px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.search-dropdown.is-open {
  max-height: 400px;
  opacity: 1;
  overflow-y: auto;
  padding: 5px 0;
}
.search-dropdown::-webkit-scrollbar {
  width: 4px;
}
.search-dropdown::-webkit-scrollbar-thumb {
  background: #3b6ff2;
  border-radius: 2px;
}
.search-item {
  padding: 10px 15px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: 0.2s;
}
.search-item:hover {
  background: rgba(59, 111, 242, 0.3);
  color: #fff;
}

/* --- СТИЛИ ДЛЯ ПИСЕМ (Block 1 & 2) --- */
.letters-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.letters-header-row .section-title {
  margin: 0;
}
.letters-tabs-main {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 3px;
  margin-bottom: 0;
  width: 210px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.tab-btn-main {
  width: 50%;
  flex: 1;
  text-align: center;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  border-radius: 40px;
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  font-weight: 400;
}
.tab-btn-main:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.tab-btn-main.active {
  background: #3b6ff2;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(59, 111, 242, 0.3);
}
.letters-cats-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.letters-cats-scroll::-webkit-scrollbar {
  display: none;
}
.cat-chip {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s;
}
.cat-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}
.cat-chip.active {
  background: rgba(59, 111, 242, 0.2);
  border-color: #3b6ff2;
  color: #fff;
}
.cat-chip.disabled {
  opacity: 0.3;
  pointer-events: none;
  display: none;
}
/* =========================================
   УМНЫЙ СКРОЛЛБАР (СМЕЩЕН ВПРАВО)
   ========================================= */

/* 1. Зона захвата (Трек) */
::-webkit-scrollbar {
  width: 12px; /* Достаточно узкий, но удобный для наведения */
  background-color: transparent;
}

/* 2. Фон трека */
::-webkit-scrollbar-track {
  background-color: transparent;
  margin-top: 20px;
  margin-bottom: 20px;
}

/* 3. Ползунок (ОБЫЧНОЕ СОСТОЯНИЕ) */
::-webkit-scrollbar-thumb {
  background-color: rgba(59, 111, 242, 0.4);
  border-radius: 10px;

  /* ТРЮК: Большая прозрачная рамка делает его визуально тонким */
  /* Реальная ширина = 12px. Рамка = 4px. Видимая часть = 4px. */
  border: 4px solid transparent;
  background-clip: content-box;

  transition: background-color 0.2s ease, border-width 0.2s ease;
}

/* 4. Ползунок (ПРИ НАВЕДЕНИИ) */
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(59, 111, 242, 0.8);

  /* Уменьшаем рамку -> ползунок становится "толще" */
  border: 2px solid transparent;
}
/* --- КНОПКА КОПИРОВАНИЯ (FIX) --- */

/* Контейнер: делаем relative, чтобы внутри всё позиционировать абсолютно */
.copy {
  position: relative;
  display: inline-block; /* Или inline-flex */
  width: 24px;
  height: 24px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 8px;
}

/* ОБЕ ИКОНКИ: Центрируем их в одной точке */
.copy .copy-icon,
.copy .check-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* Идеальный центр */
  transition: all 0.3s ease;
}

/* Старая иконка (квадратики) */
.copy .copy-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Новая иконка (галочка) - изначально скрыта */
.copy .check-icon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5); /* Чуть меньше, чтобы "выпрыгивала" */
}

/* --- СОСТОЯНИЕ "СКОПИРОВАНО" --- */

/* Скрываем старую */
.copy.copied .copy-icon {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
}

/* Показываем новую */
.copy.copied .check-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* --- ВСПЛЫВАЮЩАЯ ПОДСКАЗКА "СКОПИРОВАНО" --- */
.copy .copy-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px); /* Спрятана чуть ниже */
  background-color: #4caf50;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: sans-serif;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Эффект пружины */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Стрелочка вниз у подсказки */
.copy .copy-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #4caf50 transparent transparent transparent;
}

/* Анимация появления подсказки */
.copy.copied .copy-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px); /* Взлетает вверх */
}

/* =========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================= */

/* Базовые отступы для безопасной зоны (вырезы, индикатор) */
@supports (padding: max(0px)) {
  .main-menu,
  .footer {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  .footer {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* Планшет */
@media (max-width: 1024px) {
  :root {
    --header-h: 56px;
    --footer-h: 50px;
  }
  .menu-container {
    padding: 0 12px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .menu-left {
    gap: 10px;
    min-width: 0;
    flex: 0 1 auto;
  }
  .logo-globe-animated {
    width: 42px;
    height: 42px;
  }
  .logo-text {
    display: none; /* на планшетах и мобильных не помещается — убираем */
  }
  .menu-right {
    flex: 0 0 auto;
    min-width: 0;
    margin-left: auto !important;
    display: flex !important;
    align-items: center;
    gap: 8px;
  }
  .search-wrapper {
    flex: 0 1 160px;
    min-width: 0;
  }
  .search-container {
    width: 100%;
    min-width: 0;
    padding: 6px 10px;
  }
  .search-input {
    font-size: 13px;
  }
  .menu-right a[href*="logout"] {
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
  }
  /* Карточка и шкала — как на мобилке: шкала под карточкой, карточка на всю ширину */
  .scale {
    left: 16px;
    right: 16px;
    bottom: calc(var(--footer-h) + 12px);
    justify-content: flex-start;
    gap: 8px;
  }
  .scale .line {
    width: 24px;
  }
  .scale-text {
    font-size: 12px;
  }
  .info-card {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    bottom: calc(var(--footer-h) + 12px + 36px);
    padding: 10px 12px;
    max-height: 72px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .info-card .info-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-width: 0;
  }
  .info-text {
    font-size: 14px;
    line-height: 1.45;
  }
  .country-info {
    left: 16px;
    right: 16px;
    bottom: calc(var(--footer-h) + 12px + 36px);
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(12, 12, 12, 0.6);
    border: 1px solid rgba(95, 150, 255, 0.3);
  }
  .country-flag {
    width: 48px !important;
  }
  .country-name {
    font-size: 13px;
  }
  .zoom {
    right: 16px;
    width: 38px;
    height: 76px;
  }
  .zoom-btn {
    flex: 0 0 38px;
    min-height: 38px;
    max-height: 38px;
  }
  .zoom-btn img {
    width: 16px;
    height: 16px;
  }
  .detailed-overlay {
    top: var(--header-h);
    bottom: var(--footer-h);
    padding: 16px 20px;
  }
  .split-container {
    gap: 32px;
  }
  .col-left {
    min-width: 0;
    width: 48%;
  }
  .card-header {
    padding: 14px 16px 14px 24px;
  }
  .card-body.scrollable-content,
  .card-body {
    padding: 18px 20px 28px 20px !important;
  }
  #detail-name {
    font-size: 20px;
  }
  .btn-back {
    top: 24px !important;
    right: 24px !important;
    font-size: 12px;
  }
  .back-map-button {
    top: 80px;
    left: 16px;
    padding: 10px 18px;
    font-size: 13px;
  }
  .footer-container {
    padding: 0 16px;
    font-size: 12px;
  }
}

/* Мобильный (всё в одну строку в хедере) */
@media (max-width: 768px) {
  :root {
    --header-h: 48px;
    --footer-h: 44px;
  }
  .menu-container {
    padding: 0 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .menu-left {
    gap: 8px;
    min-width: 0;
  }
  .logo img,
  .logo-globe-animated {
    width: 36px;
    height: 36px;
  }
  .logo-text {
    display: none;
  }
  .menu-right {
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-left: auto !important;
    display: flex !important;
    align-items: center;
    gap: 6px;
    width: auto !important;
    order: unset;
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
  }
  .search-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 320px; /* подлиннее поисковик — названия стран помещаются */
  }
  .search-container {
    padding: 5px 8px;
    min-width: 0;
  }
  .search-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
  }
  .search-input {
    font-size: 12px;
    min-width: 0;
  }
  .search-input::placeholder {
    font-size: 11px;
  }
  .search-toggle-label {
    padding-left: 6px;
    margin-left: 2px;
  }
  .chevron-icon {
    width: 6px;
    height: 6px;
    border-right-width: 1.5px;
    border-bottom-width: 1.5px;
    transform: rotate(45deg) translateY(-1.5px);
  }
  .search-toggle-label input:checked ~ .chevron-icon {
    transform: rotate(225deg) translateY(-1.5px);
  }
  .search-dropdown.is-open {
    max-height: 220px; /* меню выбора страны поменьше в высоту */
  }
  .search-item {
    padding: 5px 10px;
    font-size: 12px;
    min-height: 32px;
    display: flex;
    align-items: center;
  }
  .menu-right a[href*="logout"] {
    font-size: 10px;
    padding: 4px 8px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
  }
  .map-wrap {
    padding-bottom: var(--footer-h);
  }
  /* Шкала — отдельной строкой под карточкой, чтобы карточка была на всю ширину */
  .scale {
    left: 12px;
    right: 12px;
    bottom: calc(var(--footer-h) + 8px);
    justify-content: flex-start;
    gap: 6px;
    z-index: 2;
  }
  .scale .line {
    width: 20px;
    flex-shrink: 0;
  }
  .scale-text {
    font-size: 11px;
    white-space: nowrap;
  }

  .info-card {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    bottom: calc(var(--footer-h) + 8px + 32px); /* выше шкалы */
    padding: 10px 12px;
    max-height: 70px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .info-card .info-icon {
    flex-shrink: 0;
  }
  .info-card .info-icon img {
    width: 32px;
    height: 32px;
  }
  .info-card .info-text {
    font-size: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-width: 0;
  }
  .country-info {
    left: 12px;
    right: 12px;
    bottom: calc(var(--footer-h) + 8px + 32px); /* выше шкалы */
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(12, 12, 12, 0.6);
    border: 1px solid rgba(95, 150, 255, 0.3);
  }
  .country-info .country-flag {
    width: 40px !important;
  }
  .country-info .country-name {
    font-size: 13px;
  }
  .country-info .country-density-value,
  .country-info .country-density-label {
    font-size: 11px;
  }

  /* Горизонтальное положение телефона: компактнее карточка и шкала */
  @media (max-width: 768px) and (orientation: landscape) {
    .scale {
      bottom: calc(var(--footer-h) + 6px);
      gap: 5px;
    }
    .scale .line {
      width: 16px;
    }
    .scale-text {
      font-size: 10px;
    }
    .info-card {
      bottom: calc(var(--footer-h) + 6px + 28px);
      padding: 6px 10px;
      max-height: 52px;
      gap: 8px;
    }
    .info-card .info-icon img {
      width: 26px;
      height: 26px;
    }
    .info-card .info-text {
      font-size: 11px;
      -webkit-line-clamp: 2;
      line-height: 1.35;
    }
    .country-info {
      bottom: calc(var(--footer-h) + 6px + 28px);
      padding: 6px 10px;
      gap: 6px;
    }
    .country-info .country-flag {
      width: 36px !important;
    }
    .country-info .country-name,
    .country-info .country-density-value,
    .country-info .country-density-label {
      font-size: 10px;
    }
  }

  .zoom {
    right: 12px;
    width: 34px;
    height: 68px;
    border-radius: 10px;
  }
  .zoom-btn {
    flex: 0 0 34px;
    min-height: 34px;
    max-height: 34px;
  }
  .zoom-btn img {
    width: 14px;
    height: 14px;
  }
  .back-map-button {
    top: 72px;
    left: 12px;
    padding: 10px 16px;
    font-size: 13px;
  }
  .back-map-button svg {
    width: 16px;
    height: 16px;
  }
  /* --- Детальная страница страны: мобильная адаптация (768px) --- */
  .detailed-overlay {
    top: var(--header-h);
    bottom: var(--footer-h);
    left: 0;
    right: 0;
    padding: 8px 10px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  /* Без transform — кнопка «назад» привязана к окну, не скроллится */
  #detailed-page.detailed-overlay.visible {
    transform: none !important;
  }
  /* Скрыть полосу прокрутки у оверлея детальной страницы на мобильном */
  #detailed-page.detailed-overlay {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  #detailed-page.detailed-overlay::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  .detailed-overlay .split-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .btn-back {
    position: fixed !important;
    top: max(calc(var(--header-h) + 12px), env(safe-area-inset-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    left: auto !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    background: rgba(13, 32, 67, 0.95);
    backdrop-filter: blur(8px);
    z-index: 100;
  }
  .btn-back .back-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
  /* Мобильная детальная: стрелка закреплена в блоке над картой, двигается вместе с контентом (как картинка страны) */
  #detailed-page .detail-mobile-back-wrap {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px 12px !important;
    min-height: 48px !important;
    order: -1 !important;
    z-index: 10 !important;
  }
  #detailed-page .detail-mobile-back-wrap .btn-back {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    z-index: 10 !important;
  }
  #detailed-page .btn-back .btn-back-text {
    display: none !important;
  }
  #detailed-page .btn-back .back-icon {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    object-fit: contain !important;
  }
  /* Мобильная детальная страница: контур + карточка, общий скролл как раньше, без полосы прокрутки */
  #detailed-page .split-container {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    align-items: stretch;
    max-width: 100%;
  }
  /* Скрыть полосу прокрутки (перебиваем глобальные ::-webkit-scrollbar) */
  #detailed-page .split-container::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  #detailed-page .split-container::-webkit-scrollbar-track,
  #detailed-page .split-container::-webkit-scrollbar-thumb {
    display: none !important;
  }
  #detailed-page.detailed-overlay::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  /* БЛОК 1: Контур страны */
  #detailed-page .col-right {
    order: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 180px;
    margin: 0 !important;
    padding: 20px 12px 0 12px !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    overflow: visible;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  #detailed-page .col-right .map-block {
    gap: 4px;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box;
  }
  /* Спейсер сверху: физический блок 48px, контур начинается под ним */
  #detailed-page .col-right .map-block::before {
    content: '';
    display: block;
    height: 220px;
    min-height: 220px;
    width: 100%;
    flex-shrink: 0;
  }
  #detailed-page .map-block .country-flag-map,
  #detailed-page .map-block svg.country-flag-map {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: min(40vh, 300px) !important;
    object-fit: contain !important;
    object-position: center center;
    display: block !important;
    vertical-align: middle;
  }
  #detailed-page .col-right .map-block {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  #detailed-page .map-wrapper-right,
  #detailed-page #mini-map-container {
    max-height: 28px;
    overflow: hidden;
    flex-shrink: 0;
  }
  /* БЛОК 2: Карточка */
  #detailed-page .col-left {
    order: 2 !important;
    width: 100% !important;
    min-width: 0;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 0;
  }
  #detailed-page .col-left .card-header,
  #detailed-page .col-left .left-panel-card {
    z-index: auto;
  }
  #detailed-page .col-left .left-panel-card {
    margin: 0 !important;
    margin-top: 0 !important;
  }
  .left-panel-card {
    margin: 0;
    padding: 0 0 12px 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .card-header {
    padding: 10px 14px 10px 16px;
  }
  .header-main {
    gap: 14px;
    min-width: 0;
  }
  .header-main > div {
    min-width: 0;
  }
  #detail-name {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .flag-circle {
    width: 56px !important;
    height: auto !important;
    flex-shrink: 0;
  }
  #detail-name {
    font-size: 20px;
    line-height: 1.25;
  }
  .code-text {
    font-size: 13px;
  }
  #detailed-page .info-group + .info-group {
    margin-top: 18px;
  }
  .card-body.scrollable-content,
  .card-body {
    padding: 12px 14px 18px 14px !important;
  }
  .section-title {
    font-size: 13px;
    margin-bottom: 10px;
  }
  .text-desc {
    font-size: 12px;
    line-height: 1.4;
  }
  .file-card {
    padding: 10px 12px;
  }
  .file-card .fc-name {
    font-size: 13px;
    word-break: break-word;
  }
  .btn-toggle-info,
  .js-toggle-block {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  .block-header {
    padding: 14px 16px;
  }
  .letters-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .letters-tabs-main {
    width: 100%;
    max-width: 260px;
  }
  .tab-btn-main {
    padding: 10px 0;
    font-size: 14px;
  }
  .cat-chip {
    padding: 8px 14px;
    font-size: 13px;
  }
  .contact-item {
    flex-wrap: wrap;
  }
  .footer-container {
    padding: 0 12px;
    font-size: 11px;
  }
  body.bx-panel-fixed .detailed-overlay {
    top: calc(39px + var(--header-h));
  }
}

/* Телефон (портрет) — в хедере только логотип, поиск, выход */
@media (max-width: 480px) {
  :root {
    --header-h: 44px;
  }
  .menu-container {
    padding: 0 8px;
    gap: 4px;
    min-width: 0;
  }
  .logo-text {
    display: none;
  }
  .menu-left {
    flex: 0 0 auto;
    flex-shrink: 0;
  }
  .logo-globe-animated {
    width: 32px;
    height: 32px;
  }
  .search-wrapper {
    flex: 1 1 0;
    min-width: 0;
    max-width: 200px; /* подлиннее поисковик — названия и текст помещаются */
  }
  .search-container {
    padding: 4px 6px;
    min-width: 0;
  }
  .search-input {
    min-width: 0;
  }
  .search-input::placeholder {
    font-size: 10px;
  }
  .chevron-icon {
    width: 5px;
    height: 5px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    transform: rotate(45deg) translateY(-1px);
  }
  .search-toggle-label input:checked ~ .chevron-icon {
    transform: rotate(225deg) translateY(-1px);
  }
  .search-dropdown.is-open {
    max-height: 200px; /* меню выбора страны поменьше в высоту */
  }
  .search-item {
    padding: 4px 8px;
    min-height: 28px;
    font-size: 11px;
  }
  .menu-right a[href*="logout"] {
    flex-shrink: 0;
    font-size: 9px;
    padding: 3px 6px;
    white-space: nowrap;
  }
  .info-card {
    max-height: 64px;
    padding: 8px 10px;
  }
  .info-card .info-icon img {
    width: 28px;
    height: 28px;
  }
  .info-card .info-text {
    font-size: 11px;
    -webkit-line-clamp: 3;
  }
  .country-name {
    font-size: 12px;
    max-width: 180px;
  }
  /* --- Детальная страница: телефон (480px) --- */
  .detailed-overlay {
    padding: 6px 8px 8px;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .btn-back {
    top: max(calc(var(--header-h) + 6px), env(safe-area-inset-top)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
  .btn-back .back-icon {
    width: 16px;
    height: 16px;
  }
  #detailed-page .col-right {
    margin: 0 !important;
    padding: 16px 10px 0 10px !important;
    min-height: 160px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  #detailed-page .col-right .map-block {
    padding-top: 0 !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  #detailed-page .col-right .map-block::before {
    height: 220px;
    min-height: 220px;
  }
  #detailed-page .col-left {
    padding: 0 !important;
  }
  #detailed-page .map-block .country-flag-map,
  #detailed-page .map-block svg.country-flag-map {
    max-height: min(36vh, 260px) !important;
  }
  #detailed-page .map-wrapper-right,
  #detailed-page #mini-map-container {
    max-height: 24px;
  }
  #detail-name {
    font-size: 17px;
  }
  .code-text {
    font-size: 12px;
  }
  .card-header {
    padding: 10px 12px 10px 14px;
  }
  .header-main {
    gap: 10px;
  }
  .flag-circle {
    width: 44px !important;
  }
  .card-body.scrollable-content,
  .card-body {
    padding: 10px 12px 14px 12px !important;
  }
  #detailed-page .info-group + .info-group {
    margin-top: 14px;
  }
  .section-title {
    font-size: 12px;
    margin-bottom: 8px;
  }
  .text-desc {
    font-size: 11px;
  }
  .file-card {
    padding: 8px 10px;
  }
  .file-card .fc-name {
    font-size: 12px;
  }
  .left-panel-card {
    border-radius: 12px;
    padding: 0 0 10px 0;
  }
  .block-header {
    padding: 10px 12px;
  }
  .fc-actions .btn-icon-action,
  .fc-actions .fc-download {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .back-map-button span {
    display: none;
  }
  .back-map-button {
    padding: 12px 14px;
    border-radius: 50%;
  }
  .back-map-button svg {
    margin: 0;
  }
}

/* Узкий экран */
@media (max-width: 360px) {
  :root {
    --header-h: 52px;
    --footer-h: 40px;
  }
  .menu-container {
    padding: 0 8px;
    gap: 4px;
  }
  .search-wrapper {
    max-width: 165px; /* подлиннее поисковик на узком экране */
  }
  .search-container {
    padding: 4px 6px;
  }
  .search-dropdown.is-open {
    max-height: 180px;
  }
  .menu-right a[href*="logout"] {
    font-size: 8px;
    padding: 2px 5px;
  }
  /* --- Детальная страница: узкий экран (360px) --- */
  .detailed-overlay {
    padding: 4px 6px 6px;
    padding-top: max(4px, env(safe-area-inset-top));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .btn-back {
    top: max(calc(var(--header-h) + 4px), env(safe-area-inset-top)) !important;
    right: max(6px, env(safe-area-inset-right)) !important;
    padding: 6px 8px !important;
    font-size: 11px !important;
  }
  .btn-back .back-icon {
    width: 14px;
    height: 14px;
  }
  #detailed-page .col-right {
    margin: 0 !important;
    padding: 14px 8px 0 8px !important;
    min-height: 140px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  #detailed-page .col-right .map-block {
    padding-top: 0 !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
  #detailed-page .col-right .map-block::before {
    height: 220px;
    min-height: 220px;
  }
  #detailed-page .col-left {
    padding: 0 !important;
  }
  #detailed-page .map-block .country-flag-map,
  #detailed-page .map-block svg.country-flag-map {
    max-height: min(32vh, 220px) !important;
  }
  #detailed-page .map-wrapper-right,
  #detailed-page #mini-map-container {
    max-height: 20px;
  }
  .card-header {
    padding: 8px 10px 8px 12px;
  }
  .header-main {
    gap: 8px;
  }
  .flag-circle {
    width: 40px !important;
  }
  #detail-name {
    font-size: 15px;
  }
  .code-text {
    font-size: 11px;
  }
  .card-body.scrollable-content,
  .card-body {
    padding: 8px 10px 12px 10px !important;
  }
  #detailed-page .info-group + .info-group {
    margin-top: 12px;
  }
  .section-title {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .text-desc {
    font-size: 11px;
  }
  .file-card {
    padding: 6px 8px;
  }
  .file-card .fc-name {
    font-size: 11px;
  }
  .left-panel-card {
    border-radius: 10px;
    padding: 0 0 8px 0;
  }
  .block-header {
    padding: 8px 10px;
  }
}