/* ===== ГЛАВНАЯ СТРАНИЦА (index.html) ===== */
body {
    margin: 0;
    background: radial-gradient(circle at 50% 30%, #1a1a1a 0%, #000 70%);
    color: #fff;
    font-family: Arial, sans-serif;
    min-height: 100vh;   /* было height: 100vh */
    overflow-x: hidden;  /* было overflow: hidden */
    position: relative;
}

#dust-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.coin-counter {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    font-size: 48px;
    font-weight: bold;
}

.dollar {
    color: #FFD700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.game-area {
    position: relative;
    z-index: 2;
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.clicker-image {
    width: 250px;
    height: 250px;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.3));
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
}

.clicker-wrap {
    -webkit-tap-highlight-color: transparent;
}

* {
    -webkit-tap-highlight-color: transparent;
}

.clicker-image.clicked {
    transform: scale(0.9);
}

/* ===== КНОПКА "В БОЙ" ===== */
.battle-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.battle-btn {
    flex: none;
    padding: 24px 70px;
    font-size: 24px;
    border-radius: 44px;
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.55);
}

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 3;
    display: flex;
    justify-content: space-around;
    background-color: #0d0d0d;
    border-top: 1px solid #FFD700;
    padding: 10px 0 14px 0;
    box-sizing: border-box;
}

.nav-btn {
    background: none;
    border: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
    font-family: Arial, sans-serif;
}

.nav-btn svg {
    transition: filter 0.2s;
}

.nav-btn.active,
.nav-btn:hover {
    color: #FFD700;
}

.nav-btn.active svg {
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.7));
}

/* ===== КНОПКА-ВОПРОС (help) ===== */
.help-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 4;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid #FFD700;
    color: #FFD700;
    font-weight: bold;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.help-btn:hover {
    background-color: rgba(255, 215, 0, 0.1);
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 46px;
    right: 0;
    background-color: #111;
    color: #FFD700;
    border: 1px solid #FFD700;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    transition: opacity 0.2s;
    font-weight: normal;
}

.help-btn:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.help-frame {
    background-color: #111;
    border: 1px solid #FFD700;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.1);
    color: #eee;
    line-height: 1.6;
}

.back-btn {
    margin-top: 0;
    background: none;
    border: 1px solid #FFD700;
    color: #FFD700;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.back-btn:hover {
    background-color: rgba(255, 215, 0, 0.1);
}

.btn {
    flex: 1;
    padding: 13px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, opacity 0.15s;
}

.btn:hover {
    opacity: 0.85;
}

.btn:active {
    transform: scale(0.97);
}

.btn-gold {
    background-color: #FFD700;
    color: #000;
}

.btn-outline {
    background-color: transparent;
    color: #FFD700;
    border: 1px solid #FFD700;
}

.error-text {
    color: #ff5555;
    text-align: center;
    margin-top: 16px;
    margin-bottom: 0;
    font-size: 14px;
}

.social-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #FFD700;
    color: #FFD700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.15s;
}

.social-btn:hover {
    background-color: rgba(255, 215, 0, 0.1);
    transform: scale(1.08);
}

/* ===== КНОПКА РЕЙТИНГА НА ГЛАВНОЙ ===== */
.leader-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 4;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid #FFD700;
    color: #FFD700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.leader-btn:hover {
    background-color: rgba(255, 215, 0, 0.1);
}
.leader-list {
    max-width: 400px;
    margin: 30px auto 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leader-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background-color: #111;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 14px 18px;
}

