/* ── Live Quiz Results Feed ── */
        .lb-live-feed {
            background: var(--primary-bg);
            box-shadow: var(--neumorphic-shadow);
            border-radius: 18px;
            padding: 18px 22px 14px;
            margin-bottom: 28px;
        }
        .lb-live-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }
        .lb-live-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #ef4444;
            color: #fff;
            font-size: 0.66rem;
            font-weight: 700;
            padding: 3px 10px;
            border-radius: 30px;
            letter-spacing: 0.9px;
            text-transform: uppercase;
        }
        .lb-live-pulse {
            width: 6px;
            height: 6px;
            background: #fff;
            border-radius: 50%;
            animation: lbPulse 1.4s ease-in-out infinite;
            will-change: opacity, transform;
        }
        @keyframes lbPulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50%       { opacity: 0.35; transform: scale(0.65); }
        }
        .lb-live-title {
            font-size: 0.92rem;
            font-weight: 700;
            color: var(--primary-dark);
        }
        .lb-live-count {
            margin-left: auto;
            font-size: 0.76rem;
            opacity: 0.5;
        }
        .lb-live-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 240px;
            overflow-y: auto;
        }
        .lb-live-item {
            display: flex;
            align-items: center;
            gap: 12px;
            background: var(--primary-bg);
            box-shadow: var(--neumorphic-inset);
            border-radius: 12px;
            padding: 10px 14px;
            animation: lbSlideIn 0.32s ease;
            will-change: opacity, transform;
        }
        @keyframes lbSlideIn {
            from { opacity: 0; transform: translateX(-12px); }
            to   { opacity: 1; transform: translateX(0); }
        }
        .lb-live-icon {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: var(--primary-bg);
            box-shadow: var(--neumorphic-shadow);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--primary-accent);
            font-size: 0.82rem;
            flex-shrink: 0;
        }
        .lb-live-info   { flex: 1; min-width: 0; }
        .lb-live-player { font-size: 0.87rem; font-weight: 700; }
        .lb-live-detail { font-size: 0.74rem; opacity: 0.6; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .lb-live-pts    { font-size: 0.98rem; font-weight: 800; white-space: nowrap; }
        .lb-live-pass   { color: #22c55e; }
        .lb-live-fail   { color: #f87171; }
        .lb-live-time   { font-size: 0.7rem; opacity: 0.42; white-space: nowrap; }
        .lb-live-empty  { font-size: 0.84rem; opacity: 0.48; text-align: center; padding: 8px 0 2px; margin: 0; }

/* ── Leaderboard-page specific tokens ── */
        :root {
            --gold:   #f5b042;
            --silver: #b0b8c5;
            --bronze: #cd7f56;
        }

        /* ── Leaderboard panel ── */
        .leader-panel {
            background: var(--primary-bg);
            border-radius: 1.5rem;
            padding: 1.8rem;
            box-shadow: var(--neumorphic-shadow);
            border: 1px solid var(--border-light);
            margin-bottom: 30px;
        }
        .leader-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
            margin-bottom: 1.25rem;
        }
        .leader-header h2 {
            font-size: 1.6rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 10px;
            color: var(--primary-dark);
        }

        /* ── User stats card ── */
        .user-stats-card {
            background: linear-gradient(135deg, rgba(109, 93, 252, 0.12), rgba(91, 14, 235, 0.05));
            border-radius: 1.5rem;
            padding: 1rem 1.5rem;
            margin-bottom: 1.8rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
            border: 1px solid var(--border-light);
        }
        .stat-item { display: flex; align-items: center; gap: 0.75rem; font-weight: 500; }
        .stat-icon {
            width: 40px; height: 40px;
            background: var(--primary-bg);
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--neumorphic-shadow);
            color: var(--primary-accent);
            flex-shrink: 0;
        }
        .stat-label { font-size: 0.8rem; opacity: 0.7; }
        .stat-value { font-weight: 800; font-size: 1.2rem; color: var(--primary-accent); }
        .best-subject-block { display: flex; flex-direction: column; line-height: 1.3; }
        .best-subject-name { font-weight: 800; font-size: 1.1rem; color: var(--primary-accent); }
        .best-subject-points { font-size: 0.8rem; font-weight: 500; opacity: 0.85; margin-top: 2px; }

        /* ── Leaderboard table ── */
        .table-scroll { overflow-x: auto; border-radius: 1rem; }
        .leader-table { width: 100%; border-collapse: collapse; min-width: 380px; }
        .leader-table th, .leader-table td {
            padding: 0.9rem 0.6rem;
            border-bottom: 1px solid var(--border-light);
            text-align: left;
            white-space: nowrap;
        }
        .leader-table th {
            font-weight: 700;
            font-size: 0.9rem;
            color: var(--primary-dark);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .rank-medal { font-weight: 800; width: 60px; display: inline-block; }
        .rank-1 { color: var(--gold); }
        .rank-2 { color: var(--silver); }
        .rank-3 { color: var(--bronze); }
        .player-cell { display: flex; align-items: center; gap: 10px; }
        .avatar {
            width: 36px; height: 36px;
            background: linear-gradient(145deg, var(--primary-accent), var(--primary-dark));
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            color: #fff;
        }
        .your-row { background: rgba(109, 93, 252, 0.12); font-weight: 600; }
        .your-row td:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
        .your-row td:last-child  { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
        .you-tag { font-size: 0.75rem; opacity: 0.7; }
        .level-badge {
            background: var(--primary-dark);
            padding: 3px 10px;
            border-radius: 30px;
            font-size: 0.75rem;
            font-weight: 600;
            color: #fff;
        }
        .score-value { font-weight: 700; }

        /* ── Subject mastery ── */
        .subject-stats-wrapper {
            margin: 1.5rem 0;
            background: var(--primary-bg);
            border-radius: 1.5rem;
            padding: 1.4rem;
            box-shadow: var(--neumorphic-shadow);
            border: 1px solid var(--border-light);
        }
        .subject-stats-header {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            flex-wrap: wrap;
            margin-bottom: 1.2rem;
            padding-bottom: 0.6rem;
            border-bottom: 1px solid var(--border-light);
        }
        .subject-stats-header h3 {
            font-size: 1.2rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--primary-dark);
        }
        .stats-hint { font-size: 0.78rem; opacity: 0.7; }
        .subject-stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 1.2rem;
            max-height: 480px;
            overflow-y: auto;
            padding: 0.4rem 0.2rem;
        }
        .subject-stat-card {
            background: var(--primary-bg);
            border-radius: 1.2rem;
            padding: 1rem;
            box-shadow: var(--neumorphic-shadow);
            transition: var(--transition);
            border: 1px solid var(--border-light);
            cursor: pointer;
        }
        .subject-stat-card:hover {
            transform: translateY(-3px);
            box-shadow: var(--neumorphic-inset);
        }
        .subject-stat-card.subject-not-played {
            opacity: 0.55;
            border-style: dashed;
        }
        .subject-stat-card.subject-not-played:hover {
            opacity: 0.8;
        }
        .stat-card-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }
        .stat-card-icon {
            width: 42px; height: 42px;
            background: var(--primary-accent);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 1.2rem;
            flex-shrink: 0;
        }
        .stat-card-title { font-weight: 700; font-size: 1rem; }
        .stat-details {
            display: flex;
            justify-content: space-between;
            margin: 8px 0;
            font-size: 0.85rem;
        }
        .stat-details span:first-child { opacity: 0.7; }
        .stat-details span:last-child { font-weight: 600; color: var(--primary-accent); }
        .level-number-strong {
            color: var(--text-dark);
            font-weight: 800;
            font-size: 1rem;
        }
        .rank-badge {
            background: rgba(109, 93, 252, 0.15);
            color: var(--primary-accent);
            padding: 2px 10px;
            border-radius: 30px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        @media (max-width: 768px) {
            .subject-stats-grid { grid-template-columns: 1fr; max-height: 400px; }
            .user-stats-card { flex-direction: column; align-items: flex-start; }
            .leader-table th, .leader-table td { padding: 0.6rem 0.3rem; font-size: 0.82rem; }
            .leader-panel { padding: 1.2rem; }
        }

        /* ══════════════════════════════════════════════════════
           LEADERBOARD — Enhanced Interactive Styles
        ══════════════════════════════════════════════════════ */

        /* ── Stats Banner ── */
        .lb-stats-banner {
            display: flex;
            align-items: center;
            justify-content: space-around;
            flex-wrap: wrap;
            gap: 1rem;
            background: var(--primary-bg);
            border-radius: 1.5rem;
            padding: 1.2rem 2rem;
            box-shadow: var(--neumorphic-shadow);
            border: 1px solid var(--border-light);
            margin-bottom: 1.5rem;
        }
        .lb-stat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            text-align: center;
        }
        .lb-stat-num {
            font-size: 1.7rem;
            font-weight: 800;
            color: var(--primary-accent);
            line-height: 1;
        }
        .lb-stat-label {
            font-size: 0.78rem;
            opacity: 0.7;
            font-weight: 500;
        }
        .lb-stat-divider {
            width: 1px;
            height: 40px;
            background: var(--border-light);
        }

        /* ── Period Filter Chips ── */
        .lb-chips {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        .lb-chip {
            padding: 6px 16px;
            border-radius: 20px;
            border: 1px solid var(--border-light);
            background: var(--primary-bg);
            color: var(--text-dark);
            font-family: 'Poppins', sans-serif;
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            box-shadow: var(--neumorphic-shadow);
        }
        .lb-chip:hover { box-shadow: var(--neumorphic-inset); }
        .lb-chip.active {
            background: var(--primary-accent);
            color: #fff;
            border-color: var(--primary-accent);
            box-shadow: 0 4px 12px rgba(109, 93, 252, 0.35);
        }

        /* ── Subject header right (sort) ── */
        .subj-header-right {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }
        .lb-select {
            background: var(--primary-bg);
            border: 1px solid var(--border-light);
            border-radius: 20px;
            padding: 4px 14px;
            font-family: 'Poppins', sans-serif;
            font-size: 0.8rem;
            color: var(--text-dark);
            cursor: pointer;
            box-shadow: var(--neumorphic-shadow);
            outline: none;
            transition: border-color 0.2s ease;
        }
        .lb-select:focus { border-color: var(--primary-accent); }

        /* ── Subject progress bar ── */
        .subj-progress-wrap {
            width: 100%;
            height: 6px;
            background: var(--border-light);
            border-radius: 10px;
            overflow: hidden;
            margin-top: 10px;
        }
        .subj-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--primary-accent), var(--primary-dark));
            border-radius: 10px;
            transition: width 0.6s ease;
        }
        .subj-progress-label {
            display: flex;
            justify-content: space-between;
            font-size: 0.7rem;
            opacity: 0.6;
            margin-top: 4px;
        }

        /* ── Rankings table section ── */
        .lb-table-section {
            margin-top: 1.8rem;
            background: var(--primary-bg);
            border-radius: 1.5rem;
            padding: 1.4rem;
            box-shadow: var(--neumorphic-shadow);
            border: 1px solid var(--border-light);
        }
        .lb-table-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
            margin-bottom: 1rem;
            padding-bottom: 0.8rem;
            border-bottom: 1px solid var(--border-light);
        }
        .lb-table-header h3 {
            font-size: 1.2rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--primary-dark);
        }
        .lb-search-wrap { position: relative; display: flex; align-items: center; }
        .lb-search-icon {
            position: absolute; left: 12px;
            opacity: 0.45; font-size: 0.82rem; pointer-events: none;
        }
        .lb-search-input {
            background: var(--primary-bg);
            border: 1px solid var(--border-light);
            border-radius: 20px;
            padding: 7px 14px 7px 32px;
            font-family: 'Poppins', sans-serif;
            font-size: 0.82rem;
            color: var(--text-dark);
            width: 200px;
            outline: none;
            box-shadow: var(--neumorphic-inset);
            transition: border-color 0.2s ease, width 0.3s ease;
        }
        .lb-search-input:focus { border-color: var(--primary-accent); width: 240px; }

        /* ── Rank change arrows ── */
        .rank-change { font-size: 0.7rem; font-weight: 700; margin-left: 5px; }
        .rank-up   { color: #22c55e; }
        .rank-down { color: #ef4444; }
        .rank-same { opacity: 0.32; }

        /* ── Win rate & streak ── */
        .lb-winrate { color: #22c55e; font-weight: 700; }
        .lb-streak  { font-weight: 700; color: var(--primary-accent); }

        /* ── Online dot ── */
        .online-dot {
            display: inline-block;
            width: 7px; height: 7px;
            border-radius: 50%;
            flex-shrink: 0;
            margin-right: 2px;
        }
        .online-dot-green { background: #22c55e; }
        .online-dot-gray  { background: #94a3b8; }

        /* ── Show more ── */
        .lb-show-more-wrap { text-align: center; margin-top: 1.2rem; }

        /* ── Scroll reveal ── */
        .reveal {
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 0.5s ease, transform 0.5s ease;
        }
        .reveal.revealed { opacity: 1; transform: translateY(0); }

        /* ── Responsive additions ── */
        @media (max-width: 1024px) {
            .lb-stats-banner { gap: 0.8rem; padding: 1rem 1.5rem; }
        }
        @media (max-width: 768px) {
            .lb-stats-banner { display: grid; grid-template-columns: 1fr 1fr; padding: 1rem; gap: 0.8rem; }
            .lb-stat-divider  { display: none; }
            .lb-stat-num      { font-size: 1.4rem; }
            .lb-chips         { gap: 6px; }
            .lb-chip          { padding: 5px 12px; font-size: 0.78rem; }
            .podium-wrap      { gap: 8px; }
            .podium-card      { max-width: 110px; padding: 12px 6px 0; }
            .podium-1 .podium-avatar { width: 52px; height: 52px; font-size: 1.2rem; }
            .podium-avatar    { width: 42px; height: 42px; font-size: 1rem; }
            .podium-name      { font-size: 0.75rem; max-width: 95px; }
            .lb-search-input  { width: 150px; }
            .lb-search-input:focus { width: 170px; }
            .lb-table-section { padding: 1rem; }
        }
        @media (max-width: 480px) {
            .leader-header    { flex-direction: column; align-items: flex-start; }
            .podium-name      { font-size: 0.7rem; max-width: 80px; }
        }
