:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1b2430; --mute: #667085; --line: #e4e7ec;
  --accent: #2563eb; --accent-soft: #e8efff;
  --ok: #067647; --ok-bg: #e7f6ee; --warn: #b54708; --warn-bg: #fff4e5; --bad: #b42318; --bad-bg: #fdecea;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --panel: #171e28; --ink: #e6eaf0; --mute: #98a2b3; --line: #2a3441;
    --accent: #6ea0ff; --accent-soft: #1c2a47;
    --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #3a2c0d; --bad: #f87171; --bad-bg: #3b1716;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; }
main.wrap { padding-block: 20px 40px; }
.muted { color: var(--mute); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.site-switch { display: flex; gap: 4px; }
.brand { font-weight: 800; font-size: 17px; padding: 6px 10px; border-radius: 8px; opacity: .45; }
.brand.on { opacity: 1; background: var(--accent-soft); color: var(--accent); }
.logout { color: var(--mute); font-size: 13px; }
.user-nav { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mute); }
.user-nav a { color: var(--ink); }
.foot { color: var(--mute); font-size: 12px; padding-block: 24px 40px; }

/* 요약/탭 */
.summary { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.summary h1 { font-size: 22px; }
.summary h1 b { color: var(--accent); }
.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs a { padding: 6px 14px; border-radius: 8px; font-size: 14px; color: var(--mute); }
.tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* 필터 */
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.filters .row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.filters .grow { flex: 1 1 220px; }
.filters label { font-size: 13px; color: var(--mute); display: inline-flex; align-items: center; gap: 6px; }
input, select, button {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-height: 36px;
}
input[type=number] { width: 96px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; cursor: pointer; padding-inline: 16px; }
button.danger { background: var(--bad); border-color: var(--bad); }
.reset { color: var(--mute); font-size: 13px; }
.chips .chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--ink); }
.chips .chip input { min-height: 0; width: auto; }
.count { margin: 14px 2px 8px; font-size: 13px; }