.leader-row-me {
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.leader-rank {
    color: #FFD700;
    font-weight: bold;
    width: 24px;
    text-align: center;
}

.leader-name {
    flex: 1;
    color: #fff;
}

.leader-coins {
    color: #FFD700;
    font-weight: bold;
}

.loading-text {
    text-align: center;
    color: #888;
}

/* ===== МОДАЛКА СОЗДАНИЯ ЮЗЕРНЕЙМА ===== */
.username-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.username-box {
    background-color: #111;
    border: 1px solid #FFD700;
    border-radius: 16px;
    padding: 32px;
    max-width: 340px;
    width: 100%;
    text-align: center;
}

.username-box h2 {
    color: #FFD700;
    margin: 0 0 8px 0;
}

.username-box p {
    color: #ccc;
    font-size: 14px;
    margin: 0 0 20px 0;
}

.username-box input {
    width: 100%;
    padding: 12px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.username-box input:focus {
    outline: none;
    border-color: #FFD700;
}

.whatsapp-btn { color: #25D366; border-color: #25D366; }
.whatsapp-btn:hover { background-color: rgba(37, 211, 102, 0.1); }

.telegram-btn { color: #29B6F6; border-color: #29B6F6; }
.telegram-btn:hover { background-color: rgba(41, 182, 246, 0.1); }

.viber-btn { color: #7B519D; border-color: #7B519D; }
.viber-btn:hover { background-color: rgba(123, 81, 157, 0.1); }

.lang-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.lang-picker-box {
    background-color: #111;
    border: 1px solid #FFD700;
    border-radius: 16px;
    padding: 32px;
    max-width: 340px;
    width: 100%;
    text-align: center;
}

.lang-picker-box h2 {
    color: #FFD700;
    font-size: 17px;
    line-height: 1.5;
    margin: 0 0 24px 0;
    font-weight: normal;
}

.lang-selector-btn {
    width: 100%;
    background-color: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s;
}

.lang-selector-btn:hover {
    border-color: #FFD700;
}

.lang-selector-flag {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
}

.lang-selector-btn span:nth-child(2) {
    flex: 1;
    text-align: left;
}

.lang-selector-arrow {
    color: #888;
}

.lang-dropdown-list {
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 6px;
}

.lang-dropdown-item {
    background: none;
    border: none;
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    transition: background-color 0.2s;
}

.lang-dropdown-item:hover {
    background-color: rgba(255, 215, 0, 0.1);
}

.lang-dropdown-flag {
    width: 22px;
    height: 22px;
    object-fit: cover;
    border-radius: 4px;
}

.lang-continue-btn {
    width: 100%;
    margin-top: 20px;
}
.hidden {
    display: none !important;
}

/* ===== КНОПКА "ДРУЗЬЯ" (index.html) ===== */
.friends-btn {
    position: fixed;
    top: 76px;
    left: 20px;
    z-index: 4;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid #FFD700;
    color: #FFD700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.friends-btn:hover {
    background-color: rgba(255, 215, 0, 0.1);
}

.articles-btn {
    position: fixed;
    top: 132px;
    left: 20px;
    z-index: 4;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid #FFD700;
    color: #FFD700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.articles-btn:hover {
    background-color: rgba(255, 215, 0, 0.1);
}

.articles-btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.friends-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background-color: #EF5350;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    line-height: 16px;
    box-shadow: 0 0 6px rgba(239, 83, 80, 0.6);
}

/* ======================================================================
   ГЛАВНАЯ СТРАНИЦА — ПРЕМИУМ-РЕДИЗАЙН
   Всё ниже работает только внутри <body class="home-page"> (index.html),
   поэтому не задевает другие страницы, которые переиспользуют те же
   классы: .bottom-nav, .nav-btn, .help-btn, .friends-btn, .btn-gold и т.д.
   ====================================================================== */

body.home-page {
    --gold: #FFD700;
    --gold-soft: rgba(255, 215, 0, 0.35);
    --gold-dim: rgba(255, 215, 0, 0.16);
    --cyan: #38bdf8;
    --cyan-soft: rgba(56, 189, 248, 0.32);
    --glass: rgba(255, 255, 255, 0.06);
    --font-display: 'Orbitron', 'Segoe UI', Arial, sans-serif;
    --font-body: 'Rajdhani', 'Segoe UI', Arial, sans-serif;

    background: #05060a;
    font-family: var(--font-body);
}

/* Единый контейнер контента: ровно высота экрана (с учётом мобильного dvh),
   сверху отступ под фиксированные иконки шапки, снизу — под плавающий nav.
   justify-content: space-evenly сам распределяет промежутки, поэтому ничего
   не "проваливается" вниз и не требует скролла на телефоне. */
body.home-page .home-content {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    gap: 10px;
    padding: 26px 16px 92px;
    box-sizing: border-box;
}

@keyframes homeFadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- анимированный "аврора" фон ---------- */
body.home-page .home-aurora {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
body.home-page .home-aurora::before,
body.home-page .home-aurora::after {
    content: "";
    position: absolute;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.32;
    animation: homeAuroraDrift 18s ease-in-out infinite alternate;
}
body.home-page .home-aurora::before {
    top: -20%;
    left: -12%;
    background: radial-gradient(circle, var(--gold-soft), transparent 65%);
}
body.home-page .home-aurora::after {
    bottom: -26%;
    right: -16%;
    background: radial-gradient(circle, var(--cyan-soft), transparent 65%);
    animation-delay: -9s;
}
@keyframes homeAuroraDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(6%, 8%) scale(1.15); }
}

/* ---------- иконки шапки: help / рейтинг / друзья (флаг языка не трогаем — прежний вид) ---------- */
body.home-page .help-btn,
body.home-page .friends-btn,
body.home-page .articles-btn,
body.home-page .leader-btn {
    background: var(--glass);
    border: 1px solid var(--gold-dim);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
body.home-page .leader-btn svg,
body.home-page .friends-btn svg,
body.home-page .articles-btn svg {
    width: 24px;
    height: 24px;
}
body.home-page .help-btn:hover,
body.home-page .friends-btn:hover,
body.home-page .articles-btn:hover,
body.home-page .leader-btn:hover {
    transform: translateY(-2px) scale(1.06);
    border-color: var(--gold);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4), 0 0 16px var(--gold-soft);
}
body.home-page .tooltip {
    backdrop-filter: blur(6px);
}

/* Флаг языка — прежний простой вид (как было раньше, без "стеклянного" стиля) */
#langFlagBtn {
    position: fixed;
    width: 34px;
    height: 24px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    background: #fff;
    cursor: pointer;
    z-index: 1000;
}
#langFlagBtn img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- юзернейм + кубки ---------- */
body.home-page #usernameDisplay {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--gold-dim);
    border-radius: 999px;
    padding: 8px 18px;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    font-family: var(--font-display);
    font-size: clamp(13px, 3.2vw, 16px);
    animation: homeFadeInUp 0.6s ease both;
}
body.home-page .cups-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3px 10px;
    border-radius: 999px;
}
body.home-page .cups-badge .cups-icon {
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
}

