/* ========== ДОСТИЖЕНИЯ ========== */
#tab-achievements.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#tab-achievements h2 {
    flex-shrink: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
}

/* Видимый скроллбар */
.achievements-grid::-webkit-scrollbar {
    width: 8px;
}

.achievements-grid::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.achievements-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.achievements-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 4px;
    padding-right: 8px;
}

.achievement-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3px;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
    aspect-ratio: 1;
    justify-content: center;
}

.achievement-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.achievement-check {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-icon {
    font-size: 1.6em;
    line-height: 1;
}

.achievement-name {
    font-weight: 600;
    font-size: 0.65em;
    line-height: 1.1;
    color: #333;
}

.achievement-desc {
    font-size: 0.55em;
    color: #666;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.achievement-progress-text {
    font-size: 0.6em;
    color: #667eea;
    font-weight: 600;
}

.achievement-reward {
    font-size: 0.7em;
    color: #b8860b;
    font-weight: bold;
    margin-top: auto;
    padding-top: 2px;
}

/* ========== DESKTOP ========== */
@media (min-width: 500px) {
    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
    
    .achievement-item {
        padding: 10px 8px;
    }
    
    .achievement-icon {
        font-size: 2em;
    }
    
    .achievement-name {
        font-size: 0.75em;
    }
    
    .achievement-desc {
        font-size: 0.65em;
    }
    
    .achievement-progress-text {
        font-size: 0.7em;
    }
    
    .achievement-reward {
        font-size: 0.8em;
    }
    
    .achievement-check {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

@media (min-width: 650px) {
    .achievement-item {
        aspect-ratio: auto;
    }
    
    .achievement-reward {
        margin-top: 4px;
    }
}

@media (min-width: 900px) {
    .achievements-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
    }
    
    .achievement-item {
        padding: 12px 10px;
    }
    
    .achievement-icon {
        font-size: 2.2em;
    }
    
    .achievement-name {
        font-size: 0.8em;
    }
    
    .achievement-desc {
        font-size: 0.7em;
    }
    
    .achievement-progress-text {
        font-size: 0.75em;
    }
    
    .achievement-reward {
        font-size: 0.9em;
        margin-top: 4px;
    }
}

@media (min-width: 1200px) {
    .achievements-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .achievement-icon {
        font-size: 2.5em;
    }
    
    .achievement-reward {
        font-size: 1em;
    }
}

/* ========== ЗАДАНИЯ ========== */
#tab-quests.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quests-timer {
    text-align: center;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #666;
    flex-shrink: 0;
}

.quests-timer span:last-child {
    color: #e74c3c;
    font-weight: bold;
}

.quests-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 4px;
    padding-right: 8px;
}

/* Видимый скроллбар */
.quests-list::-webkit-scrollbar {
    width: 8px;
}

.quests-list::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.quests-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.quest-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3px;
    transition: all 0.2s;
    border: 2px solid transparent;
    position: relative;
    aspect-ratio: 1;
    justify-content: center;
}

.quest-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.quest-item.completed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
}

