/* yousinsa portal v1 — 무채색 기반, 근거 칩만 유튜브 레드 */
:root {
  --bg: #fff; --surface: #f6f7f9; --ink: #111; --muted: #6b7280; --border: #e5e7eb; --hair: #eef0f3;
  --red: #ff0000; --red-h: #cc0000; --up: #d14343; --down: #2f6fed;
  --sans: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0 0 8px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
.num, .stat-v, td.num, .ts { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* 상단 바 */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 52px; }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 8px; border-bottom: 2px solid transparent; white-space: nowrap; }
.topnav a.on { border-bottom-color: var(--red); }
.topnav a:hover { text-decoration: none; background: var(--surface); }
.search { margin-left: auto; flex: 0 1 320px; }
.search input { width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); }
.datastrip { border-top: 1px solid var(--hair); background: var(--surface); font-size: 12px; color: var(--muted); }
.datastrip .wrap { height: 28px; display: flex; align-items: center; overflow-x: auto; white-space: nowrap; }
.datastrip b { color: var(--ink); font-weight: 500; font-family: var(--mono); margin: 0 2px; }

/* 레이아웃 */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding-top: 20px; padding-bottom: 40px; }
.layout-home { grid-template-columns: 220px minmax(0, 1fr) 300px; }
.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rail { display: flex; flex-direction: column; gap: 12px; align-self: start; position: sticky; top: 96px; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: var(--bg); }
.rail .card h3 { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 8px; text-transform: none; }
.links li { padding: 3px 0; }
.num-list { counter-reset: n; }
.num-list li::before { counter-increment: n; content: counter(n); display: inline-block; width: 22px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.kv.wide { font-size: 14px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.sec-h a { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sub-h { font-size: 13px; color: var(--muted); font-weight: 500; margin: 16px 0 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* 히어로·수치 */
.hero h1 { font-size: 24px; margin-bottom: 8px; }
.hero p { max-width: 720px; color: #333; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stat { flex: 1 1 120px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat-v { font-size: 20px; font-weight: 600; }
.stat-l { font-size: 12px; color: var(--muted); }
.stat-s { font-size: 11px; color: var(--muted); }

/* 허브 헤더 */
.hub-head { padding: 4px 0 8px; border-bottom: 1px solid var(--hair); }
.crumb { font-size: 12px; color: var(--muted); }
.lead { color: #333; margin-top: 6px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; }
.subnav a { font-size: 12px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }
.subnav a:hover { text-decoration: none; color: var(--ink); border-color: var(--ink); }
.alias { display: inline-block; font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); margin: 2px 4px 2px 0; }

/* 랭킹 테이블 */
.tbl-wrap { overflow-x: auto; }
.rank-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.rank-tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); white-space: nowrap; }
.rank-tbl td { padding: 0 8px; height: 36px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.rank-tbl tbody tr:hover { background: var(--surface); }
.rank-tbl .r { text-align: right; }
.c-rank { width: 40px; } .c-spark { width: 72px; }
.rank { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 6px; background: var(--border); font-family: var(--mono); font-size: 12px; }
.rank.top { background: var(--ink); color: #fff; }
.d.up { color: var(--up); } .d.down { color: var(--down); } .d.flat { color: var(--muted); }
.spark { color: var(--ink); display: block; }
.spark-big { color: var(--ink); margin: 4px 0 8px; }
.spark-big svg { width: 100%; height: 60px; }
.mini-tbl { border-collapse: collapse; font-size: 11px; width: 100%; }
.mini-tbl th { color: var(--muted); font-weight: 400; padding: 2px 3px; text-align: center; }
.mini-tbl td { text-align: center; padding: 2px 3px; border-top: 1px solid var(--hair); }

/* 근거 칩 */
.chip { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; font-size: 12px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); line-height: 1.4; }
.chip:hover { text-decoration: none; border-color: var(--ink); }
.chip .ts { color: var(--red); font-weight: 600; white-space: nowrap; }
.chip:hover .ts { color: var(--red-h); }
.chip .who { color: var(--ink); white-space: nowrap; }
.chip q { color: var(--muted); quotes: "“" "”"; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.small .alias { margin: 0; }

/* 카테고리 탭 */
.tab-list { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 10px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.cat-list li { padding: 8px 0; border-bottom: 1px solid var(--hair); }
.cat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cat-row .muted { margin-left: auto; font-size: 12px; }
.more { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--muted); }

/* 합의 타일 */
.tile { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-h { font-weight: 600; }
.tile-n { font-size: 12px; color: var(--muted); }
.tile .chip { align-self: flex-start; max-width: 100%; }

/* 토픽 칩 */
.topic-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.topic-chip:hover { text-decoration: none; border-color: var(--ink); }
.topic-chip.off { color: var(--muted); border-style: dashed; }

/* 분포 바 */
.bars li { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { height: 8px; background: var(--hair); border-radius: 2px; overflow: hidden; }
.bar-f { display: block; height: 100%; background: var(--ink); }
.bar-n { text-align: right; }

/* 인용 */
.quotes li { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.quotes blockquote { margin: 6px 0 0; padding-left: 10px; border-left: 2px solid var(--border); }

/* 영상 */
.video-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.thumb { flex: 0 0 160px; }
.thumb img { width: 160px; height: 90px; object-fit: cover; border-radius: 4px; background: var(--surface); }
.video-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.video-title { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.vcard { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vcard .thumb { flex: none; }
.vcard .thumb img { width: 100%; height: auto; aspect-ratio: 16/9; }
.vcard .chip q { max-width: 140px; }
.video-body .chips .chip q, .cat-list .chip q, .tile .chip q { max-width: 260px; }

/* AI 카드·CTA·드로어 */
.starters li { margin-bottom: 6px; }
.starters button { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.4; color: var(--ink); }
.starters button:hover { border-color: var(--ink); }
.btn { display: inline-block; background: var(--ink); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; font-size: 13px; }
.btn:hover { text-decoration: none; opacity: .9; }
.ai-card .btn { width: 100%; margin-top: 4px; }
.ai-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); }
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer[hidden] { display: none; }
.drawer-bg { position: absolute; inset: 0; background: rgba(17,17,17,.35); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: -1px 0 0 var(--border); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.ctx-chip { border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-size: 12px; color: var(--muted); }
.drawer-full { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.drawer-x { border: 0; background: none; font-size: 20px; line-height: 1; padding: 0 4px; }
.drawer-body { flex: 1; min-height: 0; }
.drawer-body iframe { width: 100%; height: 100%; border: 0; }
body.drawer-open { overflow: hidden; }

/* 인덱스 필터 */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.filter-bar input, .filter-bar select { height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font: inherit; background: var(--bg); }
.filter-bar input { flex: 1 1 220px; }

/* 푸터·모바일 탭 */
.footer { border-top: 1px solid var(--border); padding: 20px 0 80px; font-size: 12px; color: #333; }
.footer a { text-decoration: underline; }
.tabbar { display: none; }

@media (max-width: 1023px) {
  .layout-home { grid-template-columns: minmax(0,1fr) 300px; }
  .rail-left { display: none; }
  .topnav { display: none; }
}
@media (max-width: 767px) {
  .layout, .layout-home { grid-template-columns: minmax(0,1fr); }
  .rail-right { position: static; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .search { flex: 1 1 auto; }
  .topbar-in { gap: 12px; }
  .stat-v { font-size: 18px; }
  .thumb { flex-basis: 120px; } .thumb img { width: 120px; height: 68px; }
  .bars li { grid-template-columns: 90px 1fr 40px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 52px; background: var(--bg); border-top: 1px solid var(--border); z-index: 30; }
  .tabbar a { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); border-top: 2px solid transparent; }
  .tabbar a.on { color: var(--ink); border-top-color: var(--red); }
  .drawer-panel { width: 100%; }
}

/* 표 안 제품명·칩 폭 */
.rank-tbl td.nw { white-space: nowrap; }
.rank-tbl .chip q { max-width: 320px; }
.stat-v { white-space: nowrap; }
.stat-v.sm { font-size: 16px; }
