.checkout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); min-height: 100vh; min-height: 100dvh; }

/* Summary */
.summary { display: flex; justify-content: flex-end; padding: 44px 56px; border-right: 1px solid var(--line); background: var(--bg-deep); }
.summary-inner { position: sticky; top: 44px; display: flex; flex-direction: column; gap: 24px; width: min(400px, 100%); height: max-content; min-height: calc(100dvh - 88px); }
.sum-back { align-self: flex-start; }
.sum-back img { width: 20px; height: auto; }
.sum-toggle { display: none; }
.sum-details { display: grid; gap: 22px; }
.sum-label, .pay-label { margin: 0; color: var(--faint); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sum-total { margin: 6px 0 0; font: 700 2.6rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.product { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.product-thumb { display: grid; flex-shrink: 0; place-items: center; width: 52px; height: 52px; border-radius: 10px; background: var(--surface-2); }
.product-thumb img { width: 30px; height: auto; }
.product b { display: block; font-size: 1rem; }
.product small { color: var(--muted); font-size: 0.88rem; }
.product strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.perks { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.perks li { display: flex; align-items: center; gap: 10px; color: var(--prose); font-size: 0.95rem; }
.perks svg { width: 16px; height: 16px; color: var(--accent); }
.lines { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.line.discount { color: var(--ok); }
.line.total { color: var(--fg); font-size: 1.1rem; font-weight: 700; }
.help { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.help-icon { display: grid; flex-shrink: 0; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.help-icon svg { width: 18px; height: 18px; }
.help b { display: block; font-size: 0.95rem; }
.help p { margin: 2px 0 10px; color: var(--muted); font-size: 0.9rem; }
.help .button { height: 34px; padding: 0 12px; font-size: 0.85rem; }
.sum-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: auto; color: var(--faint); font-size: 0.85rem; }
.sum-foot a { color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.sum-foot a:hover { color: var(--fg); }
.pay-foot { display: none; }

/* Payment side */
.pay { padding: 44px 56px 56px; }
.pay-inner { width: min(520px, 100%); }
.steps { display: flex; align-items: center; gap: 10px; margin: 0 0 34px; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 9px; color: var(--faint); font-size: 0.9rem; font-weight: 600; white-space: nowrap; transition: color 0.3s ease; }
.steps li:not(:last-child) { flex: 1; }
.steps li:not(:last-child)::after { content: ""; flex: 1; min-width: 16px; height: 1px; margin-left: 4px; background: var(--line); transition: background-color 0.4s ease; }
.steps li.on, .steps li.done { color: var(--fg); }
.steps li.done::after { background: var(--accent); }
.steps i {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font: 700 0.78rem/1 var(--font-body);
  font-style: normal;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.steps i svg { width: 13px; height: 13px; stroke-width: 3; }
.steps li.on i { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.steps li.done i { border-color: transparent; background: var(--accent-soft); color: var(--accent); }

.panel { animation: view-in 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.pay-section { display: grid; gap: 12px; margin-bottom: 28px; }
.pay-head { margin-bottom: 26px; }
.pay-head h1, .pay-head h2 { margin: 0 0 6px; font-size: 1.9rem; font-weight: 700; }
.pay-head p { margin: 0; color: var(--muted); }

.link-btn { display: inline-flex; align-items: center; gap: 5px; justify-self: start; padding: 0; border: 0; background: none; color: var(--muted); font: 600 0.9rem var(--font-body); cursor: pointer; transition: color 0.2s ease; }
.link-btn:hover { color: var(--fg); }
.link-btn svg { width: 15px; height: 15px; transition: transform 0.25s ease; }
.link-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.code-row { display: flex; gap: 8px; }
.code-row .input { flex: 1; }
.code-row .button { height: 44px; }
.code-applied { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 0.92rem; }
.code-applied svg { width: 16px; height: 16px; }
.code-applied .icon-btn { width: 28px; height: 28px; margin-left: auto; color: var(--ok); }
.code-applied .icon-btn:hover { background: transparent; color: var(--fg); }

.methods { display: grid; gap: 10px; }
.method-card { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color 0.2s ease, background-color 0.2s ease; }
.method-card:hover { border-color: var(--line-strong); }
.method-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio { flex-shrink: 0; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-radius: 50%; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.method-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.method-card:has(input:checked) .radio { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 9px var(--accent); }
.method-card input:focus-visible ~ .radio { outline: 2px solid var(--accent); outline-offset: 2px; }
.method-icon { display: grid; flex-shrink: 0; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--fg); }
.method-icon svg { width: 20px; height: 20px; }
.method-card b { display: block; font-size: 0.98rem; }
.method-card small { color: var(--muted); font-size: 0.85rem; }
.coins { display: flex; gap: 4px; margin-left: auto; }
.coins span { padding: 2px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 0.7rem; font-weight: 700; }

.check { position: relative; display: flex; align-items: flex-start; gap: 11px; color: var(--prose); font-size: 0.93rem; line-height: 1.5; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { display: grid; flex-shrink: 0; place-items: center; width: 18px; height: 18px; margin-top: 2px; border: 1.5px solid var(--line-strong); border-radius: 5px; color: var(--on-accent); transition: background-color 0.2s ease, border-color 0.2s ease; }
.check .box svg { width: 12px; height: 12px; stroke-width: 3.2; opacity: 0; transform: scale(0.6); transition: opacity 0.2s ease, transform 0.2s ease; }
.check input:checked + .box { border-color: var(--accent); background: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check.invalid .box { border-color: var(--bad); }
.check a { color: var(--fg); }
.terms { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.terms .field-error { margin: 8px 0 0 29px; }

.pay-btn { width: 100%; height: 50px; border-radius: 8px; font-size: 1rem; }
.pay-btn svg { width: 17px; height: 17px; transition: transform 0.2s ease; }
.pay-btn:hover svg { transform: translateX(3px); }
.pay-btn.loading .label, .pay-btn.loading > svg { display: none; }
.secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; color: var(--faint); font-size: 0.85rem; text-align: center; }
.secure svg { width: 14px; height: 14px; }

.review { margin-bottom: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.review-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.review-row + .review-row { border-top: 1px solid var(--line); }
.review-row span { flex-shrink: 0; width: 64px; color: var(--faint); font-size: 0.88rem; }
.review-row b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.review-row .link-btn { margin-left: auto; }
.pay-note { margin: 0 0 18px; color: var(--muted); }

.coin-pick { margin-bottom: 14px; }
.invoice { display: grid; grid-template-columns: 156px minmax(0, 1fr); gap: 18px; margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.qr { width: 156px; height: 156px; padding: 10px; border-radius: 10px; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; fill: #111318; }
.invoice-fields { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 14px; min-width: 0; }
.invoice-fields small { display: block; margin-bottom: 4px; color: var(--faint); font-size: 0.8rem; font-weight: 600; }
.invoice-value { display: flex; align-items: center; gap: 4px; min-width: 0; }
.invoice-value code { min-width: 0; overflow: hidden; color: var(--fg); font-family: var(--font-code); font-size: 0.9rem; text-overflow: ellipsis; white-space: nowrap; }
.invoice-value .big { font-size: 1.15rem; }
.invoice-value .icon-btn { width: 30px; height: 30px; }
.invoice-value .icon-btn svg { width: 15px; height: 15px; }
.waiting { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 0.92rem; font-weight: 600; transition: background-color 0.3s ease, color 0.3s ease; }
.waiting.paid { background: var(--ok-soft); color: var(--ok); }
.waiting .pulse { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.waiting time { margin-left: auto; font-variant-numeric: tabular-nums; }
.preview-link { display: block; margin: 0 auto 4px; }
.back-step { margin-top: 18px; }

.success { text-align: left; }
.done-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 18px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); animation: pop 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.done-icon svg { width: 30px; height: 30px; stroke-width: 2.6; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.5s ease 0.25s forwards; }
.key-box { display: flex; align-items: center; gap: 12px; margin: 0 0 26px; padding: 14px 14px 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--bg-deep); }
.key-box div { min-width: 0; }
.key-box small { display: block; color: var(--faint); font-size: 0.8rem; font-weight: 600; }
.key-box code { display: block; overflow: hidden; color: var(--fg); font-family: var(--font-code); font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
.key-box .button { margin-left: auto; }
.next { display: grid; gap: 12px; margin: 0 0 28px; padding: 0; list-style: none; counter-reset: step; }
.next li { display: flex; gap: 12px; color: var(--prose); counter-increment: step; }
.next li::before { content: counter(step); display: grid; flex-shrink: 0; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.done-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.done-actions .button { height: 44px; padding: 0 18px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (max-width: 900px) {
  .checkout { grid-template-columns: minmax(0, 1fr); }
  .summary { display: block; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-inner { position: static; gap: 14px; width: 100%; min-height: 0; }
  .sum-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--fg);
    font: 600 0.95rem var(--font-body);
    cursor: pointer;
  }
  .sum-toggle svg { width: 16px; height: 16px; color: var(--muted); transition: transform 0.25s ease; }
  .sum-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .sum-toggle b { margin-left: auto; font: 700 1.1rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
  .sum-details { display: none; padding-top: 4px; }
  .summary.open .sum-details { display: grid; animation: view-in 0.3s ease both; }
  .sum-foot { display: none; }
  .pay { padding: 24px 16px 40px; }
  .pay-inner { width: 100%; }
  .pay-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 36px; color: var(--faint); font-size: 0.85rem; }
  .pay-foot a { color: var(--muted); text-decoration: none; }
}
@media (max-width: 520px) {
  .steps span { display: none; }
  .steps li.on span { display: inline; }
  .invoice { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .invoice-fields { width: 100%; }
  .coins { display: none; }
  .key-box { flex-wrap: wrap; }
  .key-box .button { width: 100%; margin-left: 0; }
  .done-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .done-icon, .done-icon svg, .waiting .pulse, .summary.open .sum-details { animation: none; }
  .done-icon svg { stroke-dashoffset: 0; }
}
