/* Keep phone controls inside their own layout instead of masking page overflow.
   Canvas gestures and the review/clip-art scrollers keep their existing behavior. */
@media (max-width:700px) {
  #homePage .store-hero,
  #homePage .store-help,
  .finish-layout,
  .banner-cart-layout,
  .accessory-layout {
    grid-template-columns:minmax(0,1fr);
  }
  #homePage .store-hero>*,
  #homePage .store-help>*,
  .finish-layout>*,
  .banner-cart-layout>*,
  .accessory-layout>* {
    min-width:0;
    max-width:100%;
  }
  #homePage .store-hero-photo,
  #homePage .featured-customer-reviews,
  #homePage .featured-review-track,
  #homePage .catalog,
  #homePage .friendly-sizing,
  #designerPage .designer-workspace-panel,
  #designerPage .designer-tools-panel,
  #productDesignerPanel,
  #cartPage .shopping-cart-item>* {
    min-width:0;
    max-width:100%;
  }
  #homePage .featured-customer-review,
  #cartPage .shopping-cart-item h2 {
    overflow-wrap:anywhere;
  }
  #designerPage :is(input,select,textarea),
  #cartPage :is(input,select,textarea),
  #productDesignerPanel :is(input,select,textarea),
  #catalogProductDialog :is(input,select,textarea) {
    min-width:0;
    max-width:100%;
  }
  #finishJump {
    width:100%;
    min-width:0;
    max-width:100%;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  #designerPage :is(.simple-canvas-bar,.simple-history,.designer-move-tools),
  #cartPage .shopping-cart-actions,
  #productDesignerSurfaces {
    flex-wrap:wrap;
  }
  #productDesignerSurfaces button {
    flex:1 1 120px;
    min-width:0;
    max-width:100%;
    white-space:normal;
  }
  #cartPage :is(dt,dd),
  #designerPage .finish-summary :is(dt,dd) {
    min-width:0;
    overflow-wrap:normal;
  }
  /* Header links remain reachable without swiping the whole page sideways. */
  header .store-header,
  header .store-header>* {
    min-width:0;
    max-width:100%;
  }
  header .store-header>nav,
  html[data-thb-route] header .store-header>nav {
    flex:1 1 100%;
    width:100%;
    min-width:0;
    max-width:100%;
    flex-wrap:wrap;
    justify-content:flex-start;
    overflow-x:visible;
  }
  header .store-header>nav a,
  html[data-thb-route] header .store-header>nav a {
    flex:0 1 auto;
    min-width:0;
    max-width:100%;
    white-space:normal;
    overflow-wrap:anywhere;
  }
  /* Override the older ID-scoped input/select minimum widths explicitly. */
  #products .catalogbar,
  #homePage .catalogbar {
    min-width:0;
    max-width:100%;
    flex-wrap:wrap;
  }
  #products .catalogbar input,
  #products .catalogbar select,
  #products .catalogbar button {
    width:100%;
    min-width:0;
    max-width:100%;
  }
}

/* Give shopping actions room to read and tap. Never split button labels
   mid-word just to make several controls share a phone-width row. */
#cartPage .shopping-cart-actions button,
#cartPage .cart-hardware-controls button {
  flex:0 1 auto;
  white-space:normal;
  word-break:normal;
  overflow-wrap:normal;
  line-height:1.4;
  padding:12px 16px;
}
#cartPage .shopping-cart-item dd,
#cartPage .cart-checkout-summary dd,
#designerPage .finish-summary dd { white-space:nowrap; }

.closemodal,
#catalogProductClose {
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;
  display:grid;
  place-items:center;
  line-height:1;
  padding:0;
}
#startDialog #aiFinishedChoice { min-height:44px; }

@media (max-width:700px) {
  #cartPage .shopping-cart-actions {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    align-items:stretch;
    gap:10px;
    margin-top:18px;
  }
  #cartPage .shopping-cart-actions label {
    width:120px;
    max-width:100%;
    margin-bottom:4px;
    font-size:16px;
  }
  #cartPage .shopping-cart-actions button,
  #cartPage .cart-hardware-controls button,
  #cartPage .cart-item-hardware>button {
    width:100%;
    min-height:48px;
    margin:0;
    font-size:16px;
    word-break:normal;
    overflow-wrap:normal;
  }
  #cartPage .cart-item-hardware>button { margin-top:10px; }
  #cartPage .cart-hardware-controls label { width:100%;max-width:100%; }
  #cartPage .cart-size-offer { padding:14px; }
  #cartPage .cart-size-offer button { overflow-wrap:normal;word-break:normal; }
  #homePage :is(input,select,textarea),
  #designerPage :is(input,select,textarea),
  #cartPage :is(input,select,textarea),
  #accessoriesPage :is(input,select,textarea),
  dialog :is(input,select,textarea) {
    font-size:16px;
  }
  header .store-header>nav { gap:4px 12px; }
  header .store-header>nav a { display:flex;align-items:center;min-height:44px;font-size:14px; }
  #finishJump,
  #finishReviewButton,
  #accessoryContinue,
  #cartCheckout { white-space:normal;overflow-wrap:normal;word-break:normal;line-height:1.4; }
  #finishRemoveDialog .finish-dialog-actions { flex-direction:column; }
  #finishRemoveDialog .finish-dialog-actions button { width:100%;min-height:48px;white-space:normal; }
  #productDialog h2,
  #startDialog .startintro h2 { padding-right:18px; }
}

@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
}