/* ---------- счётчик монет ---------- */
body.home-page .coin-counter {
    font-family: var(--font-display);
    font-size: clamp(32px, 8vw, 52px);
    width: fit-content;
    margin: -26px auto 0;
    padding: 0.28em 0.6em;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.22em;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--gold-dim);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255, 215, 0, 0.05);
    perspective: 200px;
    animation: homeFadeInUp 0.6s ease 0.05s both, homeCoinGlow 3.2s ease-in-out infinite;
}
/* Золотая монетка: градиентный диск, а не эмодзи (чтобы не показывался "квадратик"
   на телефонах, где нет нужного эмодзи-шрифта) — крутится вокруг вертикальной оси. */
body.home-page .coin-counter::before {
    content: "";
    width: 0.62em;
    height: 0.62em;
    flex: none;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 28%, #fff8d6 0%, #FFE477 22%, #FFD700 55%, #B8860B 100%);
    box-shadow: 0 0 10px var(--gold-soft), inset 0 0 6px rgba(255, 255, 255, 0.55), inset 0 0 2px rgba(120, 84, 0, 0.6);
    animation: homeCoinSpin 2.2s linear infinite;
}
body.home-page .dollar {
    display: none;
}
@keyframes homeCoinSpin {
    0%   { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}
@keyframes homeCoinGlow {
    0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255, 215, 0, 0.05); }
    50%      { box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), inset 0 0 30px rgba(255, 215, 0, 0.14); }
}

/* ---------- колобок-кликер: пьедестал, свечение, парение ---------- */
body.home-page .game-area {
    position: relative;
    height: auto;
    gap: clamp(14px, 4vh, 28px);
}
body.home-page .clicker-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: homeFloat 4s ease-in-out infinite;
}
body.home-page .clicker-image {
    width: clamp(260px, 78vw, 440px);
    height: clamp(260px, 78vw, 440px);
    position: relative;
    z-index: 1;
}
body.home-page .clicker-wrap::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(270px, 82vw, 460px);
    height: clamp(270px, 82vw, 460px);
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold-soft), transparent 70%);
    filter: blur(4px);
    animation: homePedestalPulse 2.6s ease-in-out infinite;
    z-index: 0;
}
body.home-page .clicker-wrap::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(140px, 38vw, 210px);
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.6), transparent 70%);
    z-index: 0;
}
@keyframes homeFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}
@keyframes homePedestalPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 0.85; transform: translate(-50%, -50%) scale(1.08); }
}

