:root {
  --color-donate-box-background: #ffffff;
  --color-donate-box-header-background: #f5f5f5;
  --color-donate-box-header-foreground: #444444;

  --color-donate-modal-wrapper-background: #00000080;
  --color-donate-button-foreground: #ffffff;
  --color-donate-red: #f05159;
  --color-donate-pay-border: #eeeeee;
  --color-donate-button-money-hover: #ff33660f;
}

.dark {
  --color-donate-box-background: #2f2f2f;
  --color-donate-box-header-background: #383838;
  --color-donate-box-header-foreground: #e6e6e6;
}

.donate {
  margin: 16px auto 16px;
  text-align: center;
}

.donate-slug {
  display: none;
}

.donate,
.donate-button {
  font-size: 1em;
  font-weight: bold;
}

.donate-button {
  color: var(--color-donate-button-foreground);
  background: var(--color-donate-red);
  width: 80px;
  height: 34px;
  border-radius: 0.25rem;
  margin: 12px auto 12px auto;
  padding: 0;
  cursor: pointer;
  border: none;
}

.donate-modal-wrapper {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999;
  display: none;
  flex-direction: column;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  background-color: var(--color-donate-modal-wrapper-background);
  transform: scale(1.1);
  transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
}

.donate-modal-wrapper-show {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}

.donate-modal {
  width: min(360px, calc(100vw - 32px));
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  margin-right: auto;
  margin-left: auto;
  box-sizing: border-box;
}

.donate-modal:focus {
  outline: none;
}

.donate-box {
  overflow: auto;
  background: var(--color-donate-box-background);
  border-radius: 0.25rem;
}

.donate-box-content {
  flex: 1 1;
  padding: 24px;
  line-height: 1em;
}

.donate-box-content-inner {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
}

.donate-box-close-button {
  position: absolute;
  top: 8px;
  right: -60px;
  padding: 12px;
  height: auto;
  line-height: inherit;
  background-color: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.donate-box-close-button-icon {
  vertical-align: top;
}

.donate-box-header {
  height: 2em;
  font-size: 1em;
  font-weight: bold;
  line-height: 2em;
  background: var(--color-donate-box-header-background);
  border-radius: 0.25rem;
  color: var(--color-donate-box-header-foreground);
  margin-bottom: 20px;
  position: relative;
  text-align: center;
}

.donate-box-body {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
}

.donate-box-footer {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  display: flex;
}

.donate-box-money {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 20px;
  margin-bottom: 24px;
}

.donate-box-money-button {
  border-color: var(--color-donate-red);
  color: var(--color-donate-red);
  width: 100%;
  margin: 0;
  font-size: 1em;
  font-weight: bold;
  display: inline-block;
  padding: 0;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: 1px solid var(--color-donate-red);
  border-radius: 0.25rem;
}

.donate-box-money-button-unchecked:hover {
  background-color: var(--color-donate-button-money-hover);
}

.donate-box-money-button-checked {
  background: var(--color-donate-red);
  color: var(--color-donate-button-foreground);
}

.donate-box-pay {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
  display: none;
}

.donate-box-pay-qrcode-frame {
  position: relative;
  width: 220px;
  height: 220px;
  overflow: hidden;
  background: #ffffff;
}

.donate-box-pay-qrcode {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  transform-origin: top left;
}

.donate-box-pay-qrcode[data-method="wechat-pay"] {
  width: 467px;
  transform: translate(-124px, -186px);
}

.donate-box-pay-qrcode[data-method="alipay"] {
  width: 344px;
  transform: translate(-62px, -188px);
}

.donate-box-pay-method {
  width: 46%;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid;
  border-radius: 0.25rem;
  border-color: var(--color-donate-pay-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.donate-box-pay-method-checked {
  border-color: var(--color-donate-red);
}

.donate-box-pay-method-image {
  width: 32px;
  height: 32px;
  vertical-align: middle;
}

.donate-box-pay-method-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  white-space: nowrap;
}

.donate-box-pay-method-label strong {
  font-size: 0.95em;
}

.donate-box-pay-method-label small {
  margin-top: 2px;
  font-size: 0.65em;
  color: var(--color-secondary);
}

.donate-button:focus-visible,
.donate-box-close-button:focus-visible,
.donate-box-money-button:focus-visible,
.donate-box-pay-method:focus-visible {
  outline: 2px solid var(--color-donate-red);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .donate-box-close-button {
    top: -48px;
    right: 0;
  }
}

@media (max-width: 360px) {
  .donate-box-content {
    padding: 16px;
  }

  .donate-box-money {
    gap: 12px;
  }

  .donate-box-pay-method {
    width: 48%;
    padding: 6px 4px;
    gap: 5px;
  }

  .donate-box-pay-method-image {
    width: 28px;
    height: 28px;
  }

  .donate-box-pay-method-label strong {
    font-size: 0.82em;
  }

  .donate-box-pay-method-label small {
    font-size: 0.58em;
  }
}

@media (max-height: 600px) {
  .donate-box-close-button {
    top: 8px;
    right: 8px;
    z-index: 2;
    padding: 6px;
    border-radius: 50%;
    background: #00000080;
  }
}
