/* Prebuilt template only. Tablet and phone pin the build summary to the bottom. */

body.prebuilt-template .sum-toggle {
  display: none;
}

body.prebuilt-template .xs {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
}
body.prebuilt-template .xs > div {
  width: 100%;
  min-width: 0;
}
body.prebuilt-template .xs > span.mono {
  margin-top: auto;
  color: var(--ink);
  line-height: 18px;
}

body.prebuilt-template .variant-pick .seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 7.5rem;
  width: max-content;
  max-width: 100%;
  flex-wrap: nowrap;
}
body.prebuilt-template .variant-pick .seg button {
  width: 7.5rem;
  min-width: 7.5rem;
  max-width: 7.5rem;
  min-height: 44px;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  flex: none;
}
body.prebuilt-template .variant-pick .seg.peri {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}
body.prebuilt-template .variant-pick .seg.peri button {
  width: auto;
  min-width: 0;
  max-width: none;
  flex: 1 1 7.5rem;
  white-space: normal;
  text-align: center;
}
body.prebuilt-template .g-body .seg.peri {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
}
body.prebuilt-template .g-body .seg.peri button {
  flex: 1 1 12rem;
  min-height: 44px;
  width: auto;
  max-width: none;
  white-space: normal;
  text-align: center;
}

@media (min-width: 1181px) {
  body.prebuilt-template .sum-sheet,
  body.prebuilt-template .sum-dock {
    display: contents;
  }
  body.prebuilt-template .sum-top { order: 1; }
  body.prebuilt-template .sum-list { order: 2; }
  body.prebuilt-template .sum-total { order: 3; }
  body.prebuilt-template .sum-actions { order: 4; }
  body.prebuilt-template .sum-foot { order: 5; }
}

