/*
 * 키워드 도구 스타일. 화면이 둘뿐이라 파일도 하나로 둔다.
 * 표를 오래 들여다보는 도구라서 대비는 높이고 장식은 줄였다.
 */

:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --surface: #ffffff;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #059669;
  --warn: #b45309;
  --fail: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px -12px rgba(15, 23, 42, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* ---------- 헤더/푸터 ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  letter-spacing: -0.5px;
}

.site-nav a { color: var(--ink-soft); font-size: 14px; }

.site-footer {
  margin-top: 56px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}

.site-footer p { margin: 4px 0; }

/* ---------- 히어로 ---------- */

.hero { padding: 40px 0 24px; }
.hero h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.3; letter-spacing: -0.6px; }
.hero p { margin: 0; color: var(--ink-soft); }

/* ---------- 입력 ---------- */

.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }

textarea#kw-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  line-height: 1.7;
  resize: vertical;
  background: #fff;
  color: var(--ink);
}

textarea#kw-input:focus { outline: 2px solid rgba(37, 99, 235, 0.35); border-color: var(--brand); }

.tool-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.counter { font-size: 13px; color: var(--ink-soft); }
.counter.over strong { color: var(--fail); }
.hint { font-size: 12px; color: var(--muted); }
.tool-actions .btn:first-of-type { margin-left: auto; }

.btn {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover { background: #f1f5f9; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-warn { border-color: #fcd34d; background: #fffbeb; color: var(--warn); }

.notice { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: #eff6ff; color: #1e40af; }
.notice.warn { background: #fffbeb; color: var(--warn); }
.notice.error { background: #fef2f2; color: var(--fail); }

/* ---------- 진행률 ---------- */

.progress { margin-top: 18px; }
.progress-bar { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.4s ease; }
.progress-text { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }

/* ---------- 결과 표 ---------- */

.results { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.results-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.results-toolbar .spacer { flex: 1; }

.filter {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  min-width: 200px;
}

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.data-table th, .data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table thead th { position: sticky; top: 0; background: #f8fafc; font-size: 12px; color: var(--ink-soft); font-weight: 600; z-index: 1; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .strong { font-weight: 700; }
.data-table .col-check { width: 34px; }
.data-table .col-keyword { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.data-table .empty { text-align: center; color: var(--muted); padding: 28px; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sorted-asc::after { content: ' ▲'; font-size: 9px; }
th.sorted-desc::after { content: ' ▼'; font-size: 9px; }

tr.status-pending td { color: var(--muted); }
tr.status-failed td { background: #fef2f2; }

.table-foot { margin: 10px 2px 0; font-size: 13px; color: var(--ink-soft); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #f1f5f9; color: var(--ink-soft); }
.tag-low { background: #ecfdf5; color: var(--ok); }
.tag-mid { background: #fffbeb; color: var(--warn); }
.tag-high { background: #fef2f2; color: var(--fail); }
.tag-ok { background: #ecfdf5; color: var(--ok); }
.tag-fail { background: #fef2f2; color: var(--fail); }

/* ---------- 안내 ---------- */

.guide { margin-top: 40px; }
.guide h2 { font-size: 18px; margin-bottom: 12px; }
.guide dl { display: grid; gap: 10px; margin: 0 0 12px; }
.guide dt { font-weight: 600; font-size: 14px; }
.guide dd { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.guide code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* ---------- 상세 ---------- */

.crumbs { padding: 20px 0 0; font-size: 13px; color: var(--muted); }
.crumbs strong { color: var(--ink-soft); font-weight: 600; }

.detail-title { margin: 10px 0 20px; font-size: 28px; letter-spacing: -0.6px; }
.detail-title small { font-size: 16px; color: var(--muted); font-weight: 500; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-label { margin: 0; font-size: 12px; color: var(--muted); }
.card-value { margin: 4px 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -0.8px; }
.card-sub { margin: 0; font-size: 12px; color: var(--ink-soft); }

.split { height: 5px; border-radius: 999px; background: #fbcfe8; margin-top: 10px; overflow: hidden; }
.split span { display: block; height: 100%; background: var(--brand); }

.panel {
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 { margin: 0 0 4px; font-size: 17px; }
.panel h2 .muted { font-size: 13px; font-weight: 400; }
.panel-head p { margin: 0 0 14px; font-size: 13px; }
.panel.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }

.chart-box { position: relative; height: 280px; }
.chart-box.small { height: 220px; }
.empty-box { margin: 12px 0 0; padding: 28px; text-align: center; color: var(--muted); background: #f8fafc; border-radius: 8px; font-size: 14px; }

.updated { margin: 20px 2px 0; font-size: 12px; }

.ad-slot { margin: 24px 0; min-height: 90px; }

/* ---------- 쿼터 ---------- */

.quota-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.usage-bar { height: 6px; border-radius: 999px; background: #e2e8f0; margin-top: 8px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--ok); }
.usage-bar.hot span { background: var(--fail); }

/* ---------- 반응형 ---------- */

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .panel.two-col { grid-template-columns: 1fr; }
  .quota-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 24px; }
  .detail-title { font-size: 22px; }
  .tool { padding: 16px; }
  .tool-actions .btn:first-of-type { margin-left: 0; }
  .results-toolbar .filter { min-width: 0; flex: 1; }
  .cards { grid-template-columns: 1fr; }
}
