/* global.css — общие стили для всех страниц (ratings, admin, guide) */

/* ── Site header ───────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(11, 11, 11, 0.5) !important;
  backdrop-filter: blur(40px) !important;
  -webkit-backdrop-filter: blur(40px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.3) !important;
}
.site-header-inner {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 72px;
  box-sizing: border-box;
}
.hdr-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #e0e0e0;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  flex: none;
}
.hdr-logo:hover {
  color: #fff;
}
/* Логотип: Gilroy / размер как в макете рейтинга */
.hdr-logo-text {
  color: #c9c9c9 !important;
  font-family: 'Gilroy', 'Inter', system-ui, sans-serif !important;
  font-weight: 800 !important;
  font-size: 22px !important;
  letter-spacing: 0.01em !important;
}
.hdr-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.hdr-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
/* Переключатель языков */
.lang-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.lang-btn {
  background: transparent;
  color: #888;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.04em;
  line-height: 1;
}
.lang-btn:hover {
  color: rgba(255, 255, 255, 0.75);
}
.lang-btn.lang-btn--active {
  background: rgba(198, 40, 40, 0.35) !important;
  color: #ffcdd2 !important;
}
/* Кнопка колокольчика */
#bell-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#bell-icon-img {
  display: block;
  flex-shrink: 0;
}
#bell-badge {
  box-shadow: 0 0 0 2px #050505;
}
#auth-skeleton {
  flex-shrink: 0;
}
#logged-user {
  align-items: center;
}
#user-avatar {
  flex-shrink: 0;
}
#user-greeting {
  min-width: 0;
}
/* Кнопка «Гайд» */
.hdr-guide-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(2, 37, 47, 0.4);
  border: 1px solid rgba(7, 129, 161, 0.4);
  color: #0781a1;
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}
.hdr-guide-btn:hover {
  background: rgba(2, 37, 47, 0.7);
}
/* Профиль / выход */
.hdr-profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(198, 40, 40, 0.1) !important;
  border: 1px solid rgba(198, 40, 40, 0.3) !important;
  color: #ef9a9a !important;
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.hdr-profile-btn:hover {
  background: rgba(198, 40, 40, 0.2) !important;
}
.hdr-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.hdr-logout-btn:hover {
  border-color: #ef5350;
  background: rgba(239, 83, 80, 0.1);
}
#user-greeting b {
  color: #fff;
  font-weight: 600;
}
@media (max-width: 768px) {
  .site-header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }
  .hdr-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  #user-greeting {
    display: none !important;
  }
  .hdr-logo-text {
    display: none !important;
  }
}
@media (max-width: 640px) {
  .hdr-logo-text {
    display: none;
  }
  #user-greeting {
    display: none !important;
  }
  /* На мобильном показываем кнопки профиля/выхода, но скрываем текст — только иконка */
  #btn-profile-me span[data-i18n],
  #btn-logout span[data-i18n] {
    display: none !important;
  }
  #btn-find-me span.hidden {
    display: inline !important;
  }
}

/* ── No-reflow: nav-ссылки и кнопки с data-i18n внутри flex-контейнеров
      не должны менять ширину при смене языка ──────────────────────────────── */
a[data-i18n], button[data-i18n] {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Base / reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  min-height: 100vh !important;
  height: auto !important;
}

body {
  background-color: #09090f;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: #e0e0e0;
}

/* ── Glass card ─────────────────────────────────────────────────────────────── */
.glass {
  background: rgba(67, 66, 66, 0.3) !important;
  border: 0.3px solid #4D4D4D !important;
  border-radius: 30px !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .35), inset 0 1px 0 1px rgba(255, 255, 255, .07) !important;
}

/* Тонкий золотой скролл (витрина ачивок на рейтинге, история арен в профиле) */
.gold-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 183, 77, 0.7) rgba(255, 255, 255, 0.06);
}
.gold-scrollbar::-webkit-scrollbar {
  width: 7px;
}
.gold-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
}
.gold-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 204, 102, 0.85), rgba(255, 152, 60, 0.55));
  border-radius: 99px;
  border: 1px solid rgba(9, 9, 15, 0.5);
}
.gold-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 220, 130, 0.95), rgba(255, 170, 90, 0.75));
}

/* ── Typography helpers ─────────────────────────────────────────────────────── */
.frac { font-size: .75em; opacity: .7; }

