:root {
  color-scheme: dark;
  --checkout-bg: #07111f;
  --checkout-surface: #0c1929;
  --checkout-surface-2: #101f31;
  --checkout-line: rgba(151, 180, 211, 0.18);
  --checkout-line-strong: rgba(89, 213, 184, 0.48);
  --checkout-text: #f4f8fc;
  --checkout-muted: #aebed0;
  --checkout-subtle: #8194aa;
  --checkout-accent: #38d2ad;
  --checkout-accent-strong: #21b995;
  --checkout-accent-soft: rgba(56, 210, 173, 0.11);
  --checkout-danger: #ff8d8d;
  --checkout-warning: #ffc56f;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--checkout-bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--checkout-text);
  background:
    radial-gradient(circle at 14% 0%, rgba(32, 112, 160, 0.18), transparent 31rem),
    radial-gradient(circle at 95% 15%, rgba(56, 210, 173, 0.09), transparent 28rem),
    var(--checkout-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.checkout-topbar {
  width: min(1180px, calc(100% - 40px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--checkout-line);
}

.checkout-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--checkout-text);
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
}

.checkout-brand img { width: 34px; height: 34px; object-fit: contain; }

.checkout-exit {
  color: var(--checkout-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 180ms ease;
}
.checkout-exit:hover { color: var(--checkout-text); }

.checkout-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 72px; }

.checkout-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 28px;
}

.checkout-page-head > div > span,
.checkout-section-head > div > span {
  display: block;
  margin-bottom: 7px;
  color: var(--checkout-accent);
  font-size: 12px;
  font-weight: 750;
}

.checkout-page-head h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -0.025em; }
.checkout-page-head p { max-width: 58ch; margin: 10px 0 0; color: var(--checkout-muted); font-size: 14px; line-height: 1.7; }

.checkout-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 360px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checkout-steps li { position: relative; flex: 1; display: flex; align-items: center; gap: 8px; color: var(--checkout-subtle); font-size: 12px; }
.checkout-steps li:not(:last-child)::after { content: ""; position: absolute; top: 15px; left: calc(100% - 8px); width: 16px; height: 1px; background: var(--checkout-line); }
.checkout-steps b { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--checkout-line); border-radius: 50%; color: var(--checkout-muted); font-size: 12px; }
.checkout-steps .is-current { color: var(--checkout-text); }
.checkout-steps .is-current b { border-color: var(--checkout-accent); background: var(--checkout-accent); color: #03251e; }
.checkout-steps .is-done b { border-color: var(--checkout-line-strong); color: var(--checkout-accent); }

.checkout-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr); align-items: start; gap: 20px; }
.checkout-order, .checkout-action { border: 1px solid var(--checkout-line); border-radius: 16px; background: rgba(12, 25, 41, 0.96); }
.checkout-order { padding: 28px; }
.checkout-action { overflow: hidden; }

