.donation-widget {
  --donation-green: #70A074;
  --donation-dark-green: #2c5e2e;
  --donation-soft-green: #e9f0e9;
  --donation-gold: #F1D302;
  --donation-text: #333;
}

.donation-trigger {
  position: fixed;
  right: clamp(1rem, 2vw, 1.75rem);
  bottom: calc(clamp(1rem, 2vw, 1.75rem) + env(safe-area-inset-bottom));
  z-index: 1100;
  display: grid;
  width: clamp(3.25rem, 5vw, 4rem);
  height: clamp(3.25rem, 5vw, 4rem);
  padding: 0.25rem;
  overflow: hidden;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--donation-green), var(--donation-dark-green));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.donation-trigger img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.donation-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.34);
}

.donation-trigger:focus-visible,
.donation-dialog__close:focus-visible,
.donation-dialog__cta:focus-visible {
  outline: 3px solid var(--donation-gold);
  outline-offset: 3px;
}

.donation-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.donation-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: transparent;
  color: var(--donation-text);
}

.donation-dialog:not([open]) {
  display: none;
}

.donation-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.donation-dialog::backdrop {
  background: rgba(35, 57, 39, 0.62);
  backdrop-filter: blur(2px);
}

.donation-dialog--fallback {
  background: rgba(35, 57, 39, 0.62);
}

.donation-dialog__surface {
  box-sizing: border-box;
  width: min(100%, 700px);
  max-height: 90vh;
  max-height: min(90vh, 640px);
  overflow-y: auto;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid #d0e0d0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
}

.donation-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--donation-soft-green);
}

.donation-dialog__kicker {
  color: var(--donation-dark-green);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.donation-dialog__close {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  margin: -0.25rem -0.25rem 0 0;
  border: 1px solid #d0e0d0;
  border-radius: 50%;
  background: var(--donation-soft-green);
  color: var(--donation-dark-green);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.donation-dialog__close:hover {
  background: #d0e0d0;
}

.donation-dialog__content {
  display: grid;
  gap: 1.5rem;
  padding-top: 1.25rem;
}

.donation-dialog__copy h2 {
  margin: 0 0 0.75rem;
  color: var(--donation-dark-green);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.2;
}

.donation-dialog__copy p {
  margin: 0 0 1.25rem;
  line-height: 1.6;
}

.donation-dialog__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  box-sizing: border-box;
  padding: 0.65rem 1.2rem;
  border: 2px solid var(--donation-dark-green);
  border-radius: 8px;
  background: var(--donation-green);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.donation-dialog__cta:hover {
  background: var(--donation-dark-green);
  transform: translateY(-1px);
}

.donation-dialog__note {
  margin-top: 0.85rem !important;
  color: #666;
  font-size: 0.8rem;
}

.donation-dialog__qr {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.65rem;
  text-align: center;
}

.donation-dialog__qr img {
  display: block;
  width: min(100%, 210px);
  height: auto;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.donation-dialog__qr p {
  max-width: 210px;
  margin: 0;
  color: #555;
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .donation-dialog__content {
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: center;
  }

  .donation-dialog__qr {
    display: flex;
  }
}

@media (max-width: 767px) {
  .donation-trigger {
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    width: 3.25rem;
    height: 3.25rem;
    border-width: 2px;
  }

  .donation-dialog {
    padding: 0.75rem;
  }

  .donation-dialog__surface {
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    border-radius: 16px;
    padding: 1.25rem;
  }
}

@media (max-width: 380px) {
  .donation-trigger {
    width: 3rem;
    height: 3rem;
  }

  .donation-dialog__surface {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .donation-trigger,
  .donation-dialog__cta {
    transition: none;
  }

  .donation-trigger:hover,
  .donation-dialog__cta:hover {
    transform: none;
  }
}