/* всплывающая "+1" и кольцо-импульс в точке тапа по колобку */
.home-click-burst {
    position: fixed;
    z-index: 5;
    pointer-events: none;
    font-family: 'Orbitron', Arial, sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    animation: homeBurstFloat 0.9s ease-out forwards;
}
@keyframes homeBurstFloat {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    15%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -160%) scale(1.15); }
}
.home-click-ring {
    position: fixed;
    z-index: 4;
    pointer-events: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.8);
    transform: translate(-50%, -50%);
    animation: homeRingPulse 0.5s ease-out forwards;
}
@keyframes homeRingPulse {
    0%   { opacity: 0.9; width: 20px; height: 20px; }
    100% { opacity: 0; width: 150px; height: 150px; }
}

/* ---------- кнопка "В бой" ---------- */
body.home-page .battle-row {
    animation: homeFadeInUp 0.7s ease 0.15s both;
}
body.home-page .battle-btn {
    position: relative;
    overflow: hidden;
    font-family: var(--font-display);
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: clamp(14px, 3.5vh, 24px) clamp(38px, 12vw, 70px);
    font-size: clamp(17px, 4.2vw, 24px);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
body.home-page .battle-glove-icon {
    width: 100px;
    height: 60px;
    display: inline-block;
    vertical-align: middle;
}
body.home-page .battle-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: skewX(-20deg);
    animation: homeBtnShine 3.4s ease-in-out infinite;
}
@keyframes homeBtnShine {
    0%        { left: -60%; }
    40%, 100% { left: 130%; }
}
body.home-page .battle-btn:active {
    transform: scale(0.96);
}

/* ---------- нижняя навигация: плавающий стеклянный док ---------- */
body.home-page .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 14px;
    width: calc(100% - 32px);
    max-width: 420px;
    border-radius: 22px;
    background-color: rgba(13, 13, 13, 0.75);
    backdrop-filter: blur(14px);
    border: 1px solid var(--gold-dim);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 10px 6px 10px;
}
body.home-page .nav-btn {
    position: relative;
    font-family: var(--font-body);
    font-weight: 600;
}
body.home-page .nav-btn.active::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
}

/* ---------- футер (даём место под плавающую навигацию) ---------- */
body.home-page .legal-footer {
    padding: 10px 0 118px;
}
body.home-page .legal-footer a:hover {
    color: var(--gold);
}

@media (max-width: 380px) {
    body.home-page .home-content { padding: 22px 12px 84px; }
    body.home-page .bottom-nav { width: calc(100% - 20px); }
}

/* Низкие экраны (открытая клавиатура, старые телефоны в альбомной ориентации
   и т.п.) — сжимаем вертикальные отступы, чтобы всё осталось на одном экране. */
@media (max-height: 700px) {
    body.home-page .home-content { padding: 20px 16px 80px; gap: 8px; }
    body.home-page .game-area { gap: 10px; }
}
/* ---------- кнопка «ник + кубки» в цвете лиги ---------- */
body.home-page #usernameDisplay.lg-colored {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    gap: 10px;
    padding: 7px 14px 10px 9px;
    border: 1.5px solid var(--lg-line);
    background:
        linear-gradient(135deg, var(--lg-a) 0%, var(--lg-b) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0));
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.45),
        0 0 20px var(--lg-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 0 16px var(--lg-soft);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease, box-shadow 0.3s ease;
    animation: homeFadeInUp 0.6s ease backwards;
}
body.home-page #usernameDisplay.lg-colored > * {
    position: relative;
    z-index: 1;
}
/* блик, пробегающий по кнопке раз в несколько секунд */
body.home-page #usernameDisplay.lg-colored::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, rgba(255, 255, 255, 0.05) 55%, transparent 70%);
    transform: translateX(-130%);
    animation: lgShine 5.5s ease-in-out 1.2s infinite;
}
@keyframes lgShine {
    0%, 55% { transform: translateX(-130%); }
    100%    { transform: translateX(130%); }
}
body.home-page #usernameDisplay.lg-colored:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.5),
        0 0 32px var(--lg-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 0 18px var(--lg-soft);
}
body.home-page #usernameDisplay.lg-colored:active {
    transform: scale(0.97);
}
body.home-page #usernameDisplay.lg-colored:focus-visible {
    outline: 2px solid var(--lg-light);
    outline-offset: 3px;
}

