/* ====================================================================
   top/top.css (НОВОГОДНЯЯ ВЕРСИЯ - ЛЕДЯНАЯ ТЕМА)
   ==================================================================== */

/* Новогодние переменные цвета */
:root {
    --newyear-primary: #4A7AB0;
    --newyear-secondary: #6A9AD0;
    --newyear-accent: #8AB5E0;
    --newyear-light: #A9D9F8;
    --newyear-gold: #E0FFFF;
    --newyear-silver: #C0D6FF;
    --newyear-bronze: #A0B6E0;
    --newyear-ice: rgba(224, 255, 255, 0.9);
    --newyear-dark: rgba(20, 30, 50, 0.95);
}

/* ОБНОВЛЕННАЯ ВЕРХНЯЯ ПАНЕЛЬ С FIXED */
.top-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    position: fixed; /* ИЗМЕНЕНО с absolute на fixed */
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    background: linear-gradient(180deg, 
        rgba(20, 30, 50, 0.98) 0%, 
        rgba(25, 40, 65, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid var(--newyear-primary);
    box-shadow: 
        0 5px 25px rgba(74, 122, 176, 0.3),
        inset 0 1px 0 rgba(138, 181, 224, 0.2);
    height: 70px; /* Фиксированная высота */
}

.back-button {
    background: rgba(106, 154, 208, 0.1);
    color: var(--newyear-light);
    border: 2px solid var(--newyear-accent);
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 
        0 0 15px rgba(138, 181, 224, 0.3),
        inset 0 0 10px rgba(224, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.back-button::before {
    content: '❄';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: linear-gradient(45deg, var(--newyear-secondary), var(--newyear-accent));
    color: white;
    transform: translateX(5px);
    box-shadow: 
        0 0 25px rgba(138, 181, 224, 0.6),
        0 0 15px rgba(224, 255, 255, 0.3);
    padding-right: 35px;
}

.back-button:hover::before {
    opacity: 1;
    right: 10px;
}

.top-page-title {
    text-align: center;
    font-size: 2.8em;
    margin: 20px 0 10px 0; /* ИСПРАВЛЕНО: Уменьшен отступ со 100px */
    background: linear-gradient(45deg, 
        var(--newyear-ice), 
        var(--newyear-light),
        var(--newyear-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 
        0 0 50px rgba(138, 181, 224, 0.6),
        0 0 25px rgba(169, 217, 248, 0.4),
        0 0 10px rgba(224, 255, 255, 0.3);
    position: relative;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% {
        text-shadow: 
            0 0 40px rgba(138, 181, 224, 0.5),
            0 0 20px rgba(169, 217, 248, 0.3),
            0 0 8px rgba(224, 255, 255, 0.2);
    }
    100% {
        text-shadow: 
            0 0 60px rgba(138, 181, 224, 0.7),
            0 0 35px rgba(169, 217, 248, 0.5),
            0 0 15px rgba(224, 255, 255, 0.4);
    }
}

.top-page-title::after {
    content: '🏆';
    position: absolute;
    font-size: 0.6em;
    top: -10px;
    right: -30px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
}

/* Основной контент */
.top-page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px 15px 100px; /* ИСПРАВЛЕНО: Уменьшено верхнее padding с 90px */
    position: relative;
}

/* БЛОК С ЗВЕЗДАМИ УДАЛЕН */

.ranking-table {
    background: linear-gradient(180deg,
        rgba(30, 45, 70, 0.9) 0%,
        rgba(35, 55, 85, 0.85) 100%);
    border-radius: 20px;
    padding: 15px;
    border: 2px solid rgba(138, 181, 224, 0.3);
    backdrop-filter: blur(10px);
    margin-top: 5px; /* ИСПРАВЛЕНО: Уменьшено с 20px */
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 30px rgba(74, 122, 176, 0.2),
        0 0 0 1px rgba(224, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.ranking-table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent,
        var(--newyear-accent),
        var(--newyear-light),
        var(--newyear-accent),
        transparent);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.table-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    padding: 15px;
    border-bottom: 2px solid rgba(138, 181, 224, 0.2);
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--newyear-ice);
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(40, 60, 100, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.table-header div:nth-child(2) {
    padding-left: 18px; /* Это двинет надпись "ИГРОК" вправо. Ставь больше, если надо сильнее. */
}

.table-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    padding: 12px 15px;
    background: rgba(45, 65, 95, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(138, 181, 224, 0.1);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    position: relative;
    overflow: hidden;
}

.table-row:hover {
    background: linear-gradient(90deg,
        rgba(74, 122, 176, 0.15),
        rgba(138, 181, 224, 0.1));
    transform: translateX(5px) scale(1.02);
    border-color: rgba(138, 181, 224, 0.3);
    box-shadow: 
        0 5px 20px rgba(74, 122, 176, 0.3),
        inset 0 0 20px rgba(224, 255, 255, 0.05);
}

.rank-number {
    font-size: 1.3em;
    font-weight: bold;
    height: 40px;
    width: 40px;
    border-radius: 50%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.rank-number-simple {
    margin-right: 0px; /* Регулируй число, чтобы увеличить или уменьшить отступ */
    min-width: 25px;    /* Чтобы цифры 10, 11 и т.д. не двигали аватарку */
    display: inline-block;
    text-align: center;
}

.rank-1 {
    background: linear-gradient(135deg, 
        rgba(224, 255, 255, 0.9) 0%,
        rgba(169, 217, 248, 0.8) 100%);
    border: 2px solid var(--newyear-ice);
    color: var(--newyear-dark);
    box-shadow: 
        0 0 25px rgba(224, 255, 255, 0.8),
        inset 0 0 15px rgba(255, 255, 255, 0.6),
        0 0 5px var(--newyear-ice);
    animation: pulseGold 2s infinite;
}

.rank-2 {
    background: linear-gradient(135deg, 
        rgba(192, 214, 255, 0.9) 0%,
        rgba(160, 182, 224, 0.8) 100%);
    border: 2px solid var(--newyear-silver);
    color: var(--newyear-dark);
    box-shadow: 
        0 0 20px rgba(192, 214, 255, 0.7),
        inset 0 0 12px rgba(255, 255, 255, 0.5);
}

.rank-3 {
    background: linear-gradient(135deg, 
        rgba(160, 182, 224, 0.9) 0%,
        rgba(128, 150, 192, 0.8) 100%);
    border: 2px solid var(--newyear-bronze);
    color: white;
    box-shadow: 
        0 0 15px rgba(160, 182, 224, 0.6),
        inset 0 0 10px rgba(255, 255, 255, 0.4);
}

@keyframes pulseGold {
    0%, 100% {
        box-shadow: 
            0 0 25px rgba(224, 255, 255, 0.8),
            inset 0 0 15px rgba(255, 255, 255, 0.6),
            0 0 5px var(--newyear-ice);
    }
    50% {
        box-shadow: 
            0 0 35px rgba(224, 255, 255, 1),
            inset 0 0 20px rgba(255, 255, 255, 0.8),
            0 0 10px var(--newyear-ice);
    }
}

.player-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-left: 15px;
}

.player-name {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.player-username {
    color: var(--newyear-silver);
    font-size: 0.9em;
    line-height: 1.2;
    opacity: 0.8;
}

.balance-cell {
    text-align: right;
    font-size: 1.3em;
    font-weight: bold;
    color: var(--newyear-ice);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    text-shadow: 
        0 0 10px rgba(224, 255, 255, 0.5),
        0 0 5px rgba(169, 217, 248, 0.3);
}

.balance-cell::before {
    content: '❄';
    font-size: 0.8em;
    opacity: 0.7;
}

.medal-icon {
    font-size: 1.8em;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.rank-1 .medal-icon {
    animation: medalGlow 2s infinite;
}

@keyframes medalGlow {
    0%, 100% { 
        filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)) 
                drop-shadow(0 0 5px rgba(224, 255, 255, 0.5));
    }
    50% { 
        filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)) 
                drop-shadow(0 0 15px rgba(224, 255, 255, 0.8));
    }
}

.loading-state {
    text-align: center;
    padding: 40px;
    color: var(--newyear-silver);
    font-size: 1.3em;
    background: rgba(45, 65, 95, 0.4);
    border-radius: 15px;
    border: 2px dashed rgba(138, 181, 224, 0.3);
}

.loading-state::after {
    content: '⏳';
    display: block;
    font-size: 2em;
    margin-top: 10px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-state {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
    font-size: 1.3em;
    background: rgba(45, 65, 95, 0.4);
    border-radius: 15px;
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--newyear-silver);
    font-style: italic;
    font-size: 1.2em;
    background: rgba(45, 65, 95, 0.4);
    border-radius: 15px;
    border: 2px dotted rgba(138, 181, 224, 0.2);
}

.empty-state::before {
    content: '🎄';
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
}

.stats-footer {
    margin-top: 15px; /* ИСПРАВЛЕНО: Уменьшено с 30px */
    text-align: center;
    color: var(--newyear-silver);
    font-size: 0.9em;
    padding: 15px;
    border-top: 1px solid rgba(138, 181, 224, 0.1);
    background: rgba(40, 60, 100, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.stats-footer::before {
    content: '📊';
    margin-right: 8px;
}

/* Анимации для строк таблицы */
@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.table-row:nth-child(1) { animation-delay: 0.1s; }
.table-row:nth-child(2) { animation-delay: 0.2s; }
.table-row:nth-child(3) { animation-delay: 0.3s; }
.table-row:nth-child(4) { animation-delay: 0.4s; }
.table-row:nth-child(5) { animation-delay: 0.5s; }
.table-row:nth-child(6) { animation-delay: 0.6s; }
.table-row:nth-child(7) { animation-delay: 0.7s; }
.table-row:nth-child(8) { animation-delay: 0.8s; }
.table-row:nth-child(9) { animation-delay: 0.9s; }
.table-row:nth-child(10) { animation-delay: 1s; }

/* Новогодние снежинки на заднем фоне */
.top-page-container::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(138, 181, 224, 0.3) 50%, transparent 50%),
        radial-gradient(2px 2px at 40px 70px, rgba(169, 217, 248, 0.2) 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 60px 20px, rgba(224, 255, 255, 0.25) 50%, transparent 50%),
        radial-gradient(2px 2px at 80px 50px, rgba(138, 181, 224, 0.3) 50%, transparent 50%),
        radial-gradient(2.5px 2.5px at 100px 90px, rgba(169, 217, 248, 0.2) 50%, transparent 50%);
    background-size: 120px 120px;
    z-index: -1;
    pointer-events: none;
    animation: snowfall 20s linear infinite;
}

@keyframes snowfall {
    0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 0 120px, 30px 120px, 60px 120px, 90px 120px, 120px 120px; }
}

/* Адаптивность */
@media (max-width: 768px) {
    .top-page-header {
        padding: 12px 15px;
        height: 65px;
    }
    
    .top-page-title {
        font-size: 2.2em;
        margin: 15px 0 10px 0; /* ИСПРАВЛЕНО: Уменьшено с 90px */
    }
    
    .top-page-container {
        padding: 10px 15px 90px; /* ИСПРАВЛЕНО: Уменьшено с 85px */
    }
    
    .ranking-table {
        margin-top: 5px; /* ИСПРАВЛЕНО: Уменьшено с 15px */
        padding: 10px;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 60px 1fr 100px;
        padding: 10px;
    }
    
    .rank-number {
        height: 35px;
        width: 35px;
        font-size: 1.1em;
    }
    
    .player-name {
        font-size: 1.1em;
    }
    
    .balance-cell {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .top-page-header {
        padding: 10px 12px;
        height: 60px;
    }
    
    .top-page-title {
        font-size: 1.8em;
        margin: 10px 0 10px 0; /* ИСПРАВЛЕНО: Уменьшено с 80px */
    }
    
    .top-page-container {
        padding: 5px 12px 80px; /* ИСПРАВЛЕНО: Уменьшено с 80px */
    }
    
    .back-button {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 50px 1fr 80px;
        padding: 8px;
        font-size: 0.9em;
    }
    
    .rank-number {
        height: 30px;
        width: 30px;
        font-size: 1em;
    }
}

/* Эффект для топ-3 игроков */
.table-row:nth-child(1) {
    border-left: 4px solid var(--newyear-ice);
}

.table-row:nth-child(2) {
    border-left: 4px solid var(--newyear-silver);
}

.table-row:nth-child(3) {
    border-left: 4px solid var(--newyear-bronze);
}

/* Эффект светящейся обводки при наведении на топ-3 */
.table-row:nth-child(1):hover {
    box-shadow: 
        0 5px 25px rgba(224, 255, 255, 0.4),
        inset 0 0 25px rgba(224, 255, 255, 0.1),
        0 0 5px var(--newyear-ice);
}

.table-row:nth-child(2):hover {
    box-shadow: 
        0 5px 25px rgba(192, 214, 255, 0.4),
        inset 0 0 25px rgba(192, 214, 255, 0.1),
        0 0 5px var(--newyear-silver);
}

.table-row:nth-child(3):hover {
    box-shadow: 
        0 5px 25px rgba(160, 182, 224, 0.4),
        inset 0 0 25px rgba(160, 182, 224, 0.1),
        0 0 5px var(--newyear-bronze);
}

/* ДОБАВЛЕНО: Чтобы контент не заезжал под fixed панель */
body {
    padding-top: 70px; /* Высота header */
}

@media (max-width: 768px) {
    body {
        padding-top: 65px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 60px;
    }
}

.user-rank-card {
    background: rgba(169, 217, 248, 0.1); /* Прозрачно-голубой */
    border: 1px solid rgba(169, 217, 248, 0.2);
    border-radius: 12px;
    padding: 8px 15px;
    margin-bottom: 10px;
    color: #A9D9F8;
    font-weight: bold;
    display: inline-block; /* Чтобы не на всю ширину, если не надо */
    width: 90%;
}

#my-rank-value {
    color: #fff;
    text-shadow: 0 0 8px rgba(169, 217, 248, 0.6);
}

/* Контейнер для аватара и текста */
.player-info-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1; /* Чтобы занимало все свободное место между рангом и балансом */
}

/* Сама аватарка */
.top-user-avatar, .top-user-avatar-placeholder {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(169, 217, 248, 0.3);
}

/* Стиль заглушки, если фото нет */
.top-user-avatar-placeholder {
    background: linear-gradient(45deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

/* Немного поправим отступы в строке таблицы */
.table-row {
    display: flex; /* Переключаем на flex, чтобы работали отступы */
    align-items: center;
    justify-content: space-between; /* Ранг слева, баланс справа */
    padding: 12px 15px;
    /* Убедись, что у тебя есть эти стили в top.css */
}

/* Контейнер для ника и иконки */
.name-badge-row {
    display: flex;
    align-items: center;
    gap: 8px; /* Чуть больше отступ */
}

/* Общий стиль для иконок */
.top-icon {
    width: 22px; /* Размер иконки */
    height: 22px;
    object-fit: contain;
}

/* Спецэффекты для иконки по твоей ссылке (ТОП-1) */
.first-place-gift {
    filter: drop-shadow(0 0 8px rgba(0, 198, 255, 0.6)); /* Синее свечение под цвет коробки */
    animation: giftBounce 2s infinite ease-in-out;
}

/* Анимация плавного "дыхания" иконки */
@keyframes giftBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Чтобы ник игрока не прижимался слишком сильно */
.player-name {
    font-weight: 700;
    color: #fff;
}

/* Исправляем наложение строк */
#ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Расстояние между игроками */
    padding: 10px 0;
}

/* Контейнер для ника и иконки */
.name-badge-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Спецэффекты для лидеров */
.rank-1 {
    background: rgba(255, 215, 0, 0.1) !important; /* Легкий золотистый фон для 1 места */
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
}

.first-place-gift {
    filter: drop-shadow(0 0 5px rgba(0, 198, 255, 0.8));
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Контейнер для имени и подарка */
.player-name-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Стиль для картинки-подарка */
.top-gift-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    vertical-align: middle;
}

/* Стиль для эмодзи-медалей */
.top-gift-emoji {
    font-size: 16px;
    line-height: 1;
}

/* Дополнительно: можно выделить строки ТОП-3 легким свечением */
.top-three-row {
    background: rgba(169, 217, 248, 0.15) !important;
    border: 1px solid rgba(169, 217, 248, 0.3) !important;
}