/* ==========================================================================
   유튜브 구독 채널 정리 — 웹 도구 스타일 (빌드 없는 순수 CSS)
   ========================================================================== */
:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-soft-2: #f1f5f9;
  --line: #e6ebf2;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #5b6b82;
  --muted-2: #94a3b8;
  --brand: #0f172a;
  --accent: #cc181e;
  --accent-soft: #fef2f2;
  --danger: #e11d48;
  --danger-soft: #fff1f2;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --ok: #059669;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 18px 40px -24px rgba(15, 23, 42, .25);
  --maxw: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { letter-spacing: -.02em; line-height: 1.25; margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--bg-soft-2); padding: .12em .4em; border-radius: 6px; font-size: .88em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.skip {
  position: absolute; left: -9999px; top: 0; background: #fff; padding: 10px 16px; z-index: 99;
  border-radius: 0 0 10px 0; box-shadow: var(--shadow);
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff;
}
.brand-text { font-size: 16px; letter-spacing: -.3px; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }

/* ---------------------------------------------------------------- hero */
.hero { padding: 54px 0 26px; text-align: center; }
.hero h1 { font-size: clamp(28px, 4.2vw, 42px); font-weight: 800; margin-bottom: 16px; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(180deg, transparent 58%, rgba(204, 24, 30, .16) 58%);
  color: var(--accent);
}
.lede { max-width: 680px; margin: 0 auto 30px; color: var(--muted); font-size: 16.5px; }
.lede strong { color: var(--text); font-weight: 600; }

.dropzone {
  max-width: 720px; margin: 0 auto;
  padding: 34px 26px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(180deg, #fcfdff, var(--bg-soft));
  transition: border-color .18s, background .18s, transform .18s;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.006); }
