/* ============================================================
 * TT RANK — 실시간 별풍선 · 슈퍼챗 랭킹 (라이트 테마)
 * ============================================================ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --fg: #16181d;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --line: #e6e8ec;
  --line-strong: #d3d7de;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;
  --gold: #d4a017;
  --silver: #8f98a3;
  --bronze: #b87333;
  --live: #ff2d55;
  --live-soft: #ffe9ee;
  --soop: #0545b1;
  --yt: #ff0000;
  --radius: 14px;
  --shadow: 0 10px 30px -18px rgba(22, 24, 29, 0.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
ul { list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- 헤더 ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; letter-spacing: -0.02em; font-size: 19px; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--fg); color: #fff; font-size: 13px; letter-spacing: 0.02em; }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.main-nav { display: flex; gap: 4px; margin-left: 6px; }
.main-nav a { padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; color: #3b4048; }
.main-nav a:hover { background: var(--bg); }
.main-nav a.active { color: var(--fg); background: var(--accent-soft); }
.header-search { margin-left: auto; display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px; min-width: 220px; }
.header-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14px; min-width: 0; }
.header-search button { width: 30px; height: 30px; border-radius: 50%; background: var(--fg); color: #fff; display: grid; place-items: center; font-size: 14px; }
.header-links { display: flex; align-items: center; gap: 8px; }
.header-links a { font-size: 13px; color: var(--muted); font-weight: 600; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.menu-toggle { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 18px; }
@media (max-width: 900px) {
  .main-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px 12px; gap: 2px; }
  .main-nav.open { display: flex; }
  .menu-toggle { display: grid; place-items: center; }
  .header-search { min-width: 0; flex: 1; }
  .header-links { display: none; }
}

/* ---------- 공통 레이아웃 ---------- */
main { padding: 26px 0 56px; }
main.container { padding-top: 26px; padding-bottom: 56px; }
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.page-title .badge-platform { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-platform.soop { background: #e8effc; color: var(--soop); }
.badge-platform.yt { background: #ffe8e8; color: #c00; }
.badge-platform.tt { background: var(--accent-soft); color: var(--accent); }
.updated { margin-left: auto; font-size: 12px; color: var(--faint); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; font-weight: 800; }
.card-head .tag { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.card-head .more { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; }
.card-head .more:hover { color: var(--fg); }
.card-body { padding: 14px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.section { margin-bottom: 22px; }

/* 통계 타일 */
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-tile .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-tile .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.stat-tile .sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.stat-tile.accent { background: linear-gradient(135deg, #1b1d29, #33355a); color: #fff; border-color: transparent; }
.stat-tile.accent .label, .stat-tile.accent .sub { color: rgba(255,255,255,0.7); }

/* 탭 · 필터 */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; }
.tabs button, .tabs a { padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs button.active, .tabs a.active { background: var(--fg); color: #fff; }
.select { appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 32px 8px 12px; font-size: 14px; font-weight: 600; }
.chip-clear { font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.toolbar .spacer { flex: 1; }
.date-nav { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; }
.date-nav button { width: 30px; height: 30px; border-radius: 8px; font-size: 16px; }
.date-nav button:hover { background: var(--bg); }
.date-nav .label { font-weight: 800; min-width: 84px; text-align: center; }

/* 테이블 */
.table-wrap { overflow-x: auto; }
table.rank { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rank th, table.rank td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.rank th { font-size: 12px; color: var(--muted); font-weight: 700; background: #fafbfc; position: sticky; top: 0; }
table.rank th.sortable { cursor: pointer; user-select: none; }
table.rank th.sortable:hover { color: var(--fg); }
table.rank th.sorted { color: var(--accent); }
table.rank th.sorted::after { content: " •"; }
table.rank th .rank-sort { appearance: none; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 0; white-space: nowrap; }
table.rank th .rank-sort:hover, table.rank th .rank-sort.active { color: var(--accent); }
table.rank th .rank-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
table.rank th:first-child, table.rank td:first-child { text-align: center; width: 52px; }
table.rank th.left, table.rank td.left { text-align: left; }
table.rank tbody tr:hover { background: #fafbff; }
table.rank td.rank-cell { font-weight: 800; color: var(--muted); }
table.rank tr:nth-child(1) td.rank-cell { color: var(--gold); }
table.rank tr:nth-child(2) td.rank-cell { color: var(--silver); }
table.rank tr:nth-child(3) td.rank-cell { color: var(--bronze); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #e9ebef; flex-shrink: 0; }
.avatar.sm { width: 26px; height: 26px; }
.who .name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.who .name a:hover { text-decoration: underline; }
.who .sub { font-size: 12px; color: var(--faint); }
.badge-live { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; color: #fff; background: var(--live); border-radius: 4px; padding: 1px 6px; letter-spacing: 0.04em; }
.badge-live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.cat-chip { display: inline-block; font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 1px 7px; }
.bar-cell { min-width: 150px; }
.bar { position: relative; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.bar-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.more-row { display: flex; justify-content: center; padding: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--fg); color: #fff; }
.btn.ghost { background: #fff; color: var(--fg); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.5; cursor: default; }
.empty { padding: 36px 16px; text-align: center; color: var(--faint); font-size: 14px; }

/* TOP 카드 */
.top-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 760px) { .top-cards { grid-template-columns: 1fr; } }
.top-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.top-card .avatar { width: 46px; height: 46px; }
.top-card .kind { font-size: 12px; color: var(--accent); font-weight: 800; }
.top-card .name { font-weight: 800; font-size: 15px; }
.top-card .value { margin-left: auto; text-align: right; font-weight: 800; font-size: 18px; }
.top-card .value small { display: block; font-size: 11px; color: var(--faint); font-weight: 600; }

/* 홈 */
.dashboard-intro { color: var(--muted); font-size: 14px; margin: -8px 0 20px; }
.section-heading { border: 0; padding: 0 0 12px; }
.card-head .yt-tag { background: #ffe8e8; color: #c00; }
.card-head .live-count { font-size: 13px; font-weight: 600; color: var(--muted); }
.card-head .live-count b { color: var(--live); font-weight: 800; font-size: 15px; }
.soop-heading { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line-strong); }
.soop-heading h2 { font-size: 21px; }
.youtube-stats { align-content: start; }
.youtube-stats .stat-tile { min-width: 0; min-height: 128px; }
.youtube-stats .value { font-size: clamp(19px, 2.1vw, 26px); white-space: nowrap; }
.revenue-note { grid-column: 1 / -1; color: var(--muted); font-size: 12px; padding: 0 4px; }
.youtube-ranking .mini-rank .value { white-space: nowrap; flex-shrink: 0; }
.youtube-ranking .badge-live { flex-shrink: 0; }
.youtube-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.youtube-channel-name:hover { color: var(--accent); text-decoration: underline; }
.channel-link { display: inline-block; padding: 4px 8px; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-weight: 700; }
.channel-link:hover { background: var(--accent-soft); }
@media (max-width: 480px) {
  .brand-sub { display: none; }
  .header-inner { gap: 10px; }
  .youtube-ranking .card-body { padding: 10px 12px; }
  .youtube-ranking .mini-rank li { font-size: 12px; gap: 6px; }
  .hero-stats .stat-tile { padding: 14px 12px; min-height: 118px; }
  .hero-stats .value { font-size: clamp(14px, 4vw, 19px); white-space: nowrap; }
  .card-head { flex-wrap: wrap; }
}
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 22px; }
.hero > *, .hero-stats > *, .live-grid > *, .grid-3 > * { min-width: 0; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.hero-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.popular-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.popular-list li:last-child { border-bottom: 0; }
.popular-list .rank { width: 22px; font-weight: 800; color: var(--muted); }
.popular-list .name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popular-list .viewers { font-size: 13px; color: var(--muted); }
.popular-list .viewers, .popular-list .rank { flex-shrink: 0; }
.popular-list .cat-chip { max-width: 25%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr 1fr; } }
.live-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.live-card .thumb { position: relative; aspect-ratio: 16 / 9; background: #dfe2e8; }
.live-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.live-card .thumb .badge-live { position: absolute; top: 8px; left: 8px; }
.live-card .thumb .viewers { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.live-card .meta { padding: 10px 12px; }
.live-card .title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card .sub { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.mini-rank li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mini-rank li:last-child { border-bottom: 0; }
.mini-rank .rank { width: 20px; font-weight: 800; color: var(--muted); text-align: center; }
.mini-rank .name { flex: 1; font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.mini-rank .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank .name a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-rank .value { font-weight: 800; }

/* 차트 */
.chart { width: 100%; height: 300px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--faint); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#chartFill); opacity: 0.9; }
.chart .dot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.chart .hover-line { stroke: var(--line-strong); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--fg); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 8px; transform: translate(-50%, -100%); white-space: nowrap; display: none; }
.chart-tip b { display: block; font-size: 13px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend button { font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.legend button.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* 카테고리 랭킹 (플랫폼) */
.cat-row { display: grid; grid-template-columns: 40px 1.2fr repeat(3, 1fr); gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-row .rank { font-weight: 800; color: var(--muted); text-align: center; }
.cat-row .name { font-weight: 800; }
.cat-row .metric .label { font-size: 11px; color: var(--faint); font-weight: 600; }
.cat-row .metric .value { font-weight: 800; font-size: 14px; }
.cat-row .metric .bar { margin-top: 4px; }
.cat-row .metric .bar-label { font-size: 11px; }
.cat-row .metric.viewers .bar > i { background: #10b981; }
.cat-row .metric.broadcasts .bar > i { background: #f59e0b; }
@media (max-width: 760px) { .cat-row { grid-template-columns: 30px 1fr; } .cat-row .metric { grid-column: 2; } }

/* 방송인 상세 */
.profile { display: flex; gap: 18px; align-items: center; padding: 20px; flex-wrap: wrap; }
.profile .avatar { width: 84px; height: 84px; border: 3px solid #fff; box-shadow: var(--shadow); }
.profile h1 { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.profile .sub { color: var(--muted); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.profile .groups { display: flex; gap: 6px; }
.profile .group { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.profile .actions { margin-left: auto; display: flex; gap: 8px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 18px; }
.kv div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv div span:first-child { color: var(--muted); }
.kv div span:last-child { font-weight: 700; }
.live-banner { display: flex; gap: 14px; align-items: center; padding: 12px 16px; background: var(--live-soft); border: 1px solid #ffd0da; border-radius: 12px; margin: 0 20px 20px; }
.live-banner img { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.live-banner .title { font-weight: 700; }
.live-banner .sub { font-size: 13px; color: var(--muted); }

/* 검색 */
.search-form { display: flex; gap: 8px; margin-bottom: 18px; }
.search-form input { flex: 1; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 16px; outline: none; }
.search-form input:focus { border-color: var(--accent); }
.result-list li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: 0; }
.result-list .name { font-weight: 800; }
.result-list .meta { font-size: 12px; color: var(--muted); }

/* 푸터 */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--muted); font-size: 12px; line-height: 1.7; background: #fff; }
.site-footer .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; color: var(--fg); font-weight: 800; }
.site-footer a { color: var(--muted); text-decoration: underline; }

/* 상태 표시 */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; margin-right: 5px; }
.status-dot.warn { background: #f59e0b; }
.status-dot.bad { background: var(--live); }
.notice { padding: 12px 16px; border-radius: 12px; background: #fff8e6; border: 1px solid #f5e1a8; color: #7a5a00; font-size: 13px; margin-bottom: 16px; }
.skeleton { color: transparent; background: linear-gradient(90deg, #eef0f3, #f7f8fa, #eef0f3); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.rev-src{display:inline-block;margin-left:6px;font-size:10px;font-weight:800;padding:1px 6px;border-radius:999px;vertical-align:1px}
.rev-src.screen{background:#e6f0ff;color:#1858c8}
.rev-src.manual{background:#fff0e0;color:#b76a00}

/* ---------- 엑셀 랭킹 (통합 · 숲 · 유튜브) ---------- */
.page-meta { color: var(--faint); font-size: 13px; margin: -10px 0 16px; letter-spacing: 0.01em; }
.underline-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.underline-tabs a { padding: 8px 2px 10px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.underline-tabs a.active { color: var(--fg); border-color: var(--fg); }
.underline-tabs a:hover { color: var(--fg); }
.excel-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.segmented { display: inline-flex; background: #eef0f4; border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.segmented button.active { background: var(--accent); color: #fff; box-shadow: 0 2px 6px -2px rgba(79, 70, 229, 0.6); }
.excel-caption { color: var(--muted); font-size: 13px; }
.period-picker { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.period-picker button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; }
.period-picker button:disabled { opacity: 0.35; cursor: default; }
.period-picker input { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; font-weight: 700; font-size: 14px; }
.excel-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 760px) { .excel-top { grid-template-columns: 1fr; } .period-picker { margin-left: 0; } }
.excel-top-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px; align-items: center; box-shadow: var(--shadow); }
.animate .excel-top-card { animation: rise 0.45s ease both; }
.animate .excel-top-card:nth-child(2) { animation-delay: 0.06s; }
.animate .excel-top-card:nth-child(3) { animation-delay: 0.12s; }
.excel-top-card .place { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.excel-top-card .place b { color: var(--fg); font-size: 13px; }
.excel-top-card .place i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.excel-top-card .team-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.excel-top-card .team-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.excel-top-card .amount { font-weight: 900; font-size: 19px; letter-spacing: -0.02em; white-space: nowrap; }
.excel-top-card.r1 .amount { color: #2563eb; }
.excel-top-card.r1 .place i { background: #2563eb; }
.excel-top-card.r2 .amount { color: #059669; }
.excel-top-card.r2 .place i { background: #059669; }
.excel-top-card.r3 .amount { color: #d97706; }
.excel-top-card.r3 .place i { background: #d97706; }
.excel-card { overflow: hidden; }
.excel-head, .excel-row { display: grid; grid-template-columns: 56px minmax(0, 1.4fr) minmax(90px, 1fr) minmax(104px, auto); align-items: center; gap: 14px; padding: 10px 18px; }
.excel-card.with-extra .excel-head, .excel-card.with-extra .excel-row { grid-template-columns: 56px minmax(0, 1.4fr) minmax(90px, 1fr) minmax(104px, auto) 96px; }
.excel-head { font-size: 12px; color: var(--muted); font-weight: 700; background: #fafbfc; border-bottom: 1px solid var(--line); }
.excel-head span:first-child { text-align: center; }
.excel-head span:nth-child(n+4), .excel-row > :nth-child(n+4) { text-align: right; }
.excel-row { border-bottom: 1px solid var(--line); transition: background 0.15s; }
.animate .excel-row { animation: fade 0.35s ease both; }
.excel-row.unranked .excel-bar { visibility: hidden; }
.excel-row:last-child { border-bottom: 0; }
.excel-row:hover { background: #fafbff; }
.excel-rank { text-align: center; font-weight: 800; color: var(--accent); font-size: 15px; }
.excel-rank.none { color: var(--faint); }
.excel-team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.excel-team .team-name { font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.excel-team .team-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.excel-team:hover .team-name > span:first-child { text-decoration: underline; }
.excel-bar { height: 6px; border-radius: 999px; background: #eceef2; overflow: hidden; }
.excel-bar i { display: block; height: 100%; border-radius: inherit; transform-origin: left; transition: width 0.6s ease; }
.animate .excel-bar i { animation: grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.excel-value { font-weight: 800; white-space: nowrap; font-size: 15px; }
.excel-value .unit, .amount .unit, .medal-rank .value .unit { font-weight: 600; font-size: 0.78em; margin: 0 2px 0 1px; color: inherit; opacity: 0.75; }
.excel-extra { font-size: 12px; color: var(--muted); white-space: nowrap; }
.excel-row.unranked .excel-value { color: var(--faint); }
.team-avatar { position: relative; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: #eef0f4; color: var(--muted); font-weight: 800; font-size: 15px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.team-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.team-avatar.live { box-shadow: 0 0 0 2px var(--live); }
.team-avatar.live::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--live); opacity: 0; animation: ring 1.8s ease-out infinite; }
.team-avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.team-avatar.lg { width: 46px; height: 46px; }
.platform-mark { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 900; letter-spacing: -0.01em; line-height: 1; }
.platform-mark.yt { color: #212121; }
.platform-mark.yt::before { content: ""; width: 13px; height: 9px; border-radius: 2.5px; background: #ff0000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 9'%3E%3Cpath d='M5 2.3v4.4L8.8 4.5z' fill='%23fff'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.platform-mark.soop { color: #0545b1; font-size: 9.5px; letter-spacing: 0.02em; }
.medal { display: inline-grid; place-items: center; width: 26px; height: 26px; }
.medal svg { width: 26px; height: 26px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.12)); }
.viewer-count { font-size: 11px; color: var(--live); font-weight: 700; white-space: nowrap; }
.excel-empty { padding: 48px 16px; text-align: center; color: var(--faint); }
.excel-note { font-size: 12px; margin-top: 10px; }
@media (max-width: 640px) {
  .excel-head { display: none; }
  .excel-row, .excel-card.with-extra .excel-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "rank team value" "rank bar bar"; row-gap: 6px; padding: 10px 12px; }
  .excel-row .excel-rank { grid-area: rank; }
  .excel-row .excel-team { grid-area: team; }
  .excel-row .excel-bar { grid-area: bar; }
  .excel-row .excel-value { grid-area: value; }
  .excel-row .excel-extra { display: none; }
}
/* 홈 미니 랭킹(메달 · 로고 · 막대) */
.medal-rank li { display: grid; grid-template-columns: 26px 30px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; row-gap: 4px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.medal-rank li:last-child { border-bottom: 0; }
.medal-rank li.empty { display: block; }
.medal-rank .rank { grid-row: 1 / 3; text-align: center; font-weight: 800; color: var(--muted); }
.medal-rank .team-avatar { grid-row: 1 / 3; }
.medal-rank .name { font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.medal-rank .name > a, .medal-rank .name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.medal-rank .value { font-weight: 800; white-space: nowrap; }
.medal-rank .mini-bar { grid-column: 3 / 5; height: 4px; border-radius: 999px; background: #eceef2; overflow: hidden; }
.medal-rank .mini-bar i { display: block; height: 100%; border-radius: inherit; transform-origin: left; transition: width 0.6s ease; }
.medal-rank.animate .mini-bar i { animation: grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.medal-rank .medal, .medal-rank .medal svg { width: 22px; height: 22px; }
.card-head .segmented { margin-left: auto; }
.card-head .segmented button { padding: 4px 10px; font-size: 12px; }
.card-head .segmented + .more { margin-left: 8px; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.92); } 100% { opacity: 0; transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .excel-bar i, .medal-rank .mini-bar i, .excel-row, .excel-top-card, .team-avatar.live::after { animation: none; } }
.team-avatar img { position: absolute; inset: 0; }
.medal-rank .name > a { color: inherit; }
.excel-live { margin-top: 26px; }

/* 홈 숲 지표 카드: 전일 대비 · 추이 */
.stat-tile.metric { display: flex; flex-direction: column; }
.stat-tile .trend { font-size: 12px; color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile .trend .up { color: #16a34a; font-weight: 800; }
.stat-tile .trend .down { color: #e5484d; font-weight: 800; }
.stat-tile.accent .trend { color: rgba(255, 255, 255, 0.72); }
.stat-tile.accent .trend .up { color: #6ee7a8; }
.stat-tile.accent .trend .down { color: #ff9a9e; }
.stat-tile .spark { margin-top: auto; padding-top: 8px; height: 40px; }
.stat-tile .spark svg { width: 100%; height: 32px; display: block; overflow: visible; }
.stat-tile .spark .axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); margin-top: 2px; }
.stat-tile.accent .spark .axis { color: rgba(255, 255, 255, 0.55); }
.more-row.compact { padding: 10px 0 0; }
.more-row.compact .btn { padding: 6px 16px; font-size: 13px; border-radius: 999px; }

/* 실시간 큰 후원 알림 */
.gift-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.gift-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: 0 14px 34px -16px rgba(22, 24, 29, 0.45); min-width: 220px; max-width: 320px; animation: toast-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.gift-toast .who { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.gift-toast .who b { color: var(--fg); }
.gift-toast .amount { font-weight: 900; color: #e7a12f; font-size: 15px; }
.gift-toast.leave { animation: toast-out 0.35s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@media (max-width: 640px) { .gift-toasts { left: 16px; right: 16px; } .gift-toast { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .gift-toast, .gift-toast.leave { animation: none; } }
