* { box-sizing: border-box; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  margin: 0; color: #1a1a1a; background: #fafafa;
}
header {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  background: #fff; border-bottom: 1px solid #e8e8e8; position: sticky; top: 0; z-index: 10;
}
header strong { font-size: 16px; }
header nav { margin-left: auto; display: flex; gap: 14px; align-items: center; }
header nav a { color: #555; text-decoration: none; font-size: 13px; }
header nav a:hover { color: #000; }
header nav a.active { color: #000; font-weight: 600; }
header nav button { background: transparent; border: 1px solid #ddd; padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; }
main { max-width: 980px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.card { background: #fff; border: 1px solid #e8e8e8; border-radius: 6px; padding: 16px; margin-bottom: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.btn { padding: 6px 12px; border: 1px solid #ccc; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-primary:hover { background: #333; }
.btn-danger { color: #c00; border-color: #c00; }
.btn-danger:hover { background: #fee; }
input, select, textarea { font: inherit; padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; }
th { font-weight: 600; color: #666; background: #fafafa; }
.sample-grid { display: flex; flex-direction: column; gap: 14px; max-width: 720px; margin: 0 auto; }
.sample-card-grid {
  background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,.04); transition: opacity .2s, transform .2s;
}
.sample-card-grid.focused { border-color: #1a1a1a; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.sample-card-grid .meta { font-size: 11px; color: #888; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.sample-card-grid .meta .link { margin-left: auto; color: #36c; text-decoration: none; font-size: 12px; }
.sample-card-grid .meta .link:hover { text-decoration: underline; }
.sample-card-grid .bucket { padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.bucket.top { background: #fdd; color: #c33; }
.bucket.bottom { background: #ddf; color: #36c; }
.bucket.random { background: #efe; color: #3a3; }
.sample-card-grid img { max-width: 100%; max-height: 480px; display: block; margin: 8px 0; border-radius: 4px; background: #f7f7f7; }
.sample-card-grid video { max-width: 100%; max-height: 480px; display: block; margin: 8px 0; border-radius: 4px; }
.sample-card-grid .title { font-size: 16px; font-weight: 600; margin: 8px 0; }
.sample-card-grid .body { font-size: 13px; color: #444; white-space: pre-wrap; max-height: 120px; overflow: hidden; }
.judge-bar-mini { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.judge-bar-mini button { flex: 1; padding: 10px 0; font-size: 13px; font-weight: 600; }
.judge-bar-mini .ok { background: #2c7; color: #fff; border-color: #2c7; }
.judge-bar-mini .ng { background: #c33; color: #fff; border-color: #c33; }
.judge-bar-mini .skip { background: #999; color: #fff; border-color: #999; }
.judge-bar-mini .report {
  flex: 0 0 auto; padding: 6px 10px;
  background: #fff5e8; color: #b87000; border-color: #f0d5a0;
  font-weight: 500; font-size: 12px;
}
.judge-bar-mini .report:hover { background: #fde8c8; }
.sample-progress { position: sticky; top: 56px; background: #fafafa; padding: 8px 0; z-index: 5; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.sample-progress .bar { flex: 1; background: #eee; height: 6px; border-radius: 3px; overflow: hidden; }
.sample-progress .bar > div { height: 100%; background: #1a1a1a; transition: width .3s; }
.kbd-hint { font-size: 11px; color: #aaa; }
.login-box { max-width: 360px; margin: 80px auto; }
.login-box input { width: 100%; padding: 10px; font-size: 14px; margin-bottom: 12px; }
.error { color: #c33; font-size: 12px; margin-top: 4px; }
.empty { color: #888; padding: 32px; text-align: center; font-size: 13px; }

/* nav 디버깅 메뉴 분리 (legacy) */
.nav-sep { color: #ddd; }
.nav-debug { font-size: 12px !important; color: #999 !important; }
.nav-debug:hover { color: #555 !important; }

/* nav drop-down (디버깅 ▾) */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 12px; color: #888;
  padding: 4px 6px; border-radius: 4px;
}
.nav-dropdown-toggle:hover { color: #1a1a1a; background: #f3f3f3; }
.nav-dropdown[data-open="true"] .nav-dropdown-toggle { color: #1a1a1a; background: #f0f0f0; }
.nav-dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  display: flex; flex-direction: column; min-width: 160px;
  padding: 6px; z-index: 50;
}
.nav-dropdown-menu[hidden] { display: none; }
.nav-dropdown-menu a {
  display: block; padding: 8px 10px; font-size: 12px; color: #555;
  text-decoration: none; border-radius: 4px;
}
.nav-dropdown-menu a:hover { background: #f5f5f5; color: #1a1a1a; }
.nav-dropdown-menu a.active { background: #f0f0f0; color: #1a1a1a; font-weight: 600; }

/* 발행 관리 — 라이브/시뮬 토글 */
.publish-mode-toggle {
  display: inline-flex; gap: 0;
  border: 1px solid #ddd; border-radius: 6px; overflow: hidden;
  background: #fff;
}
.publish-mode-toggle button {
  border: none; background: transparent;
  padding: 6px 14px; font-size: 13px; cursor: pointer;
  font-weight: 500; color: #666;
}
.publish-mode-toggle button.active {
  background: #1a1a1a; color: #fff;
}
.publish-mode-toggle button:not(.active):hover { background: #f5f5f5; color: #1a1a1a; }

/* 안전 필터 — 자가 학습 강조 카드 */
.selflearn-card {
  border: 2px solid #0a8043; background: #f3faf5;
  position: relative;
}
.selflearn-card::before {
  content: "★ 자가 학습"; position: absolute; top: -10px; left: 12px;
  background: #0a8043; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; letter-spacing: .03em;
}
.selflearn-card h2 {
  margin-top: 4px !important; font-size: 15px !important; color: #0a8043;
}
.selflearn-card .btn-primary { background: #0a8043; border-color: #0a8043; }
.selflearn-card .btn-primary:hover { background: #0c9650; border-color: #0c9650; }

/* funnel 표 */
.funnel { width: 100%; }
.funnel td { padding: 10px 12px; vertical-align: middle; border-bottom: 1px solid #f0f0f0; }
.funnel td:first-child { font-weight: 500; }
.funnel td.num { text-align: right; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; min-width: 80px; }
.funnel td.num b { font-size: 22px; }
.funnel td.muted { color: #888; font-size: 12px; }
.funnel tr.extra { border-top: 2px solid #eee; }
.funnel tr.extra td:first-child { color: #888; font-weight: 400; }

/* misc */
.muted { color: #888; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
code { background: #f3f3f3; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ─── Dry-run UI (기획자 미리보기) ───────────────────────────── */
.dryrun-intro { color: #555; font-size: 13px; margin: 4px 0 12px; line-height: 1.5; }
.dryrun-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; }
.dryrun-controls label { font-size: 13px; color: #444; }
.dryrun-controls input { font-size: 13px; padding: 4px 8px; }
.dryrun-loading { color: #888; padding: 24px; text-align: center; }

/* 핵심 지표 (3 metric card) */
.dryrun-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.metric { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; padding: 16px; }
.metric-label { font-size: 12px; color: #666; margin-bottom: 6px; }
.metric-value { font-size: 32px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-value .pct { font-size: 18px; font-weight: 500; color: #888; margin-left: 2px; }
.metric-sub { font-size: 11px; color: #888; margin-top: 6px; line-height: 1.4; }
.metric-good { border-left: 4px solid #0a8043; }
.metric-good .metric-value { color: #0a8043; }
.metric-meh { border-left: 4px solid #e0a000; }
.metric-meh .metric-value { color: #b87000; }
.metric-bad { border-left: 4px solid #c33; }
.metric-bad .metric-value { color: #c33; }
.metric-info { border-left: 4px solid #888; }

/* 사이트별 분포 chip */
.dryrun-distbar { background: #fafafa; border-radius: 6px; padding: 8px 12px; margin: 8px 0 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dist-label { font-size: 11px; color: #777; flex-shrink: 0; }
.dist-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dist-chip { background: #fff; border: 1px solid #e0e0e0; padding: 2px 8px; border-radius: 12px; font-size: 11px; color: #555; font-variant-numeric: tabular-nums; }

/* 카드 grid — 사용자 피드 모방. 모바일 1열, 데스크탑 2~3열 */
.dryrun-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 768px) { .dryrun-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .dryrun-cards { grid-template-columns: repeat(3, 1fr); } }

.dryrun-card { display: flex; gap: 12px; background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; padding: 12px; position: relative; transition: box-shadow .15s; }
.dryrun-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.dryrun-card.dr-multi { border-color: #0a8043; background: #f0faf3; }
.dryrun-card.dr-multi::before { content: "다출처"; position: absolute; top: 8px; right: 8px; background: #0a8043; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 600; }

.dr-rank { position: absolute; top: 8px; left: 8px; background: #1a1a1a; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }

.dr-thumb { width: 96px; height: 96px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: #f3f3f3; display: flex; align-items: center; justify-content: center; }
.dr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dr-thumb-text { color: #aaa; font-size: 11px; }
.dr-thumb-fail::after { content: "🖼"; color: #ccc; font-size: 24px; }
.dr-thumb-fail img { display: none; }

.dr-body { flex: 1; min-width: 0; padding-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.dr-title { font-size: 14px; font-weight: 600; line-height: 1.3; color: #1a1a1a; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.dr-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 11px; }
.dr-multi-tag { background: #0a8043; color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.dr-badge { background: #f0f0f0; color: #555; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.dr-badge.dr-handpick { background: #fef0c8; color: #8a5a00; font-weight: 600; }
.dr-badge.dr-handpick::after { content: " ★"; }
.dr-score { margin-left: auto; color: #666; font-variant-numeric: tabular-nums; font-weight: 500; }
.dr-link { color: #888; text-decoration: none; font-size: 11px; margin-left: 6px; }
.dr-link:hover { color: #1a1a1a; text-decoration: underline; }

/* 개발자 정보 — 접힘 */
.dryrun-stages { margin-top: 24px; }
.dryrun-stages summary { cursor: pointer; font-size: 12px; color: #888; padding: 8px 0; user-select: none; }
.dryrun-stages summary:hover { color: #555; }
.dryrun-stages[open] summary { color: #1a1a1a; font-weight: 500; }

/* ─── 소스 전략 레지스트리 ───────────────────────────────────── */
.sitegroup { margin-bottom: 16px; }
.sitegroup-h { font-size: 16px; margin: 0 0 4px; }
.sitegroup-h .muted { font-size: 12px; font-weight: 400; margin-left: 6px; }
.site-table { width: 100%; }
.site-table th { font-size: 11px; color: #888; text-align: left; padding: 6px 8px; font-weight: 500; border-bottom: 1px solid #eee; }
.site-table td { padding: 8px; border-bottom: 1px solid #f4f4f4; vertical-align: middle; font-size: 13px; }
.site-row:hover { background: #fafafa; }
.site-name { min-width: 160px; }
.site-active { /* default */ }
.site-parked td { opacity: 0.7; }
.site-excluded td { opacity: 0.55; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status-active { background: #e6f7ec; color: #0a8043; }
.status-parked { background: #f0f0f0; color: #666; }
.status-excluded { background: #fde8e8; color: #c33; }
.btn-edit { font-size: 11px; padding: 4px 10px; }

/* 편집 패널 */
.site-panel { margin-top: 16px; }
.site-panel[hidden] { display: none; }
.site-panel-card { background: #fff; border: 2px solid #1a1a1a; border-radius: 8px; padding: 0; }
.site-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #eee; }
.site-panel-head h2 { margin: 0; font-size: 16px; }
.site-panel-head .muted { font-size: 12px; font-weight: 400; }
.btn-x { background: transparent; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: #888; padding: 0 8px; }
.btn-x:hover { color: #1a1a1a; }
.site-panel-body { padding: 16px; }
.site-panel-body .field { margin-bottom: 12px; }
.site-panel-body .field label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; font-weight: 500; }
.site-panel-body .field input[type="url"],
.site-panel-body .field input[type="number"],
.site-panel-body .field select,
.site-panel-body .field textarea { width: 100%; padding: 8px; font-size: 13px; border: 1px solid #ddd; border-radius: 4px; font-family: inherit; }
.site-panel-body .field textarea { resize: vertical; }
.btn-secondary { background: #f0f0f0; }

/* 실행 trigger 그리드 */
.trigger-grid { display: flex; flex-direction: column; gap: 8px; }
.trigger-row { display: flex; gap: 12px; align-items: center; }
.trigger-row .btn { min-width: 200px; }
.trigger-row .muted { font-size: 12px; flex: 1; }
.trigger-out { font-size: 12px; white-space: pre-wrap; margin-top: 12px; background: #fafafa; padding: 8px; border-radius: 4px; min-height: 0; }
.trigger-out:empty { display: none; }

/* ─── Quick Ban (Dry-run 카드 X 버튼 + sfw 제안 모달) ───────────── */
.dr-ban-btn {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; padding: 0;
  background: rgba(200, 50, 50, 0.85); color: #fff;
  border: none; border-radius: 50%;
  font-size: 16px; line-height: 1; cursor: pointer;
  font-weight: 700;
  z-index: 10;
  opacity: 0.6; transition: opacity .15s, transform .15s;
}
.dr-ban-btn:hover { opacity: 1; background: #c33; transform: scale(1.1); }
.dryrun-card.dr-multi .dr-ban-btn { right: 56px; }  /* "다출처" 라벨 옆 */
.dryrun-card.dr-banning { opacity: 0.4; }
.dryrun-card.dr-banned { opacity: 0.3; background: #fff5f5; border-color: #c33; }
.dryrun-card.dr-banned::after {
  content: "차단됨"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #c33; color: #fff; padding: 4px 12px; border-radius: 4px; font-weight: 600;
  font-size: 12px;
}

/* ban sfw 제안 모달 */
.ban-sfw-modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ban-sfw-card {
  background: #fff; border-radius: 8px; padding: 20px; max-width: 540px; width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); max-height: 80vh; overflow-y: auto;
}
.ban-sfw-card h3 { margin: 0 0 8px; font-size: 16px; }
.ban-sfw-card .ban-title {
  background: #f3f3f3; padding: 8px 12px; border-radius: 4px; margin: 8px 0;
  font-size: 12px; color: #555;
}
.ban-tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.ban-token {
  display: flex; align-items: center; gap: 4px; padding: 4px 10px;
  background: #fafafa; border: 1px solid #e0e0e0; border-radius: 4px; cursor: pointer;
  font-size: 12px;
}
.ban-token:hover { background: #f0f0f0; }
.ban-token input[type=checkbox] { margin: 0; }
.ban-token code { background: transparent; padding: 0; font-size: 12px; }
