/* The phone version. Everything here applies only at phone width, so the desktop is untouched.
   Same pages, same parts, sized and arranged for a thumb and a narrow screen:
   a tighter header, a bar of five buttons along the bottom, smaller tiles so more fit,
   buttons a finger can hit, and text boxes that do not make an iPhone zoom in. */

/* The bottom bar exists in every page and is hidden unless the screen is narrow. */
.mbar { display: none; }

@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  /* Below 16px, an iPhone zooms the whole page in when a box is tapped, and does not zoom back. */
  input, select, textarea { font-size: 16px !important; }
  .wrap { padding-left: 14px; padding-right: 14px; }

  /* ---- Header: logo and the bell on one row, the search on the next. */
  .bar { gap: 8px 10px; padding-top: 6px; padding-bottom: 8px; }
  .brand-mark { margin: -4px 0; }
  .brand-mark img { height: 44px; width: auto; }
  .nav { gap: 6px; }
  /* These two live in the bottom bar on a phone. */
  .nav .btn.dark, .nav a.btn[href="/browse"], .nav .acct-me { display: none; }
  .nav a.btn[href="#signin"] { padding: 7px 14px; font-size: 14px; }
  .search input { padding: 10px 12px; }
  .search button { padding: 0 14px; font-size: 14px; }
  .links { gap: 4px 16px; padding-bottom: 8px; font-size: 14px; }

  /* ---- The bottom bar. */
  .mbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 94%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .mtab { display: grid; justify-items: center; gap: 2px; padding: 4px 2px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 46px; align-content: center; }
  .mtab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mtab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mtab.on { color: var(--accent); }
  .mtab.main svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--accent); color: var(--accent-text); stroke-width: 2.6; margin-top: -18px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent); }
  .mtab.main { color: var(--text); }

  /* The beta note shrinks to its two words and sits clear of the bar. The full note is in Save. */
  .beta-flag { right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); padding: 3px 9px; border-radius: 999px; }
  .beta-flag span { display: none; }
  .beta-flag b { font-size: 10px; }

  /* ---- Home. */
  .hero .wrap { padding-top: 18px; padding-bottom: 22px; }
  .post-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px; border-radius: 16px; width: 100%; }
  .post-pick span { grid-column: 1 / -1; font-size: 12px; margin: 0 0 0 4px; }
  .post-pick a { text-align: center; padding: 11px 4px; font-size: 15px; }
  .hero h1 { font-size: 30px; margin: 14px 0 8px; }
  .hero p { font-size: 15px; margin-bottom: 14px; }
  .hero .cta { display: block; text-align: center; padding: 14px; font-size: 16px; }
  .facts { font-size: 13px; }
  main { gap: 26px; padding-top: 18px; }
  section > .head { flex-wrap: wrap; row-gap: 2px; margin-bottom: 8px; }
  .head h2 { font-size: 20px; }
  #searched-when { flex-basis: 100%; font-size: 12px; }
  .sub { font-size: 14px; margin: -4px 0 10px; }
  .start { padding: 14px; }
  .start h2 { font-size: 16px; }

  /* Smaller tiles, so two and a half show: the half says "there is more, swipe". */
  .belt { gap: 12px; }
  .searched { width: 132px; }
  .searched .sq { width: 132px; height: 132px; border-radius: 14px; }
  .tile-price { font-size: 19px; }
  .listing { width: 170px; padding: 10px; }
  .card-act { padding: 11px 8px; }

  /* "See all" is a plain button under its row: nothing hovers on a phone. */
  .has-all > .see-all, section.has-all > .see-all { position: static; display: inline-flex; margin-top: 10px; top: auto; right: auto; opacity: 1; transform: none; pointer-events: auto; padding: 9px 16px; box-shadow: none; }

  /* ---- Browse. */
  .bz-top h1, .browse h1 { font-size: 24px; }
  .bz-tabs { width: 100%; }
  .bz-tabs button { padding: 9px 12px; font-size: 14px; flex: 1 0 auto; justify-content: center; }
  .bz-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bz-cat, .bz-types .chip { min-height: 36px; }
  .cards.lots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .icard { padding: 8px; }
  .bz-more { width: 100%; padding: 13px; }

  /* ---- A listing: picture beside the title, then the price and the button. */
  .full { grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; }
  .full-pic .tile { width: 84px; height: 84px; border-radius: 14px; }
  .full-main h1 { font-size: 22px; margin-top: 4px; }
  .full-main .note { font-size: 15px; }
  .full-side { grid-column: 1 / -1; }
  .full-side .big { font-size: 34px; }
  .panel { padding: 14px; border-radius: 14px; }
  .bid-box { height: 216px; }
  .minor button { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .raises button { min-height: 38px; padding: 6px 14px; }
  .tb-steps li { font-size: 12px; gap: 5px; }
  .tb-steps li span { width: 20px; height: 20px; font-size: 11px; }
  .tradebox h2 { font-size: 22px; }
  .tradebox .place span { flex: 1 1 0; text-align: center; }
  .link-quiet { padding: 10px; }
  .about-head h2 { font-size: 18px; }

  /* ---- An item. */
  .s-card { padding: 16px; }
  .s-big { font-size: 40px; }
  .t-btn { min-height: 44px; }

  /* ---- Posting and the one-action pages. */
  main.post-page { padding-top: 16px; gap: 14px; }
  .post-page h1 { font-size: 26px; }
  .step { padding: 14px; border-radius: 16px; }
  .kinds { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .kinds button { padding: 10px 8px; }
  .kinds button small { display: none; }
  .kinds button b { font-size: 15px; justify-content: center; }
  .act-what .tile { width: 68px; height: 68px; }
  .act-what h2 { font-size: 19px; }

  /* ---- A trader's page. */
  .trader .face { width: 60px; height: 60px; font-size: 28px; }
  .trader h1 { font-size: 24px; }
  .figures { gap: 14px; justify-content: space-between; }
  .figures b { font-size: 22px; }
  .lots { grid-template-columns: minmax(0, 1fr); }

  /* ---- Boxes that pop up come up from the bottom, full width, like a phone's own sheets. */
  dialog.acct, dialog#sheet, dialog#form-sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 86vh; border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .acct-in { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .bell-panel { position: fixed !important; top: 58px !important; left: 8px !important; right: 8px !important; width: auto; max-height: 70vh; }
  .suggest { left: 0 !important; width: 100% !important; }

  /* The footer's four columns become two. */
  .foot-cols .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .foot-cols a { padding: 6px 0; }
}

/* The Save sheet's "how to" steps (shown on any screen that opens it). */
.save-how { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; }
.save-how ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--muted); }
.save-how ol b, .save-how > b { color: var(--text); }
.save-beta { border-top: 1px solid var(--line); padding-top: 10px; }

@media (max-width: 640px) {
  /* The picture is drawn to fit its smaller frame. */
  .full-pic .tile img, .act-what .tile img { max-width: 78%; max-height: 78%; width: auto !important; height: auto !important; }
}

@media (max-width: 640px) {
  .ltile { width: 132px; }
  .ltile .sq { width: 132px; height: 132px; border-radius: 14px; }
  .ltile .sq .ktag { font-size: 9px; padding: 1px 6px 1px 4px; top: 9px; left: 6px; }
  .ltile .tile-from .badge { font-size: 10px; }
  .cards.lots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
}

@media (max-width: 640px) {
  .ltile .sq { padding-bottom: 30px; }
  .ltile .sq .card-act { left: 6px; right: 6px; bottom: 6px; padding: 8px 4px; font-size: 13px; }
  .ltile .sq .clock { top: 9px; right: 6px; font-size: 10px; }
}

@media (max-width: 640px) {
  /* The first row (latest sale prices), lifted above the hero. */
  .top-checks { padding-top: 14px; padding-bottom: 6px; }
  .top-checks:has(> section[hidden]) { display: none; }
}
