
.pay {
  --pay-inset: 7px;
  --pay-vh: 1vh;
  --pay-dvh: 1dvh;
  --popup-height: calc(100 * var(--pay-dvh) - var(--safe-top) - 100px - var(--pay-inset));
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 max(var(--pay-inset), var(--safe-right)) var(--pay-inset) max(var(--pay-inset), var(--safe-left));
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  visibility: hidden;
  transition: background 220ms ease, visibility 0s linear 300ms;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: normal;
}

.pay.open {
  background: rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  visibility: visible;
  transition: background 220ms ease, visibility 0s;
}

.pay-panel {
  width: 100%;
  max-height: var(--popup-height);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 15px max(14px, calc(var(--safe-bottom) - 8px));
  border-radius: 38px;
  background: #121214;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -12px 60px rgba(0, 0, 0, 0.45);
  color: #fff;
  transform: translateY(calc(100% + var(--pay-inset)));
  transition: transform 300ms ease-out;
}

.pay.open .pay-panel {
  transform: none;
}

.pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 10px;
  padding-left: 4px;
}

.pay-title {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  font: inherit;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.pay-logo {
  flex: none;
  width: 20px;
  height: 25px;
  margin-top: -3px;
  fill: currentColor;
}

.pay-cancel {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2c2c2e;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 500;
}

.pay-cancel svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }

.pay-group {
  padding: 0 15px;
  border-radius: 24px;
  background: #2c2c2e;
}

.pay-product {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
}

.pay-app-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.pay-product-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.pay-product-name {
  font-weight: 600;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.pay-product-sub {
  color: rgba(235, 235, 245, 0.6);
  font-size: 15px;
}

.pay-age {
  display: inline-block;
  padding: 0 3px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 11px;
  line-height: 13px;
  vertical-align: 2px;
}

.pay-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid #3a3a3c;
  font-size: 15px;
}

.pay-price-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.pay-price {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pay-license-row {
  justify-content: space-between;
  font-weight: 500;
  line-height: 1.3;
}

.pay-chevron { flex: none; width: 9px; height: 16px; fill: none; stroke: rgba(235, 235, 245, 0.6); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pay-account-row {
  justify-content: space-between;
  color: rgba(235, 235, 245, 0.6);
}

.pay-account { min-width: 0; overflow-wrap: anywhere; }

.pay-badge { flex: none; width: 34px; height: 16px; }
.pay-badge rect { fill: #fff; }
.pay-badge g { fill: #000; }

.pay-confirm {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 82px;
  margin-top: 10px;
  color: #fff;
}

@media (max-height: 700px) and (orientation: portrait) {
  .pay-head { margin-bottom: 6px; }
  .pay-product { padding: 10px 0; }
  .pay-row { padding: 9px 0; }
  .pay-confirm { min-height: 72px; margin-top: 4px; }
}

.pay-confirm.nudge .pay-ready {
  animation: pay-nudge 400ms ease;
}

.pay-state {
  grid-area: 1 / 1;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
}

.pay.ready .pay-ready,
.pay.busy .pay-busy,
.pay.done .pay-done {
  display: flex;
}

.pay-side-icon {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: #0a84ff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pay-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid #3a3a3c;
  border-top-color: #0a84ff;
  animation: pay-spin 0.8s linear infinite;
}

.pay-check {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #0a84ff;
  animation: pay-pop 300ms ease-out;
}

.pay-check::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 6px;
  width: 11px;
  height: 21px;
  border: solid #0a84ff;
  border-width: 0 3.5px 3.5px 0;
  transform: rotate(45deg);
}

.pay-done {
  color: #0a84ff;
  font-weight: 600;
}


.pay-side {
  --pay-sheet: var(--pay-sheet-top, calc(100 * var(--pay-vh) - var(--safe-bottom) - 450px));
  --pay-side-mid: calc(36 * var(--pay-vh) - 0.64 * 55px + 0.64 * var(--safe-top));
  --pay-side-top: max(calc(var(--safe-top) + 8px), min(calc(var(--pay-side-mid) - 24px), calc(var(--pay-sheet) - 60px)));
  position: fixed;
  z-index: 1;
  top: var(--pay-side-top);
  right: 0;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px 0 14px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  line-height: 1.2;
  opacity: 0;
  transition: opacity 200ms ease;
  cursor: pointer;
}

.pay.ready .pay-side {
  opacity: 1;
  animation: pay-side 1.2s ease-in-out infinite;
}

.pay-side-bar {
  position: absolute;
  top: calc(max(calc(var(--safe-top) + 8px), calc(var(--pay-side-mid) - 48px)) - var(--pay-side-top));
  right: 0;
  width: 6px;
  height: 96px;
  border-radius: 3px 0 0 3px;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
}

