html:has(.bb-builder[open]) { overflow: hidden; }
.bb-builder {
  width: min(54rem, calc(100% - 2rem));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line, #a9bfcc);
  border-radius: 1rem;
  background: var(--surface, #f8fbfc);
  color: var(--ink, #1c3a50);
  font: 1rem/1.4 system-ui, sans-serif;
  box-shadow: 0 1.5rem 4rem #10191d3d;
}
.bb-builder::backdrop { background: #14202bc2; }
.bb-builder *, .bb-builder *::before, .bb-builder *::after { box-sizing: border-box; }
.bb-builder [hidden] { display: none; }
.bb-builder button, .bb-builder input, .bb-builder select { font: inherit; }
.bb-builder button { cursor: pointer; }
.bb-pane { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.bb-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 clamp(1.1rem, 4vw, 2.4rem) 1.4rem; }
.bb-top { padding-block: .45rem .15rem; }
.bb-back {
  min-height: 44px;
  padding: .2rem .2rem .2rem 0;
  border: 0;
  color: var(--muted, #465f72);
  background: transparent;
}
.bb-back:hover { text-decoration: underline; }
.bb-builder h2 {
  margin: .1rem 0 1.25rem;
  font: 500 clamp(2.15rem, 5vw, 3.5rem)/1 Georgia, serif;
  letter-spacing: -.045em;
  color: inherit;
}
.bb-packs { display: flex; gap: .6rem; padding: 0; border: 0; margin: 0 0 1.1rem; }
.bb-packs legend {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
}
.bb-pack { flex: 1; min-width: 0; position: relative; cursor: pointer; }
.bb-pack input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0;
}
.bb-pack-face {
  display: flex; align-items: center; justify-content: center; gap: .65rem;
  padding: .8rem .35rem; min-height: 3.4rem; border: 1px solid var(--line, #a9bfcc);
  border-radius: .55rem; background: var(--paper, #edf5fa);
}
.bb-pack-face b { font: 600 1.3rem/1.15 Georgia, serif; }
.bb-pack-price { font-size: .93rem; font-variant-numeric: tabular-nums; }
.bb-pack input:checked + .bb-pack-face, .bb-save {
  background: var(--accent, #284e70); color: var(--on-accent, #fff);
  border-color: var(--accent, #284e70);
}
.bb-pack input:focus-visible + .bb-pack-face, .bb-builder :is(button, select, input):focus-visible {
  outline: 3px solid var(--accent, #284e70); outline-offset: 2px;
}
.bb-layout { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1fr); align-items: start; gap: clamp(1rem, 3vw, 2rem); }
.bb-photo {
  display: block; width: 100%; aspect-ratio: 5 / 4; object-fit: cover;
  border-radius: .45rem; background: var(--paper, #edf5fa);
}
.bb-layout:has(.bb-photo[hidden]) { grid-template-columns: 1fr; }
.bb-mixed-box .bb-photo { aspect-ratio: auto; height: auto; max-height: none; }
.bb-builder .bb-flavor-title {
  display: block; margin: 0 0 .55rem; color: var(--ink, #1c3a50);
  font: italic 500 1.45rem/1.25 Georgia, serif;
}
.bb-flavor, .bb-quantity {
  display: flex; align-items: center; justify-content: space-between; gap: .55rem;
  padding-block: .34rem; border-bottom: 1px solid var(--line, #a9bfcc);
}
.bb-flavor-name, .bb-quantity label { line-height: 1.25; font-weight: 560; }
.bb-stepper {
  display: flex; align-items: center; flex-shrink: 0; gap: 0;
  border: 1px solid var(--line, #a9bfcc); border-radius: .5rem;
}
.bb-stepper button {
  width: 44px; min-height: 44px; border: 0; padding: 0; border-radius: .45rem;
  color: inherit; background: transparent; font-size: 1.3rem; font-weight: 600;
}
.bb-stepper button[aria-disabled=true] { color: var(--muted, #465f72); opacity: .55; cursor: default; }
.bb-count { min-width: 1.25rem; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.bb-stepper input.bb-count {
  width: 3.2rem; min-height: 44px; border: 0; border-inline: 1px solid var(--line);
  border-radius: 0; padding: 0 .12rem; color: inherit; background: var(--paper);
  appearance: textfield; -moz-appearance: textfield;
}
.bb-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bb-stepper input[aria-invalid=true] { outline: 2px solid var(--error); outline-offset: -2px; }
.bb-builder .bb-progress {
  display: inline-block; margin: .65rem 0 .4rem; padding: .25rem .55rem;
  border-radius: .3rem; color: var(--muted, #465f72); font-size: .9rem;
}
.bb-progress.bb-complete { background: var(--paper, #e3eef4); color: var(--ink, #1c3a50); font-weight: 650; }
.bb-complete::before { content: '✓ '; }
.bb-footer-info { display: grid; gap: .2rem; }
.bb-builder .bb-footer-info .bb-progress {
  margin: 0; font-size: 1rem; font-weight: 650; padding: .35rem .55rem;
  border-inline-start: 3px solid currentColor; line-height: 1.3;
}
.bb-footer-info .bb-incomplete {
  color: var(--error); background: var(--paper);
}
.bb-quantity { margin-top: .45rem; border: 0; }
.bb-quantity input, .bb-select {
  min-height: 44px; padding: .45rem .65rem; border: 1px solid var(--line, #a9bfcc);
  border-radius: .45rem; background: var(--paper, #edf5fa); color: inherit;
}
.bb-quantity input { width: 5.6rem; }
.bb-select { width: 100%; max-width: 100%; }
.bb-footer {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .85rem clamp(1.1rem, 4vw, 2.4rem); border-top: 1px solid var(--line, #a9bfcc);
  background: var(--surface, #f8fbfc); border-radius: 0 0 1rem 1rem;
}
.bb-when { color: var(--muted, #465f72); font-size: .94rem; }
.bb-save {
  min-height: 48px; margin-inline-start: auto; padding: .65rem 1.55rem; border: 0;
  border-radius: .55rem; font-weight: 680 !important;
}
.bb-save:disabled { opacity: .57; cursor: default; }
@media (max-width: 640px) {
  .bb-builder { width: 100%; margin: auto auto 0; border-radius: 1rem 1rem 0 0; }
  .bb-pane { max-height: calc(100dvh - max(.6rem, env(safe-area-inset-top))); }
  .bb-layout { display: flex; flex-direction: column; gap: .9rem; }
  .bb-photo { aspect-ratio: 2.75; max-height: 9rem; }
  .bb-options { width: 100%; }
  .bb-builder h2 { margin-bottom: .9rem; }
  .bb-packs { gap: .4rem; margin-bottom: .85rem; }
  .bb-pack-face { flex-direction: column; gap: .2rem; padding: .55rem .2rem; }
  .bb-pack-face b { font-size: 1.08rem; }
  .bb-flavor-name, .bb-quantity label { font-size: .94rem; }
  .bb-footer {
    flex-direction: column; align-items: stretch; gap: .35rem; border-radius: 0;
    padding: .55rem 1.1rem max(.75rem, env(safe-area-inset-bottom));
  }
  .bb-when { font-size: .83rem; }
  .bb-save { width: 100%; }
}
