:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #e11d48;
  --accent-text: #ffffff;
  --error: #b91c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --line: #262a33;
    --accent: #f43f5e;
    --error: #f87171;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--accent); margin: 0; }

/* 로그인 */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 24px;
  display: grid; gap: 14px;
}
.login-card .brand { text-align: center; font-size: 26px; margin-bottom: 6px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input {
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login-card button {
  margin-top: 6px;
  border: 0; border-radius: 8px;
  padding: 11px 12px;
  background: var(--accent); color: var(--accent-text);
  font-weight: 700;
}
.error { margin: 0; color: var(--error); font-size: 13px; }

/* 앱 화면 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar form { margin: 0; }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 12px; }
.layout { display: flex; min-height: calc(100% - 56px); }
.sidebar {
  width: 200px; flex-shrink: 0;
  padding: 16px 10px;
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.sidebar a:hover { background: var(--bg); color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--bg); color: var(--accent); }
.content { flex: 1; min-width: 0; padding: 24px; }
.content h1 { margin: 0 0 16px; font-size: 22px; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .sidebar a { white-space: nowrap; }
  .content { padding: 16px; }
}

/* 필터·목록 */
.filters, .add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.filters select, .add input, .memo input {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
.add input[name="url"] { flex: 1 1 280px; min-width: 0; }
.filters button, .add button, .memo button, .save button {
  font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 7px 12px;
}
.add button { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.count { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.none { color: var(--muted); padding: 40px 0; text-align: center; }
.msg { color: var(--error); font-size: 13px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card { display: flex; flex-direction: column; min-width: 0; }
.thumb { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.hot .thumb { outline: 3px solid var(--accent); outline-offset: -3px; }
.material.channel .thumb { aspect-ratio: 1; border-radius: 50%; width: 70%; margin: 0 auto; }
.badge {
  position: absolute; left: 6px; top: 6px; font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, .7); color: #fff; padding: 2px 7px; border-radius: 999px;
}
.badge:empty { display: none; }
.badge.origin { background: #2563eb; }
.badge.new { background: var(--accent); }
.meta { display: grid; gap: 3px; padding-top: 6px; font-size: 13px; }
.meta .title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.meta .channel { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .stats { color: var(--muted); font-size: 12px; }
.meta .stats b { color: var(--text); }
.meta form { margin: 2px 0 0; }
.save button { padding: 3px 10px; font-size: 12px; }
.memo { display: grid; gap: 4px; }
.memo input { padding: 5px 8px; font-size: 12px; }
.ghost.danger { color: var(--error); padding: 3px 10px; font-size: 12px; }

.group { margin: 0 0 28px; }
.group h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); }

.tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }

.table-wrap { overflow-x: auto; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rank-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rank-table .rank { color: var(--muted); width: 40px; }
.rank-table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-table .ch { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.rank-table .ch img { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.rank-table .ch div { display: grid; }
.rank-table .ch small { color: var(--muted); font-size: 12px; }
.dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; }
.rank-table th.n { text-align: right; }
.sidebar { scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }

/* 미리보기 */
.thumb iframe.preview { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .3s; pointer-events: none; }
.thumb iframe.preview.ready { opacity: 1; }

/* 뷰어 */
body.no-scroll { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.viewer[hidden] { display: none; }
.v-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); }
.v-body {
  position: relative; display: grid; grid-template-columns: auto auto minmax(300px, 400px); gap: 16px; align-items: start;
  max-height: calc(100vh - 32px); padding: 16px;
}
.v-player { height: min(calc(100vh - 64px), 820px); aspect-ratio: 9 / 16; background: #000; border-radius: 12px; overflow: hidden; }
.v-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.v-navs { display: flex; flex-direction: column; gap: 10px; align-self: center; }
.v-nav, .v-close {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 16px;
}
.v-nav:disabled { opacity: .3; cursor: default; }
.v-close { position: absolute; right: 8px; top: 8px; }
.v-info {
  background: var(--surface); color: var(--text); border-radius: 12px; padding: 18px; overflow-y: auto;
  max-height: min(calc(100vh - 64px), 820px); display: grid; gap: 14px; align-content: start;
}
.v-title { margin: 0; font-size: 17px; line-height: 1.4; padding-right: 28px; }
.v-channel { display: flex; align-items: center; gap: 10px; }
.v-channel img { width: 40px; height: 40px; border-radius: 50%; }
.v-channel div { display: grid; min-width: 0; flex: 1; }
.v-channel a { font-weight: 700; }
.v-channel small { color: var(--muted); font-size: 12px; }
.v-type { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.v-type.compilation { background: #fee2e2; color: #b91c1c; }
.v-type.original { background: #dbeafe; color: #1d4ed8; }
.v-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.v-stat { background: var(--bg); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; }
.v-stat span { font-size: 11px; color: var(--muted); }
.v-stat b { font-size: 14px; font-variant-numeric: tabular-nums; }
.v-stat:last-child { grid-column: span 3; }
.v-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.v-btn {
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-align: center;
}
.v-actions .v-btn:first-child { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.v-btn.done { background: var(--bg) !important; color: var(--muted) !important; border-color: var(--line) !important; }
.v-section h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.v-section p { margin: 0; font-size: 13px; }
.v-spark { width: 100%; height: 70px; }
.v-spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; }
.v-group { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.v-group a { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.v-group img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; }
.v-group li.me { background: var(--bg); border-radius: 6px; }
.v-group .tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.v-group .tag.origin { background: #2563eb; color: #fff; }
.v-group .g-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }

@media (max-width: 900px) {
  .v-body { grid-template-columns: 1fr; overflow-y: auto; width: 100%; height: 100%; max-height: none; padding: 48px 12px 12px; align-content: start; justify-items: center; }
  .v-player { height: auto; width: min(100%, 420px); }
  .v-navs { flex-direction: row; }
  .v-info { width: min(100%, 420px); max-height: none; }
  .v-close { position: fixed; }
}

/* 오늘의 채널 표 */
.lead { margin: -8px 0 14px; color: var(--muted); font-size: 14px; }
.filters .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.filters .search { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 180px; }
.rank-table.today { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rank-table.today th { background: var(--bg); text-align: center; }
.rank-table.today td { padding: 12px 10px; }
.rank-table.today .save-col { width: 44px; text-align: center; }
.star { background: none; border: 0; font-size: 20px; color: var(--muted); padding: 0; line-height: 1; }
.star.on { color: #f59e0b; }
.star-form { margin: 0; }
.rank-table.today .rank { width: 56px; text-align: center; color: var(--text); }
.rank .crown { display: block; font-size: 14px; line-height: 1; }
.rank .crown.c1 { color: #1f2937; } .rank .crown.c2 { color: #9ca3af; } .rank .crown.c3 { color: #b45309; }
.rank b { display: block; font-size: 18px; }
.mv { display: block; font-size: 11px; font-weight: 700; }
.mv.up { color: #2563eb; } .mv.down { color: #dc2626; } .mv.new { color: var(--accent); }
.rank-table.today .ch { min-width: 230px; }
.rank-table.today .ch img { width: 44px; height: 44px; }
.rank-table.today .ch a { font-weight: 700; }
.chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.type { border-color: #93c5fd; color: #2563eb; background: #eff6ff; }
.cc { font-size: 11px; color: var(--muted); }
.rank-table.today .n { text-align: center; }
.rank-table.today .n small { display: block; color: var(--muted); font-size: 11px; }
.rank-table.today .big { font-size: 18px; font-weight: 800; white-space: nowrap; }
.pct { display: block; font-size: 12px; font-weight: 700; }
.pct.up { color: #2563eb; } .pct.down { color: #dc2626; }
.spark { width: 90px; height: 26px; display: block; margin: 0 auto; }
.spark polyline { fill: none; stroke: #2563eb; stroke-width: 1.5; }
.trend .fire { color: #dc2626; font-weight: 800; font-size: 16px; white-space: nowrap; }
.tops { padding: 6px 8px !important; }
.tv-row { display: flex; gap: 6px; }
.tv { position: relative; width: 72px; flex-shrink: 0; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: var(--line); }
.tv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-n { position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.tv-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 4px 3px; background: linear-gradient(transparent, rgba(0,0,0,.8)); color: #fff; font-size: 10px; display: grid; line-height: 1.25; }
.tv-meta b { font-size: 12px; }

/* 오늘의 채널: 위쪽 줄 */
.big-lead { font-size: 24px; font-weight: 800; color: var(--text); margin: -4px 0 4px; }
.big-lead b { color: #2563eb; }
.tc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 14px 0 12px; }
.tc-date { display: flex; gap: 6px; align-items: center; }
.tc-date select, .tc-top .search {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.tc-top .search { margin-left: auto; min-width: 240px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg .chip-btn span { border: 0; border-radius: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 36px; height: 20px; border-radius: 999px; background: #d1d5db; position: relative; transition: background .2s; flex-shrink: 0; }
.switch i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: #2563eb; }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid #2563eb; outline-offset: 2px; }
.filter-btn { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 7px 12px; }
.filter-btn b { background: #2563eb; color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.chip-btn { display: inline-flex; cursor: pointer; }
.chip-btn input { position: absolute; opacity: 0; pointer-events: none; }
.chip-btn span { font-size: 13px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); white-space: nowrap; }
.chip-btn input:checked + span { background: #2563eb; border-color: #2563eb; color: #fff; }
.chip-btn input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 1px; }

/* 필터 창 */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer[hidden] { display: none; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); color: var(--text);
  overflow-y: auto; padding: 18px 20px 90px; display: grid; gap: 16px; align-content: start;
}
.drawer-panel header { display: flex; justify-content: space-between; align-items: center; }
.drawer-panel h2 { margin: 0; font-size: 18px; }
.drawer-panel h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.drawer-panel .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-panel .small { font-size: 12px; margin: -10px 0 0; }
.drawer-panel details summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); }
.range { display: grid; grid-template-columns: 90px 1fr auto 1fr 44px; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; }
.range input { font: inherit; font-size: 13px; width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.range em { font-style: normal; color: var(--muted); }
.range small { color: var(--muted); }
.drawer-panel footer {
  position: fixed; right: 0; bottom: 0; width: min(440px, 100%); display: flex; gap: 8px; padding: 12px 20px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.drawer-panel footer .ghost { flex: 0 0 auto; display: grid; place-items: center; }
.drawer-panel footer .primary { flex: 1; border: 0; border-radius: 10px; padding: 11px; background: #2563eb; color: #fff; font-weight: 700; font-size: 14px; }

/* 표 보강 */
.ch-name { display: flex; align-items: center; gap: 6px; }
.grade { font-size: 12px; font-weight: 800; color: #dc2626; }
.grade.gA { color: #ea580c; } .grade.gB { color: #ca8a04; } .grade.gC { color: #16a34a; } .grade.gD { color: var(--muted); }
.chip.shop { border-color: #fcd34d; color: #b45309; background: #fffbeb; }
.chip.new { border-color: #fda4af; color: #e11d48; background: #fff1f2; }
.mid { font-size: 16px; }
@media (max-width: 720px) {
  .tc-top .search { margin-left: 0; min-width: 0; flex: 1 1 100%; }
  .big-lead { font-size: 19px; }
}

/* 공통: 메뉴·검색 */
.sidebar { width: 230px; gap: 4px; }
.sidebar a { display: grid; gap: 1px; padding: 10px 12px; }
.sidebar a small { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.sidebar a[aria-current="page"] small { color: var(--muted); }
.nav-label { display: flex; align-items: center; gap: 6px; }
.nav-section { margin: 14px 12px 4px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .02em; }
.hot { font-size: 10px; font-weight: 800; color: #dc2626; background: #fee2e2; padding: 1px 6px; border-radius: 999px; }
.topbar { gap: 16px; }
.top-search { flex: 1; max-width: 560px; display: flex; margin: 0 auto; }
.top-search input { flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; padding: 8px 16px; }
.top-search button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 0 999px 999px 0; padding: 0 16px; font-size: 13px; }
.page-title { font-size: 22px; margin: 0 0 8px; }
.search-list { display: grid; gap: 4px; }
.search-row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; }
.search-row:hover { background: var(--surface); }
.search-row img { width: 44px; height: 44px; border-radius: 50%; }
.search-row div { display: grid; }
.search-row small { color: var(--muted); font-size: 12px; }
.small { font-size: 13px; }
.mb { margin-bottom: 12px; }

/* 채널 상세 */
.ch-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.ch-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--line); }
.ch-title { flex: 1; min-width: 200px; }
.ch-title h1 { margin: 0 0 6px; font-size: 22px; }
.ch-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.ch-tools { display: flex; gap: 8px; }
.ch-tools form { margin: 0; }
.v-btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.ch-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.ch-stats div { background: var(--surface); padding: 12px 14px; display: grid; gap: 4px; }
.ch-stats span { font-size: 12px; color: var(--muted); }
.ch-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.panel h3 { margin: 6px 0 8px; font-size: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg-links { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tab-btn { padding: 5px 12px; font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); }
.tab-btn:last-child { border-right: 0; }
.tab-btn.on { background: #2563eb; color: #fff; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sim-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.sim-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.sim-table .n, .sim-table th.n { text-align: right; }
.sim-table .ch { display: flex; gap: 8px; align-items: center; }
.sim-table .ch img { width: 32px; height: 32px; border-radius: 50%; }
.sim-table .ch div { display: grid; }
.sim-table small { color: var(--muted); font-size: 11.5px; }
.rank-table.vids .vt { display: flex; gap: 10px; align-items: center; min-width: 300px; }
.thumb.mini { width: 64px; aspect-ratio: 4 / 3; flex-shrink: 0; border-radius: 6px; }
@media (max-width: 720px) {
  .ch-stats { grid-template-columns: repeat(2, 1fr); }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 16px; }
  .sidebar a small { display: none; }
  .nav-section { display: none; }
}

/* 홈 */
.hero h1 { font-size: 30px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin: 0 0 18px; }
.home-wrap { display: flex; gap: 20px; align-items: flex-start; }
.home-main { flex: 1; min-width: 0; }
.home-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.home-sub { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.home-sub .count { margin: 0 0 0 auto; }
.pill { display: inline-flex; align-items: center; font: inherit; font-size: 13px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); white-space: nowrap; cursor: pointer; }
.pill.on { background: #111827; color: #fff; border-color: #111827; }
.cat-row { display: contents; }
.cat-row .extra { display: none; }
.cat-row.expanded .extra { display: inline-flex; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; font-size: 13px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::after { content: ' ▾'; color: var(--muted); }
.dropdown summary b { background: #2563eb; color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.dropdown-body { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 2px; min-width: 160px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.dropdown-body .check { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.dropdown-body .check:hover { background: var(--bg); }
.switch-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.switch-link i { width: 36px; height: 20px; border-radius: 999px; background: #d1d5db; position: relative; }
.switch-link i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-link.on i { background: #2563eb; }
.switch-link.on i::after { transform: translateX(16px); }
.feed-more { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; min-height: 20px; }
.rail { width: 280px; flex-shrink: 0; position: sticky; top: 72px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: calc(100vh - 90px); overflow-y: auto; }
.rail.closed { width: 44px; padding: 8px; overflow: hidden; }
.rail.closed > *:not(.rail-tabs), .rail.closed .rail-tabs a { display: none; }
.rail-search input { width: 100%; font: inherit; font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--text); margin-bottom: 12px; }
.rail-tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.rail-tabs a { padding: 6px 8px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.rail-tabs a.on { color: var(--text); border-color: var(--text); }
.rail-close { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 14px; }
.kw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.kw-list a { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 6px; font-size: 13.5px; }
.kw-list a:hover { background: var(--bg); }
.kw-rank { width: 18px; color: #2563eb; font-weight: 800; text-align: right; }
.kw-word { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-chg { font-size: 11.5px; font-weight: 700; }
.kw-chg.up { color: #dc2626; } .kw-chg.down { color: #2563eb; }
.kw-new { font-size: 10.5px; font-weight: 800; color: #fff; background: #dc2626; border-radius: 4px; padding: 0 4px; }
.cloud { line-height: 2; text-align: center; }
.cloud a { display: inline-block; margin: 0 4px; font-weight: 700; }
.cloud .s0 { font-size: 13px; } .cloud .s1 { font-size: 15px; } .cloud .s2 { font-size: 18px; } .cloud .s3 { font-size: 21px; } .cloud .s4 { font-size: 25px; } .cloud .s5 { font-size: 30px; }
.cloud .c1 { color: #16a34a; } .cloud .c2 { color: #9333ea; } .cloud .c3 { color: #ea580c; } .cloud .c4 { color: #2563eb; }
.cloud .c5 { color: #dc2626; } .cloud .c6 { color: #0d9488; } .cloud .c7 { color: #c026d3; } .cloud .c8 { color: #4f46e5; }
@media (max-width: 1100px) { .rail { display: none; } }
@media (max-width: 720px) { .hero h1 { font-size: 22px; } }

/* 유사영상 */
.sim-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 12px; }
.sim-filters .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sim-filters select, .sim-filters .search { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.sim-filters .search { margin-left: auto; min-width: 200px; }
.sim-group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 16px; }
.sim-group header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sim-group header b { font-size: 14px; color: #ea580c; }
.sim-group header small { color: var(--muted); font-size: 11px; }
.sim-group .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.sim-group .card:has(.badge.origin) .thumb { outline: 3px solid #2563eb; outline-offset: -3px; }
.badge.similar { background: rgba(234, 88, 12, .9); }
.offset { color: #ea580c; font-weight: 700; }
.sim-more summary { cursor: pointer; font-size: 13px; color: var(--muted); margin: 10px 0; }

/* 내 소재함 */
.inline { display: inline-flex; margin: 0; }
.m-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.m-filters select { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.m-search { margin-left: auto; }
.m-search input { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; min-width: 200px; }
.primary-sum { background: #2563eb !important; color: #fff; border-color: #2563eb !important; font-weight: 700; }
.primary-sum::after { content: '' !important; }
.dropdown-body.wide { min-width: 280px; gap: 6px; }
.dropdown-body.wide input, .dropdown-body.wide select { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.dropdown-body .primary { border: 0; border-radius: 8px; padding: 8px; background: #2563eb; color: #fff; font-weight: 700; }
.dd-item { padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.dd-item:hover, .dd-item.on { background: var(--bg); font-weight: 700; }
.dd-form { display: flex; gap: 4px; margin-top: 4px; }
.dd-form input { flex: 1; min-width: 0; }
.dd-form button { font-size: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 8px; }
.thumb.noimg { display: grid; place-items: center; background: linear-gradient(135deg, #e0e7ff, #fce7f3); }
.thumb .plat { font-weight: 800; color: #4b5563; }
.unread-dot { position: absolute; right: 8px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 2px #fff; }
.unread-dot.inline-dot { position: static; display: inline-block; }
.badge.todo { background: #f59e0b; left: auto; right: 6px; top: auto; bottom: 6px; }
.badge.done { background: #16a34a; left: auto; right: 6px; top: auto; bottom: 6px; }
.memo-text { margin: 2px 0 0; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 4px 6px; }
.m-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.m-actions button { font-size: 11.5px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 2px 8px; }
.m-actions button.on { background: #111827; color: #fff; border-color: #111827; }
.m-edit summary { font-size: 11.5px; color: var(--muted); cursor: pointer; }
.m-edit .memo { margin-top: 4px; }
.m-edit select { font: inherit; font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
.m-list { display: grid; gap: 8px; }
.m-row { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.m-row img { width: 48px; height: 48px; border-radius: 50%; }
.m-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.m-row-main small { color: var(--muted); font-size: 12px; }
.track-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; border: 0; background: none; color: var(--text); }
.track-btn i { width: 32px; height: 18px; border-radius: 999px; background: #d1d5db; position: relative; }
.track-btn i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.track-btn.on i { background: #2563eb; }
.track-btn.on i::after { transform: translateX(14px); }

/* 채널 추적 */
.radar-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.radar-tabs a { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13.5px; font-weight: 600; }
.radar-tabs a b { color: #2563eb; margin-left: 4px; }
.radar-tabs a.on { background: #111827; color: #fff; border-color: #111827; }
.radar-tabs a.on b { color: #93c5fd; }
