/*
Theme Name: Quiz App Theme (Enhanced)
Description: Enhanced theme with improved contrast, responsive layout, full review support, and modern leaderboard.
Version: 2.0
Author: User + ChatGPT
*/

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');

:root{
  /* Prevent home categories from getting hidden behind the bottom navigation on small screens */
  --bottom-offset: calc(120px + env(safe-area-inset-bottom, 0px));
}

body {
            margin: 0;
            font-family: 'Roboto', sans-serif;
            background-color: #f5f7fa;
            color: #1f2a44;
            min-height: 100vh;
            overflow: auto;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
            background: transparent;
            padding-top: 80px;
            padding-bottom: var(--bottom-offset);
        }

        .top-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: #ffffff;
            padding: 12px 20px;
            position: fixed;
            top: 0;
            width: 100%;
            z-index: 100;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
            height: 60px;
        }

        .brand-title{
            font-weight: 900;
            letter-spacing: .2px;
            color: #1f2a44;
            font-size: 15px;
            text-align: center;
            flex: 1;
            margin: 0 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .profile img {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: 2px solid #FFD700;
            margin-left: -10px;
            transform: translateX(-12px);
        }

        .menu-icon img {
            width: 28px;
            height: 28px;
        }

        .hero {
            margin-top: 80px;
            text-align: center;
            padding: 20px;
            background: linear-gradient(120deg, #FFD700, #F2F2F2);
            color: #101820;
            border-radius: 15px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        .hero h1 {
            font-size: 24px;
            margin: 0;
            font-weight: bold;
        }

        .hero p {
            font-size: 16px;
            margin: 8px 0 20px;
            color: #1f2a44;
        }

        .hero .cta {
            display: inline-block;
            margin-top: 20px;
            background-color: #202731;
            color: #FFD700;
            padding: 10px 20px;
            font-size: 14px;
            font-weight: bold;
            border-radius: 30px;
            cursor: pointer;
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .hero .cta:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        }

        /* Disabled state for hero CTA (used for live quiz after submission / already enrolled) */
        .hero .cta.disabled,
        .hero .cta[aria-disabled="true"] {
            opacity: 0.55;
            cursor: not-allowed;
            pointer-events: none;
            transform: none !important;
            box-shadow: none !important;
        }

        .stats {
            display: flex;
            flex-direction: row;
            justify-content: space-around;
            background-color: #eeeef0;
            border-radius: 15px;
            margin-top: 20px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            padding: 15px;
        }

        .stats div {
            text-align: center;
        }

        .stats span {
            font-size: 24px;
            font-weight: 700;
            color: #6366f1;
        }

        .stats p {
            font-size: 16px;
            color: #64748b;
            margin-top: 8px;
        }

        .quiz-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            text-align: center;
            width: 100%;
            gap: 15px;
            margin-top: 20px;
        }

        .quiz-item {
            background-color: #dbdedf;
            border-radius: 15px;
            text-align: center;
            padding: 15px;
            transition: transform 0.3s, box-shadow 0.3s;
            cursor: pointer;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
        }

        .quiz-item:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
            background-color: #e0e7ff;
        }

        .quiz-item img {
            width: 70px;
            height: 70px;
            margin-bottom: 8px;
        }

        .quiz-item h3 {
            font-size: 20px;
            font-weight: 700;
            margin: 0;
            color: #1f2a44;
        }

        .quiz-item p {
            font-size: 15px;
            color: #64748b;
            margin: 6px 0 0;
        }

        .vertical-quiz-list {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
            margin-top: 24px;
        }

        .folder-item, .quiz-item-folder {
            background-color: #ffffff;
            border-radius: 12px;
            padding: 18px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            transition: all 0.3s ease;
            cursor: pointer;
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
        }

        .folder-item:hover, .quiz-item-folder:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
            background-color: #f8fafc;
        }

        .quiz-info {
            flex-grow: 1;
        }

        .quiz-info h3 {
            font-size: 1.2rem;
            font-weight: 700;
            margin: 0;
            color: #1f2a44;
            text-align: left;
        }

        .quiz-info p {
            font-size: 0.95rem;
            color: #64748b;
            margin: 4px 0 0;
            text-align: left;
        }

        .start-btn, .reattempt-btn, .resume-btn {
            padding: 8px 16px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .start-btn {
            background: #28a745;
            color: #ffffff;
        }

        .start-btn:hover {
            background: #218838;
            transform: translateY(-1px);
        }

        .reattempt-btn {
            background: #f59e0b;
            color: #ffffff;
        }

        .reattempt-btn:hover {
            background: #d97706;
            transform: translateY(-1px);
        }

        .resume-btn {
            background: #007bff;
            color: #ffffff;
        }

        .resume-btn:hover {
            background: #0056b3;
            transform: translateY(-1px);
        }

        .path-display {
            font-size: 0.95rem;
            color: #FFD700;
            font-weight: 500;
            margin: 12px 0 20px;
            text-align: center;
        }

        .quiz-container {
            display: grid;
            gap: 12px;
            padding: 20px;
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            margin-top: 80px;
            margin-bottom: 80px;
            animation: fadeIn 0.5s ease-in;
        }

        .question-text {
            font-size: 1.3rem;
            font-weight: 600;
            margin-bottom: 12px;
            color: #1f2a44;
        }

        .option {
            display: flex;
            align-items: center;
            justify-content: start;
            gap: 10px;
            padding: 14px;
            border: 2px solid #e2e8f0;
            background: #f8fafc;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
            animation: slideIn 0.3s ease-in-out;
        }

        .option:hover {
            background: #e0e7ff;
            border-color: #007bff;
        }

        .option.selected {
            background: #fef3c7;
            border-color: #f59e0b;
        }

        .timer {
            font-size: 1.2rem;
            font-weight: bold;
            color: #dc3545;
            margin: 10px 0;
            text-align: center;
        }

        .remaining-questions {
            text-align: center;
            font-size: 1rem;
            color: #64748b;
            margin: 10px 0;
        }

        .progress-bar {
            width: 100%;
            background: #e2e8f0;
            border-radius: 6px;
            overflow: hidden;
            margin: 15px 0;
        }

        .progress {
            height: 10px;
            background: #007bff;
            width: 0;
            transition: width 0.5s;
        }

        .quiz-controls {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background-color: #ffffff;
            display: flex;
            justify-content: space-around;
            align-items: center;
            padding: 12px 0;
            box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.08);
            z-index: 100;
            height: 60px;
        }

        .brand-title{
            font-weight: 900;
            letter-spacing: .2px;
            color: #1f2a44;
            font-size: 15px;
            text-align: center;
            flex: 1;
            margin: 0 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        button {
            padding: 12px 20px;
            background: #007bff;
            color: #ffffff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1rem;
            font-weight: 500;
        }

        button:hover {
            background: #0056b3;
            transform: translateY(-1px);
        }

        button:disabled {
            background: #6c757d;
            cursor: not-allowed;
        }

        .submit-early {
            background: #dc3545;
        }

        .submit-early:hover {
            background: #bb2d3b;
        }

        .save-next {
            background: #28a745;
        }

        .save-next:hover {
            background: #218838;
        }

        .previous-btn {
            background: #6c757d;
        }

        .previous-btn:hover {
            background: #5a6268;
        }

        .report-btn {
            background: #3b82f6;
            color: #ffffff;
        }

        .report-btn:hover {
            background: #e0a800;
        }

        .cancel-btn {
            background: #6c757d;
        }

        .cancel-btn:hover {
            background: #5a6268;
        }

        .menu-btn {
            position: fixed;
            top: 20px;
            right: 20px;
            background: transparent;
            padding: 10px;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 101;
            cursor: pointer;
        }

        .menu-btn img {
            width: 24px;
            height: 24px;
        }

        .footer-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background-color: #ffffff;
            display: flex;
            justify-content: space-around;
            align-items: center;
            padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
            box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.08);
            min-height: 56px;
            z-index: 200;
        }


        .footer-nav img {
            width: 24px;
            height: 24px;
        }

        .footer-nav p {
            font-size: 0.75rem;
            margin-top: 4px;
            color: #64748b;
        }

        
        .footer-nav a {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 25%;
            height: 50px;
            text-decoration: none;
            cursor: pointer;
            border-radius: 12px;
            transition: transform 0.15s ease, background-color 0.15s ease;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }

        .footer-nav a:active {
            transform: scale(0.96);
        }

        .footer-nav a.active {
            background-color: #e0e7ff;
        }

        .footer-nav a.active p {
            color: #007bff;
            font-weight: 600;
        }

        .top-nav .menu-icon, .top-nav .profile {
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
            transition: transform 0.15s ease;
        }

        .top-nav .menu-icon:active, .top-nav .profile:active {
            transform: scale(0.96);
        }

        .drawer-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.45);
            display: none;
            z-index: 1000;
        }

        .drawer {
            position: absolute;
            top: 0;
            left: 0;
            height: 100%;
            width: 78%;
            max-width: 320px;
            background: #ffffff;
            box-shadow: 4px 0 12px rgba(0, 0, 0, 0.2);
            transform: translateX(-100%);
            transition: transform 0.25s ease;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .drawer-overlay.open {
            display: block;
        }

        .drawer-overlay.open .drawer {
            transform: translateX(0);
        }

        .drawer-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .drawer-title {
            font-weight: 700;
            font-size: 1.1rem;
            color: #1f2a44;
        }

        .drawer-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px;
            border-radius: 10px;
            cursor: pointer;
            transition: background 0.2s ease, transform 0.15s ease;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
            user-select: none;
        }

        .drawer-item:hover {
            background: #f1f5f9;
        }

        .drawer-item:active {
            transform: scale(0.98);
        }

        .drawer-item img {
            width: 22px;
            height: 22px;
        }

        .drawer-footer {
            margin-top: auto;
            font-size: 0.85rem;
            color: #64748b;
        }

