/* Phone-sized screens only. Desktop typography, spacing and controls stay intact. */
@media screen and (max-width:800px){
  /* Keep editable text readable, including search, filters and inline edits. */
  body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]):not([type=button]):not([type=submit]),
  body select,body textarea{font-size:16px!important;min-width:0;max-width:100%;box-sizing:border-box}

  /* Long titles and actions should wrap within their own row. */
  .ct-card-body h3,.ct-card-place,.ct-trip-card h2,.ct-trip-card h3{overflow-wrap:anywhere}
  .ct-community h1,.ct-community h2,.ct-public-stop strong{min-width:0;overflow-wrap:anywhere}
  .ct-plan-footer,.ct-start-footer,.ct-day-picker .ct-actions{flex-wrap:wrap}
  .ct-plan-footer>button,.ct-start-footer>button{max-width:100%;white-space:normal;overflow-wrap:anywhere}
  .wiz-hdr{flex-wrap:wrap;gap:8px}
  .wiz-title{min-width:0;overflow-wrap:anywhere}
  .wiz-step-lbl{flex-shrink:0}
  .ct-sort-row label>select{min-width:0;flex:1}
  .ct-explore-search-field .ct-suggestions{max-height:min(260px,40dvh);overscroll-behavior:contain}
  .ct-extra-filters,.ct-taxonomy-fields{min-width:0}
  .ct-community .ct-extra-filters{grid-template-columns:repeat(auto-fit,minmax(min(160px,100%),1fr))}

  /* A header row may wrap naturally; it need not be forced into a column. */
  .ct-community>header{flex-direction:row;align-items:center;flex-wrap:wrap}
  .ct-community>header nav{margin-left:auto;flex-wrap:wrap}

  /* Preserve a way to scroll tall dialogs when the available height is short. */
  .ct-product-dialog,.ct-community-dialog,.ct-memories-dialog,.ct-sharing-dialog,.ct-day-picker{
    max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;
    padding-bottom:max(20px,env(safe-area-inset-bottom,0px));
  }
}

@media screen and (max-width:800px) and (pointer:coarse){
  /* Enlarge the hit area, retaining the existing icon and label design. */
  .cal-p-nav{width:44px;min-width:44px;height:44px}
  .cal-pager-action,.d-nav-btn,.ct-day-controls button,
  .ct-community #community-actions button,.ct-back-to-trips,
  .ct-memory-ratings .ct-action,.ct-memory-access,.ct-memory-delete,
  .ct-memories-dialog .ct-action,.ct-input-tool{min-height:44px!important}
  .ct-selected-day button{width:44px;min-width:44px;min-height:44px}
  .ct-action-help>summary{width:44px;min-width:44px;min-height:44px}
  .ct-action-help>summary::after{inset:12px}
  .ct-community>header nav>a,.ct-share-own{display:inline-flex;align-items:center;min-height:44px}
  .ct-public-itinerary .ct-number-pin{width:44px;height:44px;flex-basis:44px;box-sizing:border-box}
  .ct-cover-credit summary{display:flex;align-items:center;min-height:44px}
  .original-tools{flex-wrap:wrap;justify-content:flex-start;gap:8px}
  .original-tools>button{flex:1 1 72px;min-width:44px;min-height:52px}
}