.dz-icon { color: var(--accent); display: inline-grid; place-items: center; margin-bottom: 6px; }
.dz-title { font-size: 17px; font-weight: 700; margin: 6px 0 4px; }
.dz-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.dz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dz-status { margin: 14px 0 0; font-size: 13px; color: var(--muted); min-height: 1.2em; white-space: pre-line; }
.dz-status.error { color: var(--danger); }
.dz-status.warn { color: var(--warn); }
.dz-status.ok { color: var(--ok); }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 20px; font-size: 14.5px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: .16s ease;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: #1e293b; transform: translateY(-1px); }
.btn.subtle { background: #fff; border-color: var(--line-strong); color: var(--text); }
.btn.subtle:hover { background: var(--bg-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; padding-bottom: 40px; }
.content-col { min-width: 0; }
.side-col { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------------- results */
.results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  background: #fff;
  margin-bottom: 36px;
  scroll-margin-top: 78px;
}
section[id] { scroll-margin-top: 74px; }
.results-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.results-head h2 { font-size: 15px; color: var(--muted); font-weight: 700; margin: 6px 0 2px; text-transform: uppercase; letter-spacing: .03em; }
.range-banner { font-size: 21px; font-weight: 800; color: var(--text); margin: 0 0 4px; letter-spacing: -.01em; }
.range-warn { font-size: 13px; color: var(--warn); background: var(--warn-soft); border: 1px solid #fde7c7; border-radius: 9px; padding: 8px 12px; margin: 6px 0 0; max-width: 560px; }
.range-note { font-size: 12.5px; color: var(--muted-2); margin: 6px 0 0; }
.results-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.results-actions .btn { padding: 8px 13px; font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  background: #fff7ed; color: #b45309; border: 1px solid #fde7c7;
  font-size: 12px; font-weight: 600; letter-spacing: -.1px;
}

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 18px; }
.card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.stat-desc { font-size: 11.5px; color: var(--muted-2); line-height: 1.4; }
.stat-card.accent-danger { background: var(--danger-soft); border-color: #fecdd3; }
.stat-card.accent-danger .stat-num { color: var(--danger); }

.tabs { display: flex; gap: 6px; margin: 6px 0 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tab {
  appearance: none; border: 1px solid transparent; background: transparent;
  padding: 8px 13px; border-radius: 9px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--muted); font-family: inherit;
  transition: .15s;
}
.tab i { font-style: normal; font-size: 11.5px; color: var(--muted-2); margin-left: 3px; }
.tab:hover { background: var(--bg-soft); color: var(--text); }
.tab.active { background: var(--brand); color: #fff; }
.tab.active i { color: rgba(255, 255, 255, .7); }

.table-tools { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.table-tools input, .table-tools select {
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
.table-tools input { flex: 1 1 200px; }
.table-tools input:focus, .table-tools select:focus { outline: 2px solid rgba(204, 24, 30, .2); border-color: var(--accent); }
.months-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.months-label[hidden] { display: none; }

.match-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }

.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 560px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-soft);
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  letter-spacing: .02em;
}
.table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfcfe; }
.table tbody tr.is-checked { background: #f8fafc; }
.table tbody tr.is-checked .ch-title { text-decoration: line-through; color: var(--muted-2); }
.col-check { width: 40px; }
.col-last, .col-count { width: 108px; }
.col-match { width: 84px; }
.col-open { width: 92px; }
.table td.col-check { text-align: center; }
.table td.col-last, .table td.col-count { color: var(--muted); font-size: 13px; }
.ch-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ch-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.match-tag {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.match-tag.id { background: #eef2ff; color: #4338ca; }
.match-tag.name { background: var(--warn-soft); color: var(--warn); }
.match-tag.none { background: var(--bg-soft-2); color: var(--muted-2); }
.open-link { font-size: 13px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; margin: 0; }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pager button {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.pager button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: .4; cursor: default; }

.checked-note { text-align: center; font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.checked-note b { color: var(--text); }

/* ---------------------------------------------------------------- prose */
.prose { margin: 44px 0; }
.prose h2 { font-size: 24px; margin-bottom: 14px; }
.prose p { color: #334155; }

.steps { list-style: none; padding: 0; margin: 20px 0 0; counter-reset: step; }
.steps li { position: relative; padding: 0 0 22px 46px; border-left: 2px solid var(--line); margin-left: 14px; }
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -15px; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.steps h3 { font-size: 16px; margin-bottom: 6px; }
.steps p { font-size: 14.5px; margin-bottom: 0; }

.checks { padding-left: 20px; color: #334155; font-size: 14.5px; }
.checks li { margin-bottom: 6px; }

details { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; background: #fff; }
details[open] { background: var(--bg-soft); }
summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
summary::marker { color: var(--muted-2); }
details p { margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- side */
.card.tip h3 { font-size: 14px; margin-bottom: 8px; }
.card.tip ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.card.tip li { margin-bottom: 5px; }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); margin-top: 30px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding: 28px 20px 24px; flex-wrap: wrap; }
.footer-inner strong { font-size: 15px; }
.footer-inner p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .hero { padding: 34px 0 18px; }
  .dropzone { padding: 24px 14px; border-radius: 16px; }
  .results { padding: 14px; border-radius: 14px; }
  .range-banner { font-size: 17px; }
  .cards { gap: 8px; }
  .stat-num { font-size: 22px; }
  .stat-desc { display: none; }
  .nav { display: none; }
  .table { font-size: 13px; table-layout: fixed; }
  .table thead th, .table td { padding: 8px 6px; }
  .col-last { width: 72px; }
  .col-count { width: 42px; }
  .col-match { width: 34px; }
  .col-open { width: 58px; }
  .col-check { width: 30px; }
  .match-tag { padding: 2px 4px; font-size: 0; width: 18px; height: 18px; line-height: 14px; }
  .match-tag.id::before { content: 'ID'; font-size: 9px; }
  .match-tag.name::before { content: '\26A0'; font-size: 11px; }
  .match-tag.none::before { content: '-'; font-size: 11px; }
  summary { min-height: 44px; display: flex; align-items: center; }
  .footer-inner { padding: 22px 20px 6px; }

  /* 터치 조작: 최소 40~44px 타깃 */
  .btn { min-height: 44px; padding: 11px 18px; }
  .results-actions .btn { min-height: 40px; padding: 9px 13px; }
  .tab { min-height: 40px; }
  .pager button { min-height: 40px; min-width: 40px; }
  /* iOS/안드로이드가 포커스 시 화면을 확대하지 않도록 16px 이상 유지 */
  .table-tools input, .table-tools select { font-size: 16px; min-height: 44px; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tab { justify-content: center; }
  .table-tools { flex-direction: column; align-items: stretch; }
  /* flex-direction 이 column 이 되면 main axis(세로)가 바뀌므로, 가로용으로 둔 flex-grow(200px 기준)를
     그대로 두면 세로로 늘어나 버림 — column 레이아웃에서는 꺼서 높이를 고정 */
  .table-tools input, .table-tools > select { width: 100%; flex: none; }
  .months-label { width: 100%; flex: none; }
  .months-label select { flex: 1; width: auto; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
