/* ═══════════════════════════════════════════════════════════════════════════
   Cam-World — «Мировые камеры» (/stats)
   Все селекторы заскоплены под .stats-page (кроме оверлея .st-lb), чтобы не
   воевать с main.css. Цвета — только через токены темы (светлая тема работает
   автоматически, т.к. main.css переопределяет токены под body.light-theme).
   ═══════════════════════════════════════════════════════════════════════════ */

.stats-page {
    max-width: 1160px;
    margin: 0 auto;
    padding: 32px 20px 0;
}
.stats-page section { padding: 40px 0; }

/* ── типографика ─────────────────────────────────────────────────────────── */
.stats-page .st-eyebrow {
    font-size: 11.5px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--accent-pink); margin-bottom: 12px;
}
.stats-page h1 { font-size: clamp(30px, 4.6vw, 54px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; margin-bottom: 16px; }
.stats-page h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 800; letter-spacing: -.03em; margin-bottom: 12px; }
.stats-page h3.st-sub3 {
    font-size: 17px; font-weight: 800; letter-spacing: -.01em;
    margin: 44px 0 20px; padding-top: 36px; border-top: 1px solid var(--border);
}
.stats-page h3.st-sub3:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.stats-page .st-lead, .stats-page .st-sub { color: var(--text-secondary); font-size: 15.5px; max-width: 640px; line-height: 1.6; }
.stats-page .st-shead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.stats-page .st-snapshot { margin-top: 14px; font-size: 12.5px; color: var(--text-secondary); }

/* ── ссылки ──────────────────────────────────────────────────────────────── */
.stats-page a.st-lnk { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s, color .15s; }
.stats-page a.st-lnk:hover { border-bottom-color: var(--accent-pink); color: var(--accent-pink); }
.stats-page a.st-lnk.ext::after { content: '↗'; font-size: .72em; margin-left: 4px; opacity: .45; }

