.ranking-wrapper {
    max-width: 400px;
    margin: 0 auto;
    color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ranking-wrapper h3 {
    text-align: center;
    color: #f0c040;
    margin-bottom: 15px;
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 0 5px rgba(240, 192, 64, 0.05);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
}

.ranking-item:hover,
.ranking-item:focus-within {
    background: #2a2a2a;
    box-shadow: 0 0 8px rgba(240, 192, 64, 0.15);
}

.position {
    font-weight: 700;
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
    user-select: none;
}

/* ✅ Naprawiony styl dla nicków */
.nickname {
    flex-grow: 1;
    font-weight: 600;
    font-size: 1.1rem;
    position: relative;
    outline: none;
    display: inline-block;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Tooltip on hover/focus for nickname */
.nickname[title]:hover::after,
.nickname[title]:focus::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(240, 192, 64, 0.9);
    color: #000;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.85rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.nickname[title]::after {
    content: '';
    opacity: 0;
    pointer-events: none;
}

.level-bar {
    position: relative;
    min-width: 100px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: visible;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.7);
    cursor: default;
}

/* Tooltip with exp */
.level-bar:hover::after,
.level-bar:focus::after {
    content: attr(data-exp);
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(240, 192, 64, 0.9);
    color: #000;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.85rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 1;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.level-bar::after {
    content: '';
    opacity: 0;
    pointer-events: none;
}

.level-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(240, 192, 64, 0.5) 0%, rgba(212, 168, 50, 0.5) 100%);
    border-radius: 10px 0 0 10px;
    transition: width 0.6s ease;
}

.level-text {
    position: relative;
    z-index: 2;
    font-weight: 700;
    color: #000;
    padding: 0 8px;
    font-size: 0.9rem;
    user-select: none;
    line-height: 20px;
}

/* Subtelniejsze stylizacje TOP 3 */
.top-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.5), rgba(255, 234, 112, 0.5));
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}
.top-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.4), rgba(224, 224, 224, 0.4));
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.2);
}
.top-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.4), rgba(229, 176, 122, 0.4));
    box-shadow: 0 0 8px rgba(205, 127, 50, 0.25);
}
