/* ── High scores section ─────────────────────────────────── */
.high-scores {
    width: 100%; background: transparent; border-radius: 0;
    padding: 20px 4px; box-shadow: none; border: none;
    border-top: 1px solid rgba(6,182,212,0.12);
}
.high-scores-title { font-size: 1.1rem; font-weight: 800; color: var(--accent); text-align: center; direction: rtl; margin-bottom: 14px; letter-spacing: 0.02em; }
.scores-list       { display: flex; flex-direction: column; gap: 6px; }
.scores-empty      { text-align: center; color: var(--muted); direction: rtl; padding: 12px 0; font-size: 0.92rem; }

/* ── Score rows ──────────────────────────────────────────── */
.score-row {
    display: grid;
    grid-template-columns: 36px 1fr 52px 60px 76px;
    align-items: center; padding: 9px 14px; border-radius: 12px;
    background: rgba(6,182,212,0.04); border: none;
    gap: 8px; transition: background 0.35s ease;
}
.score-row--highlight { background: rgba(6,182,212,0.14); }
.score-row--global    { grid-template-columns: 36px 28px 1fr 52px 72px 60px; }

.score-rank     { font-weight: 700; color: var(--muted); font-size: 0.82rem; text-align: center; }
.score-wpm      { font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.score-wpm small { font-size: 0.68rem; font-weight: 500; color: var(--muted); }
.score-accuracy { color: var(--success); font-weight: 700; font-size: 0.88rem; text-align: center; }
.score-date     { color: var(--muted); font-size: 0.78rem; text-align: right; }

/* Leaderboard-specific cells */
.score-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.score-name   { font-weight: 600; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.score-mode   { font-size: 0.70rem; font-weight: 700; color: var(--accent); background: rgba(6,182,212,0.12); border: 1px solid rgba(6,182,212,0.28); border-radius: 8px; padding: 2px 5px; text-align: center; white-space: nowrap; align-self: center; direction: rtl; }

/* ── Leaderboard modal ───────────────────────────────────── */
.leaderboard-modal {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    background: rgba(4, 12, 24, 0.90);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.leaderboard-modal.is-open { opacity: 1; pointer-events: auto; }

.leaderboard-card {
    background: var(--surface); border-radius: 24px; padding: 32px 36px;
    box-shadow: 0 40px 100px rgba(4,14,28,0.80), 0 0 0 1px rgba(6,182,212,0.08);
    border: none;
    width: min(92%, 660px); max-height: 80vh;
    display: flex; flex-direction: column; gap: 20px;
    transform: scale(0.90) translateY(24px);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}
.leaderboard-modal.is-open .leaderboard-card { transform: scale(1) translateY(0); }

.leaderboard-header { display: flex; align-items: center; justify-content: space-between; direction: rtl; flex-shrink: 0; }
.leaderboard-title  { font-size: 1.3rem; font-weight: 800; color: var(--accent); letter-spacing: 0.02em; }
.leaderboard-close  { min-width: unset; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--surface-strong); color: var(--muted); border: 1px solid rgba(8,100,120,0.20); font-size: 0.9rem; display: grid; place-items: center; }
.leaderboard-close:hover { background: rgba(180,40,40,0.10); color: var(--danger); transform: none; box-shadow: none; }
.leaderboard-scores { overflow-y: auto; flex: 1; padding-right: 2px; }

/* Time filter tabs */
.time-tabs { display: flex; gap: 6px; flex-shrink: 0; padding: 4px 0; }
.time-tab {
    flex: 1; min-width: unset; width: auto; padding: 6px 10px;
    font-size: 0.76rem; font-weight: 700; letter-spacing: 0.03em; border-radius: 8px;
    background: transparent; color: var(--muted); border: 1px solid rgba(8,100,120,0.18);
    cursor: pointer; transition: background 0.2s, color 0.2s;
}
.time-tab:hover:not(.is-active) { background: rgba(6,182,212,0.08); transform: none; box-shadow: none; }
.time-tab.is-active             { background: rgba(6,182,212,0.18); color: var(--accent); border-color: rgba(6,182,212,0.40); transform: none; box-shadow: none; }

/* ── Streak + badge chips ────────────────────────────────── */
.results-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 28px; }

.streak-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px;
    border-radius: 999px; background: rgba(251,146,60,0.14); border: 1px solid rgba(251,146,60,0.35);
    color: #fb923c; font-size: 0.82rem; font-weight: 700;
}
.badge-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px;
    border-radius: 999px; background: rgba(6,182,212,0.12); border: 1px solid rgba(6,182,212,0.32);
    color: var(--accent); font-size: 0.80rem; font-weight: 700;
}

/* ── Achievement toast ───────────────────────────────────── */
.achievement-toast {
    position: fixed; top: 24px; left: 50%;
    transform: translateX(-50%) translateY(-90px);
    z-index: 600; display: flex; align-items: center; gap: 14px;
    padding: 14px 22px; background: var(--surface);
    border: 1px solid rgba(6,182,212,0.35); border-radius: 20px;
    box-shadow: 0 8px 32px rgba(4, 14, 28, 0.55);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
    opacity: 0; white-space: nowrap; direction: rtl;
}
.achievement-toast.is-visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.achievement-icon             { font-size: 2rem; line-height: 1; }
.achievement-text             { display: flex; flex-direction: column; gap: 2px; }
.achievement-text strong      { font-size: 0.92rem; font-weight: 800; color: var(--accent); }
.achievement-text small       { font-size: 0.76rem; color: var(--muted); }

/* ── Personal best badge ─────────────────────────────────── */
.results-pb-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: 999px;
    background: linear-gradient(135deg, rgba(250,204,21,0.22), rgba(245,158,11,0.12));
    border: 1px solid rgba(250,204,21,0.50); color: #facc15;
    font-size: 0.80rem; font-weight: 800; animation: pb-flash 0.6s ease-out;
}
@keyframes pb-flash {
    0%   { transform: scale(0.8); opacity: 0; }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1);   opacity: 1; }
}
