/* Layout: sticky header (who toggle) with a tab bar — fixed at the bottom on phones, inside the header on wide screens —
   over one column of filters and a responsive card grid; details open in a bottom sheet. */
:root {
  --bg: #f4f4f0; --surface: #ffffff; --ink: #1b1c21; --muted: #676a74; --line: #e1e1da;
  --indigo: #273a78; --on-indigo: #ffffff; --sale: #c4352b; --chip: #e9e9e2; --photo: #efefea;
  --shade: rgba(18, 20, 28, .45); --good: #2f6b45;
  --font-body: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111216; --surface: #1a1b21; --ink: #ececef; --muted: #9c9fab; --line: #2a2c35;
    --indigo: #a3b3f2; --on-indigo: #111216; --sale: #f07b70; --chip: #24262e; --photo: #dcdcd6;
    --shade: rgba(0, 0, 0, .6); --good: #7cc495; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111216; --surface: #1a1b21; --ink: #ececef; --muted: #9c9fab; --line: #2a2c35;
  --indigo: #a3b3f2; --on-indigo: #111216; --sale: #f07b70; --chip: #24262e; --photo: #dcdcd6;
  --shade: rgba(0, 0, 0, .6); --good: #7cc495; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button { font: inherit; color: inherit; }
a { color: var(--indigo); }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { padding-block: 10px 0; display: grid; gap: 8px; }
.brandline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { font-family: var(--font-data); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; }
.who { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 3px; }
.who button { border: 0; background: none; padding: 5px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; }
.who button[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); font-weight: 600; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 8px 12px 10px; font-size: 15px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.count { font-family: var(--font-data); font-size: 12px; color: var(--muted); }

main { padding-block: 16px 48px; display: grid; gap: 14px; }
.salehead { display: grid; gap: 4px; }
.sale-title { font-size: 20px; font-weight: 700; text-wrap: balance; }
.sale-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 13px; }
.dday { font-family: var(--font-data); font-weight: 600; font-size: 13px; color: var(--on-indigo); background: var(--sale); padding: 1px 8px; border-radius: 4px; }
.dday.over { background: var(--muted); }
.sale-notes { font-size: 13px; }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.notice { margin: 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 13.5px; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: 999px; font-size: 13.5px; cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 18px 12px; }
.card { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.photo { position: relative; display: block; width: 100%; max-width: 100%; aspect-ratio: 4 / 5; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: var(--photo); cursor: pointer; }
.photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.noimg { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: #6b6d75; font-size: 12.5px; text-align: center; }
.disc { position: absolute; top: 6px; left: 6px; font-family: var(--font-data); font-weight: 600; font-size: 12px; color: #fff; background: #c4352b; padding: 1px 6px; border-radius: 3px; }
.bsub { display: grid; gap: 8px; margin-top: 14px; }
.bsub h3 { margin: 0; font-size: 15px; }
.bsub h3 .count { font-weight: 400; font-size: 13px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.srcs h3 { margin: 10px 0 4px; font-size: 14px; }
.srcs ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.srcs li { font-size: 13px; line-height: 1.45; }
.srcs p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.stype { font-size: 11px; color: var(--muted); }
.hscroll { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
.bcard { flex: 0 0 68%; max-width: 250px; scroll-snap-align: start; display: grid; gap: 4px; align-content: start; }
.bcard.disliked { opacity: .55; }
.bphoto { display: block; width: 100%; height: 100%; background-color: #fff; background-repeat: no-repeat; }
.bphoto.none, .cellphoto.none { background: var(--photo); }
.rline { margin: 0; font-size: 13px; }
.heart { color: var(--sale); }
.mark { position: absolute; top: 6px; right: 6px; font-size: 12px; font-weight: 600; color: #fff; background: #2f6b45; padding: 1px 7px; border-radius: 3px; }
.body { display: grid; gap: 3px; padding-top: 8px; align-content: start; min-width: 0; }
.by { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bname { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tier { flex: none; font-size: 11px; padding: 0 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.tier.t-준명품 { border-color: var(--ink); color: var(--ink); }
.tier.t-가성비 { border-style: dashed; }
.name { all: unset; cursor: pointer; font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.price s { color: var(--muted); font-size: 12px; }
.price b { font-size: 15px; }
.price em { font-style: normal; color: var(--sale); font-weight: 600; font-size: 13px; }
.meta { color: var(--muted); font-size: 12px; }
.meta .low { color: var(--sale); font-weight: 600; }
.why { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink); opacity: .86; }
.tpo { display: flex; flex-wrap: wrap; gap: 4px; }
.tpo span { font-size: 11px; background: var(--chip); padding: 0 6px; border-radius: 3px; color: var(--muted); }
.tpo span.look { background: none; border: 1px solid var(--line); color: var(--ink); }
.acts { display: flex; gap: 6px; margin-top: 6px; }
.acts button { flex: 1; min-height: 34px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; cursor: pointer; }
.acts .want { border-color: var(--indigo); color: var(--indigo); font-weight: 600; }
.acts .want[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); }
.acts .pass { color: var(--muted); }
.acts button:disabled { cursor: default; opacity: .85; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 13.5px; padding-block: 6px; }
details.more[open] > summary { margin-bottom: 10px; }

.group { display: grid; gap: 8px; }
.group h2 { margin: 0; font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.group h2 small { font-family: var(--font-data); font-weight: 500; font-size: 13px; color: var(--muted); }
.row { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.row .photo { aspect-ratio: 1; border-radius: 4px; }
.row .info { display: grid; gap: 2px; min-width: 0; }
.row .acts { margin-top: 4px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: max-content; }
.seg button { border: 0; background: var(--surface); padding: 6px 14px; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.search { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.blist { display: grid; gap: 10px; }
.brand { display: grid; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.b-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.b-head h3 { margin: 0; font-size: 16px; }
.b-head .en { font-family: var(--font-data); font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.b-meta { color: var(--muted); font-size: 12.5px; }
.b-why { margin: 0; font-size: 14px; }
.b-parts { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 13px; }
.b-parts b { font-weight: 600; margin-right: 6px; }
.rank { font-family: var(--font-data); font-size: 11px; color: var(--sale); margin-left: 4px; }
.b-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.b-buy { display: flex; flex-wrap: wrap; gap: 6px; }
.b-buy a { font-size: 12.5px; text-decoration: none; border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; }
.best { display: grid; gap: 12px; }
.best section { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 6px; }
.best h3 { margin: 0; font-size: 15px; }
.best ol { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 14px; }
.best .items { color: var(--muted); font-size: 12.5px; }
.best .value { font-size: 13px; color: var(--muted); }

.sheet { position: fixed; inset: 0; z-index: 20; display: grid; align-items: end; background: var(--shade); }
.sheet-in { background: var(--surface); border-radius: 14px 14px 0 0; max-height: 90vh; overflow-y: auto; padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); width: 100%; max-width: 640px; margin: 0 auto; display: grid; grid-auto-rows: max-content; gap: 8px; }
.sheet .photo { aspect-ratio: 1; cursor: default; }
.sheet h2 { margin: 0; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.sheet .close { justify-self: end; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.sheet .go { display: block; text-align: center; padding: 11px; border-radius: 8px; background: var(--indigo); color: var(--on-indigo); font-weight: 600; text-decoration: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13.5px; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .sheet-in { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(24px); opacity: .6; } } }
.taste { display: grid; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.taste-count { font-weight: 600; font-size: 14px; }
.dim { font-size: 13px; color: var(--muted); }
.dim b { color: var(--ink); font-weight: 600; margin-right: 8px; }
.taste-result { display: grid; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 14px; }
.taste-result p { margin: 0; }
.taste-result ul { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 2px; }
.linklike { all: unset; color: var(--indigo); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.grid8 { position: relative; display: block; width: 100%; aspect-ratio: 960 / 600; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: #fff; cursor: pointer; }
.grid8 img { width: 100%; height: 100%; object-fit: contain; display: block; }
.grid8.none { display: grid; place-items: center; aspect-ratio: 960 / 200; color: #6b6d75; background: var(--photo); font-size: 12.5px; cursor: default; }
.b-name { all: unset; cursor: pointer; display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.b-name h3 { margin: 0; font-size: 16px; }
.tag { display: inline-block; font: inherit; font-size: 11.5px; line-height: 1.6; padding: 0 7px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); background: none; }
.tag.china { color: #fff; background: #c4352b; border-color: #c4352b; font-weight: 600; }
.tag.part { color: #6b4700; background: #fff1cc; border-color: #ecd28f; cursor: pointer; }
.tag.warn { border-style: dashed; }
.b-owner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.like-acts .like[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); border-color: var(--indigo); font-weight: 600; }
.like-acts .dislike[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.like-acts .neutral[aria-pressed="true"] { background: var(--chip); color: var(--ink); border-color: var(--muted); font-weight: 600; }
.searchrow { display: flex; gap: 6px; }
.searchrow .search { flex: 1; min-width: 0; }
.toggle { flex: none; border: 1px dashed var(--muted); background: var(--surface); color: var(--ink); padding: 0 12px; border-radius: 999px; font: inherit; font-size: 13.5px; cursor: pointer; }
.toggle[aria-pressed="true"] { background: var(--indigo); color: var(--on-indigo); border: 1px solid var(--indigo); }
.tpo span.src { background: none; border: 1px solid var(--ink); color: var(--ink); }
.tpo span.src.ad { border-color: var(--line); color: var(--muted); background: var(--chip); }
.tpo span.q { background: none; border: 1px solid var(--good); color: var(--good); }
.tpo span.q.thin { border: 1px dashed var(--muted); color: var(--muted); }
.brand.rated-like { border-color: var(--indigo); }
.brand.rated-dislike { opacity: .72; }
.brand.fading { opacity: .35; }
@media (prefers-reduced-motion: no-preference) { .brand { transition: opacity .4s ease; } }
.more-btn { justify-self: center; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 18px; font-size: 14px; cursor: pointer; }
.cellphoto { width: 100%; max-width: 360px; justify-self: center; aspect-ratio: 4 / 5; background-color: #fff; background-repeat: no-repeat; border-radius: 6px; }
.story { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13.5px; }
.story dt { color: var(--muted); }
.story dd { margin: 0; }
.sources { margin: 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 2px; }
.usual { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; }
.gap { margin: 0; font-size: 12px; color: var(--sale); font-weight: 600; }
.evid { display: flex; flex-wrap: wrap; gap: 4px; }
.evid span { font-size: 11px; border: 1px solid var(--line); padding: 0 6px; border-radius: 3px; }
.brandlines { margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; display: grid; gap: 4px; }
.brandlines a { color: inherit; }
.avoid { display: grid; gap: 2px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.avoid .why { opacity: 1; color: var(--muted); }
.evlist { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; }
.evlist small { color: var(--muted); }
.toast .undo { margin-left: 10px; border: 0; background: none; color: inherit; text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.folded { display: grid; gap: 6px; }
.frow { display: grid; gap: 2px; width: 100%; text-align: left; font: inherit; font-size: 13.5px; color: inherit; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.frow small { color: var(--muted); font-size: 12.5px; }

/* 옷장: 안 입음 토글 + 분류 칩, 카드는 읽기만 */
.closet-bar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.closet-bar .chips { flex: 1; min-width: 0; }
.closet-bar .toggle { align-self: stretch; }
.closet .photo, .closet .name { cursor: default; }

/* 탭 막대: 폭 720px 미만은 아래 고정(앱처럼), 이상은 머리 안 위쪽 + 넓은 격자 */
.tabs svg { display: none; }
.tabs .count:empty { display: none; }
.blist > .notice, .blist > .more-btn { grid-column: 1 / -1; }
@media (max-width: 719.98px) {
  .top-in { padding-block: 10px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; overflow: visible;
          background: var(--surface); border-top: 1px solid var(--line);
          padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
  .tabs button { position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px; padding: 6px 0 5px; font-size: 11.5px; border-bottom: 0; }
  .tabs svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabs button[aria-selected="true"] svg { stroke-width: 2.2; }
  .tabs .count { position: absolute; top: 4px; left: calc(50% + 7px); min-width: 17px; padding: 0 5px; border-radius: 999px; background: var(--sale); color: #fff;
                 font-size: 10.5px; line-height: 17px; text-align: center; }
  main { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 720px) {
  .blist { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 22px 16px; }
  .bcard { flex-basis: 220px; }
}
