:root {
  color-scheme: dark;
  --canvas: #020817;
  --panel: #061633;
  --panel-strong: #081d43;
  --panel-soft: #0c2857;
  --ink: #f4f8ff;
  --muted: #9cb6df;
  --line: rgba(65, 156, 255, 0.55);
  --line-soft: rgba(107, 157, 221, 0.32);
  --accent: #1eb8ff;
  --accent-strong: #0879f9;
  --secure: #77f3d1;
  --danger: #ff8092;
  --shadow: 0 24px 70px rgba(0, 8, 30, 0.62);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--canvas);
  background-image: url("picture/ui_part_01.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
  letter-spacing: 0;
}

h1,
p {
  margin: 0;
  letter-spacing: 0;
}

.page-state,
.success-shell {
  width: min(560px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.page-state[hidden],
.success-shell[hidden],
.checkout-shell[hidden] {
  display: none;
}

.state-panel,
.success-panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  text-align: center;
  background-color: rgba(4, 19, 48, 0.96);
  background-image: url("picture/ui_part_02.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: var(--shadow), inset 0 0 34px rgba(12, 103, 255, 0.18);
}

.spinner {
  width: 50px;
  height: 50px;
  display: inline-block;
  border: 4px solid rgba(117, 173, 237, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(30, 184, 255, 0.42);
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.checkout-shell {
  width: min(720px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 28px 0;
}

.checkout-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(40, 164, 255, 0.88);
  border-radius: 8px;
  padding: 28px;
  background-color: rgba(3, 17, 46, 0.97);
  box-shadow:
    var(--shadow),
    0 0 36px rgba(13, 111, 255, 0.28),
    inset 0 0 50px rgba(3, 91, 218, 0.18);
}

.checkout-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("picture/ui_part_02.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.32;
}

.checkout-frame > * {
  position: relative;
  z-index: 1;
}

.checkout-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.checkout-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.checkout-brand > img {
  width: 52px;
  height: 50px;
  flex: 0 0 auto;
  object-fit: contain;
}

.checkout-brand div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.checkout-brand strong {
  font-size: 23px;
  line-height: 1.15;
}

.checkout-brand span,
.secure-status span {
  color: var(--muted);
  font-size: 14px;
}

.secure-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(12, 40, 87, 0.82);
}

.secure-status img {
  width: 24px;
  height: 30px;
  object-fit: contain;
}

.secure-status span {
  color: #dbeaff;
  font-weight: 700;
}

.order-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(4, 22, 56, 0.78);
  box-shadow: inset 0 0 32px rgba(4, 81, 192, 0.15);
}

.amount-block > span,
.panel-heading p,
.eyebrow {
  color: #d7e6ff;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.amount-line {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

#currencyValue {
  color: #d9e8ff;
  font-size: 20px;
}

#amountValue {
  min-width: 0;
  color: #ffffff;
  font-size: 50px;
  line-height: 1;
  text-shadow: 0 0 15px rgba(62, 185, 255, 0.86);
  overflow-wrap: anywhere;
}

.order-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-top: 15px;
}

