.analytics-consent {
  position: fixed;
  z-index: 2400;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  width: min(760px, calc(100% - 32px));
  margin-inline: auto;
  padding: 24px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
}

.analytics-consent[hidden],
.analytics-settings-button[hidden],
.analytics-consent-close[hidden] {
  display: none;
}

.analytics-consent h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.25rem;
}

.analytics-consent p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

main p a,
footer p a,
.analytics-consent a {
  text-decoration: underline;
  text-decoration-thickness: max(1px, 0.08em);
  text-underline-offset: 0.18em;
}

.analytics-consent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.analytics-consent .btn {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.95rem;
}

.analytics-consent-close {
  min-height: 44px;
  padding: 8px 4px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.analytics-consent-close:hover {
  color: var(--text);
}

.analytics-settings-button {
  position: fixed;
  z-index: 2300;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  min-height: 44px;
  padding: 10px 14px;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.analytics-settings-button:hover {
  border-color: var(--primary);
}

@media (max-width: 520px) {
  .analytics-consent {
    padding: 20px;
  }

  .analytics-consent-actions .btn,
  .analytics-consent-close {
    width: 100%;
    max-width: none;
    justify-content: center;
  }
}

@media (prefers-color-scheme: light) {
  .badge-initial {
    color: #166534;
    border-color: rgba(22, 101, 52, 0.45);
  }
}

@media print {
  .analytics-consent,
  .analytics-settings-button {
    display: none;
  }
}
