/* market.css: Browse, Sell and public-profile styles (round 4b web-market lane). Loaded after listing.css; overrides app.css. */

/* Cards: condition label follows the UI language ("Well used" is wider than "6成新"), so the price row may wrap on narrow phones. */
.card .c-row{flex-wrap:wrap;row-gap:3px;column-gap:8px}
.card .c-row .cond{min-width:0;flex:0 1 auto}
.card .c-row .pct{white-space:nowrap}

/* Sold cards (seller profile → Sold tab): the 已售 stamp sits dead centre on the greyed photo */
.card .tile .stamp{top:50%}

/* Sell photos: portrait tiles (phone photos are 3:4), no gradient scrim, and tap targets a thumb can hit:
   remove × top-right, earlier / later as two half-width bars along the bottom (≥40px tall). */
.photos .ph,.photos .ph-add{aspect-ratio:3/4}
.ph .ph-tools{inset:0;display:block;padding:0;background:none;pointer-events:none}
.ph .ph-tools button{position:absolute;pointer-events:auto;width:auto;height:40px;border-radius:0;background:color-mix(in srgb,#fff 92%,transparent);color:#151515}
.ph .ph-tools button svg{width:18px;height:18px}
.ph .ph-tools [data-ph="del"]{top:0;right:0;width:40px;border-bottom-left-radius:var(--r)}
.ph .ph-tools [data-ph="left"]{left:0;bottom:0;width:calc(50% - .5px)}
.ph .ph-tools [data-ph="right"]{right:0;bottom:0;width:calc(50% - .5px)}
.ph .ph-tools button:disabled{opacity:1;color:#151515;background:color-mix(in srgb,#fff 45%,transparent)}
.ph .ph-tools button:disabled svg{opacity:.35}
.ph .ph-tools button:focus-visible{outline:2px solid var(--fg);outline-offset:-3px;z-index:1}
.ph .ph-tools button:hover:not(:disabled){background:#fff}

/* People strip (search → Items tab): name + 认证 seal on one line, then school · dorm */
.pstrip-l .ps-n{display:flex;align-items:center;gap:6px;min-width:0}
.pstrip-l .ps-n .seal-mark{flex:none}
.pstrip-l a{min-height:44px}

/* Browse on touch screens: category chips, filter checks and sort are full 44px tap targets */
@media (pointer:coarse){
  .cats .cat{min-height:44px}
  .results-bar .controls .check{min-height:44px;display:inline-flex;align-items:center}
  .results-bar .controls select{min-height:44px}
}

/* ---- v1.9 (§20.8) public profile: identity (avatar 64 · name + 认证 + 已实名 · school · dorm) + ⋯, mono stat strip,
   tabs + grid. Phone: one column. Desktop ≥960: a 300px sticky identity column on the left, tabs + grid on the right. */
.up{padding-top:20px}
.up .up-grid{display:flex;flex-direction:column;gap:0}
.up .up-id{min-width:0}
.up .up-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:14px;align-items:start;padding-bottom:16px}
.up .up-who{min-width:0;padding-top:4px}
.up .up-name{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;margin:0;font-size:22px;line-height:1.25;letter-spacing:-.02em}
.up .up-n{min-width:0;overflow-wrap:anywhere}
.up .up-name .seal-mark,.up .up-name .realname-mark{flex:none}
.up .up-where{margin:4px 0 0;font-size:14px;color:var(--muted);overflow-wrap:anywhere}
.up .up-when{margin:2px 0 0;font-size:12.5px}
.up .up-more{margin:2px -6px 0 0}
.up .up-more-btn{width:44px;height:44px;border-color:transparent;color:var(--muted)}
.up .up-more-btn:hover,.up .up-more-btn[aria-expanded="true"]{border-color:var(--rule);color:var(--fg)}
.up .up-more-btn:focus-visible{outline:2px solid var(--fg);outline-offset:1px}
.up .up-more-btn svg{width:22px;height:22px}
.up .up-menu{min-width:180px}
.up .up-menu button{display:flex;align-items:center;gap:10px;min-height:44px;color:var(--fg)}
.up .up-menu button svg{width:17px;height:17px;flex:none;color:var(--muted)}
.up .up-menu .up-danger svg{color:var(--seal)}
.up .up-menu button:focus-visible{outline:2px solid var(--fg);outline-offset:-2px}
.up .up-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:0 0 18px;border-top:1px solid var(--rule);border-bottom:1px solid var(--rule)}
.up .up-stats>div{min-width:0;padding:11px 0 11px 12px;border-left:1px solid var(--rule)}
.up .up-stats>div:first-child{padding-left:0;border-left:0}
.up .up-stats dt{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.up .up-stats dd{margin:3px 0 0;font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-size:20px;font-weight:600;letter-spacing:-.02em;line-height:1.2;white-space:nowrap}
.up .up-stats dd small{margin-left:1px;font-size:12px;font-weight:500;color:var(--muted)}
.up .up-stats .up-joined{font-size:14px;line-height:24px;letter-spacing:0}
.up .up-stats .up-new{font-family:var(--font-ui);font-size:14px;line-height:24px;font-weight:600;color:var(--muted);letter-spacing:0}
@media (max-width:400px){
  .up .up-stats>div{padding-left:9px}
  .up .up-stats dd{font-size:18px}
  .up .up-stats .up-joined{font-size:12.5px}
}
.up .up-note{display:flex;gap:8px;align-items:flex-start;margin:0 0 16px;font-size:13.5px;line-height:1.5;color:var(--muted)}
.up .up-note svg{flex:none;width:17px;height:17px;margin-top:1px;color:var(--ok)}
.up .up-bio{margin:0 0 18px;max-width:60ch;white-space:pre-wrap;overflow-wrap:anywhere;font-size:15px;line-height:1.6}
.up .up-you{margin:0 0 18px;font-size:13.5px;color:var(--muted)}
.up .up-you a{color:var(--fg);font-weight:600;white-space:nowrap}
.up .up-main{min-width:0}
@media (min-width:960px){
  .up{padding-top:32px}
  .up .up-grid{display:grid;grid-template-columns:300px minmax(0,1fr);gap:56px;align-items:start}
  .up .up-id{position:sticky;top:calc(var(--bar-h) + 24px)}
  .up .up-head{grid-template-columns:auto minmax(0,1fr) auto}
  .up .up-stats{grid-template-columns:repeat(2,minmax(0,1fr));border-bottom:0}
  .up .up-stats>div{padding:12px 0 12px 14px;border-bottom:1px solid var(--rule)}
  .up .up-stats>div:nth-child(odd){padding-left:0;border-left:0}
  .up .up-main .grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (min-width:1280px){.up .up-main .grid{grid-template-columns:repeat(4,minmax(0,1fr))}}

/* ---- v1.9 (§20.12) Browse, less chrome. Phone: the count and a "Filter · 筛选" button share ONE 36px row; the toggles and
   sort live in a bottom sheet. Desktop: category chips on the left, count + toggles + sort on the right, one row. */
.fbtn{position:relative;display:none;align-items:center;gap:6px;flex:none;height:36px;padding:0 12px;border:1px solid var(--rule);border-radius:var(--r);background:transparent;color:var(--fg);font:inherit;font-size:13.5px;font-weight:600;cursor:pointer;white-space:nowrap}
.fbtn::after{content:"";position:absolute;inset:-4px -2px}
.fbtn:hover{border-color:var(--fg)}
.fbtn:focus-visible{outline:2px solid var(--fg);outline-offset:2px}
.fbtn svg{width:17px;height:17px}
.fbtn .fb-n{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--fg);color:var(--bg);font-size:11px;font-weight:600;line-height:1}
@media (max-width:760px){
  .br-top .results-bar{flex-wrap:nowrap;min-height:36px;margin:10px 0 14px;gap:12px}
  .br-top .results-bar .stats{min-width:0;font-family:var(--font-mono);font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .br-top .results-bar .controls{display:none}
  .br-top .fbtn{display:inline-flex}
}
@media (min-width:761px){
  .br-top{display:flex;align-items:center;gap:12px 20px;margin:0 0 24px}
  .br-top .cats{flex:1 1 auto;min-width:0;gap:4px}
  .br-top .cat,.br-top .cat.all{padding:5px 10px;font-size:13.5px}
  .br-top .cat{gap:6px}
  .br-top .cat .cg{width:20px;height:20px;font-size:12px}
  .br-top .cat:not(.all){padding-left:5px}
  .br-top .cats.ng .cat{padding-left:10px}
  .br-top .cats.ng .cg{display:none} /* browse.js adds .ng when the one desktop row has no room for the glyph tiles */
  .br-top .results-bar{flex:none;flex-wrap:nowrap;margin:0;gap:14px}
  .br-top .results-bar .stats{font-family:var(--font-mono);font-size:12.5px;white-space:nowrap}
  .br-top .controls{flex-wrap:nowrap;gap:14px}
  .br-top .check{white-space:nowrap}
  /* only when the chips don't fit (narrow desktop windows): the last one fades out, so the row reads as "scroll for more" */
  .br-top .cats.ovf{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 32px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 32px),transparent);padding-right:28px}
}

/* filter sheet (a core.js modal: a bottom sheet on phones, a centred dialog elsewhere) */
.fs-dlg .modal-b{gap:18px}
.fsheet .fs-group{display:flex;flex-direction:column;margin-top:-8px}
.fsheet .fs-row{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:60px;padding:8px 0;border-bottom:1px solid var(--rule);cursor:pointer}
.fsheet .fs-row.off{cursor:default}
.fsheet .fs-l{display:flex;flex-direction:column;gap:2px;min-width:0}
.fsheet .fs-l b{font-size:15px;font-weight:600}
.fsheet .fs-l small{font-size:12.5px;line-height:1.4;color:var(--muted)}
.fsheet .fs-row.off b{color:var(--muted)}
.fsheet .fs-link{display:inline-flex;align-items:center;gap:2px;align-self:flex-start;min-height:44px;margin:-4px 0 0;color:var(--fg);font-size:13.5px;font-weight:600;text-decoration:underline;text-decoration-color:var(--faint);text-underline-offset:3px}
.fsheet .fs-link svg{width:15px;height:15px}
.fsheet .fs-sw{appearance:none;-webkit-appearance:none;position:relative;flex:none;width:46px;height:28px;margin:0;border:1px solid var(--rule);border-radius:14px;background:var(--tint);cursor:pointer;transition:background .15s var(--ease)}
.fsheet .fs-sw::before{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:var(--muted);transition:transform .15s var(--ease),background .15s var(--ease)}
.fsheet .fs-sw:checked{background:var(--fg);border-color:var(--fg)}
.fsheet .fs-sw:checked::before{transform:translateX(18px);background:var(--bg)}
.fsheet .fs-sw:disabled{opacity:.45;cursor:not-allowed}
.fsheet .fs-sw:focus-visible{outline:2px solid var(--fg);outline-offset:3px}
.fsheet .fs-sort{margin:0;padding:0;border:0;min-width:0}
.fsheet .fs-sort legend{padding:0;margin:0 0 4px;font-family:var(--font-mono);font-size:11.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.fsheet .fs-opt{display:flex;align-items:center;gap:12px;min-height:48px;border-bottom:1px solid var(--rule);font-size:15px;cursor:pointer}
.fsheet .fs-opt input{width:18px;height:18px;margin:0;accent-color:var(--fg)}
.fs-dlg .modal-f .btn:last-child{flex:1 1 auto}
@media (prefers-reduced-motion:reduce){.fsheet .fs-sw,.fsheet .fs-sw::before{transition:none}}

/* v1.9 trust line (core.js trustLine): break between the facts, never inside one */
.trust-line .tl-p{white-space:nowrap}

/* ---- v2.0 (§21.4) price drops: a small ink "↓" beside the card price; on the listing "Price dropped · 降价" + struck old price */
.card .c-pr{display:inline-flex;align-items:baseline;gap:5px;min-width:0}
.card .c-drop{display:inline-grid;place-items:center;align-self:center;width:18px;height:18px;border:1px solid var(--ok);border-radius:2px;color:var(--ok);font-family:var(--font-mono);font-size:12px;font-weight:700;line-height:1}
.li .li-drop{display:inline-flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.li .li-drop-t{display:inline-flex;align-items:center;gap:3px;align-self:center;padding:2px 7px 2px 5px;border:1px solid var(--ok);border-radius:2px;color:var(--ok);font-size:12px;font-weight:700;line-height:1.4;white-space:nowrap}
.li .li-drop-t svg{flex:none;width:13px;height:13px}
.li .li-was{color:var(--muted);font-size:15px;text-decoration-thickness:1.5px}

/* ---- no-photo tiles at card size (Browse, profile, Me, 404): the glyph is still cropped by the edge, but it reads as a character */
.tile-card .glyph{font-size:80cqw;right:-2%;bottom:-6%}

/* ---- Browse on desktop when the one row can't hold everything (browse.js adds .wrap): the chips get their own full-width
   row (nothing hidden behind a fade), the count sits under them on the left and Same building / Ships to me / Sort on the right. */
@media (min-width:761px){
  .br-top.wrap{flex-wrap:wrap;gap:12px 20px}
  .br-top.wrap .cats{flex:1 1 100%}
  .br-top.wrap .results-bar{flex:1 1 100%;justify-content:space-between}
}

/* Sell on phones: the card preview would sit after Publish, where it only adds scrolling; desktop keeps it beside the form */
@media (max-width:760px){.sell-side{display:none}}

/* category chips sit in a scroller with 2px padding: draw their focus ring inside so it isn't clipped */
.cats .cat:focus-visible{outline-offset:-2px}

/* v2.1 QA: Filter button is a full 44px target on phones */
@media (max-width:760px){ .br-top .fbtn{height:44px;min-height:44px} .br-top .results-bar{min-height:44px} }

/* §20.0: Publish / Save changes stays reachable on phones in a sticky bar above the tab bar (same look as the order page's
   .tr-dock); the form gets room underneath so its last fields are never hidden. Desktop keeps the inline row. */
@media (max-width:760px){
  #sellForm{padding-bottom:calc(64px + 16px)}
  html:has(#sellForm .sell-dock){scroll-padding-bottom:calc(var(--tabbar-h,0px) + 64px + 16px + env(safe-area-inset-bottom,0px))}
  .sell-dock{position:fixed;left:0;right:0;z-index:19;margin:0;bottom:calc(var(--tabbar-h,0px) + env(safe-area-inset-bottom,0px));
    min-height:64px;display:flex;flex-wrap:nowrap;gap:8px;align-items:center;
    padding:10px max(16px,env(safe-area-inset-right,0px)) 10px max(16px,env(safe-area-inset-left,0px));
    background:var(--bg);border-top:1px solid var(--rule)}
  .sell-dock .btn{min-height:44px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .sell-dock [type=submit]{flex:1 1 auto;min-width:0}
  .sell-dock .btn-ghost{flex:0 1 auto;min-width:0}
}
