.checkout-body [hidden] {
  display: none !important;
}

.checkout-body {
  min-height: 100svh;
}

.checkout-nav-note {
  color: var(--color-muted);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-main {
  width: min(78rem, calc(100% - (var(--page-gutter) * 2)));
  margin-inline: auto;
  padding-block: clamp(var(--space-12), 7vw, var(--space-24)) var(--space-24);
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(32rem, 1.28fr);
  gap: clamp(var(--space-12), 7vw, var(--space-24));
  align-items: start;
}

.checkout-intro {
  position: sticky;
  top: var(--space-8);
}

.checkout-intro h1 {
  max-width: 8ch;
  margin: var(--space-3) 0 var(--space-8);
  font-family: var(--font-display-zh);
  font-size: clamp(3.6rem, 6.5vw, 6.8rem);
  line-height: 0.94;
}

html[data-language="en"] .checkout-intro h1 {
  max-width: 9ch;
  font-family: var(--font-display-en);
}

.checkout-intro > p:last-of-type {
  max-width: 34rem;
  color: var(--color-ink-2);
}

.simulation-banner {
  margin-top: var(--space-8);
  padding: var(--space-4);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-4);
  border: var(--rule-strong) dashed var(--color-accent);
  background: color-mix(in oklch, var(--color-accent) 7%, var(--color-paper));
  color: var(--color-accent);
  transform: rotate(-0.7deg);
}

.simulation-banner > span {
  align-self: start;
  padding: var(--space-1) var(--space-2);
  border: var(--rule-thin) solid currentColor;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
}

.simulation-banner p,
.simulation-banner small {
  display: block;
  margin: 0;
}

.simulation-banner small {
  margin-top: var(--space-1);
  color: var(--color-ink-2);
  line-height: 1.45;
}

.checkout-sheet {
  min-width: 0;
  padding: clamp(var(--space-6), 4vw, var(--space-12));
  position: relative;
  border: var(--rule-thin) solid var(--color-rule);
  border-radius: var(--radius-paper);
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 3.45rem, var(--color-rule-2) 3.5rem, transparent 3.55rem),
    var(--color-paper-2);
  box-shadow: -0.85rem 1rem 0 var(--color-shadow-soft);
}

.checkout-sheet::before {
  content: "";
  width: 3.4rem;
  height: 1.1rem;
  position: absolute;
  top: -0.55rem;
  right: 12%;
  background: color-mix(in oklch, var(--color-note) 68%, transparent);
  transform: rotate(3deg);
}