.quest-check {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quest-icon {
    font-size: 1.6em;
    line-height: 1;
}

.quest-name {
    font-weight: 600;
    font-size: 0.65em;
    line-height: 1.1;
    color: #333;
}

.quest-desc {
    font-size: 0.55em;
    color: #666;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quest-progress-num {
    font-size: 0.6em;
    color: #667eea;
    font-weight: 600;
}

.quest-reward {
    font-size: 0.7em;
    color: #b8860b;
    font-weight: bold;
    margin-top: auto;
    padding-top: 2px;
}

.no-quests {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 20px;
}

/* ========== DESKTOP ========== */
@media (min-width: 500px) {
    .quests-list {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
    
    .quest-item {
        padding: 10px 8px;
    }
    
    .quest-icon {
        font-size: 2em;
    }
    
    .quest-name {
        font-size: 0.75em;
    }
    
    .quest-desc {
        font-size: 0.65em;
    }
    
    .quest-progress-num {
        font-size: 0.7em;
    }
    
    .quest-reward {
        font-size: 0.8em;
    }
    
    .quest-check {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
}

@media (min-width: 650px) {
    .quest-item {
        aspect-ratio: auto;
    }
    
    .quest-reward {
        margin-top: 4px;
    }
}

@media (min-width: 900px) {
    .quests-list {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
    
    .quest-item {
        padding: 12px 10px;
    }
    
    .quest-icon {
        font-size: 2.2em;
    }
    
    .quest-name {
        font-size: 0.8em;
    }
    
    .quest-desc {
        font-size: 0.7em;
    }
    
    .quest-progress-num {
        font-size: 0.75em;
    }
    
    .quest-reward {
        font-size: 0.9em;
        margin-top: 4px;
    }
}

@media (min-width: 1200px) {
    .quests-list {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .quest-icon {
        font-size: 2.5em;
    }
    
    .quest-reward {
        font-size: 1em;
    }
}

/* ========== СЕЗОН ========== */
#tab-season.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.season-header-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    color: white;
    flex-shrink: 0;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.season-title {
    font-weight: bold;
    font-size: 1.1em;
}

.season-timer {
    font-size: 0.9em;
    opacity: 0.9;
}

.my-rank {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
}

@media (max-width: 450px) {
    .season-header-bar {
        justify-content: center;
    }
    
    .my-rank {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

.rank-icon {
    font-size: 1.2em;
}

.rank-pts {
    opacity: 0.8;
    font-size: 0.9em;
}

.season-content {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.season-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    min-width: 0;
}

.season-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    flex-shrink: 0;
}

.season-col-header:hover {
    background: linear-gradient(135deg, #667eea30, #764ba230);
}

.toggle-arrow {
    font-size: 0.8em;
    transition: transform 0.3s;
    display: none;
}

.season-col-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    min-height: 0;
}

.season-col-body::-webkit-scrollbar {
    width: 6px;
}

.season-col-body::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 3px;
}

.season-col-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3px;
}

/* Мобильная версия - вертикальные секции */
@media (max-width: 800px) {
    .season-content {
        flex-direction: column;
        overflow-y: auto;
        gap: 8px;
    }
    
    .season-column {
        flex: none;
    }
    
    .toggle-arrow {
        display: inline;
    }
    
    /* По умолчанию свёрнуты на мобилках */
    .season-column .season-col-body {
        display: none;
    }
    
    .season-column .toggle-arrow {
        transform: rotate(-90deg);
    }
    
    /* Развёрнутое состояние */
    .season-column.expanded .season-col-body {
        display: block;
        max-height: 250px;
    }
    
    .season-column.expanded .toggle-arrow {
        transform: rotate(0deg);
    }
}

/* Игроки лидерборда */
.player-leader-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

.player-leader-item:hover {
    transform: translateX(3px);
}

.player-leader-item.top-1 { background: linear-gradient(135deg, #FFD70050, #FFA50030); }
.player-leader-item.top-2 { background: linear-gradient(135deg, #C0C0C050, #A8A8A830); }
.player-leader-item.top-3 { background: linear-gradient(135deg, #CD7F3250, #B8733330); }

.leader-pos {
    font-weight: bold;
    width: 24px;
    text-align: center;
    font-size: 0.9em;
}

.leader-frame {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    flex-shrink: 0;
    border: 2px solid #666;
    background-image: url('/images/photo.png');
    background-size: cover;
    background-position: center;
}

.leader-frame.frame-default { border-color: #666; }
.leader-frame.frame-bronze { border-color: #CD7F32; }
.leader-frame.frame-silver { border-color: #C0C0C0; }
.leader-frame.frame-gold { border-color: #FFD700; }
.leader-frame.frame-platinum { border-color: #E5E4E2; }
.leader-frame.frame-diamond { border-color: #B9F2FF; box-shadow: 0 0 6px #B9F2FF; }
.leader-frame.frame-purple { border-color: #9400D3; }
.leader-frame.frame-champion { border-color: #FF00FF; box-shadow: 0 0 8px #FF00FF; }

/* Заменено на player-name-styled */
.player-leader-item .player-name-styled {
    flex: 1;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-pts {
    font-size: 0.75em;
    color: #666;
    min-width: 50px;
    text-align: right;
}

/* Кланы лидерборда */
.clan-leader-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

.clan-leader-item:hover {
    transform: translateX(3px);
}

.clan-leader-item.top-1 { background: linear-gradient(135deg, #FFD70050, #FFA50030); }
.clan-leader-item.top-2 { background: linear-gradient(135deg, #C0C0C050, #A8A8A830); }
.clan-leader-item.top-3 { background: linear-gradient(135deg, #CD7F3250, #B8733330); }

/* Подсветка своей позиции */
.player-leader-item.my-position,
.clan-leader-item.my-position {
    background: linear-gradient(135deg, #667eea30, #764ba230);
    border: 2px solid #667eea;
}

/* Разделитель в лидерборде */
.leaderboard-separator {
    text-align: center;
    font-size: 0.75em;
    color: #999;
    padding: 8px 0;
    margin: 4px 0;
    border-top: 1px dashed #ddd;
    border-bottom: 1px dashed #ddd;
}

.clan-emblem-small {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    flex-shrink: 0;
}

.clan-name-text {
    flex: 1;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clan-rating-num {
    font-size: 0.75em;
    color: #666;
}

/* Компактные ранги */
.rank-compact-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: white;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 0.8em;
}

.rank-compact-item.current {
    background: linear-gradient(135deg, #667eea30, #764ba230);
    border: 2px solid #667eea;
}

.rank-compact-item.reached {
    opacity: 0.6;
}

.rank-compact-icon {
    font-size: 1.2em;
}

.rank-compact-name {
    flex: 1;
}

.rank-compact-pts {
    color: #666;
    font-size: 0.9em;
}

/* Старые стили для совместимости */
.player-rank {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.player-rank h3 {
    margin-bottom: 20px;
    color: #333;
}

.rank-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.rank-icon {
    font-size: 4em;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.rank-points {
    color: #666;
    margin-bottom: 10px;
}

.rank-progress {
    height: 12px;
    background: #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.rank-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    border-radius: 6px;
    transition: width 0.5s;
}

/* ========== ЛИДЕРБОРД ========== */
.leaderboard {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.leaderboard h3 {
    margin-bottom: 20px;
    color: #333;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    transition: all 0.2s;
}

.leaderboard-item:hover {
    transform: translateX(5px);
}

.leaderboard-item.top-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
}

.leaderboard-item.top-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: white;
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    color: white;
}

.leaderboard-position {
    font-size: 1.5em;
    font-weight: bold;
    width: 40px;
    text-align: center;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-rank {
    font-size: 1.2em;
}

.leaderboard-points {
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

/* ========== ИНФОГРАФИКА РАНГОВ ========== */
.ranks-infographic {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.ranks-infographic h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3em;
}

.ranks-ladder {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rank-group {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.rank-group.reached {
    opacity: 1;
}

.rank-group.current {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transform: scale(1.02);
}

.rank-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    font-weight: bold;
}

.rank-group-icon {
    font-size: 1.5em;
}

.rank-group-name {
    font-size: 1.2em;
    color: #333;
}

.rank-group-tiers {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: #f9f9f9;
}

.rank-tier {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.rank-tier.reached {
    opacity: 1;
}

.rank-tier.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.tier-name {
    display: block;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 3px;
}

.tier-points {
    display: block;
    font-size: 0.85em;
    opacity: 0.8;
}

/* ========== СЕКЦИЯ КЛАНОВ В СЕЗОНЕ ========== */
.clans-leaderboard-section {
    margin-top: 30px;
}

.clans-leaderboard-section h3 {
    margin-bottom: 15px;
}

.no-quests, .no-ranks {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}
