dialog.checkout-dialog {
  --checkout-ink: #33172e;
  --checkout-accent: #552047;
  --checkout-muted: #6c5667;
  --checkout-line: #e2d7df;
  --checkout-paper: #fffdfb;
  width: min(418px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--checkout-ink);
  background: var(--checkout-paper);
  border: 0;
  border-radius: 24px;
  box-shadow: 0 16px 52px rgba(47, 23, 49, .23), 0 2px 8px rgba(47, 23, 49, .1);
  font-family: var(--body, system-ui, sans-serif);
  line-height: 1.4;
}

.checkout-dialog::backdrop {
  background: rgba(63, 39, 77, .31);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.checkout-card { min-width: 0; }

.checkout-hero {
  position: relative;
  display: grid;
  align-content: end;
  width: 100%;
  min-height: 166px;
  aspect-ratio: 2.2;
  padding: 18px clamp(18px, 5.4vw, 24px) 21px;
  color: #fffaf7;
  background-color: #38192e;
  background-image: linear-gradient(90deg, rgba(40, 12, 32, .18), transparent 72%),
    url("/img/checkout-cover.webp"), linear-gradient(115deg, #35162d, #583449);
  background-size: cover;
  background-position: right center;
}

.checkout-brand,
.checkout-dialog .checkout-title,
.checkout-price,
.checkout-benefits {
  font-family: Georgia, "Times New Roman", serif;
}

.checkout-brand {
  align-self: start;
  margin-bottom: 1.1em;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.checkout-dialog .checkout-title {
  max-width: 72%;
  margin: 0;
  color: #f8e3cd;
  font-size: clamp(24px, 6.7vw, 29px);
  font-weight: 700;
  line-height: 1.13;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

.checkout-title:focus { outline: none; }

.checkout-price {
  max-width: 74%;
  margin: 3px 0 4px;
  color: #fff;
  font-size: clamp(36px, 10.5vw, 46px);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.checkout-terms {
  max-width: 74%;
  margin: 0;
  color: #fff4ed;
  font-size: 13px;
  line-height: 1.4;
}

.checkout-close {
  position: absolute;
  top: 3px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
}

.checkout-close svg { width: 18px; height: 18px; }

.checkout-body {
  padding: 14px clamp(16px, 4.8vw, 21px) 5px;
  background: linear-gradient(var(--checkout-paper), #fff 34%, #fff 81%, var(--checkout-paper));
}

.checkout-benefits {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
}

.checkout-payment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 15px;
}

.checkout-payment-title {
  margin: 0;
  font-size: clamp(16px, 4.4vw, 19px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.checkout-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  color: var(--checkout-muted);
  border: 1px solid var(--checkout-line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
}

.checkout-status[data-state="pending"] {
  position: relative;
  margin-left: auto;
  color: #542847;
  border-color: #9c8294;
}

.checkout-status[data-state="pending"]::before {
  position: absolute;
  right: calc(100% + 5px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d28a28;
  content: "";
}

.checkout-qr {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding-top: 11px;
}

.checkout-qr-image {
  display: block;
  width: min(100%, 232px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
  background: #fff;
}

.checkout-deadline {
  margin: 0;
  color: var(--checkout-ink);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.checkout-deadline svg {
  width: 16px;
  height: 16px;
  margin-right: 5px;
  vertical-align: -.18em;
}

.checkout-save,
.checkout-dialog .checkout-retry,
.checkout-dialog .checkout-login button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  margin: 6px 0 0;
  padding: 10px 14px;
  color: #fff;
  background: var(--checkout-accent);
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.checkout-save svg { width: 19px; height: 19px; flex: none; }

.checkout-note,
.checkout-login {
  color: var(--checkout-muted);
  font-size: 14px;
  line-height: 1.45;
}

.checkout-note { margin: 11px 0; text-align: center; }
.checkout-note:empty { margin: 0; }
.checkout-login { margin: 0 0 15px; }
.checkout-login button { margin-top: 10px; }

.checkout-check,
.checkout-logout {
  display: block;
  min-height: 44px;
  padding: 9px 4px;
  color: var(--checkout-accent);
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.checkout-check { width: 100%; text-align: center; }

.checkout-details {
  margin-top: 6px;
  border-top: 1px solid var(--checkout-line);
}

.checkout-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 3px 10px 0;
  list-style: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.checkout-details > summary::-webkit-details-marker { display: none; }

.checkout-details > summary::after {
  flex: none;
  width: 8px;
  height: 8px;
  border-top: 1.8px solid;
  border-right: 1.8px solid;
  transform: rotate(45deg);
  content: "";
}

.checkout-details[open] > summary::after { transform: rotate(135deg); }

.checkout-metadata {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0 0 6px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.checkout-metadata dt { color: var(--checkout-muted); }
.checkout-metadata dd { margin: 0; text-align: right; }

.checkout-dialog :is(button, summary):focus-visible {
  outline: 3px solid #855a88;
  outline-offset: 2px;
}

.checkout-dialog .checkout-close:focus-visible { outline-color: #fff4da; outline-offset: -5px; }
.checkout-dialog button:disabled { cursor: wait; opacity: .65; }
.checkout-dialog [hidden] { display: none !important; }

@media (hover: hover) {
  .checkout-close:hover { background: rgba(255, 255, 255, .12); }
  .checkout-dialog :is(.checkout-save, .checkout-retry, .checkout-login button):enabled:hover { background: #401735; }
  .checkout-dialog :is(.checkout-check, .checkout-logout, .checkout-details > summary):hover { text-decoration: underline; }
}

@media (max-width: 359px) {
  dialog.checkout-dialog { width: calc(100% - 16px); }
  .checkout-hero { min-height: 152px; padding: 16px; }
  .checkout-brand { margin-bottom: 15px; }
  .checkout-terms { font-size: 12px; }
  .checkout-body { padding-inline: 14px; }
  .checkout-payment-row { column-gap: 12px; }
  .checkout-payment-title { font-size: 15.5px; }
  .checkout-status { padding-inline: 6px; font-size: 10.5px; }
  .checkout-qr-image { width: min(100%, 216px); }
}
