:root {
  --cookie-surface: rgba(255, 255, 255, 0.97);
  --cookie-surface-soft: rgba(248, 243, 236, 0.96);
  --cookie-ink: #1e2b38;
  --cookie-muted: #637180;
  --cookie-line: rgba(30, 43, 56, 0.1);
  --cookie-shadow: 0 24px 60px rgba(28, 42, 57, 0.18);
}

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(1120px, calc(100% - 24px));
  z-index: 260;
  background: linear-gradient(180deg, var(--cookie-surface), var(--cookie-surface-soft));
  border: 1px solid var(--cookie-line);
  border-radius: 24px;
  box-shadow: var(--cookie-shadow);
  padding: 18px;
}

.cookie-banner[hidden],
.cookie-modal[hidden],
.cookie-backdrop[hidden] {
  display: none !important;
}

.cookie-banner-inner {
  display: grid;
  gap: 16px;
}

.cookie-banner-copy h3,
.cookie-modal h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--cookie-ink);
}

.cookie-banner-copy p,
.cookie-modal p,
.cookie-toggle-copy p,
.cookie-footer-note {
  margin: 8px 0 0;
  color: var(--cookie-muted);
  line-height: 1.6;
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cookie-link,
.cookie-settings-link {
  color: #233d56;
  font-weight: 700;
  text-decoration: none;
}

.cookie-settings-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(30, 43, 56, 0.1);
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font: inherit;
  flex: 0 0 auto;
}

.cookie-backdrop {
  position: fixed;
  inset: 0;
  z-index: 270;
  background: rgba(17, 28, 40, 0.46);
  backdrop-filter: blur(4px);
}

.cookie-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 280;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 24px));
  max-height: min(88vh, 880px);
  overflow: auto;
  background: linear-gradient(180deg, var(--cookie-surface), var(--cookie-surface-soft));
  border: 1px solid var(--cookie-line);
  border-radius: 28px;
  box-shadow: var(--cookie-shadow);
  padding: 22px;
}

.cookie-modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cookie-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--cookie-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--cookie-ink);
  font-size: 1.4rem;
  cursor: pointer;
}

.cookie-groups {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.cookie-toggle-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--cookie-line);
  background: rgba(255, 255, 255, 0.84);
}

.cookie-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cookie-toggle-copy strong {
  font-size: 1rem;
  color: var(--cookie-ink);
}

.cookie-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 56px;
  height: 32px;
  flex: 0 0 auto;
}

.cookie-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.cookie-slider {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(30, 43, 56, 0.18);
  transition: background 0.18s ease;
}

.cookie-slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.18s ease;
}

.cookie-switch input:checked + .cookie-slider {
  background: linear-gradient(135deg, #233d56, #315270);
}

.cookie-switch input:checked + .cookie-slider::after {
  transform: translateX(24px);
}

.cookie-switch input:disabled + .cookie-slider {
  background: rgba(35, 61, 86, 0.4);
  cursor: not-allowed;
}

.cookie-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

@media (min-width: 840px) {
  .cookie-banner-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media (max-width: 839px) {
  .cookie-banner {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 16px);
    padding: 14px;
    border-radius: 20px;
    max-height: min(42vh, 340px);
    overflow: auto;
  }

  .cookie-modal {
    width: calc(100% - 16px);
    padding: 18px;
    border-radius: 24px;
  }

  .cookie-banner-actions,
  .cookie-modal-actions {
    display: grid;
  }

  .cookie-banner-actions .btn,
  .cookie-modal-actions .btn,
  .cookie-settings-link {
    width: 100%;
  }

  .cookie-banner-copy h3 {
    font-size: 1.04rem;
  }

  .cookie-banner-copy p {
    font-size: 0.92rem;
    line-height: 1.52;
  }

  .cookie-link {
    font-size: 0.92rem;
  }
}
