/* Desktop/tablet layout; mobile keeps its existing touch navigation. */
@media (min-width: 700px) {
  main, .topbar, main > section { box-sizing: border-box; }
  main > section { margin-left: auto; margin-right: auto; }
  .market-home-search { grid-template-columns: minmax(0, 1fr) minmax(180px, 240px); }
  .home-suppliers-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-new-users { max-width: 560px; margin: 20px auto 0; }
  .home-new-users h2 { text-align: center; margin-bottom: 12px; }
  .modal-card, .detail-card:not(.detail-page .detail-card) { max-height: calc(100dvh - 48px); overflow-y: auto; }
  .auth-gate-box { box-sizing: border-box; width: min(100%, 440px); max-height: calc(100dvh - 48px); overflow-y: auto; }
  .tile { min-width: 0; }
  .tile-title { overflow-wrap: anywhere; }
}

@media (min-width: 900px) {
  :root { --desktop-width: 1200px; }
  .topbar { width: 100%; max-width: var(--desktop-width); margin: 0 auto; padding: 20px 28px 0; }
  main { max-width: var(--desktop-width); padding: 16px 28px 112px; }
  .topbar .ad-banner { width: 100%; max-width: none; margin-left: auto; margin-right: auto; }
  .topbar .ad-banner-body { padding: 18px 24px; }
  #homeView { box-sizing: border-box; max-width: var(--desktop-width); padding: 24px 28px 112px; }
  .feed-view, .news-view, .projects-view { max-width: none; padding-left: 0; padding-right: 0; }
  .market-home-head { margin-bottom: 20px; align-items: center; }
  .market-home-brand { font-size: 32px; }
  .market-home-identity .home-stats-bar { font-size: 13px; margin-top: 6px; }
  .market-home-more summary { font-size: 14px; padding: 0 18px; }
  .market-home-search { margin-bottom: 24px; }
  .market-home-section { margin-bottom: 28px; }
  .market-home-section-head h2 { font-size: 23px; }
  .market-home-section-head button { font-size: 14px; }
  .feed-grid, .market-home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .market-home-grid .tile-photo-wrap { aspect-ratio: 1.25; }
  .market-home-grid .tile-body { padding: 12px; }
  .market-home-grid .tile-title { font-size: 15px; line-height: 1.35; }
  .market-home-grid .tile-line, .market-home-grid .tile-price-line { font-size: 13px; }
  .screen-topbar { max-width: 860px; margin-left: auto; margin-right: auto; }
  .filter-bar { max-width: 860px; margin-left: auto; margin-right: auto; }
  .home-suppliers-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .home-supplier-card { min-width: 0; }
  .app-downloads { margin-top: 24px; padding-top: 16px; }
  .app-downloads-title { font-size: 14px; }
  #messagesView { width: 100%; max-width: 760px; }
  #messagesView .messages-title { font-size: 26px; }
  .messages-list .dlg-row { min-height: 64px; padding: 10px 14px; }
  .messages-list .dlg-row-name { font-size: 15px; }
  .messages-list .dlg-row-last { font-size: 13px; }
  #profileView, #productView, #balanceView { width: 100%; max-width: 880px; }
  .profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .market-dock {
    width: 680px; bottom: 16px; padding: 7px; border: 1px solid var(--border);
    border-radius: 20px; box-shadow: 0 8px 32px rgba(16, 24, 40, .12);
    backdrop-filter: blur(16px);
  }
  .market-dock button, .market-dock button.is-on { height: 58px; min-height: 58px; font-size: 12px; gap: 4px; }
  body.chat-open .chat-view { width: calc(100% - 56px); max-width: 880px; bottom: 104px; padding: 8px 20px 12px; border: 1px solid var(--border); border-radius: 18px; }
  body.chat-open:has(#marketDock.hidden) .chat-view { bottom: 20px; }
  .chat-head, .dlg-head { padding-bottom: 8px; }
  .chat-bubble { max-width: min(78%, 580px); }
  .detail-page .detail-card { max-width: 800px; margin-left: auto; margin-right: auto; }
  .detail-page .detail-photo-wrap { max-width: 520px; margin-left: auto; margin-right: auto; aspect-ratio: 1.25; }
  .detail-page .detail-photo { object-fit: contain; }
  .product-photo-wrap { max-width: 520px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1200px) {
  .feed-grid, .market-home-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (hover: hover) and (pointer: fine) and (min-width: 900px) {
  .market-home-grid .tile, .home-supplier-card { transition: box-shadow .18s ease, border-color .18s ease; }
  .market-home-grid .tile:hover, .home-supplier-card:hover { border-color: rgba(14, 107, 91, .3); box-shadow: 0 6px 20px rgba(16, 24, 40, .09); }
}
@media (prefers-reduced-motion: reduce) {
  .market-home-grid .tile, .home-supplier-card { transition: none; }
}