.pos  { color: #4ade80; }
.neg  { color: #f87171; }
.zero { color: #9ca3af; }

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);    }
}
@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Game label: #code — «lobby» marquee ────────────────────────────────────── */
@keyframes game-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Контейнер: код всегда виден, название прокручивается если не влезает */
.game-label-wrap {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  vertical-align: middle;
  overflow: hidden;
}
.game-label-wrap .game-label-code {
  flex-shrink: 0;
  white-space: nowrap;
}
.game-label-wrap .game-label-sep {
  flex-shrink: 0;
  opacity: .45;
  margin: 0 3px;
  white-space: nowrap;
}
/* Область прокрутки — только название; затухание только справа */
.game-label-wrap .game-label-clip {
  overflow: hidden;
  min-width: 0;
  max-width: 160px;
  flex: 0 1 160px;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 12px), transparent 100%);
}
.game-label-wrap .game-label-inner {
  display: inline-block;
  white-space: nowrap;
}
.game-label-wrap .game-label-inner.marquee-active {
  animation: game-marquee 9s linear infinite;
}
.game-label-wrap .game-label-gap {
  display: inline-block;
  min-width: 160px;
}
/* Для коротких названий — без анимации, просто ellipsis */
.game-label-wrap.no-marquee .game-label-inner {
  animation: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255, 255, 255, .1);
  border-top-color: #7c5cbf;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 24px auto;
}

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast {
  display: none;
  position: fixed; bottom: 24px; right: 24px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600; font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
#toast.ok  { background: #1a472a; color: #4ade80; border: 1px solid #166534; }
#toast.err { background: #4c1d1d; color: #f87171; border: 1px solid #991b1b; }

/* ── Modal backdrop ─────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #0f0f1a;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  padding: 24px;
  max-width: 520px; width: 90%;
  max-height: 80vh; overflow-y: auto;
  animation: modal-in .2s ease;
}

/* ── Leaderboard rows ────────────────────────────────────────────────────────── */
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
  transition: background .15s;
}
.lb-row:hover { background: rgba(255, 255, 255, .04); }
.lb-row--me   { background: rgba(124, 92, 191, .15); border: 1px solid rgba(124, 92, 191, .3); }