.checkout-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.checkout-section-head h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.checkout-section-head > em { align-self: center; padding: 6px 10px; border-radius: 999px; background: var(--checkout-accent-soft); color: var(--checkout-accent); font-size: 12px; font-style: normal; font-weight: 700; }
.checkout-section-head > em.is-ready { color: #84e8ce; }
.checkout-section-head.is-compact h2 { font-size: 17px; }

.checkout-product { margin-top: 22px; padding: 18px; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 16px; background: var(--checkout-surface-2); border-radius: 12px; }
.checkout-product > img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: #17283d; }
.checkout-product-copy { min-width: 0; }
.checkout-product-copy h3 { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.checkout-product-copy strong, .checkout-product-copy span { display: block; }
.checkout-product-copy strong { color: #d8e5f2; font-size: 14px; }
.checkout-product-copy span { margin-top: 5px; color: var(--checkout-subtle); font-size: 12px; }
.checkout-product-price { text-align: right; }
.checkout-product-price small { display: block; margin-bottom: 4px; color: var(--checkout-subtle); font-size: 11px; }
.checkout-product-price strong { color: var(--checkout-text); font-size: 25px; letter-spacing: -0.02em; }
.checkout-product-price strong span { margin-right: 2px; color: var(--checkout-accent); font-size: 14px; }

.checkout-price-list { margin: 20px 0 0; }
.checkout-price-list > div { padding: 10px 2px; display: flex; justify-content: space-between; color: var(--checkout-muted); font-size: 13px; }
.checkout-price-list dt, .checkout-price-list dd { margin: 0; }
.checkout-price-list .is-discount dd { color: var(--checkout-accent); }
.checkout-price-list .is-total { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--checkout-line); color: var(--checkout-text); font-weight: 750; }
.checkout-price-list .is-total dd { font-size: 20px; }

.checkout-coupon-status { margin-top: 12px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; border-radius: 10px; background: rgba(49, 211, 174, 0.08); color: #dffbf3; }
.checkout-coupon-status > span { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: rgba(49, 211, 174, 0.16); }
.checkout-coupon-status svg { width: 16px; stroke: var(--checkout-accent); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.checkout-coupon-status strong, .checkout-coupon-status small { display: block; }
.checkout-coupon-status strong { font-size: 12px; }
.checkout-coupon-status small { margin-top: 2px; color: #a9cfc4; font-size: 11px; line-height: 1.45; }

.checkout-delivery { margin-top: 20px; padding: 17px; display: flex; gap: 14px; border: 1px solid var(--checkout-line-strong); border-radius: 12px; background: var(--checkout-accent-soft); }
.checkout-delivery-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: rgba(56, 210, 173, 0.16); }
.checkout-delivery-icon svg { width: 21px; stroke: var(--checkout-accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.checkout-delivery span { color: var(--checkout-accent); font-size: 11px; font-weight: 750; }
.checkout-delivery h3 { margin: 4px 0 5px; font-size: 15px; }
.checkout-delivery p { margin: 0; color: #bdd0d8; font-size: 12px; line-height: 1.65; }

.checkout-after-pay { margin-top: 24px; }
.checkout-after-pay > span { color: var(--checkout-subtle); font-size: 12px; }
.checkout-after-pay ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.checkout-after-pay li { min-height: 72px; padding: 12px; display: flex; align-items: flex-start; gap: 9px; background: rgba(255,255,255,0.025); border-radius: 10px; }
.checkout-after-pay b { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: rgba(138, 169, 199, 0.12); color: var(--checkout-muted); font-size: 10px; }
.checkout-after-pay li span { color: #c5d3e1; font-size: 11px; line-height: 1.5; }

.checkout-account, .checkout-payment { padding: 24px; }
.checkout-payment { border-top: 1px solid var(--checkout-line); }

.checkout-user-ready { margin-top: 18px; padding: 14px; display: flex; align-items: center; gap: 12px; background: var(--checkout-surface-2); border-radius: 12px; }
.checkout-user-avatar { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--checkout-accent); color: #06261f; font-weight: 800; }
.checkout-user-ready div { min-width: 0; flex: 1; }
.checkout-user-ready strong, .checkout-user-ready div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checkout-user-ready strong { font-size: 14px; }
.checkout-user-ready div span { margin-top: 3px; color: var(--checkout-muted); font-size: 12px; }
.checkout-user-ready button { flex: 0 0 auto; min-height: 34px; padding: 0 9px; border: 0; border-radius: 8px; color: var(--checkout-accent); background: transparent; cursor: pointer; font-size: 12px; }
.checkout-user-ready button:hover { background: rgba(49, 211, 174, 0.08); }
.checkout-user-ready button:focus-visible { outline: 2px solid var(--checkout-accent); outline-offset: 2px; }
.checkout-user-ready small { display: block; margin-top: 5px; color: var(--checkout-subtle); font-size: 10px; line-height: 1.45; }
.checkout-user-ready[hidden] { display: none; }
.checkout-user-created { border: 1px solid rgba(49, 211, 174, 0.28); background: rgba(49, 211, 174, 0.08); }
.checkout-mode[hidden], .checkout-account-form[hidden], .checkout-registration-note[hidden], .checkout-field[hidden] { display: none; }

.checkout-registration-note { margin-top: 16px; padding: 12px 13px; display: grid; gap: 4px; border-radius: 10px; background: rgba(49, 211, 174, 0.075); }
.checkout-registration-note b { color: #8ff0d3; font-size: 12px; }
.checkout-registration-note span { color: #a9bdcf; font-size: 11px; line-height: 1.55; }

.checkout-mode { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #071321; border-radius: 10px; }
.checkout-mode button { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--checkout-muted); cursor: pointer; font-size: 13px; font-weight: 700; }
.checkout-mode button.is-active { background: var(--checkout-surface-2); color: var(--checkout-text); }
.checkout-mode button:focus-visible, .checkout-pay-option:focus-visible, .checkout-submit:focus-visible, .checkout-password-control button:focus-visible, input:focus-visible { outline: 2px solid var(--checkout-accent); outline-offset: 2px; }

.checkout-account-form { margin-top: 16px; display: grid; gap: 14px; }
.checkout-field { display: block; }
.checkout-field > span:first-child { display: block; margin-bottom: 7px; color: #d9e5f1; font-size: 12px; font-weight: 700; }
.checkout-field input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid rgba(151, 180, 211, 0.24); border-radius: 9px; background: #081522; color: var(--checkout-text); font-size: 13px; transition: border-color 160ms ease, background-color 160ms ease; }
.checkout-field input::placeholder { color: #758aa0; }
.checkout-field input:hover { border-color: rgba(151, 180, 211, 0.42); }
.checkout-field input:focus { border-color: var(--checkout-accent); background: #091827; outline: none; }
.checkout-field small { display: block; margin-top: 6px; color: var(--checkout-subtle); font-size: 11px; line-height: 1.5; }
.checkout-password-control { position: relative; display: block; }
.checkout-password-control input { padding-right: 58px; }
.checkout-password-control button { position: absolute; top: 5px; right: 5px; height: 34px; padding: 0 9px; border: 0; border-radius: 7px; background: rgba(135, 166, 195, 0.1); color: var(--checkout-muted); cursor: pointer; font-size: 11px; }

.checkout-pay-total { align-self: center; color: var(--checkout-text); font-size: 19px; }
.checkout-pay-list { margin-top: 16px; display: grid; gap: 9px; }
.checkout-pay-option { width: 100%; min-height: 62px; padding: 10px 12px; display: grid; grid-template-columns: 38px minmax(0,1fr) 18px; align-items: center; gap: 11px; border: 1px solid var(--checkout-line); border-radius: 10px; background: rgba(255,255,255,0.018); color: var(--checkout-text); cursor: pointer; text-align: left; transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease; }
.checkout-pay-option:hover { border-color: rgba(151, 180, 211, 0.38); background: rgba(255,255,255,0.035); }
.checkout-pay-option:active { transform: translateY(1px); }
.checkout-pay-option.is-selected { border-color: var(--checkout-accent); background: var(--checkout-accent-soft); }
.checkout-pay-option img { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; }
.checkout-pay-option span strong, .checkout-pay-option span small { display: block; }
.checkout-pay-option span strong { font-size: 13px; }
.checkout-pay-option span small { margin-top: 4px; color: var(--checkout-subtle); font-size: 11px; }
.checkout-pay-option i { width: 16px; height: 16px; border: 1px solid rgba(151, 180, 211, 0.42); border-radius: 50%; }
.checkout-pay-option.is-selected i { border: 5px solid var(--checkout-accent); background: #fff; }

.checkout-agreement { margin: 0 24px; padding: 16px 0 0; display: flex; align-items: flex-start; gap: 9px; border-top: 1px solid var(--checkout-line); color: var(--checkout-muted); font-size: 11px; line-height: 1.6; }
.checkout-agreement[hidden] { display: none; }
.checkout-agreement input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--checkout-accent); flex: 0 0 auto; }
.checkout-agreement a { color: var(--checkout-accent); text-decoration: none; }

.checkout-submit-wrap { padding: 18px 24px 24px; }
.checkout-message { min-height: 18px; margin: 0 0 8px; color: var(--checkout-danger); font-size: 12px; line-height: 1.5; }
.checkout-message.is-success { color: var(--checkout-accent); }
.checkout-submit { width: 100%; min-height: 52px; padding: 0 18px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 10px; background: var(--checkout-accent); color: #04251e; cursor: pointer; font-weight: 800; transition: background-color 160ms ease, transform 160ms ease; }
.checkout-submit:hover { background: #56dfbd; }
.checkout-submit:active { transform: translateY(1px); }
.checkout-submit:disabled { cursor: wait; opacity: .68; transform: none; }
.checkout-submit strong { font-size: 17px; }
.checkout-safety { margin-top: 12px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 14px; color: var(--checkout-subtle); font-size: 10px; }
.checkout-safety span::before { content: "✓"; margin-right: 4px; color: var(--checkout-accent); }

@media (max-width: 900px) {
  .checkout-page-head { align-items: flex-start; flex-direction: column; gap: 22px; }
  .checkout-steps { width: 100%; min-width: 0; }
  .checkout-layout { grid-template-columns: 1fr; }
  .checkout-action { order: -1; }
}

@media (max-width: 620px) {
  .checkout-topbar, .checkout-shell { width: min(100% - 24px, 1180px); }
  .checkout-topbar { min-height: 58px; }
  .checkout-brand img { width: 30px; height: 30px; }
  .checkout-brand span { max-width: 54vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .checkout-shell { padding: 26px 0 calc(32px + env(safe-area-inset-bottom)); }
  .checkout-page-head { margin-bottom: 18px; }
  .checkout-page-head h1 { font-size: 24px; }
  .checkout-page-head p { font-size: 13px; }
  .checkout-steps li { justify-content: center; }
  .checkout-steps li span { display: none; }
  .checkout-steps li:not(:last-child)::after { left: calc(50% + 19px); width: calc(100% - 38px); }
  .checkout-layout { gap: 12px; }
  .checkout-order, .checkout-action { border-radius: 13px; }
  .checkout-order, .checkout-account, .checkout-payment { padding: 18px; }
  .checkout-product { grid-template-columns: 58px minmax(0, 1fr); padding: 13px; }
  .checkout-product > img { width: 58px; height: 58px; }
  .checkout-product-price { grid-column: 1 / -1; padding-top: 11px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--checkout-line); text-align: left; }
  .checkout-product-price small { margin: 0; }
  .checkout-product-price strong { font-size: 22px; }
  .checkout-after-pay ol { grid-template-columns: 1fr; }
  .checkout-after-pay li { min-height: 0; align-items: center; }
  .checkout-agreement { margin: 0 18px; }
  .checkout-submit-wrap { position: sticky; bottom: 0; z-index: 10; padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(12,25,41,.92), var(--checkout-surface) 24%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