.order-row {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.order-row strong {
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.payment-panel {
  padding-top: 24px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading > div {
  min-width: 0;
}

.panel-heading p,
.eyebrow {
  color: var(--accent);
}

.panel-heading h1,
.success-panel h1 {
  margin-top: 5px;
  font-size: 29px;
  line-height: 1.12;
}

.panel-heading > span {
  flex: 0 0 auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px 11px;
  color: #d9e9ff;
  background: rgba(11, 42, 91, 0.72);
  font-size: 13px;
}

.payment-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.empty-state {
  min-height: 90px;
  display: grid;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: rgba(7, 31, 72, 0.72);
}

.payment-option {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--ink);
  background-color: rgba(8, 34, 77, 0.94);
  background-image: url("picture/ui_part_06.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.payment-option:hover {
  border-color: rgba(84, 186, 255, 0.72);
  transform: translateY(-1px);
}

.payment-option:focus-visible,
.pay-button:focus-visible {
  outline: 3px solid rgba(111, 239, 215, 0.42);
  outline-offset: 3px;
}

.payment-option.is-selected {
  border-color: #4dd7ff;
  background-image: url("picture/ui_part_41.png");
  box-shadow:
    0 0 18px rgba(38, 183, 255, 0.5),
    inset 0 0 16px rgba(14, 96, 255, 0.35);
}

.payment-icon {
  width: 62px;
  height: 58px;
  display: grid;
  place-items: center;
}

.payment-icon img {
  width: 58px;
  height: 54px;
  display: block;
  object-fit: contain;
}

.apple-icon {
  border: 1px solid rgba(111, 177, 255, 0.5);
  border-radius: 8px;
  background: rgba(3, 20, 49, 0.84);
}

.apple-icon img {
  width: 48px;
  height: 30px;
}

.payment-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.payment-copy strong {
  color: #ffffff;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.payment-copy > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.payment-radio {
  width: 38px;
  height: 38px;
  justify-self: end;
  background-image: url("picture/ui_part_20.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.payment-option.is-selected .payment-radio {
  background-image: url("picture/ui_part_21.png");
}

#paymentForm {
  margin: 0;
}

.card-fields {
  margin-top: 20px;
  padding-top: 2px;
}

.card-fields[hidden] {
  display: none;
}

.field-group {
  min-width: 0;
}

.field-label {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.frame-field {
  height: 58px;
  min-height: 58px;
  overflow: hidden;
  border: 1px solid rgba(73, 142, 230, 0.72);
  border-radius: 8px;
  padding: 0 14px;
  background-color: rgba(10, 42, 93, 0.92);
  background-image: url("picture/ui_part_08.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.frame-field iframe {
  width: 100%;
  height: 58px;
  min-height: 58px;
  background: transparent;
}

.mock-frame-value {
  height: 58px;
  display: flex;
  align-items: center;
  color: #7595c9;
  font-size: 16px;
}

.card-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.expiry-date-frame {
  background-image: url("picture/ui_part_13.png");
}

.cvv-frame {
  background-image: url("picture/ui_part_14.png");
}

.card-brands {
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.card-brands img {
  width: auto;
  height: 27px;
  object-fit: contain;
}

.pay-bar {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.pay-button {
  width: min(100%, 573px);
  min-height: 0;
  aspect-ratio: 573 / 90;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 10px 20px;
  color: #ffffff;
  background-color: transparent;
  background-image: url("picture/ui_part_23_clean.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 0 24px rgba(37, 181, 255, 0.5);
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

.pay-button > img:first-child {
  width: 28px;
  height: 34px;
  object-fit: contain;
}

.pay-button .pay-arrow {
  width: 20px;
  height: 34px;
  justify-self: end;
  object-fit: contain;
}

.pay-button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.pay-button:disabled {
  background-image: url("picture/ui_part_23_clean.png");
  filter: brightness(0.72);
  opacity: 0.78;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.checkout-footer {
  margin: 20px auto 0;
  max-width: 570px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.success-brand {
  width: 58px;
  height: 56px;
  margin-bottom: 14px;
  object-fit: contain;
}

.success-mark {
  width: 54px;
  height: 54px;
  position: relative;
  margin: 0 auto 17px;
  border: 1px solid var(--secure);
  border-radius: 50%;
  background: rgba(20, 164, 132, 0.24);
  box-shadow: 0 0 26px rgba(76, 241, 204, 0.3);
}

.success-mark::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 12px;
  width: 16px;
  height: 25px;
  border: solid var(--secure);
  border-width: 0 4px 4px 0;
  transform: rotate(45deg);
}

.success-panel p:not(.eyebrow) {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.success-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--muted);
  background: rgba(8, 35, 78, 0.78);
  text-align: left;
}

.success-detail strong {
  color: var(--ink);
  overflow-wrap: anywhere;
  text-align: right;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: min(440px, calc(100% - 28px));
  border: 1px solid rgba(255, 128, 146, 0.55);
  border-radius: 8px;
  padding: 13px 15px;
  color: #ffffff;
  background: #33182a;
  box-shadow: 0 18px 40px rgba(0, 5, 22, 0.52);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 620px) {
  .checkout-shell {
    width: min(100% - 14px, 480px);
    align-items: start;
    padding: 12px 0 24px;
  }

  .checkout-frame {
    padding: 18px;
  }

  .checkout-header {
    align-items: flex-start;
  }

  .checkout-brand > img {
    width: 46px;
    height: 45px;
  }

  .checkout-brand strong {
    font-size: 19px;
  }

  .checkout-brand span {
    font-size: 12px;
  }

  .secure-status {
    padding: 8px;
  }

  .secure-status span {
    display: none;
  }

  .order-panel {
    padding: 18px;
  }

  #amountValue {
    font-size: 43px;
  }

  .panel-heading h1,
  .success-panel h1 {
    font-size: 25px;
  }

  .panel-heading > span {
    display: none;
  }

  .payment-option {
    grid-template-columns: 58px minmax(0, 1fr) 34px;
    gap: 11px;
    min-height: 84px;
    padding: 11px 12px;
  }

  .payment-icon {
    width: 54px;
    height: 52px;
  }

  .payment-icon img {
    width: 52px;
    height: 50px;
  }

  .payment-copy strong {
    font-size: 16px;
  }

  .payment-radio {
    width: 32px;
    height: 32px;
  }

  .pay-button {
    min-height: 0;
    padding: 7px 14px;
    font-size: 15px;
  }
}

@media (max-width: 360px) {
  .checkout-frame {
    padding: 14px;
  }

  .amount-line {
    gap: 10px;
  }

  #currencyValue {
    font-size: 16px;
  }

  #amountValue {
    font-size: 37px;
  }

  .order-list,
  .card-field-row {
    grid-template-columns: 1fr;
  }

  .payment-copy > span {
    display: none;
  }

  .pay-button {
    grid-template-columns: 28px minmax(0, 1fr) 22px;
    font-size: 14px;
  }
}
