:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --panel-2: #f1f1ee;
  --ink: #1b1b1f;
  --ink-2: #3f3f46;
  --muted: #6b6b74;
  --line: #e4e4e0;
  --line-2: #d6d6d1;
  --accent: #e5484d;
  --accent-ink: #ffffff;
  --accent-soft: #fde8e8;
  --accent-text: #b22f34;
  --accent-solid: #c9363b; /* 흰 글자를 얹는 칠(배지). 흰 글자 5.15:1, 두 테마 같은 값 */
  --accent-deep: #8d2629; /* ×3~9 배지 칠 = accent-solid 70%+검정 30%. 흰 글자 8.6:1, 두 테마 같은 값 */
  --up: #187a4f;
  --shadow: 0 1px 2px rgba(27, 27, 31, .05), 0 6px 18px -8px rgba(27, 27, 31, .12);
  --radius: 10px;
  --side-w: 212px;
  --detail-w: 420px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --panel: #18181b;
    --panel-2: #202024;
    --ink: #ededef;
    --ink-2: #c8c8ce;
    --muted: #9b9ba4;
    --line: #2a2a2f;
    --line-2: #36363c;
    --accent: #ec5d61;
    --accent-soft: #3a1d1f;
    --accent-text: #ff8a8d;
    --up: #4cc38a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: 84px; } /* 고정 머리줄 아래로: 커서가 돌아간 카드가 머리줄에 가리지 않게 */
.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 100;
  padding: 9px 14px; border-radius: 9px;
  background: var(--ink); color: var(--panel); font-weight: 600; font-size: .875rem; text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; outline: 2px solid var(--ink); outline-offset: 2px; }
body {
  background: var(--bg);
  color: var(--ink);
  font: .875rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100dvh;
}
.app.has-detail { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--detail-w); }

.side {
  position: sticky; top: 0; height: 100dvh;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; color: var(--ink); }
