* { box-sizing: border-box; }

/* 채널 등급 배지 */
.badge-yt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1.5;
    height: 30px;
    font-weight: 800;
    border-radius: 6px;
    white-space: nowrap;
    transition: transform 0.2s, filter 0.2s;
    text-decoration: none !important;
    border-width: medium !important;
    border-style: none !important;
    border-color: currentcolor !important;
    border-image: none !important;
    padding: 2px 12px;
    color: #f8fafc;
}
.badge-yt:hover { transform: translateY(-1px); filter: brightness(1.1); }

/* 1등급 - 골드 */
.badge-5m {
    background: linear-gradient(135deg, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c) !important;
}

/* 2등급 - 시안/마젠타 글로우 */
.badge-1m {
    color: white !important;
    animation: 2s linear 0s infinite normal none running million-glow;
    background: linear-gradient(135deg, rgb(0, 219, 222) 0%, rgb(252, 0, 255) 100%) !important;
}
@keyframes million-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 219, 222, 0.6), 0 0 6px rgba(252, 0, 255, 0.6); }
    50% { box-shadow: 0 0 14px rgba(0, 219, 222, 0.9), 0 0 14px rgba(252, 0, 255, 0.9); }
}

/* 3등급 - 화이트/블루 셔닝 */
.badge-10m {
    background: linear-gradient(45deg, #ffffff, #00d2ff, #3a7bd5, #ffffff) !important;
    animation: master-shine 1.5s infinite linear;
}
@keyframes master-shine {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* 4등급 - 무채색 (평범한 등급이라 화려한 효과 없이) */
.badge-plain {
    background: #334155 !important;
    color: #94a3b8 !important;
}

/* 반복 발견(노출) 배지 - 횟수가 많을수록 등급 배지와 같은 톤으로 더 화려해짐 */
.encounter-badge {
    display: inline-block; padding: 2px 9px; border-radius: 10px;
    font-size: 11px; font-weight: bold; margin-top: 4px;
}
.encounter-t1 { background: #334155; color: #94a3b8; } /* 2~4번 */
.encounter-t2 { background: linear-gradient(135deg, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c); color: #3a2a06; } /* 5~7번 */
.encounter-t3 { /* 8~10번 */
    color: white;
    animation: 2s linear 0s infinite normal none running million-glow;
    background: linear-gradient(135deg, rgb(0, 219, 222) 0%, rgb(252, 0, 255) 100%);
}
.encounter-t4 { /* 11번+ */
    background: linear-gradient(45deg, #ffffff, #00d2ff, #3a7bd5, #ffffff);
    animation: master-shine 1.5s infinite linear;
    color: #003366;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 24px;
    background: #0f172a;
    color: #f8fafc;
}

a { text-decoration: none; }

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    border-bottom: 2px solid #334155;
    padding-bottom: 16px;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 190px;
    background: #1e293b;
    border-right: 1px solid #334155;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    z-index: 200;
    box-sizing: border-box;
}
.sidebar-logo { font-size: 16px; font-weight: bold; color: #ff4545; margin: 0 8px 12px; text-decoration: none; display: block; }
.sidebar-logo:hover { color: #ff6b6b; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 14px;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    font-family: inherit;
}
.sidebar-link:hover { background: #273549; }
.main-content { margin-left: 190px; }

.logo { font-size: 28px; font-weight: bold; color: #ff4545; }
.header-right { display: flex; align-items: center; gap: 24px; }
.count-badge { font-size: 16px; color: #cbd5e1; font-weight: 600; }

/* API 쿼터 사용량 박스 */
.quota-box {
    background: #1e293b;
    border: 1px solid #475569;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quota-progress-bg {
    width: 120px;
    height: 10px;
    background: #334155;
    border-radius: 5px;
    overflow: hidden;
}

.quota-progress-fill {
    height: 100%;
    background: #38bdf8;
    width: 0%;
    transition: width 0.4s ease;
}

.sort-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.sort-btn {
    padding: 8px 16px; border-radius: 8px; border: 1px solid #334155;
    background: #1e293b; color: #cbd5e1; font-weight: 600; font-size: 14px; cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sort-btn:hover { background: #273549; }
.sort-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }

.search-input-wrap { position: relative; display: inline-block; margin-left: 8px; }
.search-input {
    padding: 8px 30px 8px 14px; border-radius: 8px; border: 1px solid #334155;
    background: #1e293b; color: #f8fafc; font-size: 14px; width: 220px;
    margin-left: 0;
}
.search-input:focus { outline: none; border-color: #38bdf8; }
.search-input::placeholder { color: #64748b; }
.search-clear-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #94a3b8; font-size: 14px; cursor: pointer;
    padding: 4px 6px; line-height: 1;
}
.search-clear-btn:hover { color: #f8fafc; }

.filter-select {
    padding: 8px 12px; border-radius: 8px; border: 1px solid #334155;
    background: #1e293b; color: #cbd5e1; font-weight: 600; font-size: 14px; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #38bdf8; }

.container {
    width: 100%;
    overflow-x: auto;
    background: #1e293b;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    border: 1px solid #334155;
}

table { width: 100%; border-collapse: collapse; font-size: 15px; table-layout: fixed; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid #334155; vertical-align: middle; word-break: break-all; }
th { background: #0f172a; color: #cbd5e1; font-weight: 700; font-size: 15px; white-space: nowrap; }

th:nth-child(1) { width: 22%; }
th:nth-child(2) { width: 8%; }
th:nth-child(3) { width: 10%; }
th:nth-child(4) { width: 13%; }
th:nth-child(5) { width: 17%; }
th:nth-child(6) { width: 12%; }
th:nth-child(7) { width: 9%; }
th:nth-child(8) { width: 9%; }

tr:hover { background-color: #273549; }

.btn { padding: 6px 10px; border: none; cursor: pointer; border-radius: 5px; font-weight: 600; font-size: 12px; margin-bottom: 3px; }
.btn-refresh { background: none; border: none; cursor: pointer; font-size: 16px; margin-left: 4px; padding: 2px; color: #cbd5e1; transition: transform 0.3s, color 0.2s; }
.btn-refresh:hover { transform: rotate(180deg); color: #38bdf8; }

.btn-my { background: #334155; color: #f1f5f9; }
.btn-my:hover { background: #475569; }
.btn-research { background: #064e3b; color: #6ee7b7; }
.btn-research:hover { background: #047857; }
.btn-fun { background: #713f12; color: #fde047; }
.btn-fun:hover { background: #a16207; }
.btn-exclude { background: #881337; color: #fca5a5; }
.btn-exclude:hover { background: #9f1239; }
.btn-delete { background: #450a0a; color: #f87171; border: 1px solid #7f1d1d; }
.btn-delete:hover { background: #7f1d1d; }
.btn-full-sync { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.btn-full-sync:hover { opacity: 0.9; }
.btn-full-sync:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-analyze-type { background: linear-gradient(135deg, #7c3aed, #4c1d95); color: #fff; }
.btn-analyze-type:hover { opacity: 0.9; }
.btn-analyze-type:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-view-analysis { background: linear-gradient(135deg, #0891b2, #0e7490); color: #fff; }
.btn-view-analysis:hover { opacity: 0.9; }
.btn-site-capture { background: linear-gradient(135deg, #ea580c, #9a3412); color: #fff; }
.btn-site-capture:hover { opacity: 0.9; }
.btn-site-capture:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-view-capture { background: linear-gradient(135deg, #4f46e5, #3730a3); color: #fff; }
.btn-view-capture:hover { opacity: 0.9; }
.btn-scrape-refresh { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
.btn-scrape-refresh:hover { opacity: 0.9; }
.btn-scrape-refresh:disabled { opacity: 0.6; cursor: not-allowed; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { position: relative; background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 28px; width: 560px; max-width: 92vw; color: #f8fafc; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: #94a3b8; font-size: 18px; cursor: pointer; }
.modal-close:hover { color: #f8fafc; }

.badge { padding: 4px 8px; border-radius: 12px; font-size: 13px; font-weight: bold; background: #334155; color: #f8fafc; display: inline-block; white-space: nowrap; }
.video-sub { font-size: 13px; color: #94a3b8; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-box { font-size: 14px; line-height: 1.6; white-space: nowrap; }

.memo-input { width: 95%; padding: 7px 9px; border: 1px solid #475569; background: #0f172a; color: #f8fafc; border-radius: 5px; font-size: 14px; }
.memo-input:focus { outline: none; border-color: #38bdf8; }

.type-field { position: relative; }
.type-input { padding: 6px 24px 6px 8px; border-radius: 5px; border: 1px solid #475569; background: #0f172a; color: #f8fafc; font-size: 14px; width: 100%; }
.type-input:focus { outline: none; border-color: #38bdf8; }
.type-caret { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; color: #94a3b8; font-size: 11px; }

.type-dropdown-popup {
    display: none;
    position: fixed;
    z-index: 10000;
    max-height: 240px;
    overflow-y: auto;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.type-dropdown-item { padding: 7px 10px; font-size: 13px; color: #f1f5f9; cursor: pointer; white-space: nowrap; }
.type-dropdown-item:hover { background: #273549; }
.type-dropdown-empty { padding: 7px 10px; font-size: 12px; color: #94a3b8; font-style: italic; }

.action-group { display: flex; flex-wrap: wrap; gap: 3px; }
a { color: #60a5fa; text-decoration: none; font-weight: bold; font-size: 16px; }
a:hover { text-decoration: underline; }

.channel-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding: 0 20px 20px; }
.channel-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; overflow: hidden; transition: transform 0.2s, border-color 0.2s; }
.channel-card:hover { transform: translateY(-3px); border-color: #38bdf8; }
.channel-card-thumb { width: 100%; aspect-ratio: 16/9; background: #000; }
.channel-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.channel-card-body { padding: 12px; font-size: 13px; }
.channel-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.channel-card-name { font-weight: bold; color: #f1f5f9; font-size: 14px; }
.channel-card-video { color: #94a3b8; font-size: 12px; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-card-stats { color: #cbd5e1; font-size: 12px; line-height: 1.6; margin-bottom: 10px; }
.channel-card-actions { display: flex; flex-wrap: wrap; gap: 4px; }

.channel-hybrid-list { display: flex; flex-direction: column; gap: 12px; padding: 0 20px 20px; }
.hybrid-row { background: #1e293b; border: 1px solid #334155; border-radius: 12px; overflow: hidden; display: flex; gap: 0; transition: border-color 0.2s; }
.hybrid-row:hover { border-color: #38bdf8; }
.hybrid-thumb { flex: 0 0 260px; aspect-ratio: 16/9; background: #000; }
.hybrid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hybrid-info { flex: 1 1 320px; min-width: 260px; padding: 20px 24px; font-size: 13px; border-right: 1px solid #334155; display: flex; flex-direction: column; justify-content: center; }
.hybrid-info .btn { font-size: 13px; padding: 8px 14px; }
.hybrid-info .badge, .hybrid-info .badge-yt { font-size: 14px; padding: 5px 10px; }
.hybrid-analysis { flex: 1 1 320px; min-width: 260px; padding: 14px 16px; font-size: 13px; background: #17233a; }
.hybrid-analysis-empty { color: #64748b; font-size: 13px; }
.ai-keyword { background: #fde047; color: #dc2626; padding: 0 3px; border-radius: 3px; font-weight: bold; }

/* 공용 영상 재생 팝업 (video-modal.js) */
.vpm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 2000; }
.vpm-box { position: relative; background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 28px; width: 1100px; max-width: 96vw; max-height: 90vh; overflow-y: auto; color: #f8fafc; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.vpm-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: #94a3b8; font-size: 18px; cursor: pointer; }
.vpm-close:hover { color: #f8fafc; }
.vpm-memo-textarea {
    width: 100%; box-sizing: border-box; background: #0f172a; color: #fbbf24;
    border: 1px solid #334155; border-radius: 6px; padding: 10px 12px; font-size: 14px;
    font-family: inherit; resize: vertical; flex: 1; min-height: 400px;
}
.vpm-memo-textarea::placeholder { color: #64748b; }
.vpm-memo-textarea:focus { outline: none; border-color: #fbbf24; }