/* ============================================
   Rankerage.com — Modern Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&family=Noto+Sans+KR:wght@400;500;700&family=Outfit:wght@600;700;800&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111627;
  --bg-surface: #161c2e;
  --bg-hover: #1c2340;
  --text-primary: #e8ecf4;
  --text-secondary: #8892b0;
  --text-muted: #545d7a;
  --accent: #5b8def;
  --accent-glow: rgba(91, 141, 239, 0.3);
  --success: #3fb68b;
  --warning: #f0a04b;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 14px; }

body {
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Header Bar ---- */
.header-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 48px;
  background: linear-gradient(135deg, #0f1729 0%, #1a1f3a 50%, #0f1729 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.header-content {
  max-width: 100%; height: 100%;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px;
  gap: 16px;
}

/* ---- Logo ---- */
.site-title {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 20px; font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: linear-gradient(135deg, #5b8def 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-title::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5b8def;
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
  50% { box-shadow: 0 0 20px rgba(91,141,239,0.6); }
}

/* ---- Header Slogan ---- */
.header-slogan {
  font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: 1px;
  color: rgba(224,200,124,0.7);
  white-space: nowrap;
  margin: 0 auto 0 14px;
}
.header-scroll-hint {
  font-size: 10px; font-weight: 400;
  color: rgba(255,255,255,0.2);
  margin-left: 8px;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- Header Right ---- */
.header-right { display: flex; align-items: center; gap: 12px; }

/* ── 검색 그룹 ── */
.search-group { display: flex; align-items: center; }

#search {
  width: 220px; height: 36px; padding: 0 14px;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 13px; font-family: inherit;
  background: rgba(22,28,46,0.8);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}
#search:hover { border-color: rgba(255,255,255,0.2); background: rgba(22,28,46,0.95); }
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  width: 260px;
}
#search::placeholder { color: var(--text-muted); }