.sheet-kicker {
  margin: 0 0 var(--space-3);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

.checkout-sheet h2 {
  max-width: none;
  margin-bottom: var(--space-8);
  font-size: clamp(2.2rem, 4.2vw, 4.1rem);
}

.checkout-unavailable p:not(.sheet-kicker) {
  max-width: 38rem;
  color: var(--color-ink-2);
}

.checkout-unavailable .ink-button {
  margin-top: var(--space-4);
}

.choice-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-group + .choice-group {
  margin-top: var(--space-10);
}

.choice-group legend {
  width: 100%;
  margin-bottom: var(--space-3);
  padding: 0 0 var(--space-3);
  border-bottom: var(--rule-strong) solid var(--color-ink);
  font-size: var(--text-sm);
}

.choice-card,
.channel-card {
  min-width: 0;
  min-height: 5.6rem;
  padding: var(--space-4) var(--space-3);
  position: relative;
  display: grid;
  align-items: center;
  gap: var(--space-4);
  border-bottom: var(--rule-thin) solid var(--color-rule);
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.choice-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.channel-card {
  grid-template-columns: auto auto minmax(0, 1fr);
}

.choice-card:has(input:checked),
.channel-card:has(input:checked) {
  color: var(--color-accent);
  background: linear-gradient(90deg, color-mix(in oklch, var(--color-accent) 8%, transparent), transparent 82%);
  transform: translateX(var(--space-1));
}

.choice-card input,
.channel-card input {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  opacity: 0;
}

.choice-mark {
  width: 1rem;
  height: 1rem;
  display: block;
  border: var(--rule-thin) solid var(--color-ink);
  border-radius: 50%;
  background: var(--color-paper);
  box-shadow: inset 0 0 0 0.2rem var(--color-paper);
}

input:checked + .choice-mark {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

input:focus-visible + .choice-mark {
  outline: var(--rule-strong) solid var(--color-focus);
  outline-offset: var(--space-1);
}

.choice-card strong,
.choice-card small,
.channel-card strong,
.channel-card small {
  display: block;
}

.choice-card strong,
.channel-card strong {
  font-size: var(--text-md);
  font-weight: 400;
  line-height: 1.25;
}

.choice-card small,
.channel-card small {
  margin-top: var(--space-1);
  color: var(--color-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.choice-price {
  color: var(--color-ink);
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.channel-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-5);
}

.channel-choices legend {
  grid-column: 1 / -1;
}

.channel-monogram {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border: var(--rule-thin) solid var(--color-sage);
  border-radius: 50%;
  color: var(--color-sage);
  font-size: var(--text-sm);
}

.channel-monogram-blue {
  border-color: var(--color-focus);
  color: var(--color-focus);
}

.checkout-submit {
  width: 100%;
  margin-top: var(--space-10);
  gap: var(--space-4);
}

.turnstile-shell {
  min-height: 4.1rem;
  display: grid;
  place-items: center;
  margin-block: var(--space-5) var(--space-3);
}

.turnstile-shell:empty {
  min-height: 0;
}

.form-footnote {
  margin: var(--space-4) 0 0;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.form-message,
.order-alert {
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-4);
  border-left: 0.22rem solid var(--color-error);
  background: color-mix(in oklch, var(--color-error) 7%, var(--color-paper));
  color: var(--color-error);
  font-size: var(--text-sm);
}

.order-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
}

.order-heading h2 {
  margin-bottom: var(--space-6);
}

.countdown-card {
  flex: 0 0 auto;
  min-width: 6.7rem;
  padding: var(--space-3) var(--space-4);
  border: var(--rule-thin) solid var(--color-rule);
  background: var(--color-paper);
  text-align: right;
  transform: rotate(1.2deg);
}

.countdown-card span,
.countdown-card strong {
  display: block;
}

.countdown-card span {
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.countdown-card strong {
  font-size: var(--text-lg);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.countdown-card.is-expired {
  border-color: var(--color-error);
  color: var(--color-error);
}

.receipt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.78fr);
  gap: var(--space-8);
  align-items: start;
}

.receipt-lines {
  margin: 0;
  border-top: var(--rule-strong) solid var(--color-ink);
}

.receipt-lines > div {
  min-height: 3.65rem;
  display: grid;
  grid-template-columns: minmax(7rem, 0.8fr) minmax(0, 1.2fr);
  gap: var(--space-4);
  align-items: center;
  border-bottom: var(--rule-thin) solid var(--color-rule);
}

.receipt-lines dt {
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.receipt-lines dd {
  min-width: 0;
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.receipt-lines .receipt-total {
  min-height: 5.2rem;
  border-bottom-color: var(--color-ink);
}

.receipt-total dd {
  color: var(--color-accent);
  font-size: var(--text-lg);
}

.order-id-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.order-id-row code {
  max-width: 13rem;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button,
.order-action-button {
  border: 0;
  border-bottom: var(--rule-thin) solid currentColor;
  background: transparent;
  padding: var(--space-1);
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  cursor: pointer;
}

.qr-panel {
  min-width: 0;
  text-align: center;
}

.qr-frame {
  width: min(100%, 15rem);
  aspect-ratio: 1;
  margin-inline: auto;
  padding: var(--space-4);
  display: grid;
  place-items: center;
  border: var(--rule-thin) solid var(--color-ink);
  background: var(--color-paper);
  box-shadow: 0.35rem 0.45rem 0 var(--color-shadow-soft);
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.simulation-qr {
  width: 100%;
  height: 100%;
  padding: var(--space-4);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  border: var(--rule-strong) dashed var(--color-accent);
  color: var(--color-accent);
}

.simulation-seal {
  justify-self: start;
  padding: var(--space-1) var(--space-2);
  border: var(--rule-thin) solid currentColor;
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
}

.simulation-lines {
  align-self: stretch;
  background:
    repeating-linear-gradient(90deg, var(--color-accent) 0 0.22rem, transparent 0.22rem 0.48rem),
    repeating-linear-gradient(0deg, var(--color-accent) 0 0.22rem, transparent 0.22rem 0.48rem);
  opacity: 0.12;
}

.simulation-qr strong {
  font-weight: 400;
}

.qr-missing {
  color: var(--color-error);
  font-size: var(--text-sm);
}

.qr-panel > p {
  margin: var(--space-4) 0 var(--space-1);
}

.qr-panel > small {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.payment-progress {
  margin-top: var(--space-8);
  padding: var(--space-4) 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border-top: var(--rule-thin) solid var(--color-rule);
  border-bottom: var(--rule-thin) solid var(--color-rule);
}

.payment-progress p,
.payment-progress strong,
.payment-progress small {
  display: block;
  margin: 0;
}

.payment-progress small {
  margin-top: var(--space-1);
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.status-pulse {
  width: 0.85rem;
  height: 0.85rem;
  flex: 0 0 auto;
  border: var(--rule-thin) solid var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 color-mix(in oklch, var(--color-accent) 25%, transparent);
  animation: checkout-pulse 1.8s var(--ease-out) infinite;
}

.payment-progress.is-complete .status-pulse {
  border-color: var(--color-success);
  background: var(--color-success);
  animation: none;
}

.payment-progress.is-error .status-pulse {
  border-color: var(--color-error);
  animation: none;
}

@keyframes checkout-pulse {
  55% {
    background: var(--color-accent);
    box-shadow: 0 0 0 0.5rem transparent;
  }
}

.delivery-panel {
  margin-top: var(--space-8);
  padding: var(--space-6);
  border: var(--rule-strong) solid var(--color-success);
  background: color-mix(in oklch, var(--color-sage-soft) 68%, var(--color-paper));
  box-shadow: -0.45rem 0.55rem 0 color-mix(in oklch, var(--color-success) 14%, transparent);
  transform: rotate(-0.35deg);
}

.delivery-panel h3 {
  margin-bottom: var(--space-3);
  font-family: var(--font-display-zh);
  font-size: var(--text-lg);
}

html[data-language="en"] .delivery-panel h3 {
  font-family: var(--font-display-en);
}

.delivery-panel > p:not(.sheet-kicker) {
  color: var(--color-ink-2);
  font-size: var(--text-sm);
}

.delivery-warning {
  margin: var(--space-5) 0 var(--space-4);
  padding: var(--space-4);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  border: var(--rule-strong) solid var(--color-accent);
  background: color-mix(in oklch, var(--color-accent) 10%, var(--color-paper));
  box-shadow: 0.3rem 0.35rem 0 color-mix(in oklch, var(--color-accent) 16%, transparent);
  transform: rotate(0.25deg);
}

.delivery-warning-mark {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-family: var(--font-display-en);
  font-size: var(--text-md);
  line-height: 1;
}

.delivery-warning p,
.delivery-warning strong,
.delivery-warning small {
  display: block;
}

.delivery-warning p {
  margin: 0;
}

.delivery-warning strong {
  color: var(--color-ink);
  font-size: var(--text-md);
  line-height: 1.15;
}

.delivery-warning small {
  margin-top: var(--space-1);
  color: var(--color-ink-2);
  font-size: var(--text-sm);
}

.delivery-code-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
}

.delivery-code-row code {
  min-width: 0;
  flex: 1 1 auto;
  padding: var(--space-3) var(--space-4);
  border: var(--rule-thin) solid var(--color-rule);
  background: var(--color-paper);
  font-family: var(--font-body);
  font-size: var(--text-md);
  overflow-wrap: anywhere;
  text-align: center;
}

.delivery-code-row .ink-button {
  flex: 0 0 auto;
}

.order-actions {
  margin-top: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
}

.order-action-button {
  min-height: 2.75rem;
  color: var(--color-ink);
  font-size: var(--text-sm);
}

.checkout-noscript {
  padding: var(--space-4);
  border: var(--rule-thin) solid var(--color-error);
  color: var(--color-error);
}

.checkout-footer {
  width: min(78rem, calc(100% - (var(--page-gutter) * 2)));
  margin-inline: auto;
  padding: var(--space-8) 0 var(--space-12);
  position: relative;
  z-index: var(--z-base);
  display: flex;
  justify-content: space-between;
  gap: var(--space-6);
  border-top: var(--rule-thin) solid var(--color-rule);
  color: var(--color-muted);
  font-size: var(--text-xs);
}

.checkout-footer p {
  margin: 0;
}

@media (hover: hover) and (pointer: fine) {
  .choice-card:hover,
  .channel-card:hover {
    background: color-mix(in oklch, var(--color-accent) 5%, transparent);
  }

  .copy-button:hover,
  .order-action-button:hover {
    color: var(--color-accent);
  }
}

@media (max-width: 64rem) {
  .checkout-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .checkout-intro {
    position: relative;
    top: auto;
  }

  .checkout-intro h1 {
    max-width: 10ch;
  }
}

@media (max-width: 40rem) {
  .checkout-nav-note {
    display: none;
  }

  .checkout-main {
    padding-block: var(--space-10) var(--space-16);
    gap: var(--space-10);
  }

  .checkout-intro h1 {
    max-width: 9ch;
    margin-bottom: var(--space-5);
    font-size: clamp(3.1rem, 16vw, 4.7rem);
  }

  .checkout-sheet {
    padding: var(--space-6) var(--space-4);
    box-shadow: -0.35rem 0.5rem 0 var(--color-shadow-soft);
  }

  .channel-choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .choice-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: var(--space-3);
  }

  .choice-card strong,
  .channel-card strong {
    font-size: 1.12rem;
  }

  .order-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
  }

  .countdown-card {
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    transform: none;
  }

  .receipt-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-lines > div {
    grid-template-columns: minmax(6rem, 0.8fr) minmax(0, 1.2fr);
  }

  .qr-frame {
    width: min(100%, 17rem);
  }

  .delivery-code-row {
    flex-direction: column;
  }

  .delivery-code-row .ink-button {
    width: 100%;
  }

  .checkout-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-pulse {
    background: var(--color-accent);
    animation: none;
  }
}
