.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  /* Слой из z-шкалы (tokens.css): выше панели ассистента, ниже toast-стека
     и онбординга — без хардкода «максимального» z. */
  z-index: var(--z-consent, 2147483100);
  isolation: isolate;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(3,20,14,.97), rgba(2,12,9,.98));
  border: 1px solid rgba(46,230,168,.22);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.85);
  color: #e8fff5;
  font: 14px/1.45 var(--font, system-ui, sans-serif);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.cookie-banner[hidden] { display: none !important; }
.cookie-banner p { margin: 0 0 12px; opacity: .92; }
.cookie-banner a { color: #2ee6a8; }
.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cookie-banner__actions button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}
.cookie-banner__accept {
  background: linear-gradient(135deg, #2ee6a8, #0fae7a);
  color: #04140d;
  font-weight: 600;
}
.cookie-banner__decline {
  background: rgba(255,255,255,.08);
  color: #e8fff5;
}
.cookie-banner__settings {
  background: transparent;
  color: #9fdcc4;
  text-decoration: underline;
}

body.cookie-consent-open,
body.onboarding-open { overflow: hidden !important; }

/* Class-based fallback for Android WebView/Samsung Internet versions where
   :has() is missing or behaves inconsistently during a DOM mutation. */
body.cookie-consent-open #mobileNav,
body.cookie-consent-open .mobile-nav,
body.cookie-consent-open #omniAssistant,
body.cookie-consent-open .ta-search-launcher,
body.cookie-consent-open .ta-feedback,
body.onboarding-open #mobileNav,
body.onboarding-open .mobile-nav,
body.onboarding-open #omniAssistant,
body.onboarding-open .ta-search-launcher,
body.onboarding-open .ta-feedback {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Студия: нижняя mobile-nav перекрывала баннер (z-index wow-layer) */
@media (max-width: 820px) {
  .cookie-banner {
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 14px 16px;
  }
  body:has(.mobile-nav) .cookie-banner {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
  /* Аудит (первый визит): строка ассистента — fixed на bottom:84px, фактическая
     высота по Playwright-прогону ~103px (верхняя кромка ~187px от низа).
     Баннер поднимаем выше с запасом, чтобы согласие и ассистент не
     перекрывались и оба оставались кликабельными. */
  body:has(.mobile-nav):has(#omniAssistant) .cookie-banner {
    bottom: calc(252px + env(safe-area-inset-bottom));
  }
  /* While consent is open the nav, assistant, search and feedback controls are
     inert and hidden (rules above). The old 252px reservation therefore left
     the banner floating over the hero for no reason. */
  body.cookie-consent-open .cookie-banner {
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
  body:has(.onboarding-overlay:not([hidden])) .cookie-banner {
    display: none !important;
  }
}

@media (max-width: 520px) {
  .cookie-banner__actions {
    display: grid;
    grid-template-columns: minmax(0,.82fr) minmax(0,1.18fr);
  }
  .cookie-banner__actions button {
    width: 100%;
    text-align: center;
    padding-inline: 10px;
    font-size: 13px;
  }
}
