/* CBI — cookie consent: компактная панель справа (Я.Метрика только после согласия) */

.cookie-consent {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: max(14px, env(safe-area-inset-bottom));
  left: auto;
  top: auto;
  z-index: 200;
  width: min(368px, calc(100vw - 28px));
  pointer-events: none;
  font-family: var(--font-body, system-ui, sans-serif);
}

.cookie-consent__panel {
  position: relative;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 4vw, 22px);
  padding-top: clamp(26px, 5vw, 30px);
  min-height: 0;
  background: linear-gradient(
    160deg,
    rgba(28, 31, 35, 0.97) 0%,
    rgba(18, 20, 22, 0.99) 100%
  );
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.22));
  border-radius: var(--r-card, 4px);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    -1px 0 0 rgba(var(--accent-rgb), 0.12) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .cookie-consent__panel {
    transition-duration: 0.01ms;
  }
}

.cookie-consent--dismissed .cookie-consent__panel {
  transform: translate3d(115%, 0, 0);
  opacity: 0;
  pointer-events: none;
}

.cookie-consent__corner {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 10px;
  pointer-events: none;
}

.cookie-consent__corner-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 18px;
  line-height: 1;
  background: rgba(var(--accent-rgb), 0.1);
  border: 2px solid var(--accent, #7ac637);
  border-radius: var(--r-card, 4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.cookie-consent__title {
  margin: 0;
  font-size: clamp(16px, 3.8vw, 18px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text, #f1efea);
}

.cookie-consent__text {
  margin: 0;
  font-size: var(--text-sm, 13px);
  line-height: 1.52;
  color: var(--text-soft, rgba(241, 239, 234, 0.78));
}

.cookie-consent__policies {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: var(--text-xs, 12px);
  line-height: 1.4;
}

.cookie-consent__policies li {
  margin: 0;
}

.cookie-consent__link {
  color: var(--accent, #7ac637);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.45);
  text-underline-offset: 0.17em;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.cookie-consent__link:hover {
  color: #cbff61;
  text-decoration-color: rgba(var(--accent-rgb), 0.85);
}

.cookie-consent__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.cookie-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--r-card, 4px);
  font-size: var(--text-xs, 12px);
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.18s ease;
}

.cookie-consent__btn:active {
  transform: scale(0.98);
}

.cookie-consent__btn--accept {
  background: var(--accent, #7ac637);
  color: #0a0d0a;
  border-color: var(--accent, #7ac637);
}

.cookie-consent__btn--accept:hover {
  background: #b8ff7a;
  border-color: #b8ff7a;
}

.cookie-consent__btn--decline {
  background: transparent;
  color: var(--text-mute, #a7a39b);
  border-color: var(--line-strong, rgba(255, 255, 255, 0.18));
}

.cookie-consent__btn--decline:hover {
  color: var(--text, #f1efea);
  border-color: var(--accent, #7ac637);
  background: var(--accent-soft, rgba(var(--accent-rgb), 0.14));
}

/* Узкие экраны: панель почти на всю ширину */
@media (max-width: 399px) {
  .cookie-consent {
    right: clamp(12px, 4vw, 20px);
    width: calc(100vw - 24px);
  }

  .cookie-consent__actions {
    grid-template-columns: 1fr 1fr;
  }
}

body.cookie-consent-visible {
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}

html[data-color-mode="light"] .cookie-consent__panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 242, 236, 0.99) 100%);
  box-shadow:
    0 12px 48px rgba(14, 15, 17, 0.12),
    0 0 0 1px rgba(14, 15, 17, 0.05) inset,
    -1px 0 0 rgba(var(--accent-rgb), 0.18) inset;
}
