#checkout {
  width: min(34rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: clamp(1rem, 4vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
#checkout::backdrop { background: rgb(45 38 29 / .64); }
#checkout [hidden] { display: none; }
#checkout h2 { font-size: clamp(2rem, 6vw, 3rem); margin-bottom: .8rem; }
.checkout-top, .checkout-line, .checkout-counter { display: flex; align-items: center; gap: .55rem; }
.checkout-top, .checkout-line { justify-content: space-between; }
.checkout-demo, .checkout-note { margin: .45rem 0; color: var(--muted); font-size: .9rem; }
.checkout-close, .checkout-counter button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.2rem;
}
.checkout-counter button:disabled { opacity: .55; cursor: default; }
.checkout-counter output { min-width: 1.5em; text-align: center; }
.checkout-line { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.checkout-line strong { white-space: nowrap; }
.checkout-selection {
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  background: #fffaf0;
  border-radius: 4px;
}
.checkout-selection h3 {
  font: 650 .93rem/1.4 system-ui, sans-serif;
  letter-spacing: normal;
}
.checkout-selection .checkout-line { padding-bottom: 0; border: 0; }
.checkout-product { display: flex; align-items: center; gap: .65rem; }
.checkout-product img { flex: none; object-fit: cover; border-radius: 3px; }
.checkout-addon .checkout-product { gap: .5rem; min-width: 0; }
.checkout-addon .checkout-counter { flex: none; }
#checkout-extras {
  margin: .85rem 0 .45rem;
  padding: .8rem .9rem .35rem;
  border: 1px solid #c69d50;
  border-radius: 4px;
  background: #faebc7;
}
#checkout-extras h3 { font-size: 1.35rem; }
.checkout-prices s { margin-right: .35rem; }
.checkout-prices strong { color: var(--ink); }
.checkout-addon small { display: block; color: var(--muted); font-size: .875rem; }
.checkout-total { border-bottom: 0; font-size: 1.1rem; margin-bottom: .45rem; }
#checkout-preview { width: 100%; }
#checkout-payment { margin-top: .8rem; padding: .75rem; border: 1px solid var(--line); }
#checkout-payment p { margin: .35rem 0 0; }
.delivery-methods { margin: .9rem 0 .35rem; }
.delivery-methods label { min-height: 44px; }
.delivery-fields { grid-template-columns: 7rem minmax(0, 1fr); margin: .65rem 0 0; gap: .6rem; }
.delivery-fields > :first-of-type { grid-column: 1 / -1; }
.delivery-field { display: grid; gap: .25rem; }
.delivery-field label { padding: 0; border: 0; font-size: .875rem; cursor: default; }
.delivery-field input, .delivery-field select, .delivery-map-button {
  width: 100%; min-width: 0; min-height: 44px; padding: .45rem .6rem;
  border: 1px solid var(--line); border-radius: 3px; background: #fffaf0; color: var(--ink); font: inherit;
}
.delivery-map-button { cursor: pointer; text-align: left; }
#delivery-widget inpost-geowidget { display: block; width: 100%; height: min(440px, 55dvh); }

@media (max-width: 580px) {
  #checkout {
    width: 100%;
    max-width: none;
    height: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0 1rem max(1rem, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .checkout-top {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--paper);
    padding-block: .55rem;
  }
  .checkout-selection { padding-inline: .75rem; }
  #checkout-extras { padding-inline: .7rem; }
  .checkout-addon { display: grid; grid-template-columns: minmax(0, 1fr); }
  .checkout-addon .checkout-counter { justify-self: end; }
  .checkout-product { min-width: 0; }
  .delivery-fields { grid-template-columns: minmax(0, 1fr); }
  .delivery-field input, .delivery-field select { font-size: max(1rem, 16px); }
  #checkout-payment { scroll-margin-block-start: 4rem; }
}