/* ── 검색 버튼 ── */
.search-btn {
  height: 36px; padding: 0 14px 0 12px; gap: 6px;
  background: linear-gradient(135deg, #5b8def, #4a7de0);
  border: 1.5px solid #5b8def; border-left: none;
  border-radius: 0 8px 8px 0;
  color: #fff; cursor: pointer; flex-shrink: 0; white-space: nowrap;
  transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center;
}
.search-btn:hover {
  background: linear-gradient(135deg, #6b9df5, #5b8def);
  box-shadow: 0 0 14px rgba(91,141,239,0.5);
}
.search-btn:active { transform: scale(0.97); }
.search-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.search-label {
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.3px;
}

.login-text {
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.login-text:hover { color: #fff; background: var(--bg-hover); }

/* ---- Scroll Hint ---- */
.scroll-hint {
  position: relative; text-align: center; padding: 4px;
  font-size: 10px; color: rgba(255,255,255,0.12);
  font-family: 'JetBrains Mono', Consolas, monospace;
  transition: opacity 1s; user-select: none; pointer-events: none;
}

/* ---- Table Container ---- */
#user-table-container {
  width: 100vw; height: calc(100vh - 48px);
  padding-top: 48px;
}

/* ============================================
   Tabulator Overrides
   ============================================ */

.tabulator {
  border: none !important;
  background: transparent !important;
  font-family: inherit !important;
  color: var(--text-primary) !important;
}

.tabulator .tabulator-tableholder {
  overflow-x: auto !important;
  background: var(--bg-primary) !important;
}

.tabulator .tabulator-table {
  background: var(--bg-primary) !important;
}

/* ---- Header ---- */
.tabulator-header {
  background: var(--bg-secondary) !important;
  border-bottom: 2px solid var(--border-strong) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

.tabulator-header .tabulator-col {
  background: var(--bg-secondary) !important;
  border-right: 1px solid var(--border) !important;
  font-weight: 700 !important;
  color: #e0c87c !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
  transition: var(--transition) !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  padding: 4px 6px !important;
}

/* Hide sort arrows */
.tabulator-col-sorter { display: none !important; }

/* Kill all ellipsis */
.tabulator-cell { text-overflow: clip !important; }
.tabulator-col-title { text-overflow: clip !important; padding-right: 0 !important; }

.tabulator-header .tabulator-col:hover {
  color: #fff !important;
  background: var(--bg-hover) !important;
}

.tabulator-col-sorter {
  color: var(--text-muted) !important;
}

.tabulator-col.tabulator-sortable[aria-sort="asc"] .tabulator-col-sorter .tabulator-arrow,
.tabulator-col.tabulator-sortable[aria-sort="desc"] .tabulator-col-sorter .tabulator-arrow {
  color: var(--accent) !important;
}

/* ---- Rows ---- */
.tabulator-row {
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
  transition: background var(--transition) !important;
  min-height: 36px !important;
}

.tabulator-row.tabulator-row-even {
  background: rgba(255,255,255,0.01) !important;
}

.tabulator-row:hover {
  background: var(--bg-hover) !important;
  box-shadow: inset 3px 0 0 var(--accent);
}

.tabulator-row.tabulator-selected {
  background: rgba(91,141,239,0.12) !important;
}

.tabulator-row.tabulator-selected .tabulator-cell {
  color: #fff !important;
}

/* ---- Cells ---- */
.tabulator-cell {
  padding: 8px 12px !important;
  border-right: 1px solid var(--border) !important;
  font-size: 13px !important;
  color: var(--text-primary) !important;
  transition: color var(--transition) !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* ---- Frozen Columns — 강한 음영 ---- */
.tabulator-row .tabulator-cell.tabulator-frozen {
  background: #0d1225 !important;
  box-shadow: inset -2px 0 0 rgba(255,255,255,0.06);
}
.tabulator-row.tabulator-row-even .tabulator-cell.tabulator-frozen {
  background: #111a2e !important;
}
.tabulator-row:hover .tabulator-cell.tabulator-frozen {
  background: var(--bg-hover) !important;
}
.tabulator-header .tabulator-col.tabulator-frozen {
  background: #0d1225 !important;
  box-shadow: inset -2px 0 0 rgba(255,255,255,0.08);
}

/* ---- Column-Specific Styles ---- */

/* Flag column */

/* Country name */
.tabulator-cell[tabulator-field="country_name_en"] {
  font-weight: 800 !important;
  font-size: 14.5px !important;
  color: #a0c4ff !important;
  letter-spacing: 0.3px !important;
  text-overflow: clip !important;
}

/* OECD, BRICS badges */
.tabulator-cell[data-field="oecd_member"],
.tabulator-cell[data-field="brics_member"] {
  text-align: center !important;
  font-weight: 600 !important;
}

/* Flag column — prevent ellipsis */
.tabulator-cell[data-field="country_code"] {
  text-overflow: clip !important;
  padding: 0 !important;
}

/* ---- Tooltip ---- */
.tabulator-tooltip {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  padding: 8px 14px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-lg) !important;
  max-width: 320px !important;
  line-height: 1.5 !important;
}

/* ---- Loading / Placeholder ---- */
.tabulator-placeholder {
  color: var(--text-muted) !important;
  font-size: 14px !important;
}

.tabulator-placeholder .tabulator-loader {
  border-color: var(--accent) transparent transparent transparent !important;
}

/* ---- Scrollbar ---- */
.tabulator-tableholder::-webkit-scrollbar { width: 8px; height: 8px; }
.tabulator-tableholder::-webkit-scrollbar-track { background: transparent; }
.tabulator-tableholder::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 4px;
}
.tabulator-tableholder::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.tabulator-tableholder::-webkit-scrollbar-corner { background: transparent; }

/* ---- Footer (hidden, no pagination) ---- */
.tabulator-footer { display: none !important; }

/* ---- Cell Selection ---- */
.tabulator-cell.selected {
  background: rgba(91,141,239,0.25) !important;
  color: #fff !important;
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

/* ---- Language Button ---- */
.lang-btn {
  font-size: 16px; cursor: pointer;
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.lang-btn:hover { background: var(--bg-hover); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: center;
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 420px; max-width: 90vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 16px; font-weight: 600; color: #fff;
}
.modal-close {
  font-size: 18px; color: var(--text-muted);
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.modal-close:hover { color: #fff; background: var(--bg-hover); }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group select { cursor: pointer; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.btn-primary {
  width: 100%; height: 38px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; margin-top: 6px;
  transition: var(--transition);
}
.btn-primary:hover { background: #4a7de0; box-shadow: 0 4px 12px var(--accent-glow); }

/* ---- Search Dropdown ---- */
.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 280px; overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.search-dropdown-item {
  padding: 8px 12px; cursor: pointer;
  font-size: 12px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.search-dropdown-item:hover, .search-dropdown-item.active {
  background: var(--bg-hover); color: #fff;
}
.search-dropdown-item strong { color: var(--accent); }

/* ── Column highlight on search select (enhanced) ── */
.tabulator-col.highlight {
  background: rgba(224,200,124,0.25) !important;
  box-shadow:
    inset 0 -4px 0 #e0c87c,
    0 0 20px rgba(224,200,124,0.15) !important;
  color: #fff !important;
  transition: background 0.3s, box-shadow 0.3s;
  position: relative;
}

/* Sort direction indicator on highlighted column */
.tabulator-col.highlight[aria-sort="descending"] .tabulator-col-title::after {
  content: ' ▼';
  color: #e0c87c;
  font-size: 10px;
}

.tabulator-col.highlight[aria-sort="ascending"] .tabulator-col-title::after {
  content: ' ▲';
  color: #e0c87c;
  font-size: 10px;
}

/* Pulse ring around highlighted column */
.tabulator-col.highlight-pulse {
  animation: searchPulse 1.5s ease-in-out 3;
}

@keyframes searchPulse {
  0%, 100% { box-shadow: inset 0 -4px 0 #e0c87c, 0 0 20px rgba(224,200,124,0.15); }
  50%      { box-shadow: inset 0 -4px 0 #e0c87c, 0 0 35px rgba(224,200,124,0.4), 0 0 60px rgba(224,200,124,0.2); }
}

/* 📍 찾음 배지 */
.search-found-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  z-index: 5;
  pointer-events: none;
  animation: badgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 국가명 셀 — "클릭 → 강한 순위순 정렬" 힌트 */
.tabulator-cell[tabulator-field="country_name_en"] {
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}
.tabulator-cell[tabulator-field="country_name_en"]:hover {
  color: #e0c87c !important;
  background: rgba(224,200,124,0.06) !important;
  text-shadow: 0 0 8px rgba(224,200,124,0.3);
}
/* 호버 시 ↕ 아이콘 (우측) */
.tabulator-cell[tabulator-field="country_name_en"]::before {
  content: '↕';
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  font-size: 9px; color: #545d7a;
  opacity: 0; transition: opacity 0.2s;
  z-index: 1;
}
.tabulator-cell[tabulator-field="country_name_en"]:hover::before {
  opacity: 1;
}
/* 호버 시 하단 언더라인 슬라이드 */
.tabulator-cell[tabulator-field="country_name_en"]::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 12px; right: 12px;
  height: 1.5px;
  background: #e0c87c;
  transform: scaleX(0);
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.tabulator-cell[tabulator-field="country_name_en"]:hover::after {
  transform: scaleX(1);
}

/* ---- Country Detail Panel ---- */
.detail-panel { position: fixed; inset: 0; z-index: 10000; }
.detail-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.detail-card {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  z-index: 1;
  width: 620px; max-width: 94vw; max-height: 95vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
  margin-top: 4px;
  animation: fadeIn 0.25s ease;
}
.detail-close {
  position: absolute; top: 12px; right: 14px; z-index: 20;
  font-size: 20px; color: #fff; cursor: pointer;
  width: 32px; height: 32px; display: flex;
  align-items: center; justify-content: center;
  border-radius: 8px; background: rgba(0,0,0,0.5);
  transition: var(--transition);
}
.detail-close:hover { background: rgba(255,255,255,0.15); }
.detail-map {
  width: 100%; height: 180px;
  background: var(--bg-secondary);
  position: relative; overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.detail-map iframe {
  width: 100%; height: 100%; border: none;
}
.detail-body {
  padding: 6px 20px 8px !important;
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}
.detail-comments {
  border-top: 1px solid var(--border);
  padding-top: 8px; margin-top: 4px;
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}
.comments-list {
  flex: 1; overflow-y: auto; min-height: 0;
  font-size: 10px;
}
.comment-form {
  display: flex; gap: 3px; align-items: center;
  margin-bottom: 4px; flex-shrink: 0;
}

.detail-country {
  font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 0;
}
.detail-native {
  font-size: 13px; color: var(--text-secondary); margin-bottom: 8px;
}
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px;
}
.detail-item {
  display: flex; justify-content: space-between;
  padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.detail-label { color: var(--text-muted); }
.detail-value { color: var(--text-primary); font-weight: 500; }

/* ---- Trend Chart ---- */
.chart-modal { position: fixed; inset: 0; z-index: 20000; }
.chart-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
.chart-container {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 700px; max-width: 95vw; background: var(--bg-surface);
  border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  padding: 16px;
}
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chart-title { font-size: 14px; font-weight: 700; color: var(--accent); }
.chart-close { cursor: pointer; color: var(--text-muted); font-size: 18px; padding: 4px 8px; }
.chart-close:hover { color: #fff; }

/* ---- Anthem Nested (inside identity app) ---- */
.anthem-nested {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
.anthem-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.85);
}
.anthem-card {
  position: relative; z-index: 1;
  width: 60%; max-width: 400px; max-height: 80%;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.anthem-close {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  font-size: 16px; color: #fff; cursor: pointer;
  width: 26px; height: 26px; display: flex;
  align-items: center; justify-content: center;
  border-radius: 6px; background: rgba(0,0,0,0.5);
}
.anthem-close:hover { background: rgba(255,255,255,0.15); }
.anthem-header {
  padding: 14px 18px 8px;
}
.anthem-sub { font-size: 13px; color: var(--accent); margin-top: 2px; }
.anthem-body { padding: 0 18px 14px; flex: 1; overflow-y: auto; }
.anthem-section { margin-top: 8px; }
.anthem-section h4 { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.anthem-lyrics { 
  font-size: 11px; color: var(--text-secondary); line-height: 1.6;
  white-space: pre-line; font-family: inherit;
}
.anthem-pronounce {
  font-size: 11px; color: var(--accent); line-height: 1.6;
  white-space: pre-line; font-family: inherit; margin-bottom: 3px;
}
.anthem-video {
  margin-top: 8px; width: 100%; height: 200px;
  border: none; border-radius: 6px;
}
#trendChart { max-height: 380px; }

/* ---- Data cells clickable hint ---- */
.tabulator-row .tabulator-cell[data-trend="1"] { cursor: pointer; }

/* ---- Comments ---- */
.detail-comments {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  max-height: 250px;
  display: flex; flex-direction: column;
}
.comments-title { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.comments-list { flex: 1; overflow-y: auto; min-height: 60px; max-height: 140px; }
.comment-item {
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
}
.comment-nick-text { color: var(--accent); font-weight: 600; }
.comment-time { color: var(--text-muted); font-size: 10px; margin-left: 6px; }
.comment-body { color: var(--text-secondary); margin-top: 2px; }
.comment-form {
  display: flex; gap: 6px; margin-top: 8px;
  align-items: flex-end;
}
.comment-nick {
  width: 56px; height: 24px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 3px; color: var(--text-primary); font-size: 10px;
  padding: 0 3px; font-family: inherit; flex-shrink: 0;
}
.comment-input {
  flex: 1; height: 24px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 3px; color: var(--text-primary); font-size: 10px;
  padding: 0 5px; font-family: inherit;
}
.comment-input:focus, .comment-nick:focus {
  border-color: var(--accent); outline: none;
}
.comment-submit {
  height: 24px; padding: 0 8px;
  background: var(--accent); border: none; border-radius: 3px;
  color: #fff; font-size: 10px; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}
.comment-submit:hover { background: #4a7de0; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .header-content { padding: 0 8px; }
  .site-title { font-size: 15px; }
  #search { width: 100%; max-width: 100%; font-size: 14px; height: 36px; }
  .search-group { flex: 1; }
  .login-text { display: none; }

  /* Taller rows for touch */
  .tabulator-row { min-height: 40px; }
  .tabulator-row .tabulator-cell { padding: 6px 4px; }

  /* Bigger tap targets on headers */
  .tabulator-header .tabulator-col { min-height: 36px; }
  .tabulator-col-title { font-size: 10px !important; letter-spacing: 0.1px !important; }

  /* Mobile detail panel */
  .detail-container {
    width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh;
    border-radius: 0; margin: 0;
  }
  .detail-container iframe { height: 180px; }

  /* Mobile chart */
  .chart-container { width: 96vw; padding: 10px; }
  #trendChart { max-height: 250px; }

  /* Language modal */
  .lang-container { width: 96vw; padding: 16px; }

  /* Search dropdown */
  .search-dropdown { max-height: 200px; }
  .search-dropdown-item { padding: 10px 12px; font-size: 14px; }
}

/* Extra small phones */
@media (max-width: 400px) {
  .site-title { font-size: 13px; }
  #search { font-size: 13px; height: 34px; }
  .tabulator-col-title { font-size: 9px !important; }
  .tabulator-row { min-height: 36px; }
  .tabulator-row .tabulator-cell { font-size: 10px; }
}

/* ============================================
   Animations — 테이블에 생명력을!
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 행 등장 애니메이션 (초기 로드 시) */
.tabulator-row {
  animation: fadeIn 0.3s ease-out both;
}

/* 소팅 시 행 위치 변경을 부드럽게 */
.tabulator-table {
  transition: transform 0.2s ease-out;
}

/* ── 컬럼 헤더 호버: 살짝 떠오르는 효과 ── */
.tabulator-header .tabulator-col {
  transition: transform 0.15s ease, background 0.2s, color 0.2s !important;
}

.tabulator-header .tabulator-col:hover {
  transform: translateY(-1px);
  text-shadow: 0 0 6px rgba(224,200,124,0.3);
}

/* ── 데이터 셀: 소팅 후 값 변경 시 미묘한 깜빡임 ── */
@keyframes valuePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); color: #e0c87c; }
  100% { transform: scale(1); }
}

/* ── 🥇🥈🥉 TOP 3 행: 은은한 골드 쉬머 ── */
@keyframes topShimmer {
  0%, 100% { box-shadow: inset 3px 0 0 rgba(224,200,124,0.15); }
  50%      { box-shadow: inset 3px 0 0 rgba(224,200,124,0.35), 0 0 12px rgba(224,200,124,0.08); }
}

.tabulator-row.top-1,
.tabulator-row.top-2,
.tabulator-row.top-3 {
  animation: topShimmer 3s ease-in-out infinite;
}

.tabulator-row.top-1 { background: rgba(224,200,124,0.04) !important; }
.tabulator-row.top-2 { background: rgba(192,192,192,0.03) !important; }
.tabulator-row.top-3 { background: rgba(180,130,80,0.025) !important; }

/* 1등 국가명 골드 글로우 */
.tabulator-row.top-1 .tabulator-cell[tabulator-field="country_name_en"] {
  color: #e0c87c !important;
  text-shadow: 0 0 6px rgba(224,200,124,0.4);
  font-weight: 900 !important;
}

/* ── 인기 지표 셀: 숨쉬는 글로우 ── */
@keyframes cellBreathe {
  0%, 100% { background: transparent; }
  50%      { background: rgba(91,141,239,0.04); }
}

.tabulator-cell.hot-cell {
  animation: cellBreathe 4s ease-in-out infinite;
}

/* ── 최상위 값 (1~3위) 금빛 뱃지 효과 ── */
@keyframes rankGlow {
  0%, 100% { text-shadow: 0 0 4px rgba(224,200,124,0.2); }
  50%      { text-shadow: 0 0 10px rgba(224,200,124,0.5); }
}

.tabulator-cell .rank-1,
.tabulator-cell .rank-2,
.tabulator-cell .rank-3 {
  animation: rankGlow 2.5s ease-in-out infinite;
}

/* ── 빈 값은 회색으로 희미하게 (데이터 부재 명확히) ── */
.tabulator-cell:empty::before,
.tabulator-cell[data-value="-"] {
  color: rgba(255,255,255,0.08);
  content: '—';
}

.update-badge {
  font-size: 10px; color: var(--accent); background: rgba(224,200,124,0.1);
  padding: 3px 8px; border-radius: 10px; margin-right: 8px; white-space: nowrap;
  font-family: 'JetBrains Mono', Consolas, monospace;
}

.shadow-badge { font-size: 12px; cursor: help; }

/* ── 광고 행 ── */
.tabulator-row.ad-row {
  background: rgba(22,28,46,0.5) !important;
  cursor: default !important;
  min-height: 90px !important;
}
.tabulator-row.ad-row:hover {
  background: rgba(22,28,46,0.7) !important;
  box-shadow: none !important;
}
.tabulator-row.ad-row .tabulator-cell {
  display: none !important;
}

/* ── 광고 로딩 애니메이션 ── */
.ad-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 80px; color: rgba(255,255,255,0.1); font-size: 11px;
  letter-spacing: 2px;
}


.tabulator-row:hover .tabulator-cell {
  background: rgba(91,141,239,0.04) !important;
}
.tabulator-row:hover .tabulator-cell.tabulator-frozen {
  background: rgba(91,141,239,0.06) !important;
}

/* 열 하이라이트: 같은 열의 모든 셀 */
.tabulator-cell.col-hover {
  background: rgba(91,141,239,0.05) !important;
}
.tabulator-cell.tabulator-frozen.col-hover {
  background: rgba(91,141,239,0.07) !important;
}

/* 행+열 교차점 */
.tabulator-row:hover .tabulator-cell.col-hover {
  background: rgba(91,141,239,0.12) !important;
  box-shadow: inset 0 0 0 1px rgba(91,141,239,0.3);
}

/* ── 순수 CSS 십자가 하이라이트 ── */
.tabulator-row:hover .tabulator-cell {
  background: rgba(91,141,239,0.04) !important;
  transition: background 0.15s;
}
.tabulator-row:hover .tabulator-cell.tabulator-frozen {
  background: rgba(91,141,239,0.06) !important;
}

/* ── News Card (Trend colspan cell) ── */
.news-card {
  display: flex; align-items: center; gap: 6px;
  width: 100%; height: 100%; min-height: 36px; padding: 2px 4px;
}
.news-thumb {
  width: 40px; height: 30px; object-fit: cover; border-radius: 3px;
  flex-shrink: 0; background: rgba(255,255,255,0.04);
}
.news-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.news-headline {
  font-size: 10px; line-height: 1.3; color: #c8d2e0; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-headline:hover { color: #fff; text-decoration: underline; }
.news-meta {
  font-size: 8.5px; color: #545d7a; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Colspan cell (AdSense merged cell 포함) ── */
.colspan-cell {
  background: rgba(224,200,124,0.03) !important;
  border-left: 1px solid rgba(224,200,124,0.12) !important;
  border-right: none !important;
  transition: background 0.3s;
}
.colspan-cell:hover { background: rgba(224,200,124,0.06) !important; }
.colspan-cell .colspan-inner { display: flex; align-items: center; height: 100%; }
.colspan-ad {
  border-radius: 4px;
  background: rgba(17,22,39,0.5);
}

/* ── Graph View link ── */
.graph-link {
  font-size: 12px; font-weight: 600; color: #8892b0;
  text-decoration: none; padding: 4px 10px;
  border-radius: 6px; transition: all 0.2s;
  white-space: nowrap;
}
.graph-link:hover { color: #e0c87c; background: rgba(224,200,124,0.08); }