/* ── счётчики ────────────────────────────────────────────────────────────── */
.stats-page .st-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 32px; }
.stats-page .st-stats.three { grid-template-columns: repeat(3, 1fr); }
.stats-page .st-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.stats-page .st-stat .v { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats-page .st-stat.st-accent .v { color: var(--accent-pink); }
.stats-page .st-stat .l { font-size: 13px; color: var(--text-secondary); margin-top: 5px; }
.stats-page .st-stat .s { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

/* ── флаги ───────────────────────────────────────────────────────────────── */
.stats-page .st-flag { display: inline-block; width: 24px; overflow: hidden; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.stats-page .st-flag svg { display: block; width: 100%; height: auto; }
.stats-page .st-flag.lg { width: 60px; }
.stats-page .st-flag-emoji { font-size: 20px; line-height: 1; }
.stats-page .st-flag-emoji.lg { font-size: 44px; }

/* ── ЭФИР ────────────────────────────────────────────────────────────────── */
.stats-page .st-live { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; }
.stats-page .st-live-col { min-width: 0; }
.stats-page .st-live-main { position: relative; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16/9; }
.stats-page .st-live-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stats-page .st-live-tag {
    position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.55); color: #fff;
    font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 999px; display: flex; align-items: center; gap: 6px;
}
.stats-page .st-live-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-pink); }
.stats-page .st-live-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; background: linear-gradient(transparent, rgba(0,0,0,.82)); color: #fff; }
.stats-page .st-live-meta .t { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.stats-page .st-live-meta .t a.st-lnk:hover { color: #fff; border-bottom-color: #fff; }
.stats-page .st-live-meta .s { font-size: 12.5px; opacity: .82; margin-top: 3px; }
.stats-page .st-live-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.stats-page .st-live-metrics .m { border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; background: var(--bg-card); }
.stats-page .st-live-metrics .k { font-size: 10px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-page .st-live-metrics .v { font-size: 15px; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stats-page .st-live-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.stats-page .st-thumb { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 16/9; background: var(--bg-card); padding: 0; }
.stats-page .st-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.stats-page .st-thumb:hover img { transform: scale(1.06); }
.stats-page .st-thumb.on { border-color: var(--accent-pink); }
.stats-page .st-thumb .sh { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.62); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.stats-page .st-thumb .lbl { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px; font-size: 10.5px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.85)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }

/* ── ГЛОБУС ──────────────────────────────────────────────────────────────── */
.stats-page .st-globe-wrap { position: relative; border: 1px solid var(--border); border-radius: 14px; background: var(--map-water); overflow: hidden; }
.stats-page #stGlobe { display: block; width: 100%; height: min(560px, 74vw); cursor: grab; touch-action: none; }
.stats-page #stGlobe.dragging { cursor: grabbing; }
.stats-page .st-ghint { position: absolute; left: 14px; bottom: 12px; font-size: 11.5px; color: var(--text-secondary); pointer-events: none; }
.stats-page .st-gctrl { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 6px; }
.stats-page .st-gctrl button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-size: 17px; line-height: 1; }
.stats-page .st-gctrl button:hover { border-color: var(--accent-pink); }
.stats-page .st-gtip {
    position: absolute; z-index: 20; pointer-events: none; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 11px; padding: 10px 12px; font-size: 12.5px; box-shadow: 0 12px 34px rgba(0,0,0,.4);
    opacity: 0; transform: translate(-50%,-130%); transition: opacity .12s; min-width: 150px;
}
.stats-page .st-gtip.on { opacity: 1; }
.stats-page .st-gtip .tt { font-weight: 800; font-size: 13.5px; margin-bottom: 5px; display: flex; align-items: center; gap: 7px; }
.stats-page .st-gtip .tt .st-flag { flex: 0 0 auto; }
.stats-page .st-gtip .r { display: flex; justify-content: space-between; gap: 16px; color: var(--text-secondary); }
.stats-page .st-gtip .r b { color: var(--text-primary); }

/* ── РЕЙТИНГ ─────────────────────────────────────────────────────────────── */
.stats-page .st-rank-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stats-page .st-search { display: flex; align-items: center; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; }
.stats-page .st-search svg { width: 15px; height: 15px; margin-left: 12px; opacity: .5; flex-shrink: 0; }
.stats-page .st-search input { background: transparent; border: 0; color: var(--text-primary); padding: 10px 13px 10px 9px; font-size: 13.5px; font-family: inherit; width: 190px; outline: none; }
.stats-page .st-seg { display: inline-flex; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 3px; flex-wrap: wrap; }
.stats-page .st-seg button { border: 0; background: transparent; color: var(--text-secondary); font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-family: inherit; }
.stats-page .st-seg button.on { background: var(--accent-pink); color: #fff; }
.stats-page .st-rank { display: flex; flex-direction: column; gap: 9px; }
.stats-page .st-rrow { display: grid; grid-template-columns: 34px 30px 1fr; align-items: center; gap: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 13px; padding: 13px 16px; }
.stats-page .st-rrow .pos { font-weight: 800; color: var(--text-secondary); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.stats-page .st-rrow.top .pos { color: var(--accent-pink); }
.stats-page .st-rrow .fl { display: flex; }
.stats-page .st-rrow .mid { min-width: 0; }
.stats-page .st-rrow .l1 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.stats-page .st-rrow .cn { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-page .st-rrow .num { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; white-space: nowrap; }
.stats-page .st-rrow .num small { color: var(--text-secondary); font-weight: 500; font-size: 11.5px; }
.stats-page .st-rrow .alive { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 9px; background: color-mix(in srgb, var(--accent-pink) 14%, transparent); color: var(--accent-pink); }
.stats-page .st-rrow.sel { border-color: var(--accent-pink); }
/* свёрнутые строки рейтинга (топ-10 + «показать ещё») */
.stats-page .st-rrow.st-hidden { display: none; }
.stats-page .st-more-wrap { margin-top: 16px; text-align: center; }
/* бейдж доли: зелёный >90%, амбер <78% (как в демо) */
.stats-page .st-rrow .alive.ok { background: color-mix(in srgb, var(--accent-green) 16%, transparent); color: var(--accent-green); }
.stats-page .st-rrow .alive.warn { background: rgba(245, 158, 11, .16); color: #f59e0b; }

/* ── бары ────────────────────────────────────────────────────────────────── */
.stats-page .st-bar { height: 9px; border-radius: 6px; background: var(--bg-secondary); overflow: hidden; }
.stats-page .st-bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent-pink); transition: width .5s cubic-bezier(.2,.7,.3,1); }
.stats-page .st-bars { display: flex; flex-direction: column; gap: 8px; }
.stats-page .st-brow { display: grid; grid-template-columns: minmax(140px, 248px) 1fr 68px; gap: 12px; align-items: center; font-size: 13.5px; }
.stats-page .st-brow .bn { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.stats-page .st-brow .bn .cthumb { width: 46px; height: 27px; object-fit: cover; border-radius: 6px; flex-shrink: 0; display: block; cursor: zoom-in; }
.stats-page .st-brow .bt { height: 20px; border-radius: 6px; background: var(--bg-secondary); overflow: hidden; }
.stats-page .st-brow .bt i { display: block; height: 100%; background: var(--accent-pink); }
.stats-page .st-brow .bv { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── инсайты ─────────────────────────────────────────────────────────────── */
.stats-page .st-insight { margin-top: 22px; padding: 16px 18px; border-radius: 13px; border: 1px solid var(--border); background: var(--bg-card); font-size: 14.5px; line-height: 1.6; }

/* ── платформы ───────────────────────────────────────────────────────────── */
.stats-page .st-plat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stats-page .st-pcard { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.stats-page .st-pcard .pn { font-weight: 700; font-size: 14px; margin-bottom: 14px; color: var(--text-secondary); }
.stats-page .st-pcard .pv { font-size: 36px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stats-page .st-pcard .pm { font-size: 12.5px; color: var(--text-secondary); margin-top: 12px; }

/* ── город дня ───────────────────────────────────────────────────────────── */
.stats-page .st-cityday { border: 1px solid var(--border); border-radius: 18px; background: var(--bg-card); padding: 28px; margin-top: 26px; }
.stats-page .st-cityday .cd-head { display: flex; align-items: center; gap: 16px; }
.stats-page .st-cityday .cn { font-size: clamp(28px, 4.2vw, 44px); font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.stats-page .st-cityday .cd { color: var(--text-secondary); max-width: 560px; margin-top: 12px; font-size: 15px; }
.stats-page .st-cd-gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 20px; }
.stats-page .st-cd-gallery img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; display: block; cursor: zoom-in; }
.stats-page .st-cityday .cd-row { display: flex; gap: 44px; flex-wrap: wrap; align-items: flex-end; margin-top: 22px; }
.stats-page .st-cityday .big { font-size: clamp(34px, 5vw, 54px); font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stats-page .st-cityday .big.a { color: var(--accent-pink); }
.stats-page .st-cityday .k { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 7px; }

/* ── донат ───────────────────────────────────────────────────────────────── */
.stats-page .st-donut-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 30px; align-items: center; }
.stats-page .st-donut { position: relative; width: 280px; height: 280px; margin: 0 auto; }
.stats-page .st-donut .ctr { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.stats-page .st-donut .ctr .big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stats-page .st-donut .ctr .cap { font-size: 11px; color: var(--text-secondary); font-weight: 600; margin-top: 3px; }
.stats-page .st-dleg { display: flex; flex-direction: column; gap: 7px; }
.stats-page .st-dleg .row { display: flex; align-items: center; gap: 11px; font-size: 13.5px; }
.stats-page .st-dleg .row b { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.stats-page .st-dleg .row .n { flex: 1; }
.stats-page .st-dleg .row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-page .st-dleg .row .pc { color: var(--text-secondary); font-size: 12px; width: 46px; text-align: right; }

/* ── графики ─────────────────────────────────────────────────────────────── */
/* ── графики (CSS-столбики: тянутся по ширине без масштабирования) ────────── */
.stats-page .st-chart2 { display: flex; gap: 10px; align-items: flex-start; padding-bottom: 20px; }
.stats-page .st-chart2-y {
    display: flex; flex-direction: column; justify-content: space-between;
    width: 36px; height: 170px; font-size: 10px; color: var(--text-secondary);
    text-align: right; flex: 0 0 auto;
}
.stats-page .st-chart2-plot {
    position: relative; flex: 1 1 auto; min-width: 0;
    display: flex; align-items: flex-end; gap: 2%; height: 170px;
    border-bottom: 1px solid var(--border);
    background-image: repeating-linear-gradient(to top, var(--border) 0 1px, transparent 1px 25%);
}
.stats-page .st-chart2-plain .st-chart2-plot { height: 200px; }
.stats-page .st-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; }
.stats-page .st-cb {
    position: absolute; left: 12%; right: 12%; bottom: 0;
    background: var(--accent-pink); border-radius: 3px 3px 0 0;
}
.stats-page .st-cb-empty { height: 3px; background: var(--text-secondary); opacity: .45; }
.stats-page .st-cv { position: absolute; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 700; }
.stats-page .st-cv-empty { bottom: 8px; color: var(--text-secondary); }
.stats-page .st-cx { position: absolute; left: 0; right: 0; bottom: -16px; text-align: center; font-size: 10px; color: var(--text-secondary); }

/* ── города: таблица + карточка лидера в две колонки ─────────────────────── */
.stats-page .st-cities-wrap {
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 20px; align-items: start;
}
.stats-page .st-cityday { margin-top: 0; }
.stats-page .st-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.stats-page .st-card .cap { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin-bottom: 14px; }
.stats-page .st-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

/* ── кнопка ──────────────────────────────────────────────────────────────── */
.stats-page .st-btn { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); font-weight: 700; font-size: 13.5px; padding: 10px 16px; border-radius: 11px; cursor: pointer; font-family: inherit; }
.stats-page .st-btn:hover { border-color: var(--accent-pink); }
.stats-page .st-btn[hidden] { display: none; }

/* ── лайтбокс ────────────────────────────────────────────────────────────── */
.st-lb { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.93); display: none; align-items: center; justify-content: center; padding: 26px; }
.st-lb.on { display: flex; }
.st-lb img { max-width: 100%; max-height: 82vh; border-radius: 12px; display: block; }
.st-lb .cap { position: absolute; bottom: 26px; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; font-weight: 600; }
.st-lb .x { position: absolute; top: 16px; right: 22px; background: none; border: 0; color: #fff; font-size: 34px; line-height: 1; cursor: pointer; opacity: .8; }
.st-lb .x:hover { opacity: 1; }

/* ── адаптив ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .stats-page .st-live { grid-template-columns: 1fr; }
    .stats-page .st-live-metrics { grid-template-columns: repeat(2, 1fr); }
    .stats-page .st-stats, .stats-page .st-stats.three { grid-template-columns: repeat(2, 1fr); }
    .stats-page .st-plat-grid { grid-template-columns: 1fr; }
    .stats-page .st-donut-wrap { grid-template-columns: 1fr; }
    .stats-page .st-split { grid-template-columns: 1fr; }
    .stats-page .st-cd-gallery { grid-template-columns: repeat(3, 1fr); }
    .stats-page .st-cities-wrap { grid-template-columns: 1fr; }
    .stats-page .st-cityday { margin-top: 16px; }
    .stats-page .st-chart2-y { width: 28px; height: 140px; }
    .stats-page .st-chart2-plot { height: 140px; }
    .stats-page .st-chart2-plain .st-chart2-plot { height: 170px; }
}
@media (max-width: 560px) {
    .stats-page .st-stats, .stats-page .st-stats.three { grid-template-columns: 1fr; }
    .stats-page .st-brow { grid-template-columns: minmax(110px, 1fr) 1fr 56px; font-size: 12.5px; }
    .stats-page .st-brow .bn .cthumb { width: 38px; height: 23px; }
    .stats-page .st-rrow { grid-template-columns: 26px 22px 1fr; gap: 9px; padding: 11px 12px; }
}