.nav {
  display: flex; flex-direction: column; gap: 1px;
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -6px; padding: 0 6px 8px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.nav-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .75rem; color: var(--muted); padding: 16px 10px 5px; font-weight: 600;
}
.nav-more { border: 0; background: none; color: var(--muted); font: inherit; font-size: .75rem; font-weight: 500; cursor: pointer; padding: 0; }
.nav-more { position: relative; }
.nav-more::after { content: ""; position: absolute; inset: -4px -6px; } /* 보이는 글자는 그대로, 누르는 범위 25px 높이 */
@media (hover: hover) { .nav-more:hover { color: var(--ink); } }
.nav-topics { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.nav a.on .ico { opacity: 1; }
.nav .tdot { flex: none; width: 17px; display: flex; justify-content: center; }
.nav .tdot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.nav a.on .tdot::before { background: var(--accent); }
@media (hover: hover) { .nav a:hover { background: var(--panel-2); color: var(--ink); } }
.nav a.on { background: var(--ink); color: var(--panel); }
.nav a em { font-style: normal; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav a.on em { color: color-mix(in srgb, var(--panel) 70%, transparent); }
.side-foot { flex: none; font-size: .75rem; color: var(--muted); padding: 10px 10px 0; line-height: 1.6; border-top: 1px solid var(--line); }
.side-foot b { color: var(--ink-2); font-weight: 600; }

.main { min-width: 0; padding: 0 24px 40px; }

/* ---------- top ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}
.top-title { min-width: 0; flex: 1; }
.top-title h1 { font-size: 1.3125rem; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.top-title h1:focus { outline: none; } /* 화면 전환 때 커서 자리일 뿐 누르는 칸이 아님 */
/* 화면 설명: 고정 머리줄 밖에 두어 길어도 잘리지 않고(줄바꿈) 내리면 함께 지나간다 */
.page-desc { margin: 0 0 8px; max-width: 60em; color: var(--muted); font-size: .78125rem; line-height: 1.55; text-wrap: pretty; }
.page-desc:empty { display: none; }
.search {
  display: flex; align-items: center; gap: 8px;
  width: min(360px, 40vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 0 12px; height: 38px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--line-2); outline: 2px solid var(--ink); outline-offset: 2px; }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; width: 100%; }
.icon-btn { display: none; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); align-items: center; justify-content: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.fgroup { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fgroup > label, .flabel { font-size: .75rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--panel-2); border-radius: 8px; padding: 2px; gap: 2px 1px; }
.seg button {
  white-space: nowrap;
  border: 0; background: transparent; padding: 4px 9px; border-radius: 6px; font-size: .78125rem; color: var(--ink-2); cursor: pointer;
  transition: background .12s, color .12s;
}
@media (hover: hover) { .seg button:hover { color: var(--ink); } }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button:active { transform: scale(.97); }
select.sel {
  appearance: none; border: 1px solid var(--line); background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%2371717a' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 8px center / 12px;
  color: var(--ink); font: inherit; font-size: .78125rem; padding: 5px 28px 5px 10px; border-radius: 8px; cursor: pointer;
}
.result-line { display: flex; align-items: center; gap: 10px; font-size: .78125rem; color: var(--muted); padding: 12px 0 10px; min-height: 20px; }
.result-line b { color: var(--ink); font-weight: 600; }
.result-line .rl-h { margin: 0; font: inherit; color: inherit; }
.rl-hid { color: var(--muted); font-size: .75rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
@media (hover: hover) { .rl-hid:hover { color: var(--ink); text-decoration-color: currentColor; } }
.btn.ftoggle { display: none; margin-left: auto; }
.chip-x { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 600; border: 0; cursor: pointer; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 18px 14px; }
.card { display: block; min-width: 0; outline: none; }
.thumb {
  position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius); overflow: hidden;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  transform: translateZ(0);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.card:focus-visible .thumb img { transform: scale(1.035); }
@media (hover: hover) { .card:hover .thumb img { transform: scale(1.035); } }
.card:focus-visible .thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.sel .thumb { outline: 2px solid var(--ink); outline-offset: 2px; }
.thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.38) 0, transparent 22%, transparent 62%, rgba(0,0,0,.72) 100%); pointer-events: none; }
.t-age, .t-mult, .t-views, .t-dur { position: absolute; z-index: 1; font-size: .75rem; font-weight: 600; color: #fff; }
/* 썸네일 위 칩: 그림이 하얘도 흰 글자 4.5:1 이상(검정 55% 이상) */
.t-age { top: 8px; left: 8px; background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 5px; backdrop-filter: blur(4px); }
/* 배수 배지 위계: ×3 미만 회색 → ×3~9 검붉은 칠 → ×10~99 빨간 칠 → ×100+ 빨간 칠+흰 테+굵게 */
.t-mult { top: 8px; right: 8px; padding: 2px 7px; border-radius: 5px; background: rgba(0,0,0,.55); font-family: var(--mono); font-size: .75rem; letter-spacing: -.02em; white-space: nowrap; }
.t-mult.m1 { background: var(--accent-deep); }
.t-mult.m2 { background: var(--accent-solid); }
.t-mult.m3 { background: var(--accent-solid); outline: 2px solid #fff; font-weight: 800; }
.t-mult small { font-family: var(--font); font-size: .75rem; font-weight: 600; letter-spacing: 0; margin-right: 3px; }
.t-mult b { font-weight: inherit; }
/* 줄 목록(대본 모음·참고함)은 썸네일이 좁아 배지를 정보 줄 앞에 둔다 */
.t-mult.inl { position: static; display: inline-block; margin-right: 6px; padding: 0 6px; line-height: 18px; vertical-align: 1px; }
.t-mult.inl:not(.m1):not(.m2):not(.m3) { background: var(--panel-2); color: var(--ink-2); box-shadow: 0 0 0 1px var(--line) inset; }
.t-mult.inl.m3 { outline: 1.5px solid var(--accent-solid); outline-offset: 1.5px; margin-left: 3px; }
.t-views { left: 9px; bottom: 8px; font-size: .8125rem; text-shadow: 0 1px 2px rgba(0,0,0,.4); display: flex; align-items: center; gap: 4px; }
.t-views svg { width: 12px; height: 12px; }
.t-dur { right: 9px; bottom: 9px; font-size: .75rem; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.c-title { margin: 8px 2px 4px; font-size: .84375rem; font-weight: 600; line-height: 1.38; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; overflow-wrap: anywhere; }
.c-ch { display: flex; align-items: center; gap: 6px; margin: 0 2px; font-size: .75rem; color: var(--muted); min-width: 0; }
.c-ch img { width: 18px; height: 18px; border-radius: 50%; flex: none; background: var(--panel-2); }
.c-ch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-ch .subs { flex: none; color: var(--muted); }
.c-stats { display: flex; gap: 8px; margin: 3px 2px 0; font-size: .75rem; color: var(--muted); }
.c-stats .up { color: var(--up); font-weight: 600; }

/* skeleton */
.sk .thumb { box-shadow: none; }
.sk .thumb, .sk .bar { background: linear-gradient(90deg, var(--panel-2) 0, color-mix(in srgb, var(--panel-2) 60%, var(--panel)) 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: sh 1.3s linear infinite; }
.sk .bar { height: 12px; border-radius: 4px; margin: 10px 2px 0; }
.sk .bar.s { width: 60%; }
.sk .thumb::after { display: none; } /* 자리표시에는 썸네일 그늘을 깔지 않는다(검은 깨진 카드처럼 보임) */
.sk.bar, .sk.av, .sk-cell .sk.bar { display: block; height: 12px; border-radius: 4px; margin: 0; background: linear-gradient(90deg, var(--panel-2) 0, color-mix(in srgb, var(--panel-2) 60%, var(--panel)) 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: sh 1.3s linear infinite; }
.sk-cell .sk.bar + .sk.bar { margin-top: 8px; }
.sk-cell .sk.bar.s { width: 55%; }
.sk-cell .sk.bar.m { width: 70%; height: 14px; }
.sk-cell .sk.bar:only-child, .stat.sk-cell .sk.bar.m { height: 20px; }
.sk.av { width: 40px; height: 40px; border-radius: 50%; }
.sk-row { grid-template-columns: 34px 44px minmax(0, 1fr); }
.sk-row .sk.bar, .sk-row .sk.av { background-color: var(--line); background-image: linear-gradient(90deg, var(--line) 0, color-mix(in srgb, var(--line) 50%, var(--bg)) 50%, var(--line) 100%); } /* 페이지 바탕 위라 칸 안 자리표시보다 한 단계 진하게 */
.sk-row .sk.bar:first-child { width: 16px; justify-self: center; }
.sk-row .sk.bar:last-child { width: 40%; }
.script.sk-cell { grid-template-columns: 74px minmax(0, 1fr); }
@keyframes sh { to { background-position: -200% 0; } }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); margin: 0 0 6px; font-size: 1rem; }
.empty h2, .empty p { word-break: keep-all; overflow-wrap: anywhere; }
.empty h2, .top-title h1, .ch-head h2, .bsec-h h2, .panel h2 { text-wrap: balance; }
.empty p { max-width: 36em; margin: 0 auto; text-wrap: pretty; }
.empty .acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.empty.more-err { padding: 28px 20px 8px; }
.sentinel { height: 1px; }
.more-btn { display: block; margin: 26px auto 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 8px; padding: 7px 12px; font-size: .8125rem; font-weight: 500; cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
@media (hover: hover) { .btn:hover { border-color: var(--line-2); background: var(--panel-2); } }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
@media (hover: hover) { .btn.primary:hover { opacity: .9; } }
.btn.on { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.d-head .label a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-2); }

/* ---------- detail ---------- */
.detail {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  border-left: 1px solid var(--line); background: var(--panel);
  display: none;
}
.app.has-detail .detail { display: block; }
.detail-inner { padding: 16px 18px 40px; }
.d-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.d-head .label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.close-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.close-btn svg { width: 16px; height: 16px; }
.player { position: relative; aspect-ratio: 9 / 16; max-height: 62vh; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; }
.player img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); transition: transform .15s, background .15s; }
@media (hover: hover) { .play:hover { transform: scale(1.06); background: rgba(0,0,0,.7); } }
.play svg { width: 26px; height: 26px; margin-left: 3px; }
.d-title { font-size: 1rem; font-weight: 700; margin: 14px 0 8px; line-height: 1.4; letter-spacing: -.01em; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.d-chrow { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.d-ch { display: flex; align-items: center; gap: 10px; padding: 8px 0 12px; flex: 1; min-width: 0; }
.hide-btn { flex: none; padding: 5px 10px; font-size: .75rem; color: var(--ink-2); }
.d-chrow .hide-btn { margin-bottom: 4px; }
.ch-hid { margin: 8px 0 0; font-size: .78125rem; color: var(--ink-2); }
.d-ch img { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); }
.d-ch .nm { font-weight: 600; font-size: .84375rem; }
.d-ch .sb { font-size: .75rem; color: var(--muted); }
.d-ch .go { margin-left: auto; font-size: .75rem; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 14px 0; }
.tiles.n4 { grid-template-columns: repeat(2, 1fr); }
.tiles.n5 .tile:last-child { grid-column: span 2; }
.tile { background: var(--panel); padding: 10px 11px; }
.tile .k { font-size: .75rem; color: var(--muted); }
.tile .v { font-size: 1.0625rem; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.tile .v.acc { color: var(--accent-text); }
.tile .s { font-size: .75rem; color: var(--muted); word-break: keep-all; }
.tile .s .nw { white-space: nowrap; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 16px; }
.sec { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.sec h3 { margin: 0 0 10px; font-size: .84375rem; display: flex; justify-content: space-between; align-items: center; }
.sec-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 10px; }
.sec-h h3 { margin: 0; }
.sec h3 small { font-weight: 500; color: var(--muted); font-size: .75rem; }
.chart { position: relative; }
.chart svg { width: 100%; height: 150px; overflow: visible; }
.chart .ax { font-size: .75rem; fill: var(--muted); }
.chart .ay { paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--panel); font-size: .75rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -120%); opacity: 0; transition: opacity .1s; }
.chart-empty { font-size: .78125rem; color: var(--muted); padding: 18px 0; text-align: center; background: var(--panel-2); border-radius: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; background: var(--panel-2); border-radius: 6px; padding: 3px 8px; font-size: .78125rem; color: var(--ink-2); }
@media (hover: hover) { .tag:hover { background: var(--accent-soft); color: var(--accent-text); } }
.transcript { font-size: .8125rem; line-height: 1.7; white-space: pre-wrap; max-height: 260px; overflow: auto; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); }
.comments { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow: auto; }
.cm { font-size: .8125rem; line-height: 1.5; }
.cm .a { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini { display: block; }
.mini .thumb { border-radius: 8px; box-shadow: none; }
.mini .t-views { font-size: .75rem; }
.desc-note { font-size: .75rem; color: var(--muted); }

/* ---------- channel / rank / tags ---------- */
.ch-head { display: flex; gap: 16px; align-items: center; padding: 6px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.ch-head img { width: 64px; height: 64px; border-radius: 50%; background: var(--panel-2); }
.ch-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.ch-head .meta { color: var(--muted); font-size: .8125rem; margin-top: 2px; }
.ch-stats { display: flex; gap: 22px; margin-left: auto; }
.ch-stats div { text-align: right; }
.ch-stats .k { font-size: .75rem; color: var(--muted); }
.ch-stats .v { font-size: 1.125rem; font-weight: 700; }
.rank { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 34px 44px minmax(0, 1fr) 90px 80px 116px 64px; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 8px; }
@media (hover: hover) { .rank-row:hover { background: var(--panel); } }
.rank-row .no { color: var(--muted); font-weight: 600; text-align: center; }
.rank-row img.av { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-2); }
.rank-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .hd { font-size: .75rem; color: var(--muted); }
.rank-row .c { text-align: right; font-size: .8125rem; }
.rank-row .c small { display: block; font-size: .75rem; color: var(--muted); }
.rank-row .c small.u { display: inline; margin-left: 2px; }
.rank-head .c { white-space: nowrap; }
.rank-row .hd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .hd-s { display: none; }
.rank-row .hd .nw { white-space: nowrap; }
.rank-row .tv { width: 40px; aspect-ratio: 9/16; border-radius: 5px; object-fit: cover; justify-self: end; background: var(--panel-2); }
.rank-head { font-size: .75rem; color: var(--muted); cursor: default; }
@media (hover: hover) { .rank-head:hover { background: transparent; } }
.tagcloud { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.tagcell { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; transition: border-color .12s; }
@media (hover: hover) { .tagcell:hover { border-color: var(--accent); } }
.tagcell .tg { font-weight: 700; }
.tagcell .st { font-size: .75rem; color: var(--muted); margin-top: 2px; word-break: keep-all; }
.tagcell .kw-share b { color: var(--ink); font-weight: 700; }
.bar-chart svg { width: 100%; height: 180px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .k { font-size: .75rem; color: var(--muted); }
.stat .v { font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat .s { font-size: .75rem; color: var(--muted); margin-top: 2px; word-break: keep-all; }
a.stat[href] { transition: border-color .12s; }
@media (hover: hover) { a.stat[href]:hover { border-color: var(--line-2); } }

/* ---------- briefing ---------- */
.brief-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 4px; }
.brief-fresh { display: none; margin: 0 0 14px; font-size: .75rem; color: var(--muted); } /* 모바일에서 숫자 설명 줄을 접을 때만 보임 */
.bsec { margin: 6px 0 22px; }
.bsec-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.bsec-h h2 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.bsec-h span { font-size: .75rem; color: var(--muted); }
.bsec-h a, .panel h2 a { margin-left: auto; font-size: .78125rem; color: var(--muted); font-weight: 500; }
@media (hover: hover) { .bsec-h a:hover, .panel h2 a:hover { color: var(--ink); } }
.hrow {
  display: grid; grid-auto-flow: column; grid-auto-columns: 158px; gap: 14px;
  overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.hrow .card { scroll-snap-align: start; }
.brief-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel h2 { display: flex; align-items: baseline; gap: 8px; }
.panel h2 small { font-weight: 500; color: var(--muted); font-size: .75rem; }
.tbars { display: flex; flex-direction: column; gap: 2px; }
.tbar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 64px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 7px; }
@media (hover: hover) { .tbar:hover { background: var(--panel-2); } }
.tbar .nm { font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbar .track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.tbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }
.tbar .ct { text-align: right; font-size: .8125rem; font-weight: 600; }
.tbar .ct small, .mr .ct small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.mini-rank { display: flex; flex-direction: column; }
.mr { display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; }
@media (hover: hover) { .mr:hover { background: var(--panel-2); } }
.mr .no { color: var(--muted); font-weight: 600; text-align: center; font-size: .78125rem; }
.mr img, .mr .av { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); }
.mr .nm { font-weight: 600; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr .nm small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.mr .ct { font-weight: 700; font-size: .875rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 5px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px; font-size: .8125rem; color: var(--ink-2); transition: border-color .12s, color .12s; }
.chip small { color: var(--muted); font-size: .75rem; }
@media (hover: hover) { .chip:hover { border-color: var(--accent); color: var(--accent-text); } }

/* ---------- scripts ---------- */
.scripts { display: flex; flex-direction: column; gap: 10px; }
.script { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 14px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; position: relative; transition: border-color .12s; }
.script:focus-within { border-color: var(--line-2); }
@media (hover: hover) { .script:hover { border-color: var(--line-2); } }
/* 제목 링크가 줄 전체를 덮고(누르면 상세), 복사·메모·빼기 단추는 그 위에 */
.sc-open::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.sc-copy, .sv-kv, .sv-acts { position: relative; z-index: 1; }
.script.sel { border-color: var(--ink); }
.script .thumb { border-radius: 8px; box-shadow: none; }
.sc-body h3 { margin: 0 0 3px; font-size: .875rem; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
.sc-meta { font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.sc-tx { margin: 0; font-size: .8125rem; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.sc-copy { padding: 5px 10px; font-size: .78125rem; }

/* ---------- 참고함 ---------- */
.script.sv { grid-template-columns: 74px minmax(0, 1fr); }
.sv-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0 0 10px; font-size: .8125rem; line-height: 1.6; }
.sv-kv dt { color: var(--muted); font-size: .75rem; line-height: 1.75; }
.sv-kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.sv-kv .none { color: var(--muted); }
.sv-line { color: var(--ink-2); }
.sv-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-acts .btn, .sv-copyall { padding: 5px 10px; font-size: .78125rem; }
.sv-copyall { margin-left: auto; }
.sv-store { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.sv-store p { margin: 0; flex: 1 1 280px; font-size: .8125rem; color: var(--ink-2); line-height: 1.6; }
.sv-store .note-row { flex: 1 1 300px; }
.sv-store .warn { color: var(--accent-text); font-weight: 600; }
.sv-store .token-err { flex-basis: 100%; color: var(--accent-text); font-size: .78125rem; }
.sv-store .token-err:empty { display: none; }
.note-form { min-width: 0; }
.save-box .note-form { margin-top: 12px; }
.note-form label { display: block; font-size: .78125rem; font-weight: 600; margin-bottom: 5px; }
.note-form label small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.note-row { display: flex; gap: 6px; min-width: 0; }
.note-row input { flex: 1; min-width: 0; font: inherit; font-size: .84375rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; }
.note-row input::placeholder { color: var(--muted); }
.note-row input:focus { border-color: var(--ink-2); outline: 2px solid var(--ink); outline-offset: 1px; }
.note-row .btn { flex: none; }
.note-line { margin: 7px 0 0; font-size: .78125rem; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.note-line q { color: var(--ink-2); quotes: "「" "」"; }
.sv-note .note-form { margin: 2px 0; }
.sv-note .note-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- watch ---------- */
.wchs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.wch { display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px 7px 9px; max-width: 280px; position: relative; }
.wch .nm::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.wch .wx, .wch .unhide { position: relative; z-index: 1; }
.wch .unhide { flex: none; padding: 4px 9px; font-size: .75rem; }
.hid-box { margin: -6px 0 18px; }
.hid-box summary { cursor: pointer; width: fit-content; font-size: .8125rem; color: var(--ink-2); padding: 4px 0; }
.hid-box summary small { color: var(--muted); font-size: .75rem; margin-left: 4px; }
.hid-box[open] summary { margin-bottom: 8px; }
.hid-box .wchs { margin-bottom: 0; }
.hid-box .wch { background: var(--panel-2); }
.hid-box .wch .nm { color: var(--ink-2); }
@media (hover: hover) { .wch:hover { border-color: var(--line-2); } }
.wch img, .wch .av { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); flex: none; }
.wch .nm { font-weight: 600; font-size: .8125rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wch .nm small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.wx { flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
@media (hover: hover) { .wx:hover { background: var(--panel-2); color: var(--ink); } }
.wx svg { width: 14px; height: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: .875rem; }
.note { font-size: .78125rem; color: var(--muted); line-height: 1.7; }

/* ---------- 단축키 ---------- */
kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--panel); color: var(--ink); font: 600 .75rem/1.4 var(--mono); text-align: center; }
.kbd-btn { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 2px 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
@media (hover: hover) { .kbd-btn:hover { color: var(--ink); } }
.kbd-btn kbd { font-size: .75rem; padding: 0 4px; }
.keys { width: min(420px, calc(100vw - 32px)); padding: 20px 22px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 24px 60px -12px rgba(0,0,0,.35); }
.keys::backdrop { background: rgba(0,0,0,.32); }
.keys h2 { margin: 0 0 12px; font-size: 1rem; }
.keys dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 14px; margin: 0 0 16px; font-size: .8125rem; align-items: baseline; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--ink-2); line-height: 1.5; word-break: keep-all; }
.keys form { display: flex; justify-content: flex-end; }
@media (hover: none) { .kbd-btn { display: none; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--panel); padding: 9px 16px; border-radius: 9px; font-size: .8125rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app.has-detail { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .detail { position: fixed; right: 0; top: 0; width: min(var(--detail-w), 100vw); z-index: 50; box-shadow: -12px 0 40px rgba(0,0,0,.18); }
  .app.has-detail .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 40; }
}
@media (max-width: 820px) {
  .app, .app.has-detail { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; width: 240px; transform: translateX(-100%); transition: transform .25s cubic-bezier(.16,1,.3,1); }
  .app.nav-open .side { transform: none; box-shadow: 12px 0 40px rgba(0,0,0,.2); } /* 닫혀 있을 때 그림자가 화면 왼쪽에 띠로 번지지 않게 */
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 25; }
  .icon-btn { display: inline-flex; }
  .main { padding: 0 12px 40px; }
  .top { flex-wrap: wrap; gap: 10px; }
  html { scroll-padding-top: 128px; }
  .search { width: 100%; order: 3; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .detail { width: 100vw; }
  .player { max-height: 56vh; }
  .filters { display: none; flex-direction: column; flex-wrap: nowrap; gap: 8px; }
  .filters.open { display: flex; }
  .btn.ftoggle { display: inline-flex; }
  .fgroup { flex-wrap: nowrap; min-width: 0; align-items: flex-start; }
  .fgroup > label, .flabel { flex: none; width: 5.7em; white-space: nowrap; padding-top: 7px; } /* 단추가 두 줄로 넘어가도 이름은 첫 줄에 맞춤 */
  .filters .seg { min-width: 0; }
  .seg button { flex: none; }
  /* 좁은 화면: 구독자 칸을 빼고 이름 아래 줄로(이름이 두 글자만 남지 않게), 채널 아이디는 줄인다 */
  .rank-row { grid-template-columns: 26px 36px minmax(0, 1fr) 56px; }
  .rank-row .c.hide-m, .rank-row .tv, .rank-row .hd-h { display: none; }
  .rank-row .hd-s { display: inline; }
  .rank-row .hd { white-space: normal; } /* 320px에서 「수집 N개」가 말줄임으로 잘리지 않게 두 줄 허용 */
  .rank-row:not(.sk-row) > :last-child { display: none; } /* 맨 끝 대표 쇼츠 칸(없으면 빈 칸)이 다음 줄로 밀리지 않게 */
  .sk-row { grid-template-columns: 26px 36px minmax(0, 1fr); }
  .sk.av { width: 36px; height: 36px; }
  .script.sk-cell { grid-template-columns: 60px minmax(0, 1fr); }
  .ch-head { flex-wrap: wrap; }
  .ch-stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .filters { gap: 8px 12px; }
  .brief-cols { grid-template-columns: minmax(0, 1fr); }
  /* 브리핑 숫자: 첫 화면에 쇼츠 줄이 보이게 3칸×2줄 요약. 설명 줄(기준)은 화면낭독기에만 남김 */
  .brief-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 6px; }
  .brief-stats .stat { border: 0; border-radius: 0; padding: 6px 9px; min-height: 44px; }
  .brief-stats .stat .k { font-size: .75rem; line-height: 1.3; word-break: keep-all; }
  .brief-stats .stat .v { font-size: 1rem; margin-top: 1px; }
  .brief-stats .stat .s { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .brief-fresh { display: block; }
  /* 손가락으로 누르는 칸 44px 이상: 단추는 실제 크기로, 글자 줄 안의 작은 링크·칩은 보이는 크기를 두고 누르는 범위만 넓힘 */
  .icon-btn, .close-btn { width: 44px; height: 44px; }
  .btn, select.sel, .note-row input, .nav a, .tbar { min-height: 44px; }
  .search { height: 46px; } .search input { align-self: stretch; } /* 글자 칸 자체가 44px(테두리 밖 여백을 눌러도 커서가 안 가므로) */
  .tag, .chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 13px; }
  #chart-range button { min-height: 44px; min-width: 44px; padding: 0 11px; }
  .wx { width: 44px; height: 44px; margin: -7px -8px -7px 0; }
  .nav-label { min-height: 44px; padding: 0 0 0 10px; margin-top: 6px; }
  .nav-more { align-self: stretch; padding: 0 10px 0 18px; }
  .chip-x, a.more, .d-head .label a, .rl-hid { position: relative; }
  .chip-x::after, a.more::after, .d-head .label a::after, .rl-hid::after { content: ""; position: absolute; inset: -13px -4px; }
  .rl-hid::after { inset: -14px -4px; }
  .d-chrow .hide-btn { margin-bottom: 0; }
  .d-head .label a::after { inset: -16px min(-4px, calc((100% - 44px) / 2)); } /* 글자 줄 안 링크는 상자가 글자 높이(14px)뿐, 짧은 소재 이름(「동물」)도 너비 44px */
  .kbd-btn { min-height: 44px; }
  .hrow { grid-auto-columns: 42vw; }
  .script { grid-template-columns: 60px minmax(0, 1fr); }
  .sc-copy { grid-column: 2; justify-self: start; }
  .script.sv { grid-template-columns: 60px minmax(0, 1fr); }
  .note-row input, .search input, select.sel { font-size: 1rem; }
  .note-row { flex-wrap: wrap; }
  .sv-note .note-row input { flex-basis: 100%; }
  .side { padding-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
