/* 전체 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Malgun Gothic", "맑은 고딕", sans-serif;
  background: #f7f8fa;
  color: #1a1d23;
  line-height: 1.5;
}
main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; }
footer { text-align: center; color: #99a; padding: 32px 0; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 상단바 */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .logo { font-size: 18px; font-weight: 700; color: #1a1d23; }
.topbar nav a { margin-left: 16px; color: #4b5563; }

/* 홈 hero */
.hero { text-align: center; padding: 40px 0; }
.hero h1 {
  font-size: 36px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.hero .lead { color: #6b7280; font-size: 17px; margin-bottom: 32px; }

.search-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto 56px;
  flex-wrap: wrap;
}
.kw-input {
  flex: 1 1 320px;
  padding: 14px 18px;
  font-size: 16px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
}
.kw-input:focus { outline: none; border-color: #2563eb; }
.select-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  padding: 4px 12px;
  cursor: pointer;
}
.select-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}
.pages-select {
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  padding: 0 0 4px;
  cursor: pointer;
}
.hint {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  margin: -40px 0 40px;
}
.btn-primary {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.btn-primary:hover { background: #1d4ed8; }

/* 기능 카드 */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px;
  text-align: left;
}
.card .icon { font-size: 28px; margin-bottom: 8px; }
.card h3 { margin: 4px 0 8px; font-size: 17px; }
.card p { color: #6b7280; margin: 0; font-size: 14px; }

/* 결과 페이지 헤더 */
.results-head h2 {
  margin: 8px 0 16px;
  font-size: 24px;
}
.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.badge {
  background: #eef2ff;
  color: #4338ca;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge.status-done { background: #d1fae5; color: #065f46; }
.badge.status-error { background: #fee2e2; color: #991b1b; }
.counts { color: #6b7280; font-size: 14px; }
.downloads { margin-left: auto; display: flex; gap: 8px; }
.btn-ghost {
  background: #fff;
  border: 1.5px solid #d1d5db;
  color: #374151;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn-ghost:hover { background: #f3f4f6; text-decoration: none; }

/* 영상 카드 그리드 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.placeholder {
  grid-column: 1 / -1;
  text-align: center;
  color: #9ca3af;
  padding: 60px 0;
}
.vcard {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  transition: transform 0.12s, box-shadow 0.12s;
}
.vcard:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,0.08); }
.vcard .thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .thumb iframe { width: 100%; height: 100%; border: 0; display: block; }
.vcard .thumb-hover {
  cursor: pointer;
  transition: transform 0.2s;
}
.vcard .thumb-hover:hover { transform: scale(1.01); }
.vcard .play-big {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 56px;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,0.85);
  opacity: 0.75;
  pointer-events: none;
  transition: transform 0.15s, opacity 0.15s;
}
.vcard .thumb-hover:hover .play-big {
  transform: translate(-50%, -50%) scale(1.25);
  opacity: 1;
}
.vcard .dur-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

/* === 엑셀 스타일 테이블 === */
.table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #d0d7de;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  max-height: 600px;
  overflow-y: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: "Malgun Gothic", "맑은 고딕", -apple-system, sans-serif;
}
.data-table thead {
  background: #305496;
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table th {
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
  border-right: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
}
.data-table th:last-child { border-right: 0; }
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #f3f4f6;
  vertical-align: middle;
}
.data-table td:last-child { border-right: 0; }
.data-table tbody tr:nth-child(even) { background: #f7f9fc; }
.data-table tbody tr:hover { background: #eef4ff; }
.data-table .td-url {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table .td-url a {
  color: #2563eb;
  font-size: 12px;
  font-family: Consolas, monospace;
}
.data-table .td-title {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table .td-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .td-dur { text-align: center; font-variant-numeric: tabular-nums; }

/* === 모달 === */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.18s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  width: 92vw;
  max-width: 1024px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}
.modal-close:hover { color: #ef4444; }
.modal-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}
.modal-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.modal-hint {
  color: #aaa;
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
}
.modal-hint a {
  color: #93c5fd;
  margin-left: 6px;
}
.modal-hint a:hover { color: #60a5fa; }
.vcard .yt-link {
  color: #6b7280;
  margin-left: 4px;
  text-decoration: none;
}
.vcard .yt-link:hover { color: #2563eb; }
.vcard .rank {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.vcard .duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}
.vcard .info { padding: 12px 14px 14px; }
.vcard h4 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vcard .chan { color: #6b7280; font-size: 13px; margin-bottom: 8px; }
.vcard .stats {
  display: flex;
  gap: 10px;
  color: #4b5563;
  font-size: 13px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.vcard .daily { font-size: 13px; color: #6b7280; }
.vcard .daily b { color: #ef4444; }

/* 통계 박스 */
.stats-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0 24px;
}
.stats-boxes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #6b7280;
}
.stat-box b { color: #1a1d23; font-weight: 700; margin-left: 4px; font-size: 15px; }
.stat-box.stat-hi { background: #eef2ff; border-color: #c7d2fe; }
.stat-box.stat-hi b { color: #4338ca; }

.section-title {
  font-size: 18px;
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title small { color: #9ca3af; font-weight: 400; font-size: 14px; }
.section-hint { color: #9ca3af; font-weight: 400; font-size: 12px; margin-left: 4px; }
.inline-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #4b5563;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
}
.section-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-filter label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.inline-filter select {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.inline-filter select:focus { outline: none; border-color: #2563eb; }
.btn-tiny {
  padding: 5px 12px;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-tiny:hover { background: #1d4ed8; }

/* 작은 광고 카드 그리드 (이미지 광고 / 기타) */
.grid-small {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.ocard {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.12s;
  color: inherit;
  text-decoration: none;
}
.ocard:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.06); }
.othumb {
  aspect-ratio: 4 / 3;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.othumb img { width: 100%; height: 100%; object-fit: cover; }
.othumb-placeholder { color: #9ca3af; font-size: 13px; padding: 12px; text-align: center; }
.img-fail::before {
  content: "🖼";
  font-size: 40px;
  opacity: 0.5;
}
.img-fail-text {
  color: #9ca3af;
  font-size: 13px;
  padding: 8px;
  text-align: center;
}
.ometa { padding: 8px 10px; }
.oadv {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.odate { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* 로그 박스 */
.log-box {
  margin-top: 32px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 16px;
}
.log-box summary { cursor: pointer; font-weight: 600; color: #374151; }
.log-box pre {
  margin: 10px 0 0;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #4b5563;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}