/* 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card-wrap { position: relative; }
.fav-btn { position: absolute; top: 10px; right: 10px; z-index: 2; width: 32px; height: 32px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.fav-btn.on { color: #f5a524; border-color: #f5a524; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card.rej { opacity: .82; }
.card h2 { font-size: 17px; margin: 8px 0 4px; }
.card h2 small, .hero h1 small { font-size: 13px; font-weight: 500; color: var(--mute); }
.price { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.price small { display: block; font-size: 12px; font-weight: 500; color: var(--mute); letter-spacing: 0; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 10px 0; }
.meta div { min-width: 0; }
.meta dt { font-size: 11px; color: var(--mute); }
.meta dd { margin: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.flag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.flag.ok { background: var(--ok-bg); color: var(--ok); }
.flag.warn { background: var(--warn-bg); color: var(--warn); }
.flag.bad { background: var(--bad-bg); color: var(--bad); }
.reason { margin: 8px 0 0; font-size: 12px; color: var(--bad); word-break: break-all; }
.candidate-reason { margin: 8px 0 0; padding: 8px 10px; background: var(--warn-bg); border-radius: 8px; font-size: 12px; color: var(--warn); word-break: break-all; }
.candidate-reason b { display: block; margin-bottom: 2px; }

.chips-line { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--mute); font-weight: 600; }
.pill.hot { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.pill.ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.pill.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.empty { text-align: center; color: var(--mute); padding: 60px 0; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 20px; }
.pager a { color: var(--accent); font-weight: 700; }

/* 상세 */
.back { margin: 0 0 10px; font-size: 14px; }
.back a { color: var(--accent); }
.hero { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.hero h1 { font-size: 24px; margin: 10px 0 2px; }
.pricebox { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pricebox .lbl { display: block; font-size: 12px; color: var(--mute); }
.pricebox b { font-size: 18px; }
.pricebox .big { font-size: 28px; color: var(--accent); letter-spacing: -.02em; }
.pricebox .sub { display: block; font-size: 12px; color: var(--mute); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-top: 12px; box-shadow: var(--shadow); }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.panel h3 small { font-weight: 500; color: var(--mute); font-size: 12px; margin-left: 6px; }
.panel h4 { font-size: 13px; margin: 14px 0 6px; color: var(--mute); }
.bad-panel { background: var(--bad-bg); border-color: transparent; }
.bad-panel h3, .bad-panel p { color: var(--bad); margin: 0 0 4px; word-break: break-all; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 20px; margin: 0; }
.kv dt { font-size: 12px; color: var(--mute); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.verdicts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.verdicts li { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: var(--bg); border-left: 4px solid var(--line); }
.verdicts li.ok { border-left-color: var(--ok); }
.verdicts li.warn { border-left-color: var(--warn); }
.verdicts span { font-weight: 700; font-size: 13px; }
.verdicts em { font-style: normal; color: var(--mute); font-size: 13px; overflow-wrap: anywhere; }
.defects { margin: 0; padding-left: 18px; }
.defects li { margin: 2px 0; }
.note { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); color: var(--mute); font-size: 13px; }
pre.text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: 13px/1.6 inherit; color: var(--ink); background: var(--bg); padding: 10px 12px; border-radius: 8px; }

/* 시세 범위 막대 */
.range { position: relative; height: 92px; margin: 6px 10px 0; }
.range .track { position: absolute; top: 46px; left: 0; right: 0; height: 6px; border-radius: 3px; background: var(--line); }
.range .span { position: absolute; top: 46px; height: 6px; border-radius: 3px; background: var(--accent-soft); outline: 1px solid var(--accent); }
.range .mark { position: absolute; transform: translateX(-50%); display: flex; align-items: center; font-size: 11.5px; white-space: nowrap; }
.range .mark i { display: block; background: var(--mute); width: 2px; }
.range .mark.avg { top: 0; height: 46px; flex-direction: column-reverse; justify-content: flex-start; }
.range .mark.avg i { height: 26px; }
.range .mark.avg span { color: var(--mute); margin-bottom: 2px; }
.range .mark.me { top: 46px; flex-direction: column; }
.range .mark.me i { height: 16px; width: 3px; background: var(--accent); }
.range .mark.me span { color: var(--accent); font-weight: 800; margin-top: 2px; }

/* 기일 표 */
.rounds { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rounds th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 4px 8px; }
.rounds td { padding: 7px 8px; border-top: 1px solid var(--line); }
.rounds .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rounds .barcell { width: 32%; }
.rounds .bar { height: 8px; border-radius: 4px; background: var(--accent); opacity: .75; }
.links .btn { display: inline-block; margin: 0 6px 6px 0; padding: 8px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }

/* 로그인 */
.login { max-width: 340px; margin: 12vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.login h1 { font-size: 20px; }
.login label { font-size: 13px; color: var(--mute); }
.login .err { color: var(--bad); margin: 0; font-size: 13px; }

@media (max-width: 520px) {
  .summary h1 { font-size: 19px; }
  .price { font-size: 22px; }
  .hero h1 { font-size: 21px; }
  .pricebox .big { font-size: 24px; }
  .rounds .barcell { display: none; }
}

/* 사진 */
.card .thumb { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; margin-bottom: 10px; background: var(--bg); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shots a { display: block; border-radius: 10px; overflow: hidden; background: var(--bg); }
.shots img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .15s; }
.shots a:hover img { transform: scale(1.04); }
.shots a { position: relative; }
.maptag { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.range .mark.edge-l { transform: none; align-items: flex-start; }
.range .mark.edge-r { transform: translateX(-100%); align-items: flex-end; }
.range .mark.edge-l i { align-self: flex-start; }
.range .mark.edge-r i { align-self: flex-end; }

/* 메뉴(디스코드 채널 구성과 동일) */
.menu { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.menu a { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; color: var(--ink); }
.menu a b { margin-left: 5px; font-weight: 600; opacity: .7; }
.menu a.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.menu a.on b { opacity: .9; }
.menu-desc { margin: 0 2px 12px; font-size: 13px; }
.pill.new { background: var(--accent); color: #fff; border-color: transparent; }
@media (max-width: 520px) { .menu { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .menu a { white-space: nowrap; } }
.kv .wide { grid-column: 1 / -1; }
.meta-line { font-size: 12.5px; margin: 10px 0 8px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