.score-card {
            padding: 24px;
            border-radius: 12px;
            background: var(--card);
            backdrop-filter: blur(10px);
            box-shadow: var(--shadow);
            margin-top: 80px;
            text-align: center;
        }

        .score-metrics {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
            margin: 20px 0;
            justify-items: center;
        }

        .metric-box {
            padding: 12px;
            border-radius: 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100px;
        }

        .correct-metric {
            background: #e8f5e9;
            color: #28a745;
        }

        .wrong-metric {
            background: #ffebee;
            color: #dc3545;
        }

        .skipped-metric {
            background: #fff8e1;
            color: #ffc107;
        }

        .metric-box:hover {
            transform: scale(1.05);
        }

        .accuracy-ring {
            width: 140px;
            height: 140px;
            margin: 20px auto;
            border-radius: 50%;
            background: conic-gradient(#28a745 var(--percent), #e9ecef 0);
            display: flex;
            align-items: center;
            justify-content: center;
            animation: ringGrowth 2s ease-out;
        }

        .accuracy-text {
            font-size: 24px;
            font-weight: 700;
            color: #1f2a44;
        }

        .total-score {
            font-size: 3.5rem;
            font-weight: 800;
            color: #28a745;
            text-align: center;
            animation: scorePop 0.5s ease-out;
        }

        .total-score span {
            font-size: 1.8rem;
            color: #64748b;
        }

        .time-taken {
            color: #dc3545;
            font-size: 1.8rem;
            text-align: center;
            margin-top: 12px;
        }

        .review-question {
            margin: 15px 0;
            padding: 15px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            background: #f8f9fa;
        }

        .review-option {
            padding: 10px;
            margin: 6px 0;
            border-radius: 6px;
        }

        .user-answer {
            background: #fff3cd;
        }

        .correct-answer {
            background: #d1fae5;
        }

        .wrong-answer {
            background: #fee2e2;
        }

        .nav-buttons {
            display: flex;
            gap: 12px;
            justify-content: center;
            margin: 20px 0;
            flex-wrap: wrap;
        }

        .error-message {
            color: #dc3545;
            padding: 15px;
            background: #ffebee;
            border-radius: 8px;
            margin: 15px 0;
            text-align: center;
        }

        .loading {
            text-align: center;
            padding: 20px;
            font-size: 1.2rem;
            color: #007bff;
        }

        .breadcrumb {
            margin: 0;
            display: flex;
            gap: 5px;
            flex-wrap: wrap;
        }

        .breadcrumb-item {
            cursor: pointer;
            color: #FFD700;
            transition: all 0.3s ease;
        }

        .breadcrumb-item:hover {
            color: #ffca28;
            text-decoration: underline;
        }

        .header {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #ffffff;
            padding: 12px 20px;
            position: fixed;
            top: 0;
            width: 100%;
            z-index: 100;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
            height: 60px;
        }

        .brand-title{
            font-weight: 900;
            letter-spacing: .2px;
            color: #1f2a44;
            font-size: 15px;
            text-align: center;
            flex: 1;
            margin: 0 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .header-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: #1f2a44;
            text-align: center;
            flex-grow: 1;
        }

        .back-arrow {
            position: absolute;
            left: 20px;
            font-size: 1.8rem;
            color: #007bff;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
        }

        .back-arrow:hover {
            color: #0056b3;
            transform: scale(1.05);
        }

        .quiz-header {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #ffffff;
            padding: 12px 20px;
            position: fixed;
            top: 0;
            width: 100%;
            z-index: 100;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
            height: 60px;
        }

        .brand-title{
            font-weight: 900;
            letter-spacing: .2px;
            color: #1f2a44;
            font-size: 15px;
            text-align: center;
            flex: 1;
            margin: 0 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .timer-toggle {
            position: absolute;
            left: 20px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .timer-text {
            font-size: 1rem;
            font-weight: bold;
            color: #dc3545;
        }

        h2 {
            text-align: center;
            font-size: 1.8rem;
            font-weight: 700;
            margin-bottom: 10px;
            color: #1f2a44;
        }

        p {
            margin: 10px 0;
            font-size: 1rem;
            color: #64748b;
        }

        .solution-box {
            margin-top: 12px;
            padding: 15px;
            background: #1f2a44;
            color: #10b981;
            border-radius: 8px;
            border-left: 4px solid #f59e0b;
            text-align: left;
            display: none;
        }

        .solution-box.visible {
            display: block;
        }

        .toggle-solution {
            padding: 8px 16px;
            background: #007bff;
            color: #ffffff;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            margin-top: 10px;
            font-size: 0.9rem;
        }

        .toggle-solution:hover {
            background: #0056b3;
        }

        .popup-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .popup-content {
            background: #ffffff;
            border-radius: 12px;
            padding: 20px;
            width: 90%;
            max-width: 500px;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
            animation: slideIn 0.3s ease-in-out;
        }

        .popup-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .popup-close {
            font-size: 1.5rem;
            cursor: pointer;
            color: #1f2a44;
        }

        .question-status-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
            gap: 10px;
            margin-bottom: 20px;
        }

        .question-status {
            width: 50px;
            height: 50px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .question-status.attempted {
            background: #28a745;
            color: #ffffff;
        }

        .question-status.skipped {
            background: #3b82f6;
            color: #1f2a44;
        }

        .question-status.not-visited {
            background: #e2e8f0;
            color: #64748b;
        }

        .question-status.review-unanswered {
            background: #facc15;
            color: #1f2937;
        }

        .question-status.review-answered {
            background: #ef4444;
            color: #ffffff;
        }

        .question-status:hover {
            transform: scale(1.1);
        }

        .status-legend {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-bottom: 20px;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.9rem;
        }

        .legend-box {
            width: 20px;
            height: 20px;
            border-radius: 4px;
        }

        .status-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            display: inline-block;
        }

        .attempted-dot {
            background: #28a745;
        }

        .skipped-dot {
            background: #ffc107;
        }

        .not-visited-dot {
            background: #e2e8f0;
        }

        .modal-buttons {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
            margin-top: 20px;
        }

        .quiz-details, .quiz-status {
            margin-bottom: 20px;
        }

        .quiz-details p, .quiz-status p {
            margin: 8px 0;
            font-size: 1rem;
            color: #1f2a44;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        @media (max-width: 768px) {
            .hero {
                padding: 15px;
                margin-top: 10px;
            }
            .hero h1 {
                font-size: 20px;
            }
            .hero p {
                font-size: 14px;
            }
            .hero .cta {
                padding: 8px 16px;
                font-size: 12px;
            }
            .stats {
                flex-direction: row;
                gap: 10px;
                padding: 15px;
            }
            .stats span {
                font-size: 20px;
            }
            .quiz-container {
                padding: 15px;
                margin-top: 15px;
                margin-bottom: 10px;
            }
            .quiz-item {
                padding: 12px;
            }
            .question-status-grid {
                grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
            }
            .question-status {
                width: 45px;
                height: 45px;
                font-size: 0.9rem;
            }
            .menu-btn {
                top: 15px;
                right: 15px;
                width: 36px;
                height: 36px;
            }
            .quiz-controls {
                padding: 10px 0;
                height: 60px;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 70px 10px var(--bottom-offset);
            }
            .quiz-list {
                grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
                gap: 12px;
                margin-top: 25px;
            }
            .quiz-item {
                aspect-ratio: 1/1;
                border-radius: 20px;
                padding: 15px;
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
            }
            .quiz-item img {
                width: 50px;
                height: 50px;
                margin-bottom: 8px;
            }
            .quiz-item h3 {
                font-size: 0.9rem;
                margin: 5px 0;
            }
            .quiz-item p {
                font-size: 0.7rem;
                margin: 0;
            }
            .top-nav, .header, .quiz-header {
                height: 50px;
                padding: 8px 10px;
            }
            .profile img {
                width: 32px;
                height: 32px;
            }
            .footer-nav {
                height: 50px;
                padding: 8px 0;
            }
            .footer-nav img {
                width: 20px;
                height: 20px;
            }
            .footer-nav p {
                font-size: 0.6rem;
                margin-top: 1px;
            }
            .timer {
                font-size: 1rem;
            }
            .remaining-questions {
                font-size: 0.9rem;
            }
            .progress-bar {
                margin: 12px 0;
            }
            .quiz-container {
                margin-top: 70px;
                padding: 12px;
                margin-bottom: 50px;
            }
            .question-text {
                font-size: 1.1rem;
            }
            .option {
                padding: 12px;
                font-size: 0.9rem;
            }
            .quiz-controls {
                flex-direction: row;
                justify-content: space-around;
                padding: 8px 0;
                height: 60px;
            }
            .quiz-controls button {
                padding: 8px 16px;
                font-size: 0.9rem;
            }
            .popup-content {
                width: 95%;
                padding: 15px;
            }
            .question-status {
                width: 40px;
                height: 40px;
                font-size: 0.8rem;
            }
            .menu-btn {
                top: 10px;
                right: 10px;
                width: 32px;
                height: 32px;
            }
            .score-metrics {
                grid-template-columns: 1fr;
            }
            .metric-box {
                width: 80%;
            }
            .stats {
                flex-direction: column;
                gap: 10px;
            }
            .start-btn, .reattempt-btn, .resume-btn {
                padding: 6px 12px;
                font-size: 0.8rem;
            }
        }
        .stats {
                flex-direction: column; /* Stack vertically for small screens */
                gap: 10px;
            }
            .start-btn, .reattempt-btn {
                padding: 6px 12px;
                font-size: 0.8rem;
            }
        
        .stats {
                flex-direction: row; /* Keep horizontal for medium screens */
                gap: 10px;
                padding: 15px;
            }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes slideIn {
            from { transform: translateY(20px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        @keyframes ringGrowth {
            from { transform: scale(0.5); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }

        @keyframes scorePop {
            0% { transform: scale(0); }
            90% { transform: scale(1.1); }
            100% { transform: scale(1); }
        }
    
        /* ------------------------------
           Modern Loading + Skeleton
        ------------------------------ */
        .app-loader{
            position: fixed;
            inset: 0;
            display: grid;
            place-items: center;
            background: rgba(10, 12, 18, 0.62);
            backdrop-filter: blur(10px);
            z-index: 9999;
            opacity: 0;
            pointer-events: none;
            transition: opacity .25s ease;
        }
        .app-loader.open{ opacity: 1; pointer-events: auto; }
        .app-loader-card{
            width: min(520px, 92vw);
            border-radius: 18px;
            padding: 18px 16px 16px;
            background: rgba(255,255,255,0.92);
            box-shadow: 0 18px 55px rgba(0,0,0,0.25);
            overflow: hidden;
        }
        .app-loader-header{ display:flex; gap:12px; align-items:center; margin-bottom: 14px; }
        .app-loader-logo{
            width: 44px; height: 44px; border-radius: 14px;
            background: linear-gradient(135deg, rgba(0,123,255,0.25), rgba(40,167,69,0.18));
            position: relative;
        }
        .app-loader-logo:after{
            content:"";
            position:absolute; inset: 10px;
            border-radius: 10px;
            background: linear-gradient(135deg, rgba(0,123,255,0.85), rgba(40,167,69,0.75));
            filter: saturate(1.1);
        }
        .app-loader-title{ font-weight: 800; font-size: 1.05rem; letter-spacing: 0.2px; color:#111827; }
        .app-loader-sub{ font-size: .92rem; color:#475569; margin-top: 2px; }

        .app-loader-skel{ margin-top: 8px; }
        .skel-line, .skel-card, .skel-item, .skeleton-block, .skeleton-line, .skeleton-circle, .skeleton-pill{
            background: linear-gradient(90deg, rgba(148,163,184,0.18), rgba(148,163,184,0.34), rgba(148,163,184,0.18));
            background-size: 200% 100%;
            animation: shimmer 1.2s ease-in-out infinite;
            border-radius: 12px;
        }
        @keyframes shimmer{
            0%{ background-position: 200% 0; }
            100%{ background-position: -200% 0; }
        }
        .skel-line{ height: 12px; margin: 9px 0; border-radius: 10px; }
        .w-80{ width: 80%; } .w-55{ width: 55%; }
        .skel-spacer{ height: 10px; }
        .skel-row{ display:flex; gap:10px; }
        .skel-card{ flex:1; height: 64px; border-radius: 14px; }
        .skel-list{ display:grid; gap:10px; }
        .skel-item{ height: 54px; border-radius: 14px; }
        .app-loader-progress{ margin-top: 14px; height: 8px; border-radius: 999px; background: rgba(15,23,42,0.08); overflow:hidden; }
        .app-loader-progress .bar{
            height: 100%;
            width: 42%;
            border-radius: 999px;
            background: linear-gradient(90deg, rgba(0,123,255,0.85), rgba(40,167,69,0.75));
            animation: progressMove 1.1s ease-in-out infinite alternate;
        }
        @keyframes progressMove{
            0%{ transform: translateX(-35%); }
            100%{ transform: translateX(140%); }
        }

        .skeleton-card{
            padding: 14px 14px;
            border: 1px solid rgba(148,163,184,0.24);
            border-radius: 16px;
            background: rgba(255,255,255,0.92);
            margin-bottom: 12px;
        }
        .skeleton-row{ display:flex; align-items:center; gap:12px; }
        .skeleton-circle{ width: 40px; height: 40px; border-radius: 14px; }
        .skeleton-line{ height: 10px; border-radius: 999px; margin: 7px 0; }
        .skeleton-pill{ width: 72px; height: 28px; border-radius: 999px; }

        /* ------------------------------
           History (Modern)
        ------------------------------ */
        .input{
            width: 100%;
            padding: 12px 12px;
            border-radius: 14px;
            border: 1px solid rgba(148,163,184,0.32);
            outline: none;
            background: rgba(255,255,255,0.95);
            font-size: 0.98rem;
        }
        .input:focus{ border-color: rgba(0,123,255,0.55); box-shadow: 0 0 0 4px rgba(0,123,255,0.12); }
        .secondary-btn{
            padding: 11px 14px;
            border-radius: 14px;
            border: 1px solid rgba(148,163,184,0.35);
            background: rgba(255,255,255,0.95);
            font-weight: 700;
            cursor: pointer;
        }
        .secondary-btn:active{ transform: scale(0.98); }
        .chip-row{ display:flex; gap:10px; flex-wrap: wrap; margin-top: 10px; }
        .chip{
            padding: 9px 12px;
            border-radius: 999px;
            border: 1px solid rgba(148,163,184,0.35);
            background: rgba(255,255,255,0.95);
            font-weight: 700;
            cursor: pointer;
        }
        .chip.active{ border-color: rgba(0,123,255,0.65); box-shadow: 0 0 0 4px rgba(0,123,255,0.12); }
        .history-summary{
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin-bottom: 12px;
        }
        .summary-card{
            border-radius: 16px;
            background: rgba(255,255,255,0.95);
            border: 1px solid rgba(148,163,184,0.24);
            padding: 12px 12px;
        }
        .summary-card .label{ color:#64748b; font-weight: 700; font-size: .85rem; }
        .summary-card .value{ color:#0f172a; font-weight: 900; font-size: 1.15rem; margin-top: 4px; }
        .history-actions{ display:flex; gap:10px; align-items:center; }
        .history-actions .input{ flex:1; }
        .history-list{ display:grid; gap: 12px; margin-top: 14px; }
        .history-card{
            border-radius: 18px;
            background: rgba(255,255,255,0.96);
            border: 1px solid rgba(148,163,184,0.24);
            padding: 14px 14px;
            box-shadow: 0 10px 28px rgba(0,0,0,0.06);
        }
        .history-card-top{ display:flex; gap: 12px; align-items:flex-start; }
        .history-icon{
            width: 42px; height: 42px; border-radius: 14px;
            background: rgba(0,123,255,0.12);
            display:grid; place-items:center;
            font-size: 1.1rem;
        }
        .history-meta{ flex: 1; }
        .history-title{ margin:0; font-size: 1.03rem; font-weight: 900; color:#0f172a; line-height: 1.2; }
        .history-date{ margin: 4px 0 0; color:#64748b; font-size: .86rem; font-weight: 700; }
        .history-right{ text-align:right; min-width: 92px; }
        .history-score{ font-weight: 900; color:#0f172a; }
        .badge{
            display:inline-flex;
            align-items:center;
            gap: 6px;
            padding: 6px 10px;
            border-radius: 999px;
            font-weight: 900;
            font-size: .82rem;
            border: 1px solid rgba(148,163,184,0.28);
            margin-top: 8px;
        }
        .badge.good{ background: rgba(40,167,69,0.12); border-color: rgba(40,167,69,0.18); color:#14532d; }
        .badge.bad{ background: rgba(220,53,69,0.12); border-color: rgba(220,53,69,0.18); color:#7f1d1d; }
        .history-bar{
            height: 10px;
            border-radius: 999px;
            background: rgba(15,23,42,0.08);
            margin-top: 12px;
            overflow:hidden;
        }
        .history-bar > div{
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, rgba(0,123,255,0.85), rgba(40,167,69,0.75));
            width: 0%;
        }
        .history-card-actions{
            display:flex; gap:10px; margin-top: 12px;
        }
	        /* Live quiz: hide Results/Review buttons while the live window is active */
	        .history-locked{
	            flex: 1;
	            width: 100%;
	            text-align: center;
	            padding: 10px 12px;
	            border-radius: 14px;
	            background: #f1f5f9;
	            color: #64748b;
	            font-weight: 900;
	        }
        .history-card-actions button{
            flex:1;
            border-radius: 14px;
            padding: 11px 12px;
            font-weight: 900;
            cursor:pointer;
        }
        .btn-primary{
            background: rgba(0,123,255,0.95);
            color: #fff;
            border: none;
        }
        .btn-primary:active{ transform: scale(0.98); }
        .btn-ghost{
            background: rgba(255,255,255,0.95);
            border: 1px solid rgba(148,163,184,0.32);
        }

        /* ------------------------------
           Review (Modern)
        ------------------------------ */
        .review-toolbar{
            position: sticky;
            top: 0;
            z-index: 10;
            background: rgba(248,250,252,0.92);
            backdrop-filter: blur(10px);
            padding: 10px 10px;
            border-bottom: 1px solid rgba(148,163,184,0.20);
            border-radius: 16px;
            margin-bottom: 12px;
        }
        .review-toolbar-row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
        .review-toolbar .input{ flex:1; min-width: 200px; }
        .review-select{
            padding: 11px 12px;
            border-radius: 14px;
            border: 1px solid rgba(148,163,184,0.32);
            background: rgba(255,255,255,0.95);
            font-weight: 800;
        }
        .review-card{
            border-radius: 18px;
            background: rgba(255,255,255,0.96);
            border: 1px solid rgba(148,163,184,0.24);
            padding: 14px 14px;
            box-shadow: 0 10px 28px rgba(0,0,0,0.06);
            margin-bottom: 12px;
        }
        .review-head{
            display:flex; gap:10px; align-items:flex-start;
        }
        .qno{
            width: 36px; height: 36px; border-radius: 14px;
            display:grid; place-items:center;
            background: rgba(15,23,42,0.06);
            font-weight: 900;
            color:#0f172a;
            flex: 0 0 auto;
        }
        .review-qtext{
            margin: 2px 0 0;
            font-weight: 900;
            color:#0f172a;
            line-height: 1.35;
        }
        .status-chip{
            display:inline-flex;
            align-items:center;
            padding: 6px 10px;
            border-radius: 999px;
            font-weight: 900;
            font-size: .8rem;
            border: 1px solid rgba(148,163,184,0.28);
            background: rgba(255,255,255,0.95);
            margin-left: auto;
            flex: 0 0 auto;
        }
        .status-chip.correct{ background: rgba(40,167,69,0.12); border-color: rgba(40,167,69,0.18); color:#14532d; }
        .status-chip.wrong{ background: rgba(220,53,69,0.12); border-color: rgba(220,53,69,0.18); color:#7f1d1d; }
        .status-chip.skipped{ background: rgba(234,179,8,0.14); border-color: rgba(234,179,8,0.20); color:#713f12; }

        .opt-list{ margin-top: 12px; display:grid; gap:10px; }
        .opt-pill{
            display:flex;
            align-items:flex-start;
            gap: 10px;
            padding: 12px 12px;
            border-radius: 16px;
            border: 1px solid rgba(148,163,184,0.24);
            background: rgba(248,250,252,0.80);
        }
        .opt-mark{
            width: 26px; height: 26px;
            border-radius: 10px;
            display:grid; place-items:center;
            background: rgba(15,23,42,0.06);
            font-weight: 900;
            color:#0f172a;
            flex: 0 0 auto;
        }
        .opt-pill.user{ border-color: rgba(0,123,255,0.35); background: rgba(0,123,255,0.07); }
        .opt-pill.correct{ border-color: rgba(40,167,69,0.35); background: rgba(40,167,69,0.08); }
        .opt-pill.wrong{ border-color: rgba(220,53,69,0.35); background: rgba(220,53,69,0.08); }
        .opt-note{
            margin-left: auto;
            font-weight: 900;
            font-size: .85rem;
            color:#334155;
        }

        .solution-box{
            margin-top: 12px;
            border-radius: 16px;
            border: 1px solid rgba(148,163,184,0.20);
            background: rgba(15,23,42,0.03);
            padding: 0 12px;
            max-height: 0;
            overflow: hidden;
            transition: max-height .25s ease, padding .25s ease;
        }
        .solution-box.visible{ max-height: 600px; padding: 12px 12px; }
        .toggle-solution{
            margin-top: 10px;
            width: 100%;
            border-radius: 14px;
            padding: 11px 12px;
            font-weight: 900;
            border: 1px solid rgba(148,163,184,0.32);
            background: rgba(255,255,255,0.95);
            cursor:pointer;
        }
        .toggle-solution.active{ border-color: rgba(0,123,255,0.5); }



        /* Auth + Profile + Leaderboard avatars */
        .auth-error{
            margin-top: 12px;
            padding: 10px 12px;
            border-radius: 14px;
            background: rgba(220,53,69,0.10);
            border: 1px solid rgba(220,53,69,0.18);
            color: #7f1d1d;
            font-weight: 800;
        }
        .profile-header{
            display:flex;
            gap: 12px;
            align-items:center;
            margin-top: 12px;
        }
        .profile-photo{
            width: 64px;
            height: 64px;
	            border-radius: 50%;
            object-fit: cover;
            border: 1px solid rgba(148,163,184,0.28);
            background: rgba(255,255,255,0.9);
	            display:block;
        }
        .profile-uploader{
            display:flex;
            gap: 12px;
            align-items:center;
            flex-wrap: wrap;
        }
        .lb-item{
            align-items: center;
        }
        .lb-avatar{
            width: 44px;
            height: 44px;
            border-radius: 50%;
            overflow: hidden;
            flex: 0 0 auto;
            border: 1px solid rgba(148,163,184,0.28);
            background: rgba(255,255,255,0.9);
            margin-right: 10px;
        }
        .lb-avatar img{
            width: 100%;
            height: 100%;
            object-fit: cover;
            display:block;
        }

        /* History visibility safeguard */
        .history-card, .history-card *{
            color: inherit;
        }
        .history-card{
            background: rgba(255,255,255,0.98) !important;
        }
        .history-title, .history-score{
            color:#0f172a !important;
        }
        .history-date{
            color:#475569 !important;
        }

        /* ------------------------------
           Buttons (Danger)
        ------------------------------ */
        .danger-btn{
            background: #dc3545 !important;
            color: #ffffff !important;
            border: none !important;
        }
        .danger-btn:hover{
            background: #bb2d3b !important;
        }

        /* ------------------------------
           History page background
        ------------------------------ */
        .history-page{
            background: linear-gradient(180deg, rgba(224,231,255,0.95) 0%, rgba(248,250,252,0.98) 60%, rgba(255,255,255,0.98) 100%);
            border: 1px solid rgba(148,163,184,0.22);
            border-radius: 18px;
            padding: 18px;
            box-shadow: 0 10px 28px rgba(0,0,0,0.06);
        }

        /* ------------------------------
           Profile (Modern)
        ------------------------------ */
        .profile-hero{
            border-radius: 18px;
            padding: 16px;
            color: #0f172a;
            background: linear-gradient(120deg, rgba(255,215,0,0.85), rgba(224,231,255,0.85));
            border: 1px solid rgba(148,163,184,0.18);
            box-shadow: 0 10px 28px rgba(0,0,0,0.06);
        }
        .profile-hero-top{
            display:flex;
            gap: 14px;
            align-items:center;
            flex-wrap: wrap;
        }
        .profile-name{
            font-weight: 950;
            font-size: 1.25rem;
            margin: 0;
            line-height: 1.15;
        }
        .profile-sub{
            margin-top: 6px;
            color: rgba(15,23,42,0.72);
            font-weight: 800;
        }
        .profile-pillrow{
            display:flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 12px;
        }
        .profile-pill{
            padding: 8px 10px;
            border-radius: 999px;
            background: rgba(255,255,255,0.85);
            border: 1px solid rgba(148,163,184,0.22);
            font-weight: 900;
            font-size: .85rem;
            color:#0f172a;
        }

        /* Centered photo + left-aligned details (Profile page) */
        .profile-hero-center{
            display:flex;
            flex-direction:column;
            align-items:flex-start;
        }
        .profile-photo-wrap{
            width: 100%;
            display:flex;
            justify-content:center;
        }
        .profile-photo-lg{
            width: 96px;
            height: 96px;
	            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.9);
            object-fit: cover;
            background: rgba(255,255,255,0.85);
            box-shadow: 0 10px 24px rgba(0,0,0,0.10);
	            display:block;
        }

	        .profile-details-card{
	            background: rgba(255,255,255,0.92);
	            border: 1px solid rgba(148,163,184,0.22);
	            border-radius: 18px;
	            padding: 14px;
	            width: 100%;
	            box-shadow: 0 10px 26px rgba(0,0,0,0.06);
	        }
	        .profile-details-title{
	            font-weight: 950;
	            margin-bottom: 10px;
	            font-size: 1.02rem;
	        }
	        .profile-details{ display:flex; flex-direction:column; gap: 10px; }
	        .profile-detail-row{ display:flex; justify-content:space-between; gap: 12px; }
	        .profile-detail-row .k{ color:#64748b; font-weight:800; }
	        .profile-detail-row .v{ font-weight:900; color:#0f172a; text-align:right; }

	        .folder-disabled{ opacity: 0.55; cursor: not-allowed; }
	        .folder-disabled .quiz-info{ pointer-events:none; }
        .profile-badges{
            display:flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 12px;
            width: 100%;
            justify-content:flex-start;
        }
        .profile-basiclist{
            width: 100%;
            display:flex;
            flex-direction:column;
            gap: 10px;
        }
        .profile-basiclist .details-row .dv{
            text-align:left;
            margin-left:12px;
        }
        .profile-grid{
            display:grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            margin-top: 14px;
        }
        @media (max-width: 560px){
    
        /* Centered photo + left-aligned details (Profile page) */
        .profile-hero-center{
            display:flex;
            flex-direction:column;
            align-items:flex-start;
        }
        .profile-photo-wrap{
            width: 100%;
            display:flex;
            justify-content:center;
        }
        .profile-photo-lg{
            width: 96px;
            height: 96px;
	            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.9);
            object-fit: cover;
            background: rgba(255,255,255,0.85);
            box-shadow: 0 10px 24px rgba(0,0,0,0.10);
        }
        .profile-badges{
            display:flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 12px;
            width: 100%;
            justify-content:flex-start;
        }
        .profile-basiclist{
            width: 100%;
            display:flex;
            flex-direction:column;
            gap: 10px;
        }
        .profile-basiclist .details-row .dv{
            text-align:left;
            margin-left:12px;
        }
        .profile-grid{ grid-template-columns: 1fr; }
        }
        .profile-mini-card{
            border-radius: 18px;
            background: rgba(255,255,255,0.98);
            border: 1px solid rgba(148,163,184,0.22);
            padding: 14px 14px;
            box-shadow: 0 10px 28px rgba(0,0,0,0.05);
        }
        .profile-mini-card .k{
            color:#64748b;
            font-weight: 800;
            font-size: .85rem;
        }
        .profile-mini-card .v{
            margin-top: 6px;
            font-weight: 950;
            color:#0f172a;
            font-size: 1.25rem;
        }
        .profile-actions{
            display:flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 14px;
        }
        .profile-actions button{ flex: 1; min-width: 140px; }

        /* Profile details list */
        .details-list{
            display:flex;
            flex-direction:column;
            gap: 10px;
        }
        .details-row{
            display:flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 14px;
            background: rgba(248,250,252,0.95);
            border: 1px solid rgba(148,163,184,0.18);
        }
        .details-row .dk{
            color:#64748b;
            font-weight: 900;
            font-size: .88rem;
        }
        .details-row .dv{
            color:#0f172a;
            font-weight: 950;
            text-align:right;
            word-break: break-word;
        }

        /* Photo editor modal */
        .photo-editor-overlay{
            position: fixed;
            inset: 0;
            background: rgba(15,23,42,0.65);
            display:flex;
            align-items:center;
            justify-content:center;
            z-index: 9999;
            padding: 16px;
        }
        .photo-editor{
            width: min(920px, 100%);
            background: rgba(255,255,255,0.98);
            border-radius: 20px;
            border: 1px solid rgba(148,163,184,0.22);
            box-shadow: 0 18px 60px rgba(0,0,0,0.22);
            overflow:hidden;
        }
        .photo-editor-header{
            display:flex;
            align-items:center;
            justify-content: space-between;
            padding: 14px 16px;
            background: linear-gradient(120deg, rgba(255,215,0,0.20), rgba(224,231,255,0.35));
            border-bottom: 1px solid rgba(148,163,184,0.18);
        }
        .photo-editor-title{
            font-weight: 950;
            font-size: 1.05rem;
            color:#0f172a;
        }
        .photo-editor-close{
            width: 40px;
            height: 40px;
            border-radius: 14px;
            border: 1px solid rgba(148,163,184,0.18);
            background: rgba(255,255,255,0.9);
            font-size: 22px;
            font-weight: 900;
            line-height: 1;
            cursor:pointer;
        }
        .photo-editor-body{
            display:grid;
            grid-template-columns: 1.4fr .9fr;
            gap: 12px;
            padding: 14px;
        }
        @media (max-width: 760px){
            .photo-editor-body{ grid-template-columns: 1fr; }
        }
        .photo-editor-canvas{
            border-radius: 18px;
            overflow:hidden;
            border: 1px solid rgba(148,163,184,0.20);
            background: rgba(248,250,252,0.98);
            min-height: 360px;
            display:flex;
            align-items:center;
            justify-content:center;
        }
        .photo-editor-canvas img{
            max-width: 100%;
            display:block;
        }
        .photo-editor-controls{
            border-radius: 18px;
            border: 1px solid rgba(148,163,184,0.20);
            background: rgba(248,250,252,0.98);
            padding: 12px;
            display:flex;
            flex-direction:column;
            gap: 10px;
        }
        .photo-editor-row{
            display:flex;
            gap: 10px;
            align-items:center;
            flex-wrap: wrap;
        }
        .photo-editor-label{
            font-weight: 900;
            color:#0f172a;
        }
        .photo-editor-help{
            color:#64748b;
            font-weight: 750;
            font-size: .9rem;
        }
        .photo-editor-footer{
            padding: 14px 16px;
            display:flex;
            justify-content: flex-end;
            gap: 10px;
            border-top: 1px solid rgba(148,163,184,0.18);
            background: rgba(255,255,255,0.98);
        }


        /* --- Instant home + text visibility overrides (v4) --- */
        .app-loader{ display:none !important; pointer-events:none !important; opacity:0 !important; }
        body{ color:#0f172a; }
        .container, .card, .score-card, .quiz-card, .history-card, .profile-card, .leaderboard-card{ color:#0f172a; }
        p, span, label, small{ color: inherit; }
        .muted, .subtext{ color:#475569 !important; }
        a{ color: inherit; }
        input, textarea, select{ color:#0f172a; }
        input::placeholder, textarea::placeholder{ color:#64748b; opacity:1; }

        /* Fix header overlap: keep title centered and away from back arrow */
        .header{ justify-content:flex-start !important; }
        .header-title{ flex:1; text-align:center; padding:0 56px; line-height:1.2; }
        .back-arrow{ left:16px !important; }

        /* History header spacing on small screens */
        .history-page{ color:#0f172a; }
        .history-summary .value{ color:#0f172a !important; }
        .history-actions .secondary-btn{ color:#0f172a; }

        /* Ensure contrast on dark areas */
        .drawer .drawer-links span, .drawer .drawer-links p{ color:#ffffff !important; }
        .drawer .drawer-header .drawer-user-name{ color:#ffffff !important; }
        .drawer .drawer-header .drawer-user-mobile{ color:rgba(255,255,255,0.85) !important; }

/* ===========================
   Modern theme overrides (v2)
   Fixes: contrast, overlap, responsive layout, modern leaderboard
   =========================== */

:root{
  --bg: #f5f7fa;
  --card: rgba(255,255,255,0.92);
  --text: #0f172a;
  --muted: #475569;
  --brand: #3b82f6;
  --brand-2: #6366f1;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(148,163,184,0.28);
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
}

body{ color: var(--text); background: var(--bg); }

/* Remove white sheet look for pages that show results/leaderboards */
.no-white-page{
  background: transparent !important;
  --card: rgba(255,255,255,0.14);
}

.no-white-page .page,
.no-white-page .container{
  background: transparent !important;
}

/* Home hero live list */
.hero-live-list{
  margin-top: 14px;
  width: 100%;
}
.hero-live-list-sec{ margin-top: 12px; }
.hero-live-list-title{
  font-weight: 900;
  letter-spacing: 0.2px;
  margin: 6px 4px;
}
.hero-live-list-cards{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px){
  .hero-live-list-cards{ grid-template-columns: 1fr 1fr; }
}
.hero-live-card{
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(2,6,23,0.06);
  text-align: left;
}
.hero-live-card-top{ display:flex; gap:10px; align-items: center; }
.hero-live-card-title{ font-weight: 900; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-live-card-badge{
  font-weight: 900;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.hero-live-card-badge.running{ background: rgba(16,185,129,0.14); }
.hero-live-card-badge.upcoming{ background: rgba(59,130,246,0.14); }
.hero-live-card-badge.ended{ background: rgba(100,116,139,0.14); }
.hero-live-card-meta{ color: var(--muted); font-weight: 700; margin-top: 6px; }
.hero-live-card-btn{
  margin-top: 10px;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 900;
  background: var(--brand);
  color: white;
}
.hero-live-card-btn:disabled{ opacity: .55; }
.hero-live-empty{ color: var(--muted); font-weight: 800; padding: 10px 6px; }

/* Live result overlay (transparent, no white sheet) */
.live-result-overlay{
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.45);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display:flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.live-result-modal{
  width: min(520px, 96vw);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 60px rgba(2,6,23,0.30);
  padding: 14px;
}
.live-result-top{ display:flex; align-items:center; justify-content: space-between; gap: 10px; padding: 2px 6px 8px 6px; }
.live-result-title{ font-weight: 1000; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-result-me{
  display:grid;
  grid-template-columns: 52px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.10);
}
.live-result-me-name{ font-weight: 1000; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-result-me-rank, .live-result-me-score{ font-weight: 1000; min-width: 44px; text-align: right; }
.live-result-actions{ margin-top: 10px; }
.live-result-lb{ margin-top: 10px; }

/* Header: no overlap, always clickable back */
.header{
  display: grid !important;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  justify-items: center;
  padding: 10px 14px !important;
  height: 60px;
  backdrop-filter: blur(10px);
}
.back-arrow{
  position: relative !important;
  left: auto !important;
  justify-self: start;
  z-index: 110;
  width: 40px;
  height: 40px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 12px;
  background: rgba(15,23,42,0.04);
}
.back-arrow:active{ transform: scale(0.98); }
.header-title{
  width: 100%;
  text-align: center;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.container{ padding-top: 86px !important; }

/* Generic contrast helpers */
.badge, .status-chip{ color: var(--text) !important; }
.muted, .subtext{ color: var(--muted) !important; }
.option{ color: var(--text) !important; }

/* Status chips */
.status-chip{ border: 1px solid var(--border); }
.status-chip.notvisited{
  background: rgba(100,116,139,0.10);
  border-color: rgba(100,116,139,0.25);
}

/* Review header responsiveness */
.review-topbar{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.review-select, .review-topbar .input{
  min-width: 160px;
  flex: 1 1 160px;
}

/* Leaderboard modern list */
.lb-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 10px 4px;
}
.lb-title{ margin:0; font-size: 1.05rem; letter-spacing: 0.2px; }
.lb-my-rank{ font-weight:700; color: var(--muted); }

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

.lb-row{
  width:100%;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 6px 18px rgba(2,6,23,0.06);
  border-radius: 18px;
  padding: 12px 12px;
  display:flex;
  align-items:center;
  gap: 12px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  text-align:left;
}
.lb-row:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: rgba(99,102,241,0.35);
}
.lb-row:active{ transform: translateY(0); }

.lb-rank{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  background: rgba(99,102,241,0.12);
  color: #3730a3;
}
.lb-avatar{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow:hidden;
  border: 1px solid rgba(226,232,240,0.9);
  flex: 0 0 auto;
}
.lb-avatar img{ width:100%; height:100%; object-fit: cover; display:block; }

.lb-meta{ flex: 1 1 auto; min-width: 0; }
.lb-name{ font-weight: 900; font-size: 0.98rem; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub{ margin-top: 2px; font-size: 0.82rem; color: var(--muted); }

.lb-score{ text-align:right; flex: 0 0 auto; }
.lb-points{ font-weight: 900; font-size: 1.02rem; }
.lb-scorelabel{ font-size: 0.78rem; color: var(--muted); }

/* Responsive: tighten spacing + prevent overlap */
@media (max-width: 768px){
  .container{ padding: 14px !important; padding-top: 86px !important; }
  .header{ padding: 10px 12px !important; }
  .lb-row{ padding: 11px 11px; border-radius: 16px; }
  .lb-rank{ width: 36px; height: 36px; border-radius: 12px; }
  .lb-avatar{ width: 40px; height: 40px; border-radius: 14px; }
}

/* Fix “text equals background” edge cases */
button, .primary-btn, .secondary-btn, .danger-btn{
  color: inherit;
}
.primary-btn{ color: #ffffff !important; }
.secondary-btn{ color: var(--text) !important; }
.danger-btn{ color: #ffffff !important; }

/* Reduce accidental overflow in cards */
.card, .quiz-card, .score-card, .history-card, .profile-card{
  overflow: hidden;
}



/* ------------------------------
   Dark mode (toggle adds .dark on <html>)
------------------------------ */
:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(148,163,184,0.28);
}
html.dark{
  --bg: #0b1220;
  --card: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: rgba(148,163,184,0.20);
}
html.dark body{ background: var(--bg); color: var(--text); }
html.dark .header,
html.dark .quiz-header{ background: rgba(15,23,42,0.92); color: var(--text); }
html.dark .container,
html.dark #mainContent{ color: var(--text); }
html.dark .history-card,
html.dark .score-card,
html.dark .profile-mini-card,
html.dark .drawer,
html.dark .popup-content,
html.dark .review-card{ background: var(--card); border-color: var(--border); color: var(--text); }
html.dark .profile-sub,
html.dark .history-date,
html.dark .weak-meta{ color: var(--muted) !important; }
html.dark .option{ background: rgba(148,163,184,0.08); border-color: rgba(148,163,184,0.18); color: var(--text); }
html.dark .option.selected{ border-color: rgba(99,102,241,0.55); }
html.dark .btn-ghost{ background: rgba(148,163,184,0.10); color: var(--text); }
html.dark .drawer-item img{ filter: invert(1); opacity: .85; }
html.dark .menu-btn img{ filter: invert(1); opacity: .9; }

/* Drawer toggle switch */
.drawer-toggle{ display:flex; align-items:center; gap:12px; }
.switch{ position: relative; display: inline-block; width: 44px; height: 26px; }
.switch input{ opacity: 0; width: 0; height: 0; }
.slider{
  position:absolute; cursor:pointer; inset:0;
  background: rgba(148,163,184,0.45);
  border-radius: 999px;
  transition: .2s;
}
.slider:before{
  content:"";
  position:absolute; height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: #ffffff;
  border-radius: 999px;
  transition: .2s;
}
.switch input:checked + .slider{
  background: rgba(99,102,241,0.9);
}
.switch input:checked + .slider:before{
  transform: translateX(18px);
}

/* Weak topics panels */
.weak-panel{
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  padding: 14px;
}
.weak-head{ display:flex; justify-content:space-between; gap:10px; align-items:baseline; flex-wrap:wrap; }
.weak-title{ font-weight: 950; font-size: 1.05rem; }
.weak-sub{ color: var(--muted); font-weight: 700; font-size: .92rem; }
.weak-list{ margin-top: 10px; display:grid; gap:10px; }
.weak-item{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.08);
}
.weak-topic{ font-weight: 900; }
.weak-meta{ margin-top: 4px; font-weight: 700; color: var(--muted); font-size: .9rem; }


/* --- Mobile header/footer sizing tweaks --- */
@media (max-width: 480px) {
  .header {
    padding: 8px 12px !important;
    height: 48px;
  }
  .header-title { font-size: 16px !important; }
  .back-arrow { font-size: 20px !important; left: 10px !important; }

  .footer-nav {
    padding: 6px 8px !important;
    height: 56px;
  }
  .footer-nav img { width: 22px !important; height: 22px !important; }
  .footer-nav p { font-size: 11px !important; margin-top: 2px !important; }
}

/* --- Auth page centering + modern look --- */
.auth-center{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: calc(100vh - 120px);
}
.auth-center .score-card{
  width: min(460px, 100%);
  margin: 16px auto;
}

/* Auth loader */
.auth-loader-overlay{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9999;
}
.auth-loader-card{
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 18px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  width: min(360px, 88vw);
  text-align:center;
}
.spinner{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(0,0,0,0.15);
  border-top-color: rgba(0,0,0,0.75);
  margin: 0 auto 10px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-loader-text{
  font-weight: 700;
  color: #0f172a;
}

/* Best-effort: disable text selection/callout (inputs still selectable) */
body{
  -webkit-touch-callout: none;
}
body *{
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, [contenteditable="true"]{
  -webkit-user-select: text !important;
  user-select: text !important;
}

.footer-nav.hidden{ display:none !important; }


/* Allow scrolling (question scroll handles long content; keep page scroll usable too) */
body.quiz-mode{
  overflow: auto;
}

.quiz-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
}

.timer-toggle{
  display:flex;
  align-items:center;
  gap: 10px;
}

.pause-inline-btn{
  border: none;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pause-inline-btn:active{ transform: scale(0.98); }

.quiz-container{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

.question-scroll{
  max-height: 34vh;
  overflow: auto;
  padding-right: 6px;
}

.options-fixed{
  flex: 0 0 auto;
}

.mark-btn{
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(245,158,11,0.35);
  background: rgba(245,158,11,0.10);
  font-weight: 800;
  cursor: pointer;
}
.mark-btn:active{ transform: scale(0.98); }

/* Ensure drawer toggle/labels are always visible */
.drawer-item span{ color: var(--text); }

@media (max-width: 480px){
  .question-scroll{ max-height: 30vh; }
  .pause-inline-btn{ padding: 6px 9px; }
}



/* --- Live Quiz UI --- */

.live-hero{
  margin-top:14px;
  padding:16px;
  border-radius:18px;
  background: linear-gradient(120deg, rgba(255,215,0,0.75), rgba(242,242,242,0.9));
  box-shadow: 0 6px 18px rgba(15,23,42,0.10);
}
.dark .live-hero{
  background: linear-gradient(120deg, rgba(255,215,0,0.20), rgba(15,23,42,0.90));
}
.live-hero-top{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;}
.live-hero-title{font-weight:950;font-size:1.15rem;}
.live-hero-sub{color:#475569;font-weight:800;margin-top:2px;}
.dark .live-hero-sub{color:rgba(226,232,240,0.8);}
.live-count{font-weight:950;font-size:1.1rem;background:rgba(255,255,255,0.75);padding:8px 12px;border-radius:14px;}
.dark .live-count{background:rgba(2,6,23,0.55);}
.live-hero-actions{margin-top:12px;display:flex;gap:10px;flex-wrap:wrap;}
.live-quiz-section{margin-top:14px;}
.section-title-row{margin-top:10px;}
.section-title{margin:0;font-size:1.1rem;font-weight:950;}
.section-sub{margin-top:4px;color:#64748b;font-weight:700;}
.live-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin-top:12px;}
.live-card{background:#fff;border-radius:18px;padding:14px;box-shadow:0 6px 16px rgba(15,23,42,0.08);text-align:left;}
.dark .live-card{background:#0b1220;}
.live-card-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;}
.live-card-title{font-weight:950;}
.live-pill{font-size:.75rem;font-weight:900;padding:6px 10px;border-radius:999px;background:rgba(2,6,23,0.08);}
.dark .live-pill{background:rgba(226,232,240,0.12);}
.live-pill.live{background:rgba(16,185,129,0.16);}
.live-pill.upcoming{background:rgba(59,130,246,0.16);}
.live-pill.ended{background:rgba(239,68,68,0.16);}
.live-card-meta{display:flex;justify-content:space-between;gap:10px;margin-top:10px;color:#64748b;font-weight:700;flex-wrap:wrap;}
.dark .live-card-meta{color:rgba(226,232,240,0.75);}
.live-card-count{display:flex;justify-content:space-between;gap:10px;margin-top:10px;font-weight:900;}
.live-actions{margin-top:12px;display:flex;gap:10px;justify-content:space-between;flex-wrap:wrap;}
.live-lb-card{margin-bottom:14px;padding:14px;border-radius:18px;background:#fff;box-shadow:0 6px 16px rgba(15,23,42,0.08);}
.dark .live-lb-card{background:#0b1220;}


/* --- Home Hero: Live Quiz strip (uses existing hero, no extra hero section) --- */
.home-live-title{
  margin: 6px 0 0;
  font-weight: 950;
  font-size: 1.05rem;
  letter-spacing: .2px;
}

.hero-live-row{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(15,23,42,0.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-live-right{ display:flex; align-items:center; justify-content:flex-end; flex: 0 0 auto; }
.hero-live-row .cta{ margin-top: 0; }

/* ------------------------------
   Live indicator (pulsing pop)
   Used on Category / Folder / Subfolder / Quiz tiles
------------------------------ */
.live-pop{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:4px 10px;
    border-radius:999px;
    font-weight:900;
    font-size:12px;
    letter-spacing:0.3px;
    line-height:1;
    margin-left:10px;
    vertical-align:middle;
    user-select:none;
}
.live-pop .dot{
    width:10px;
    height:10px;
    border-radius:999px;
    display:inline-block;
    position:relative;
}
.live-pop .dot::after{
    content:'';
    position:absolute;
    inset:-6px;
    border-radius:999px;
    opacity:0.0;
    transform:scale(0.75);
    animation:livePulse 1.15s infinite;
}

.live-pop.running{
    background:rgba(239, 68, 68, 0.12);
    color:#b91c1c;
}
.live-pop.running .dot{ background:#ef4444; }
.live-pop.running .dot::after{ background:rgba(239, 68, 68, 0.30); }

.live-pop.upcoming{
    background:rgba(245, 158, 11, 0.15);
    color:#92400e;
}
.live-pop.upcoming .dot{ background:#f59e0b; }
.live-pop.upcoming .dot::after{ background:rgba(245, 158, 11, 0.30); }

@keyframes livePulse{
    0%{ opacity:0.00; transform:scale(0.70); }
    30%{ opacity:0.45; }
    60%{ opacity:0.10; }
    100%{ opacity:0.00; transform:scale(1.25); }
}

/* Make it fit inside headings nicely */
.vertical-quiz-list h3 .live-pop{ margin-left:8px; }
.quiz-item h3 .live-pop{ margin-left:8px; }

/* Home category tiles: show LIVE pop at the top-right of the tile */
.quiz-item.home-tile{ position: relative; }
.quiz-item.home-tile .live-pop{
  position: absolute;
  top: 10px;
  right: 10px;
  margin-left: 0;
}
.dark .hero-live-row{
  background: rgba(15,23,42,0.55);
  border-color: rgba(148,163,184,0.18);
}
.hero-live-left{ min-width: 0; text-align:left; flex: 1 1 auto; }
.hero-live-label{ font-weight: 900; font-size: .82rem; color:#64748b; }
.dark .hero-live-label{ color: rgba(226,232,240,0.78); }

.hero-live-count{
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.hero-live-count .tbox{
  padding: 6px 8px;
  border-radius: 16px;
  background: rgba(15,23,42,0.06);
  min-width: 52px;
  text-align: center;
}
.dark .hero-live-count .tbox{ background: rgba(148,163,184,0.14); }
.hero-live-count .num{ font-weight: 950; font-size: .95rem; line-height: 1.05; }
.hero-live-count .cap{ font-weight: 900; font-size: .65rem; color:#64748b; margin-top: 1px; }
.dark .hero-live-count .cap{ color: rgba(226,232,240,0.75); }
.hero-live-count .tsep{ font-weight: 950; opacity: .55; }


@media (max-width: 520px){
  .hero-live-row{ padding: 8px 10px; border-radius: 16px; }
  .hero-live-label{ font-size: .78rem; }
  .hero-live-count{ gap: 4px; }
  .hero-live-count .tbox{ padding: 5px 6px; border-radius: 14px; min-width: 44px; }
  .hero-live-count .num{ font-size: .86rem; }
  .hero-live-count .cap{ font-size: .6rem; }
}

/* --- Live categories headings --- */
.live-cat{ margin-top: 12px; }
.live-cat-head{ display:flex; justify-content:space-between; align-items:flex-end; gap:12px; margin: 10px 2px; flex-wrap:wrap; }
.live-cat-title{ font-weight: 950; font-size: 1.05rem; }
.live-cat-sub{ color:#64748b; font-weight: 700; font-size: .85rem; }
.dark .live-cat-sub{ color: rgba(226,232,240,0.70); }

.live-pill.running{ background: rgba(34,197,94,0.14); color:#16a34a; }
.live-pill.upcoming{ background: rgba(59,130,246,0.14); color:#2563eb; }
.live-pill.ended{ background: rgba(148,163,184,0.18); color:#475569; }
.dark .live-pill.ended{ color: rgba(226,232,240,0.75); }

/* --- Leaderboard tabs --- */
.lb-tabs{
  display:flex;
  gap: 8px;
  overflow:auto;
  padding: 4px 2px 10px;
  -webkit-overflow-scrolling: touch;
}
.lb-tab{
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.7);
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.dark .lb-tab{
  background: rgba(15,23,42,0.40);
  border-color: rgba(148,163,184,0.20);
}
.lb-tab.active{
  background: rgba(15,23,42,0.92);
  color: white;
  border-color: rgba(15,23,42,0.92);
}

/* After selecting a category, hide other categories (tap "All" to show). */
.lb-tabs.compact .lb-tab{ display:none; }
.lb-tabs.compact .lb-tab.active{ display:inline-flex; }
.lb-tabs.compact .lb-tab-more{ display:inline-flex; margin-left:auto; }

.lb-tab-more{
  opacity: 0.85;
}
.dark .lb-tab.active{
  background: rgba(226,232,240,0.92);
  color: #0f172a;
  border-color: rgba(226,232,240,0.92);
}

/* --- Live leaderboard picker chips --- */
.live-lb-picker{ margin: 6px 0 12px; }
.live-lb-picker-title{ font-weight: 950; margin-bottom: 8px; }
.live-lb-chips{ display:flex; gap: 8px; overflow:auto; padding-bottom: 4px; }
.live-lb-chips .chip{
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.7);
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.dark .live-lb-chips .chip{
  background: rgba(15,23,42,0.40);
  border-color: rgba(148,163,184,0.20);
}
.live-lb-chips .chip.active{
  background: rgba(59,130,246,0.14);
  border-color: rgba(59,130,246,0.30);
}


@media (max-width: 560px){
  .hero-live-row{
    padding: 10px 10px;
    border-radius: 16px;
  }
  .hero-live-left{ text-align:center; width:100%; }
  .hero-live-count{ justify-content:center; }
  .hero-live-right{ width:100%; justify-content:center; }
  .hero-live-count .tbox{ min-width: 48px; padding: 6px 7px; }
  .hero-live-count .num{ font-size: .92rem; }
}



/* Live quiz title inside hero countdown strip */
.hero-live-quiztitle{
  font-weight:900;
  font-size:16px;
  margin-top:4px;
  margin-bottom:8px;
  color:#0f172a;
}
@media (max-width:480px){
  .hero-live-quiztitle{ font-size:14px; margin-bottom:6px; }
}

.home-container{ padding-bottom: var(--bottom-offset); }

/* ==============================
   LIVE QUIZ UI + Anti-cheat
   ============================== */
.quiz-watermark{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-22deg);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 1px;
  color: rgba(120,120,120,0.22);
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  text-align: center;
  width: 90vw;
  max-width: 900px;
  text-transform: uppercase;
}

.option{ position: relative; }
.option .live-pct{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 900;
  font-size: 13px;
  color: #334155;
  opacity: 0.9;
}

/* Instant feedback colors */
.option.opt-correct{
  background: rgba(34,197,94,0.18) !important;
  border-color: rgba(34,197,94,0.55) !important;
}
.option.opt-wrong{
  background: rgba(239,68,68,0.16) !important;
  border-color: rgba(239,68,68,0.55) !important;
}

/* Leaderboard: per-attempt meta */
.lb-small{
  font-size:12px;
  color:#64748b;
  font-weight:800;
  margin-top:2px;
}


/* Attempt badge + switcher (Results page) */
.attempt-badge{
  position:absolute;
  top:12px;
  left:12px;
  padding:6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  font-weight: 900;
  font-size: 12px;
}
.attempt-switcher{ margin-top: 6px; }
.attempt-switcher .chip{ padding: 7px 10px; font-weight: 800; }


/* LIVE badge on Home category tiles (top-right) */
.quiz-item{ position:relative; }
.quiz-item .live-pop{
    position:absolute;
    top:12px;
    right:12px;
    margin-left:0 !important;
    z-index:3;
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}



/* --- Fix mobile bottom overlap with fixed footer nav --- */
#mainContent{ padding-bottom: calc(var(--bottom-offset) + 8px); }
@media (max-width: 768px){
  .container{ padding-bottom: var(--bottom-offset) !important; margin-bottom:0 !important; }
  .quiz-list, .vertical-quiz-list, .folder-list, .subfolder-list{ margin-bottom: calc(var(--bottom-offset) + 8px) !important; }
}

/* Report question floating button (left of menu button) */
.report-q-btn{ position: fixed; top: 20px; right: 70px; background: rgba(255,255,255,0.95); border: 1px solid rgba(148,163,184,0.25); padding: 10px; border-radius: 50%; width: 40px; height: 40px; display:flex; align-items:center; justify-content:center; z-index:101; cursor:pointer; box-shadow: 0 8px 20px rgba(15,23,42,0.10); }
.report-q-btn img{ width:20px; height:20px; opacity:.9; }
.report-q-btn:active{ transform: scale(.97); }
@media (max-width: 480px){ .report-q-btn{ top:14px; right:58px; width:38px; height:38px; padding:8px; } .report-q-btn img{ width:18px; height:18px; } }

/* Modern report popup */
.report-popup-modern{ border-radius:18px; border:1px solid rgba(148,163,184,0.20); box-shadow:0 20px 50px rgba(15,23,42,0.20); }
.report-subtitle{ margin:-6px 0 12px; color:#64748b; font-weight:600; }
.report-options{ display:grid; gap:10px; }
.report-option{ display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:14px; border:1px solid rgba(148,163,184,0.24); background: rgba(248,250,252,0.8); font-weight:700; }
.report-option input{ margin:0; }
.report-other-text{ margin-top:12px; width:100%; resize:vertical; min-height:100px; }

/* Skipped color override (requested: blue) */
.question-status.skipped{ color:#ffffff !important; }
.legend-box.skipped, .skipped-dot{ background:#3b82f6 !important; }

.legend-box.review-unanswered, .review-unanswered-dot{ background:#facc15 !important; }
.legend-box.review-answered, .review-answered-dot{ background:#ef4444 !important; }

.small-link{color:#2563eb;font-weight:600;font-size:13px;text-decoration:none;}
.small-link:hover{text-decoration:underline;}
