/* Phone polish (≤768px): no layout changes, only touch, legibility and feedback details.
   Desktop rules live in desktop.css; nothing here applies above 768px. */
@media (max-width:768px) {
  /* iOS Safari zooms into any focused field under 16px and stays zoomed. */
  input:not([type='checkbox']):not([type='radio']):not([type='range']),select,textarea { font-size:16px!important; }
  .ranking-search { min-height:34px; }
  .ranking-search input { padding:4px 0; }
  #header-filters :is(.auth-input,.range-input,select),.mb-select { height:34px; }

  /* Bigger touch targets without changing what the controls look like. */
  :is(.icon-button:not(.scroll-top),.header-back,.glass-tabs button,.chip,.glass-label,.fund-external,.fav-star,.header-login,.header-avatar,.text-link) { position:relative; }
  :is(.icon-button,.header-back,.header-login,.header-avatar)::after { content:''; position:absolute; inset:-7px -2px; }
  :is(.glass-tabs button,.chip,.glass-label)::after { content:''; position:absolute; inset:-7px 0; }
  .fund-favorite::after { inset:-11px -8px -11px -10px; }
  :is(.fund-external,.fav-star)::after { content:''; position:absolute; inset:-11px -8px; }
  .text-link::after { content:''; position:absolute; inset:-10px -4px; }

  /* 10px Chinese is hard to read on a phone; reading text moves up to 11px. Chart labels stay. */
  .tabbar a { font-size:11px; }
  .header-heading small,.fund-tag,.fund-result-value small,.fund-periods,.detail-heading>.muted,
  .quant-snapshot-time small,.quant-composite small,.quant-factor-label>small,.quant-factor-missing,
  .quant-card-provenance,.quant-chanlun-scope,.quant-confirmed-label,.seat-kind,.market-tag,.report-chip,
  .mb-sources,.mb-result-summary,.mb-area-notice,.mb-chart-tip,.mb-note,.mb-meta,.mb-footer,
  .mb-list-row small,.mb-stock-row small,.mb-metric small,.mb-market-status strong,
  .rotation-hint,.rotation-source,.rotation-table thead th small,.chain-node-footer { font-size:11px; }

  /* The back-to-top button only appears once there is something to go back to. */
  .scroll-top { width:36px; height:36px; opacity:0; pointer-events:none; transform:translateY(8px);
    transition:opacity .2s,transform .2s; }
  .is-scrolled .scroll-top { opacity:.92; pointer-events:auto; transform:none; }

  /* Tab roots have nowhere to go back to. */
  .is-tab-root .header-back { display:none; }

  /* Pressed feedback, since touch has no hover. */
  :is(.more-link,.quick-cell,.index-card,.rank-item,.sector-item,.fav-item,.longhu-item,.fund-title-button,.scope-option) { transition:background-color .12s,transform .12s; }
  :is(.more-link,.quick-cell,.index-card,.rank-item,.sector-item,.fav-item,.scope-option):active { background:var(--color-surface-alt); transform:scale(.985); }
  :is(.btn,.btn-secondary,.chip,.glass-tabs button,.glass-label,.icon-button,.header-back,.header-login):active { opacity:.72; }
  .tabbar a:active .icon { transform:scale(.88); }
  .tabbar .icon { transition:transform .12s; }
  .tabbar a.is-active span:last-child { font-weight:600; }

  /* Quant: the result-time label stays beside the view tabs instead of taking its own row. */
  .quant-header-row { flex-wrap:nowrap; align-items:center; gap:8px; }
  .quant-header-row>.glass-tabs { width:auto; flex:1 1 auto; }
  .quant-snapshot-time { margin-left:0; line-height:1.3; }

  /* Short quote time on index cards: 09-23 15:00 instead of 2026-09-23 15:00:00. */
  .quote-full { display:none; }
}

/* iPhone SE and other 320–360px screens: keep header actions on one line. */
@media (max-width:360px) {
  .header-controls,#header-actions { gap:2px; }
  .app-header .icon-button { width:26px; height:26px; }
  .app-header .icon-button .icon { width:15px; height:15px; }
  .ranking-toolbar { gap:4px; }
  .ranking-toolbar .glass-label { padding:4px 8px; }
  .merge-label { margin-left:0; gap:3px; }
  .quant-header-row { gap:6px; }
  .quant-header-row>.glass-tabs button { padding:0 6px; }
}
