/* 아이템매니아·바로템 시세 화면 공통 (다이아·계정·아이템). 휴대폰을 먼저 맞추고 넓은 화면에서 칸을 늘린다.
   사이트 색 (--im 아이템매니아 · --bt 바로템)은 왼쪽 메뉴도 쓰므로 site.css 에 있다. */

/* ---------- 사이트 배지 ---------- */
.site-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 3px; border-radius: 99px; font-size: 11.5px;
  font-weight: 700; line-height: 1; white-space: nowrap; vertical-align: middle; }
.site-badge img { display: block; width: 16px; height: 16px; border-radius: 5px; flex: none; }
.site-badge b { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 99px; color: #fff;
  font-size: 9px; font-weight: 900; }
.site-badge.im { background: var(--im-soft); color: var(--im); } .site-badge.im b { background: var(--im); }
.site-badge.bt { background: var(--bt-soft); color: var(--bt); } .site-badge.bt b { background: var(--bt); }
.site-badge.mini { padding: 0; background: none; } .site-badge.mini span { display: none; }
.site-badge.mini img { width: 18px; height: 18px; }

/* ---------- 머리: 제목 · 출처 · 핵심 숫자 ---------- */
.tr { --tr-gap: 12px; }
.tr-hero { margin-bottom: 16px; }
.tr-title h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.tr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.tr-live { display: inline-flex; align-items: center; gap: 7px; }
.tr-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.tr-dot { color: var(--border-strong); }
.tr-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 16px; }
.tr-kpi { min-width: 0; padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); text-align: left; color: var(--text); }
.tr-kpi .l { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.tr-kpi .l svg.lucide { width: 14px; height: 14px; color: var(--faint); }
.tr-kpi .v { margin-top: 3px; font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.tr-kpi .s { margin-top: 2px; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-kpi.key { border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface); }
.tr-kpi.key .v { color: var(--accent-strong); }
.tr-sitev { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 16px; }
.tr-sitev > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
button.tr-kpi { cursor: pointer; font: inherit; }
button.tr-kpi:hover { border-color: var(--border-strong); }
button.tr-kpi .s::after { content: " ›"; }

/* ---------- 찾기·거르기 막대 (위에 붙는다) ---------- */
.tr-bar { position: sticky; top: var(--header-h); z-index: 25; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px;
  padding: 10px 0; background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tr-search { position: relative; flex: 1 1 260px; min-width: 0; }
.tr-search svg.lucide { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.tr-search input { width: 100%; height: 42px; padding: 0 14px 0 38px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  font-size: 15px; }
.tr-search input:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--focus); }
.tr-seg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tr-seg::-webkit-scrollbar { display: none; }
.tr-seg button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.tr-seg button:hover { color: var(--text); }
.tr-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tr-seg button .site-badge { height: 18px; }
.tr-seg.sm button { height: 30px; padding: 0 10px; font-size: 13px; }
.tr-ibtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.tr-ibtn:hover { border-color: var(--border-strong); }
.tr-ibtn .n { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 11px;
  font-weight: 800; display: inline-grid; place-items: center; }
.tr-select { height: 42px; padding: 0 32px 0 12px; border: 1px solid var(--border); border-radius: 12px; background-color: var(--surface);
  font-size: 14px; font-weight: 600; min-width: 0; }
.tr-bar .tr-select, .tr-list-head .tr-select, .tr-sec-head .tr-select { flex: none; width: auto; }
.tr-only-narrow { display: none; }

/* ---------- 거르기 칸: 넓은 화면은 카드, 좁은 화면은 아래에서 올라오는 시트 ---------- */
.tr-filters { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); }
.tr-fgroup { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tr-fgroup > .t { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-chip { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.tr-chip:hover { color: var(--text); border-color: var(--border-strong); }
.tr-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent-strong); }
.tr-chip .c { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.tr-range { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.tr-range input, .tr-fgroup select { width: 86px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  font-size: 14px; }
.tr-fgroup select { width: auto; min-width: 140px; }
.tr-check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.tr-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.tr-filters-foot { display: flex; align-items: flex-end; margin-left: auto; }
.tr-sheet-head { display: none; }
.tr-scrim { position: fixed; inset: 0; z-index: 110; background: var(--scrim); }

/* ---------- 칸·탭 ---------- */
.tr-sec { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.tr-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 52px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); }
.tr-sec-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 750; }
.tr-sec-head h2 svg.lucide { color: var(--accent); }
.tr-sec-head .sub { font-size: 12.5px; color: var(--faint); font-weight: 600; }
.tr-sec-body { padding: 14px 16px; }
.tr-sec-body.flush { padding: 0; }
.tr-note { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1.6; }
.tr-note button, .tr-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.tr-note button:hover, .tr-link:hover { text-decoration: underline; }
.tr-hint { padding: 36px 16px; text-align: center; color: var(--faint); font-size: 14px; }
.tr-foot { margin: 18px 2px 0; color: var(--faint); font-size: 12.5px; line-height: 1.7; }
.tr-chart { position: relative; height: 260px; }

/* ---------- 매물 카드 ---------- */
.tr-list { display: flex; flex-direction: column; gap: 8px; }
.tr-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who side" "body body"; gap: 7px 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
a.tr-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); color: var(--text); }
a.tr-item:hover .tr-title { color: var(--accent-strong); }
.tr-item .who { grid-area: who; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; min-width: 0; font-size: 13px; color: var(--muted); }
.tr-item .who b { color: var(--text); font-size: 14.5px; font-weight: 750; }
.tr-item .side { grid-area: side; text-align: right; }
.tr-item .body { grid-area: body; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tr-price { font-size: 17px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-sub { font-size: 12px; color: var(--faint); white-space: nowrap; }
.tr-title { font-size: 13.5px; line-height: 1.5; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tr-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tr-tag { display: inline-flex; align-items: center; gap: 4px; height: 23px; padding: 0 8px; border-radius: 7px; background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-tag.strong { color: var(--text); }
.tr-tag.m { background: color-mix(in srgb, var(--violet) 13%, transparent); color: var(--violet); }
.tr-tag.a { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.tr-tag.good { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); }
.tr-tag.bad { background: color-mix(in srgb, var(--red) 11%, transparent); color: var(--red); }
.tr-tag.info { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.tr-tag.enh { background: var(--accent-soft); color: var(--accent-strong); }
.tr-tag.flag { background: transparent; border: 1px dashed color-mix(in srgb, var(--red) 60%, var(--border)); color: var(--red); }
.tr-st { display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.tr-st.selling { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.tr-st.trading, .tr-st.reserved, .tr-st.cancelling { background: color-mix(in srgb, var(--blue) 13%, transparent); color: var(--blue); }
.tr-st.done { background: var(--surface-3); color: var(--muted); }
.tr-st.gone { background: var(--surface-2); color: var(--faint); }
.tr-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 2px 10px; }
.tr-list-head h2 { margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 17px; font-weight: 800; }
.tr-list-head .tr-select { height: 38px; }
.tr-more { display: flex; justify-content: center; padding: 14px 0 4px; }
.tr-more .btn { min-width: 200px; }
.tr-count { font-size: 13px; color: var(--faint); font-weight: 600; }

/* ---------- 표 (구간별 시세 등) ---------- */
.tr-table-wrap { overflow-x: auto; }
.tr-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tr-table th { padding: 9px 12px; text-align: right; font-size: 12px; font-weight: 700; color: var(--faint); white-space: nowrap; border-bottom: 1px solid var(--border); }
.tr-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tr-table tr:last-child td { border-bottom: 0; }
.tr-table .l { text-align: left; }
.tr-table .p { font-weight: 750; }
.tr-table .sub { color: var(--faint); }
.tr-table tr.click { cursor: pointer; }
.tr-table tr.click:hover td { background: var(--surface-2); }
.tr-table tr.sel td { background: var(--accent-soft); }

/* ---------- 넓은 화면 ---------- */
@media (min-width: 1024px) {
  .tr-item { grid-template-columns: minmax(190px, 250px) minmax(0, 1fr) minmax(110px, auto); grid-template-areas: "who body side"; align-items: center; }
  .tr-item .who { align-self: start; }
}

/* ---------- 좁은 화면 ---------- */
@media (max-width: 1023.98px) {
  .tr-only-narrow { display: inline-flex; }
  .tr-filters { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 18px; margin: 0;
    max-height: min(84vh, 720px); overflow-y: auto; overscroll-behavior: contain; padding: 0 18px calc(18px + env(safe-area-inset-bottom));
    border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); transform: translateY(105%); visibility: hidden;
    transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s .24s; }
  .tr-filters.open { transform: none; visibility: visible; transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
  .tr-sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin: 0 -18px; padding: 14px 18px 10px;
    background: var(--surface); border-bottom: 1px solid var(--border); }
  .tr-sheet-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--border-strong); }
  .tr-sheet-head b { font-size: 16px; }
  .tr-filters .tr-fgroup select { width: 100%; height: 42px; }
  .tr-filters .tr-range input { flex: 1; height: 42px; }
  .tr-filters .tr-chip { height: 36px; }
  .tr-filters-foot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 0 -18px calc(-18px - env(safe-area-inset-bottom));
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); gap: 8px; }
  .tr-filters-foot .btn { flex: 1; height: 44px; }
}
@media (max-width: 767.98px) {
  .tr-title h1 { font-size: 22px; }
  .tr-kpis { display: flex; gap: 8px; margin: 14px -16px 0; padding: 0 16px 4px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .tr-kpis::-webkit-scrollbar { display: none; }
  .tr-kpi { flex: 0 0 auto; width: min(44vw, 200px); scroll-snap-align: start; padding: 11px 13px; }
  .tr-kpi .v { font-size: 19px; }
  /* 휴대폰에서는 막대가 세 줄이라 붙여 두면 화면을 너무 가린다 */
  .tr-bar { position: static; margin-left: -16px; margin-right: -16px; padding: 8px 16px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tr-bar .tr-search { flex-basis: 100%; }
  .tr-sec { border-radius: 12px; }
  .tr-sec-head { padding: 10px 14px; }
  .tr-sec-body { padding: 12px 14px; }
  .tr-item { padding: 12px; }
  .tr-price { font-size: 16px; }
  .tr-chart { height: 220px; }
}
@media (prefers-reduced-motion: reduce) { .tr-filters { transition: none !important; } }
