:root {
  --bg: #0e131d;
  --panel: #141a26;
  --panel-2: #19202e;
  --line: #232b3a;
  --text: #e4e8ef;
  --muted: #8a93a4;
  --faint: #5f6878;
  --accent: #7aa7ff;
  --accent-bg: #1b2a47;
  --up: #63d19b;
  --warn: #e0b060;
  --warn-bg: #2a2416;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: Pretendard, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
svg.lucide { width: 16px; height: 16px; stroke-width: 1.75; flex: none; }

/* 상단 */
.top {
  height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.brand svg { color: var(--accent); width: 20px; height: 20px; }
.crumb { color: var(--muted); display: flex; gap: 10px; }
.crumb b { color: var(--text); font-weight: 500; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.shell { display: flex; min-height: calc(100vh - 52px); }
.side {
  width: 204px; flex: none; border-right: 1px solid var(--line); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.side h6 { margin: 14px 10px 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.side h6:first-child { margin-top: 0; }
.side a.nav, .side .mk {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--muted); cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.side a.nav:hover, .side .mk:hover { background: var(--panel); text-decoration: none; color: var(--text); }
.side a.nav.on { background: var(--accent-bg); color: var(--text); font-weight: 600; }
.side a.nav .tag { margin-left: auto; font-size: 11px; color: var(--warn); }
.side .mk .code {
  font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted);
}
.side .mk.on { color: var(--text); }
.side .mk .chk { margin-left: auto; color: var(--accent); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 8px; width: auto; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--faint); display: grid; gap: 6px; }
.side .foot a { color: var(--muted); }

main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
.meta b { color: var(--text); font-weight: 600; }
.head { display: flex; align-items: flex-start; gap: 16px; }
.head .act { margin-left: auto; display: flex; gap: 8px; }

.banner {
  margin-top: 16px; padding: 10px 14px; border: 1px solid #4a3d1c; background: var(--warn-bg);
  color: #e9d6a6; border-radius: 6px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px;
}
.banner svg { color: var(--warn); margin-top: 2px; }
.banner.info { border-color: var(--line); background: var(--panel); color: var(--muted); }
.banner.info svg { color: var(--muted); }

.tabs { display: flex; gap: 24px; margin-top: 20px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; padding: 0 0 12px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px;
}
.tabs button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tabs button span { color: var(--faint); margin-left: 6px; font-weight: 400; }

.bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; align-items: center; }
.ctl {
  height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--text);
}
.ctl input { background: none; border: 0; outline: 0; width: 180px; }
.ctl input::placeholder { color: var(--faint); }
select.ctl { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select.ctl option { background: var(--panel); }
button.ctl { cursor: pointer; }
button.ctl:hover { background: var(--panel-2); }
button.ctl[disabled] { color: var(--faint); cursor: not-allowed; }
.bar .sp { margin-left: auto; color: var(--muted); font-size: 13px; }

.tbl { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.tbl .scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2);
}
th.num { text-align: right; }
td { padding: 6px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.sel { background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
tbody tr.click { cursor: pointer; }
td.rank { color: var(--faint); width: 44px; font-variant-numeric: tabular-nums; }
td.muted, .muted { color: var(--muted); }
td.up { color: var(--up); }
.vid { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vid img, .vid .ph {
  width: 64px; height: 36px; border-radius: 4px; object-fit: cover; flex: none; background: var(--panel-2);
}
.vid .ph { width: 44px; height: 26px; border: 1px solid var(--line); }
.vid .t { overflow: hidden; text-overflow: ellipsis; }
table.videos td.title { width: 100%; max-width: 0; min-width: 260px; }
body.drawer-open table.videos:not(.chans) :is(th, td):nth-child(n+6):nth-child(-n+7) { display: none; }
.chan { overflow: hidden; text-overflow: ellipsis; max-width: 180px; display: inline-block; vertical-align: bottom; }
.cc { font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); margin-left: 6px; }
.tfoot { display: flex; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.pager button {
  min-width: 28px; height: 28px; border-radius: 5px; border: 1px solid transparent; background: none;
  color: var(--muted); cursor: pointer;
}
.pager button.on { border-color: var(--line); background: var(--panel-2); color: var(--text); }
.pager button[disabled] { color: var(--faint); cursor: default; }
.empty { padding: 48px; text-align: center; color: var(--muted); }

.detail { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.detail header { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.detail header b { font-size: 15px; }
.detail .cols { display: grid; grid-template-columns: 1fr 1fr; }
.detail .cols > div { padding: 16px; }
.detail .cols > div + div { border-left: 1px solid var(--line); }
.detail h5 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.steps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.steps span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); font-size: 13px; }
.steps svg { color: var(--faint); }
.eg { font-size: 11px; color: var(--warn); border: 1px solid #4a3d1c; border-radius: 4px; padding: 0 5px; margin-left: 6px; font-weight: 500; }

/* 문서 페이지 */
.doc { max-width: 760px; margin: 0 auto; padding: 40px 24px 80px; }
.doc h1 { font-size: 24px; }
.doc h2 { font-size: 16px; margin: 32px 0 8px; }
.doc p, .doc li { color: #c3c9d4; }
.doc a { color: var(--accent); }
.doc .back { color: var(--muted); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 24px; }

@media (max-width: 900px) {
  .side { display: none; }
  main { padding: 16px; }
  .detail .cols { grid-template-columns: 1fr; }
  .detail .cols > div + div { border-left: 0; border-top: 1px solid var(--line); }
}

/* 보강: 아이콘 버튼, 채널 칩, 상세 패널 */
.side a.nav .cnt { margin-left: auto; font-size: 12px; color: var(--faint); }
.ib {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 5px; color: var(--faint); cursor: pointer;
}
.ib:hover { background: var(--line); color: var(--text); }
.ib.on, .ctl.on { color: var(--accent); }
.ib.on svg, .ctl.on svg { fill: currentColor; }
.ctl.chip { color: var(--accent); border-color: #2c4372; background: var(--accent-bg); }
a.ctl:hover { text-decoration: none; background: var(--panel-2); }
.chan.wide { max-width: 260px; }

#drawer { display: none; }
body.drawer-open #drawer {
  display: flex; flex-direction: column; width: 400px; flex: none; border-left: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; height: calc(100vh - 52px); overflow-y: auto;
}
#drawer header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#drawer header .ib { margin-left: auto; }
#drawer .player { background: #000; aspect-ratio: 16 / 9; width: 100%; }
#drawer .player.tall { aspect-ratio: 9 / 16; width: auto; height: min(58vh, 600px); margin: 0 auto; }
#drawer .player iframe { width: 100%; height: 100%; border: 0; display: block; }
#drawer .body { padding: 16px; }
#drawer h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; line-height: 1.4; }
#drawer .kv { grid-template-columns: 120px 1fr; }
#drawer .acts { display: flex; gap: 8px; margin-top: 16px; }
@media (max-width: 1200px) {
  body.drawer-open #drawer { position: fixed; right: 0; top: 0; z-index: 10; width: min(400px, 100vw); }
}
