/* Anime Wordle - Leaderboard widget styles
 * Loaded by every game page via <link rel="stylesheet" href="shared/leaderboard.css">.
 * Reuses CSS variables defined inline by each game page (--bg-card,
 * --bg-dropdown, --accent-sky, --accent-ocean, --color-correct,
 * --color-close, --color-incorrect, --text-primary, --text-secondary).
 *
 * Visual language matches the auth dropdown / celebration modal —
 * deep ocean panel, soft sky border, no nested cards.
 */

.leaderboard-slot {
    /* Desktop (>=1500px): pinned to the right of the centered 900px game
     * container. Below that we collapse to a static column under the game
     * (see media query below) so the rail never overlaps the gameplay area.
     */
    position: fixed;
    top: 96px;
    right: 20px;
    width: 300px;
    max-width: calc(100vw - 40px);
    z-index: 30;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary, #F5F5F0);
}

.lb-panel {
    background: rgba(20, 60, 100, 0.92);
    border: 1px solid rgba(91, 164, 212, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 14px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.lb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.lb-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary, #F5F5F0);
    letter-spacing: 0.01em;
}

.lb-info-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1px solid rgba(91, 164, 212, 0.4);
    border-radius: 50%;
    color: var(--text-primary, #F5F5F0);
    cursor: pointer;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}
.lb-info-btn:hover {
    background: rgba(91, 164, 212, 0.18);
    border-color: rgba(91, 164, 212, 0.55);
}
.lb-info-btn:focus-visible {
    outline: 2px solid var(--accent-sky, #5BA4D4);
    outline-offset: 2px;
}

.lb-info-popover {
    margin: 0 0 10px 0;
    padding: 10px 12px;
    background: rgba(91, 164, 212, 0.12);
    border: 1px solid rgba(91, 164, 212, 0.3);
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: rgba(245, 245, 240, 0.85);
}
.lb-info-popover[hidden] { display: none; }

.lb-notice {
    margin: 0 0 10px 0;
    padding: 8px 10px;
    background: rgba(91, 164, 212, 0.10);
    border: 1px solid rgba(91, 164, 212, 0.28);
    border-radius: 8px;
    font-size: 0.82rem;
    color: rgba(245, 245, 240, 0.85);
}
.lb-notice[hidden] { display: none; }

.lb-body { font-size: 0.88rem; }

.lb-status {
    padding: 12px 4px;
    text-align: center;
    color: rgba(245, 245, 240, 0.65);
    font-size: 0.85rem;
}
.lb-status[hidden] { display: none; }

.lb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lb-list[hidden] { display: none; }

.lb-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.lb-row-self {
    background: rgba(91, 164, 212, 0.18);
    border-color: rgba(91, 164, 212, 0.55);
}
.lb-row:hover { background: rgba(91, 164, 212, 0.10); }
.lb-row-self:hover { background: rgba(91, 164, 212, 0.22); }

.lb-rank {
    font-size: 0.78rem;
    color: rgba(245, 245, 240, 0.55);
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.lb-player {
    min-width: 0;
    font-weight: 600;
    color: var(--text-primary, #F5F5F0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-score {
    font-weight: 700;
    color: var(--accent-sky, #5BA4D4);
    font-variant-numeric: tabular-nums;
    padding-left: 6px;
}

.lb-pattern {
    grid-column: 2 / -1;
    margin-top: 2px;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    font-size: 0.85rem;
    color: rgba(245, 245, 240, 0.85);
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.15;
}

/* --- Responsive: collapse to a static column under the game -----------
 * The game container is centered with max-width 900px, so the right rail
 * only fits without overlapping at viewports >= 1540px. Below that we
 * stack the leaderboard under the game content as a single column. */
@media (max-width: 1539px) {
    .leaderboard-slot {
        position: static;
        width: 100%;
        max-width: 900px;
        margin: 24px auto 16px auto;
        right: auto;
        top: auto;
    }
    .lb-panel { max-height: none; }
}

@media (max-width: 600px) {
    .leaderboard-slot {
        margin: 18px auto 8px auto;
        padding: 0 4px;
    }
    .lb-panel { padding: 12px; }
    .lb-title { font-size: 0.95rem; }
}