@media (max-width: 1180px) {
  body.prebuilt-template {
    padding-bottom: calc(210px + env(safe-area-inset-bottom));
  }
  body.prebuilt-template .summary {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 39;
    clip-path: none;
    background: var(--surface);
    border-top: 2px solid var(--ink);
    box-shadow: none;
    max-height: calc(100dvh - 8px);
  }
  body.prebuilt-template .sum-sheet {
    display: none;
    max-height: calc(100dvh - 76px - 210px - env(safe-area-inset-bottom));
    overflow: auto;
  }
  body.prebuilt-template .summary.is-open .sum-sheet {
    display: block;
  }
  body.prebuilt-template .sum-list {
    max-height: none;
    overflow: visible;
  }
  body.prebuilt-template .sum-dock {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
  }
  body.prebuilt-template .sum-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 10px 0 2px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
  }
  body.prebuilt-template .sum-actions {
    padding: 0;
  }
  body.prebuilt-template .sum-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  body.prebuilt-template .sum-toggle .k {
    font-family: var(--display);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
  }
  body.prebuilt-template .sum-toggle .v {
    font-family: var(--mono);
    font-size: 20px;
    line-height: 24px;
    font-weight: 500;
  }
  body.prebuilt-template .sum-arrow {
    flex: none;
    transition: transform .2s ease;
  }
  body.prebuilt-template .summary.is-open .sum-arrow {
    transform: rotate(180deg);
  }
  body.prebuilt-template .sum-actions .btn {
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 720px) {
  body.prebuilt-template .g-head {
    grid-template-columns: 48px minmax(0, 1fr) auto 18px;
    gap: 10px;
    padding: 12px;
  }
  body.prebuilt-template .g-price {
    display: block;
    font-size: 12px;
  }
  body.prebuilt-template .g-ico {
    width: 48px;
    height: 48px;
  }
  body.prebuilt-template .g-ico img {
    width: 40px;
    height: 40px;
  }
  body.prebuilt-template .g-title .t {
    font-size: 16px;
    line-height: 20px;
  }
  body.prebuilt-template .g-title .s {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 18px;
  }
  body.prebuilt-template .g-body {
    padding: 4px 12px 14px;
  }
  body.prebuilt-template .opts {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  body.prebuilt-template .opt {
    clip-path: none;
  }
  body.prebuilt-template .o-main {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px;
    align-items: center;
  }
  body.prebuilt-template .o-img {
    width: 56px;
    height: 56px;
  }
  body.prebuilt-template .o-img img {
    width: 48px;
    height: 48px;
  }
  body.prebuilt-template .o-name {
    font-size: 14px;
    line-height: 18px;
  }
  body.prebuilt-template .o-spec {
    font-size: 11px;
    line-height: 15px;
    margin-top: 2px;
  }
  body.prebuilt-template .o-price {
    font-size: 12px;
  }
  body.prebuilt-template .o-right {
    gap: 6px;
  }
  body.prebuilt-template .seg {
    display: flex;
    width: 100%;
  }
  body.prebuilt-template .seg button {
    flex: 1 1 0;
    padding: 10px 8px;
    white-space: normal;
  }
  body.prebuilt-template .sum-actions .row {
    grid-template-columns: 1fr 1fr;
  }
}

html[lang|="zh"] body.prebuilt-template .btn,
html[lang|="zh"] body.prebuilt-template .plate,
html[lang|="zh"] body.prebuilt-template .eyebrow,
html[lang|="zh"] body.prebuilt-template .sum-toggle .k,
html[lang|="zh"] body.prebuilt-template .g-title .t {
  letter-spacing: 0.04em;
}

@media (max-width: 400px) {
  body.prebuilt-template .o-main {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    padding: 10px;
  }
  body.prebuilt-template .o-img,
  body.prebuilt-template .o-img img {
    width: 48px;
    height: 48px;
  }
}

body.prebuilt-template .g-body .seg.peri,
body.prebuilt-template .variant-pick .seg.peri {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
body.prebuilt-template .g-body .seg.peri button.peri-opt,
body.prebuilt-template .variant-pick .seg.peri button.peri-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
}
body.prebuilt-template .peri-shots {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: none;
}
body.prebuilt-template .peri-main,
body.prebuilt-template .peri-extra {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #fff;
  flex: none;
}
body.prebuilt-template .peri-more {
  display: none;
  align-items: center;
  gap: 6px;
}
body.prebuilt-template .peri-opt:hover .peri-more,
body.prebuilt-template .peri-opt:focus-within .peri-more,
body.prebuilt-template .peri-row:hover .peri-more,
body.prebuilt-template .peri-row:focus-within .peri-more {
  display: flex;
}
body.prebuilt-template .seg.peri.peri-classes {
  box-shadow: none;
  gap: 12px;
}
body.prebuilt-template .peri-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
body.prebuilt-template .peri-frame-title {
  font-family: var(--display);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
body.prebuilt-template .peri-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
body.prebuilt-template .peri-row .peri-opt {
  flex: 1 1 auto;
  min-width: 0;
}
body.prebuilt-template .peri-qty {
  display: inline-flex;
  align-items: stretch;
  flex: none;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
body.prebuilt-template .peri-qty button {
  width: 36px;
  height: 36px;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
  font-size: 18px;
  line-height: 1;
}
body.prebuilt-template .peri-count {
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
}
body.prebuilt-template .peri-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
body.prebuilt-template .peri-name {
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.04em;
}
body.prebuilt-template .peri-spec {
  font-size: 11px;
  line-height: 15px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}
body.prebuilt-template .peri-price {
  margin-left: auto;
  font-size: 12px;
  white-space: nowrap;
}
@media (max-width: 1180px) {
  body.prebuilt-template .g-body .seg.peri button.peri-opt,
  body.prebuilt-template .variant-pick .seg.peri button.peri-opt {
    flex: 1 1 auto;
    width: 100%;
  }
  body.prebuilt-template .peri-row .peri-opt {
    width: auto;
  }
}
@media (max-width: 640px) {
  body.prebuilt-template .peri-row {
    flex-wrap: wrap;
  }
  body.prebuilt-template .peri-row .peri-opt {
    flex: 1 1 100%;
    width: 100%;
  }
  body.prebuilt-template .peri-qty {
    margin-left: auto;
  }
}