body.home-page #usernameDisplay.lg-colored .lg-emblem {
    display: flex;
    width: 30px;
    height: 35px;
    flex: none;
    filter: drop-shadow(0 0 8px var(--lg-glow));
}
body.home-page #usernameDisplay.lg-colored .lg-emblem .lg-shield {
    display: block;
    width: 100%;
    height: 100%;
}
body.home-page #usernameDisplay.lg-colored .lg-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    line-height: 1.05;
}
body.home-page #usernameDisplay.lg-colored #usernameText {
    max-width: min(44vw, 190px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5), 0 0 12px var(--lg-glow);
}
body.home-page #usernameDisplay.lg-colored .lg-league-name {
    font-family: var(--font-body);
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--lg-light);
    white-space: nowrap;
}
body.home-page #usernameDisplay.lg-colored .cups-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    color: #fff;
    font-weight: 700;
    background: rgba(6, 8, 18, 0.55);
    border: 1px solid var(--lg-line);
    box-shadow: inset 0 0 10px var(--lg-soft);
}
body.home-page #usernameDisplay.lg-colored .lg-chevron {
    display: flex;
    width: 16px;
    height: 16px;
    flex: none;
    color: var(--lg-light);
    opacity: 0.8;
    transition: transform 0.2s ease;
}
body.home-page #usernameDisplay.lg-colored:hover .lg-chevron {
    transform: translateX(3px);
}
body.home-page #usernameDisplay.lg-colored .lg-chevron-svg {
    width: 100%;
    height: 100%;
}
/* тонкая полоска прогресса до следующего уровня — по нижнему краю кнопки */
body.home-page #usernameDisplay.lg-colored .lg-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.4);
}
body.home-page #usernameDisplay.lg-colored .lg-progress i {
    display: block;
    height: 100%;
    width: var(--lg-progress, 0%);
    background: linear-gradient(90deg, var(--lg-color), var(--lg-light));
    box-shadow: 0 0 8px var(--lg-glow);
    transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Мастер / Легенда — переливающаяся рамка */
body.home-page #usernameDisplay.lg-colored[data-league="master"] {
    border: 2px solid transparent;
    background:
        linear-gradient(135deg, #2b1247, #140a28) padding-box,
        linear-gradient(90deg, #c56bff, #ff6bd6, #6be3ff, #ffe66b, #c56bff) border-box;
    background-size: 100% 100%, 300% 100%;
    animation: homeFadeInUp 0.6s ease backwards, lgMasterFlow 6s linear infinite;
}
@keyframes lgMasterFlow {
    to { background-position: 0 0, 300% 0; }
}

/* ---------- окно лиг ---------- */
body.lg-noscroll { overflow: hidden; }

.lg-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 16px;
    background:
        radial-gradient(70% 50% at 50% 0%, var(--lg-soft), transparent 70%),
        rgba(4, 6, 16, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: var(--font-body, 'Rajdhani', 'Segoe UI', Arial, sans-serif);
    color: #eef1ff;
    opacity: 0;
    transition: opacity 0.22s ease;
}
.lg-overlay.lg-open { opacity: 1; }

.lg-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: min(88vh, 720px);
    max-height: min(88dvh, 720px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 24px;
    background: linear-gradient(180deg, #1a2040 0%, #0d1126 55%, #090c1c 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 70px var(--lg-soft), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transform: translateY(18px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.lg-overlay.lg-open .lg-box { transform: none; }
.lg-box::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 3;
    background: linear-gradient(90deg, transparent, var(--lg-color), var(--lg-light), var(--lg-color), transparent);
}

.lg-head {
    position: relative;
    flex: none;
    padding: 22px 20px 16px;
    background: radial-gradient(80% 130% at 50% -15%, var(--lg-a), transparent 70%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.lg-title {
    margin: 0 0 14px;
    font-family: var(--font-display, 'Orbitron', 'Segoe UI', Arial, sans-serif);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}
.lg-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.lg-close:hover { background: rgba(255, 255, 255, 0.16); transform: rotate(90deg); }
.lg-close svg { width: 16px; height: 16px; }

.lg-hero { display: flex; align-items: center; gap: 18px; }
.lg-emblem-big {
    position: relative;
    width: 68px;
    height: 80px;
    flex: none;
    animation: lgFloat 3.6s ease-in-out infinite;
}
.lg-emblem-big .lg-shield {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 16px var(--lg-glow));
}
.lg-halo {
    position: absolute;
    inset: -24px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--lg-glow), transparent 68%);
    animation: lgHalo 3.2s ease-in-out infinite;
}
.lg-hero-info { min-width: 0; }
.lg-current-name {
    font-family: var(--font-display, 'Orbitron', 'Segoe UI', Arial, sans-serif);
    font-weight: 800;
    font-size: clamp(20px, 6vw, 26px);
    line-height: 1.15;
    color: var(--lg-light);
    background: linear-gradient(180deg, #fff 0%, var(--lg-light) 55%, var(--lg-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.lg-current-cups {
    margin-top: 6px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    opacity: 0.92;
}

.lg-progress-wrap { margin-top: 18px; }
.lg-progress-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}
.lg-bar {
    height: 12px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}
.lg-bar-fill {
    position: relative;
    height: 100%;
    width: 0;
    overflow: hidden;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--lg-dark), var(--lg-color) 60%, var(--lg-light));
    box-shadow: 0 0 12px var(--lg-glow);
    transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s;
}
.lg-bar-fill::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: lgBarShine 2.4s linear infinite;
}
.lg-next {
    margin-top: 10px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--lg-light);
}