.lb-rank  { width: 32px; text-align: right; font-weight: 700; font-size: 13px; color: #888; flex-shrink: 0; }
.lb-name  { flex: 1; font-weight: 500; color: #e0d0ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 700; font-size: 13px; min-width: 70px; text-align: right; }
.lb-games { color: #666; font-size: 11px; min-width: 50px; text-align: right; flex-shrink: 0; }
.lb-empty { color: #666; text-align: center; padding: 24px; font-size: 13px; }

/* ── Achievement pills ───────────────────────────────────────────────────────── */
.ach-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
  font-size: 12px; opacity: .5; transition: opacity .2s, border-color .2s;
  cursor: default;
}
.ach-pill--unlocked {
  opacity: 1;
  border-color: rgba(124,92,191,.4);
  background: rgba(124,92,191,.12);
}
.ach-icon { font-size: 14px; }
.ach-name { color: #e0d0ff; font-weight: 500; }
.ach-pts  { color: #9d7fe0; font-weight: 700; font-size: 11px; }

/* ── Button base ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 10px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:hover    { opacity: .85; }
.btn:active   { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: #7c5cbf; color: #fff; }
.btn-ghost   { background: rgba(255,255,255,.07); color: #ccc; border: 1px solid rgba(255,255,255,.1); }
.btn-danger  { background: rgba(244,67,54,.15); color: #f87171; border: 1px solid rgba(244,67,54,.2); }

/* ══ Ratings: центральная зона вкладок / период (классы hdr-* в разметке lb-card) ══ */
.hdr-center-zone {
  flex: none;
  margin-left: 30px;
  display: flex;
  align-items: center;
}
.hdr-center-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hdr-tabs-wrap {
  flex: none;
  display: flex;
  align-items: center;
}
.hdr-tabs {
  display: flex;
  gap: 1px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hdr-tabs::-webkit-scrollbar {
  display: none;
}

.ratings-page .hdr-center-zone {
  display: none !important;
}

.lb-card-header .hdr-tabs {
  flex-shrink: 0;
  order: 1;
}

.ratings-page .lb-card-header .hdr-tabs,
.ratings-page .lb-card-header .lb-search-inner,
.ratings-page .lb-card-header .lb-friends-pill-wrap,
.ratings-page #friends-toggle.friends-toggle-sr {
  height: var(--lb-header-control-h);
  box-sizing: border-box;
}

.ratings-page .lb-card-header .hdr-tabs,
.ratings-page .lb-card-header .lb-friends-pill-wrap {
  align-items: center;
}

.ratings-page .hdr-tabs {
  background: rgba(26, 26, 26, 0.56) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 99px !important;
  padding: 3px !important;
  gap: 1px !important;
}

.lb-card-header .lb-card-right {
  order: 2;
  flex-shrink: 0;
}
.lb-card-header .lb-search-outer {
  order: 3;
  flex: 1 1 auto;
  min-width: 160px;
}

@media (max-width: 640px) {
  .hdr-center-zone {
    order: 10;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    padding-bottom: 4px;
    overflow-x: auto;
  }
  .hdr-center-group {
    gap: 16px;
  }
  .hdr-tabs-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .lb-card-header .hdr-tabs {
    overflow-x: auto;
    flex-shrink: 1;
    min-width: 0;
  }
}

/* Динамическая маска для скролла (viewer: история арен, витрина; ratings: витрина ачивок) */
@property --mask-top {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}
@property --mask-bottom {
  syntax: '<length>';
  inherits: false;
  initial-value: 24px;
}
.fade-scroll-mask {
  --mask-top: 0px;
  --mask-bottom: 24px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black var(--mask-top), black calc(100% - var(--mask-bottom)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black var(--mask-top), black calc(100% - var(--mask-bottom)), transparent 100%);
  transition: --mask-top 0.2s ease, --mask-bottom 0.2s ease;
}
.fade-scroll-mask.is-scrolled-top { --mask-top: 24px; }
.fade-scroll-mask.is-scrolled-bottom { --mask-bottom: 0px; }

/* После отрисовки списков вызывайте initSmartScrollFade(container) из shared/utils.js */

/* Hover карточек: inset box-shadow вместо смены border-color — см. viewer.css (.ach-item, .stat-tile, .gh-row, .arena-acc) и ratings .arena-acc-card */

/* VIP glass overlay (графики, мета, детали игры) */
.vip-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  box-sizing: border-box;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.vip-lock-overlay .vip-lock-emoji {
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 1rem;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.vip-lock-overlay .vip-lock-heading {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 4px;
  max-width: 280px;
}
.vip-lock-overlay .vip-lock-sub {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  margin-bottom: 20px;
  padding: 0 8px;
  max-width: 280px;
  line-height: 1.45;
}

/* Универсальная кнопка VIP (оверлеи, модалки, тизеры) */
.vip-action-btn,
.vip-lock-overlay .vip-lock-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 24px !important;
  background: transparent !important;
  color: #B89C26 !important;
  border: 1.5px solid #B89C26 !important;
  border-radius: 30px !important;
  font-family: 'Inter', sans-serif;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.vip-action-btn:hover,
.vip-lock-overlay .vip-lock-btn:hover {
  background: rgba(184, 156, 38, 0.1) !important;
  transform: translateY(-1px);
  opacity: 1 !important;
}

.vip-action-btn img,
.vip-lock-overlay .vip-lock-btn img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

/* VIP CTA в оверлее — как profile-action-btn по размеру, золотая обводка */
.vip-lock-overlay .vip-action-btn.vip-lock-cta {
  padding: 6px 12px !important;
  border-radius: 15px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 16px !important;
  gap: 6px !important;
  border-width: 1px !important;
}
.vip-lock-overlay .vip-action-btn.vip-lock-cta img {
  width: 14px !important;
  height: 14px !important;
}

/* Кнопка VIP в модалке арены (отдельный класс) */
.arm-vip-cta.vip-action-btn {
  box-shadow: none !important;
}

/* Замок на закрытых / секретных ачивках — компактный индикатор (не растягивается во flex/grid) */
.ach-lock-icon {
  width: 24px !important;
  height: 24px !important;
  flex: none !important;
  opacity: 0.3;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1;
  object-fit: contain;
}
img.ach-lock-icon {
  display: block;
  padding: 0;
}
