:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #6b7385;
  --line: #e3e6ec;
  --accent: #5b4bdb;
  --accent-soft: #ecebff;
  --self: #e8457a;
  --self-soft: #fde8ef;
  --ok: #1f9d6a;
  --warn: #c98a00;
  --warn-soft: #fff5d9;
  --bad: #d64545;
  --bad-soft: #fde9e9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 2px 8px rgba(20, 24, 40, .04);
  font-family: "Pretendard", "Noto Sans KR", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a; --panel: #1b1e27; --ink: #e6e8ef; --muted: #9aa1b2; --line: #2b2f3b;
    --accent: #8f83ff; --accent-soft: #2a2750; --self: #ff6f9c; --self-soft: #3d2030;
    --warn-soft: #3a3115; --bad-soft: #3d1f1f;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: block; font-weight: 800; font-size: 18px; padding: 0 10px 16px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand:hover { opacity: .75; }
.brand span { font-weight: 500; color: var(--muted); font-size: 13px; }
nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
nav a b { width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 11px; border-radius: 6px; background: var(--bg); color: var(--muted); }
nav a:hover { background: var(--bg); }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav a.active b { background: var(--accent); color: #fff; }
nav hr { border: 0; border-top: 1px solid var(--line); margin: 10px 4px; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 8px 10px; }

main { min-width: 0; }
.banner { background: var(--bad-soft); color: var(--bad); padding: 10px 24px; font-weight: 600; border-bottom: 1px solid var(--line); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.f-group { display: flex; flex-direction: column; gap: 4px; }
.f-group label { font-size: 11px; color: var(--muted); font-weight: 600; }
.f-group > div, .f-group { }
select, input, textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
textarea { width: 100%; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 6px 12px; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 6px 10px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }

.page { padding: 20px 24px 60px; }
.page h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.02em; }
.page .lead { color: var(--muted); margin: 0 0 18px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.grow { flex: 1 1 0; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.card h2 .tools { display: flex; gap: 6px; font-weight: 400; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.note { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; }
.note.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }

/* 표 */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th .arrow { font-size: 10px; margin-left: 2px; }
tbody tr:hover { background: var(--bg); }
tr.self { background: var(--self-soft); }
tr.self td:first-child { box-shadow: inset 3px 0 0 var(--self); }
tr.clickable { cursor: pointer; }
td { max-width: 420px; }
td.nowrap, th, .nowrap { white-space: nowrap; }
tr.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 칩 · 배지 */
.chip { display: inline-block; padding: 2px 8px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; white-space: nowrap; }
.chip.gray { background: var(--bg); color: var(--muted); }
.chip.music { background: #e7f6ef; color: #17805a; }
.chip.click { cursor: pointer; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--bg); color: var(--muted); }
.badge.hot { background: var(--self); color: #fff; }
.badge.ok { background: #e3f5ec; color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.self { background: var(--self); color: #fff; }

/* 게시물 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.post .thumb { aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(135deg, var(--accent-soft), var(--self-soft)); display: grid; place-items: center; color: var(--muted); font-size: 12px; position: relative; }
.post .thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post .thumb .badge { position: absolute; top: 8px; left: 8px; }
.post .thumb .ptype { position: absolute; top: 8px; right: 8px; left: auto; }
.post .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.post .author { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; gap: 6px; }
.post .text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
.post .metrics { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.post .foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); gap: 6px; flex-wrap: wrap; }

/* 빈 상태 */
.empty { padding: 36px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.empty.nosource { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.empty.nosource b { color: var(--warn); }

/* 패널 */
.side-panel { position: fixed; top: 0; right: 0; width: min(520px, 100%); height: 100vh; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(0,0,0,.12); z-index: 20; overflow-y: auto; padding: 18px; }
.side-panel .close { float: right; }
.side-panel h2 { font-size: 16px; margin: 0 0 12px; }
.side-panel.wide { width: min(780px, 100%); }
.side-panel .card { box-shadow: none; }
.side-panel .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fab { position: fixed; right: 24px; bottom: 24px; z-index: 19; border-radius: 999px; padding: 10px 18px; font-weight: 600; box-shadow: 0 4px 16px rgba(20, 24, 40, .2); }
.steps { display: flex; gap: 4px; margin: 10px 0 14px; }
.steps span { flex: 1; text-align: center; font-size: 11px; padding: 4px 0; border-radius: 4px; background: var(--bg); color: var(--muted); }
.steps span.done { background: var(--accent-soft); color: var(--accent); }
.steps span.cur { background: var(--accent); color: #fff; }
.steps span.fail { background: var(--bad); color: #fff; }
.timeline { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 8px 0; }
.timeline div { font-size: 10px; color: #fff; display: grid; place-items: center; overflow: hidden; white-space: nowrap; }

/* 칸반 */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.kanban .col { background: var(--bg); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kanban .col h3 { font-size: 13px; margin: 0 0 8px; display: flex; justify-content: space-between; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; font-size: 13px; }
.kcard .t { font-weight: 600; margin-bottom: 4px; }

.bar-row { display: grid; grid-template-columns: 140px 1fr 70px; gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; }
.bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 20px; background: var(--panel); color: var(--ink); min-width: 320px; }
dialog::backdrop { background: rgba(10, 12, 20, .45); }
dialog input { width: 100%; margin: 8px 0; }
dialog menu { padding: 0; margin: 8px 0 0; display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 8px 16px; border-radius: 8px; z-index: 50; }
.dropzone { display: block; cursor: pointer; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.chart-box { position: relative; height: 320px; }
.chart-box.sm { height: 220px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tagset { font-family: ui-monospace, monospace; background: var(--bg); padding: 10px; border-radius: 8px; min-height: 40px; word-break: break-all; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  /* 휴대폰: 메뉴는 위쪽 한 줄(가로 스크롤), 비용 표시는 숨긴다 */
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; padding: 8px 10px; flex-direction: row; align-items: center; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 6px 0 2px; font-size: 16px; white-space: nowrap; }
  .brand span { display: none; }
  nav { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .sidebar { min-width: 0; max-width: 100vw; }
  nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; margin: 0; padding: 6px 10px; }
  nav hr, .sidebar-foot { display: none; }
  .page, .filters { padding-left: 16px; padding-right: 16px; }
}

/* AI 아이돌 레이더 */
.nav-hero { font-weight: 700; }
.rk { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rk.up { color: #12a150; }
.rk.down { color: var(--bad); }
.rk.same { color: var(--muted); }
.badge.new { background: var(--accent-soft); color: var(--accent); }
.badge.spike { background: #fde2e2; color: #c92a2a; }
.badge.rise { background: #fff1d6; color: #b25e00; }
.badge.ai { background: #e7e3ff; color: #5b4bdb; }
.spark { display: inline-flex; align-items: flex-end; gap: 1px; height: 22px; vertical-align: middle; }
.spark i { display: block; width: 4px; background: var(--accent); opacity: .55; border-radius: 1px; }
.spark i.last { opacity: 1; background: #e8457a; }
.movers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.movers .card { margin: 0; }
.mover { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.mover:last-child { border-bottom: 0; }
.mover .rkchip { font-size: 11px; color: var(--muted); min-width: 30px; }
.method { font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 24px; padding-top: 10px; line-height: 1.7; }
@media (max-width: 860px) { .movers { grid-template-columns: 1fr; } }

/* 레이더: 새로 발견한 AI 아이돌 */
.rookies { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rookie { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 4px; }
.rookie:hover { border-color: var(--accent); }
.badge.challenge { background: #fff1e6; color: #c2410c; }
.follow-btn { margin-left: 6px; }

/* X 미리보기: 썸네일이 없으면 본문을 카드처럼 */
.post .thumb .tpreview { width: 100%; height: 100%; padding: 36px 14px 12px; display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 13px; line-height: 1.5; overflow: hidden; text-align: left; }
.post .thumb .tpreview p { margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.post .thumb .tpreview .av { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; }
.post .thumb .play { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 18px; }

/* 터진 게시물 지표 칩 */
.mchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.mchip { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.mchip.hot { background: var(--self-soft); color: var(--self); font-weight: 600; }

/* 카드 · 클릭 가능한 것은 눌러도 된다는 티를 낸다 */
.post[data-href] { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.post[data-href]:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(20, 24, 40, .10); }
.post[data-href]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post .author a { color: var(--ink); font-weight: 600; text-decoration: none; }
.post .author a:hover { text-decoration: underline; }
a.chip { text-decoration: none; }
a.chip:hover { filter: brightness(.95); text-decoration: underline; }
.mover:hover, .rookie:hover, tr.clickable:hover td { background: var(--accent-soft); }
.mover { border-radius: 6px; padding-left: 4px; padding-right: 4px; }
a.mover { color: inherit; text-decoration: none; }
/* 서랍 패널 바깥(어둡게) — 누르면 닫힌다 */
.backdrop { position: fixed; inset: 0; background: rgba(15, 18, 30, .25); z-index: 19; }
@media (prefers-reduced-motion: reduce) { .post[data-href] { transition: none; } .post[data-href]:hover { transform: none; } }

.tbl-more { text-align: center; padding: 10px 0 2px; }

/* AI 아이돌 목록 */
.idols { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.idol { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; align-content: start; cursor: pointer; box-shadow: var(--shadow); transition: border-color .12s ease, transform .12s ease; }
.idol:hover { border-color: var(--accent); transform: translateY(-1px); }
.idol .ihead { display: flex; gap: 10px; align-items: center; }
.idol .av { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--accent-soft); }
.idol .av.ph { display: grid; place-items: center; font-weight: 700; color: var(--accent); }
.idol .iname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idol .ibadges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.idol .ibio { margin: 0; font-size: 13px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.idol .imedia { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.idol .imedia a { position: relative; display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--bg); }
.idol .imedia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play.sm { position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 10px; }
.idol .istats { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.idol .istats b { color: var(--ink); }
.idol .ihead select { flex: none; width: 104px; }
.idol { overflow: hidden; }
.idol .ihead > .grow { flex: 1 1 0; min-width: 0; overflow: hidden; }

/* AI 아이돌 랭킹: 순위 · 수익 방식 */
.idol .irankbox { display: grid; justify-items: center; gap: 2px; min-width: 34px; flex: none; }
.idol .irank { font-size: 20px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.idol .irankbox .rk, .idol .irankbox .badge { font-size: 11px; }
.idol .imon { display: flex; flex-wrap: wrap; gap: 4px; }
.mchip.mon { background: var(--warn-soft); color: #8a5a00; text-decoration: none; }
a.mchip.mon:hover { text-decoration: underline; }

/* 뜨는 챌린지: 곡 카드 → 참여 그룹 → 쇼츠 */
.songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 860px) { .songs { grid-template-columns: 1fr; } }
.song { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; cursor: pointer; box-shadow: var(--shadow); overflow: hidden; transition: border-color .12s ease; }
.song:hover { border-color: var(--accent); }
.song .shead { display: flex; gap: 10px; align-items: center; }
.song .srank { font-size: 22px; font-weight: 800; min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.song .sname { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .sstats { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); align-items: center; }
.song .sstats b { color: var(--ink); }
.parts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.part { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; }
.part.official { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.part.subject { background: var(--self-soft); border-color: transparent; }
a.part:hover { text-decoration: underline; }
.shorts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shorts.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.short { position: relative; display: block; aspect-ratio: 9 / 14; border-radius: 8px; overflow: hidden; background: var(--bg); color: #fff; text-decoration: none; }
.short img { width: 100%; height: 100%; object-fit: cover; display: block; }
.short .ph { position: absolute; inset: 0; padding: 8px; color: var(--ink); font-size: 11px; overflow: hidden; }
.short .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 5px; font-size: 10.5px; line-height: 1.3; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.idol > *, .song > * { min-width: 0; }
.post .thumb .tbadges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.post .thumb .tbadges .badge { position: static; }
.seg button.on .muted { color: inherit; opacity: .85; }

/* 해시태그 추천 */
.sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.tset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.tset-head { display: flex; align-items: center; gap: 6px; }
.tset-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rtag { display: inline-grid; padding: 4px 10px; border-radius: 8px; background: var(--bg); font-weight: 700; font-size: 14px; line-height: 1.25; }
.rtag small { font-weight: 400; font-size: 10.5px; color: var(--muted); }
.rtag.identity, .tagcat.identity h2 { color: var(--accent); }
.rtag.identity { background: var(--accent-soft); }
.rtag.trend { background: var(--self-soft); color: var(--self); }
.rtag.generic { background: var(--warn-soft); color: #8a5a00; }
.rtag.self { background: var(--ink); color: var(--panel); }
.rtag.self small { color: inherit; opacity: .7; }
.tagcats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 12px 0; }
.tagcat { margin: 0; }
.tagcat.avoid { opacity: .85; }
.tagcat.avoid .tterm { text-decoration: line-through; color: var(--muted); }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tmain { min-width: 0; display: grid; gap: 2px; }
.tmeta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.trow:last-child { border-bottom: 0; }
.tterm { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.tterm:hover { text-decoration: underline; }
.aifit { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent-soft) var(--w), transparent var(--w)); border: 1px solid var(--line); white-space: nowrap; }
details#all > summary { cursor: pointer; padding: 4px 0; }

/* 해시태그 추천: 인기 AI 아이돌의 실제 묶음 */
.ibundles { display: grid; gap: 0; }
.ibrow { display: grid; grid-template-columns: 220px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.ibrow:first-child { border-top: 0; }
.ibwho { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.ibwho .av { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.ibwho .irank { font-weight: 800; font-size: 18px; min-width: 22px; }
.ibsets { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; min-width: 0; }
.ib { display: grid; gap: 6px; align-content: start; min-width: 0; }
.rtag.own { background: var(--self-soft); color: var(--self); outline: 1px dashed var(--self); }
.rtag.avoid { text-decoration: line-through; opacity: .6; }
@media (max-width: 720px) { .ibrow { grid-template-columns: 1fr; } }

/* 뜨는 챌린지: 바이럴 쇼츠 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.click { cursor: pointer; border: 1px solid var(--line); background: var(--panel); }
.chip.click.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.click.on .muted { color: inherit; opacity: .8; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.vtile { display: grid; gap: 6px; color: inherit; text-decoration: none; min-width: 0; }
.vthumb { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--bg); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb .play { position: absolute; inset: 0; margin: auto; }
.vviews { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px; }
.vmeta { display: grid; gap: 3px; min-width: 0; }
.vtitle { font-weight: 600; font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vtile:hover .vtitle { color: var(--accent); }
.vbadges { display: flex; flex-wrap: wrap; gap: 4px; }
.vthumb .dl { position: absolute; right: 6px; top: 6px; min-width: 30px; height: 30px; padding: 0 7px; border-radius: 15px; border: 0;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.vthumb .dl:hover { background: var(--accent); }
.vthumb .dl.busy { background: var(--accent); font-size: 11px; }
.vthumb .dl.ok { background: #17805a; }
.vthumb .dl.err { background: #c0392b; }
.vthumb .ref { position: absolute; right: 42px; top: 6px; width: 30px; height: 30px; border-radius: 15px; border: 0;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 16px; cursor: pointer; }
.vthumb .ref:hover { background: #d4a106; }
.vthumb .ref.on { background: #f5b301; color: #fff; }
/* 참고 목록 */
.refs { display: grid; gap: 10px; }
.refrow { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); }
.rthumb { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: var(--bg); }
.rthumb img { width: 100%; height: 100%; object-fit: cover; }
.rbody { display: grid; gap: 6px; align-content: start; min-width: 0; }
.rbody .vtitle { color: inherit; text-decoration: none; }
.rbody textarea { width: 100%; resize: vertical; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