.lg-list {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 14px 14px 22px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.lg-group {
    flex: none;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.07);
    animation: lgIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 50ms + 80ms);
}
.lg-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 12px;
    background: linear-gradient(90deg, var(--lg-soft), transparent 80%);
}
.lg-group-head .lg-shield {
    width: 26px;
    height: 30px;
    flex: none;
    filter: drop-shadow(0 0 6px var(--lg-soft));
}
.lg-group-name {
    flex: 1;
    font-family: var(--font-display, 'Orbitron', 'Segoe UI', Arial, sans-serif);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: var(--lg-light);
}
.lg-group-total {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.55;
    font-variant-numeric: tabular-nums;
}
.lg-is-locked { opacity: 0.55; filter: saturate(0.55); }
.lg-is-current {
    border-color: var(--lg-line);
    box-shadow: 0 0 22px var(--lg-soft), inset 0 0 20px var(--lg-soft);
}

.lg-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.lg-pill {
    min-width: 34px;
    padding: 2px 8px;
    box-sizing: border-box;
    text-align: center;
    border-radius: 8px;
    font-family: var(--font-display, 'Orbitron', 'Segoe UI', Arial, sans-serif);
    font-weight: 800;
    font-size: 12px;
    color: var(--lg-light);
    background: var(--lg-soft);
    border: 1px solid var(--lg-line);
}
.lg-pill-dot { background: transparent; border-color: transparent; }
.lg-pill-dot::before { content: "•"; }
.lg-row-range { flex: 1; color: rgba(255, 255, 255, 0.85); }
.lg-row-passed .lg-row-range { color: rgba(255, 255, 255, 0.5); }
.lg-ico { width: 20px; height: 20px; flex: none; }
.lg-ico-lock { color: rgba(255, 255, 255, 0.4); }
.lg-row-current {
    background: linear-gradient(90deg,
        var(--lg-a) 0,
        var(--lg-a) var(--lg-row-progress, 0%),
        var(--lg-soft) var(--lg-row-progress, 0%),
        transparent 100%);
    box-shadow: inset 3px 0 0 var(--lg-color);
}
.lg-row-current .lg-row-range { color: #fff; }
.lg-here {
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #0b0e1a;
    background: linear-gradient(180deg, var(--lg-light), var(--lg-color));
    box-shadow: 0 0 12px var(--lg-glow);
    white-space: nowrap;
}

@keyframes lgFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes lgHalo  { 0%, 100% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes lgBarShine { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes lgIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 380px) {
    .lg-box { border-radius: 20px; }
    .lg-head { padding: 20px 16px 14px; }
    .lg-list { padding: 12px 10px 18px; }
    .lg-row { font-size: 16px; padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .lg-emblem-big, .lg-halo, .lg-bar-fill::after, .lg-group,
    body.home-page #usernameDisplay.lg-colored::before {
        animation: none !important;
    }
    body.home-page #usernameDisplay.lg-colored[data-league="master"] { animation: none; }
}
