.cookie-consent {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30000;
  display: none;
  justify-content: center;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.cookie-consent.open {
  display: flex;
}

.cookie-panel {
  width: min(720px, 100%);
  max-height: min(82vh, 720px);
  overflow: auto;
  pointer-events: auto;
  border: 1px solid rgba(158, 28, 28, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  color: #24140c;
  box-shadow: 0 20px 60px rgba(55, 20, 10, 0.24);
}

.cookie-panel.compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.cookie-title {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
  color: #9e1c1c;
}

.cookie-text {
  margin: 0;
  color: #65483a;
  font-size: 13px;
  line-height: 1.65;
}

.cookie-links {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cookie-links a {
  color: #b91c1c;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.cookie-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cookie-btn {
  min-height: 40px;
  border: 1px solid rgba(158, 28, 28, 0.2);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff8ed;
  color: #7a2116;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.cookie-btn.primary {
  border-color: #d42b2b;
  background: linear-gradient(135deg, #d42b2b, #f1a51c);
  color: #fff;
  box-shadow: 0 8px 18px rgba(212, 43, 43, 0.18);
}

.cookie-btn.ghost {
  background: #fff;
  color: #5a392b;
}

.cookie-settings {
  padding: 18px;
}

.cookie-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1dfc9;
}

.cookie-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #fff1df;
  color: #7a2116;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.cookie-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f4e7d5;
}

.cookie-category strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.cookie-category span {
  display: block;
  color: #72594d;
  font-size: 12px;
  line-height: 1.55;
}

.cookie-switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
}

.cookie-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cookie-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d8c8ba;
  transition: background 0.18s ease;
}

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

.cookie-switch input:checked + .cookie-slider {
  background: #16a34a;
}

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

.cookie-switch input:disabled + .cookie-slider {
  background: #9e1c1c;
}

.cookie-manage {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 25000;
  display: none;
  min-height: 34px;
  border: 1px solid rgba(158, 28, 28, 0.2);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255,255,255,0.94);
  color: #7a2116;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(55, 20, 10, 0.14);
  cursor: pointer;
}

.cookie-manage.show {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 720px) {
  .cookie-consent {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .cookie-panel.compact {
    display: block;
    padding: 15px;
  }

  .cookie-actions {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .cookie-actions .primary {
    grid-column: 1 / -1;
  }

  .cookie-btn {
    width: 100%;
    padding: 0 10px;
  }

  .cookie-manage {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}
